1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | let schema = `
|
23 |
|
24 | type Query {
|
25 | searchProducts(text: String, filter: [String], selectedFacets: [String], queryFacets: [String], sort: [String], offset: Int, limit: Int): PagedResponseProduct
|
26 | }
|
27 |
|
28 | type PagedResponseProduct {
|
29 | # The actual number of results returned in results.
|
30 | count: Int!
|
31 | # The list of facets for this response.
|
32 | facets: [Facet]
|
33 | # The offset for this response, this is the number of elements skipped, not a page number.
|
34 | offset: Int!
|
35 | # The results for this response.
|
36 | results: [Product]!
|
37 | # The total number of results matching the query.
|
38 | total: Int!
|
39 | }
|
40 |
|
41 | type Facet {
|
42 | # The id of the facet.
|
43 | id: String!
|
44 | # The number of missed items.
|
45 | missed: Int
|
46 | # Indicates if the facet is multi selectable.
|
47 | multiSelect: Boolean
|
48 | # The name of the facet.
|
49 | name: String!
|
50 | # The type of the facet.
|
51 | type: String!
|
52 | # List of facetValues calculated for this facet.
|
53 | values: [FacetValue]!
|
54 | }
|
55 |
|
56 | type FacetValue {
|
57 | # The id for this facet.
|
58 | id: String!
|
59 | # The number of facet value occurrences.
|
60 | occurrences: Int
|
61 | # Indicates if the current facet value was selected.
|
62 | selected: Boolean
|
63 | # The value for this facet.
|
64 | value: String!
|
65 | }
|
66 |
|
67 | type Product {
|
68 | # The assets for this product.
|
69 | assets: [Asset]
|
70 | # The attributes for this product.
|
71 | attributes: [Attribute]
|
72 | # The categories for this product.
|
73 | categories: [Category]
|
74 | # The date-time when this object was created. The JSON representation must be in RFC339 / ISO8601 format
|
75 | createdAt: String
|
76 | # The description of the product.
|
77 | description: String
|
78 | # The internal unique ID of the product in the commerce backend system.
|
79 | id: String!
|
80 | # The date-time when this object was last modified. The JSON representation must be in RFC339 / ISO8601 format
|
81 | lastModifiedAt: String
|
82 | # The id of the master variant
|
83 | masterVariantId: String!
|
84 | # The name of the product.
|
85 | name: String!
|
86 | # The prices for this product.
|
87 | prices: [MoneyValue]!
|
88 | # The unique SKU of the product assigned by the vendor or manufacturer.
|
89 | sku: String
|
90 | # The variants for this product.
|
91 | variants: [ProductVariant]!
|
92 | }
|
93 |
|
94 | type Asset {
|
95 | # The id of the asset.
|
96 | id: String!
|
97 | # The url of the asset.
|
98 | url: String!
|
99 | }
|
100 |
|
101 | type Attribute {
|
102 | # The unique id for this text attribute, for example 'width'.
|
103 | id: String!
|
104 | # If true, this attribute is a variant attribute. If not set or false, the attribute is a normal/simple attribute.
|
105 | isVariantAxis: Boolean
|
106 | # The name for this text attribute.
|
107 | name: String!
|
108 | # The value of the attribute. This can be any arbitrary valid JSON value.
|
109 | value: String!
|
110 | }
|
111 |
|
112 | type Category {
|
113 | # The list of subcategories for this category. Depending on the backend system, the returned items may only have their ids being set.
|
114 | children: [Category]
|
115 | # The date-time when this object was created. The JSON representation must be in RFC339 / ISO8601 format
|
116 | createdAt: String
|
117 | # The description of the category.
|
118 | description: String
|
119 | # The internal unique ID of the category in the commerce backend system.
|
120 | id: String!
|
121 | # The date-time when this object was last modified. The JSON representation must be in RFC339 / ISO8601 format
|
122 | lastModifiedAt: String
|
123 | # The id of the main parent category (if this category has multiple parents).
|
124 | mainParentId: String
|
125 | # The name of the category.
|
126 | name: String
|
127 | # The list of parent categories for this category. Depending on the backend system, the returned items may only have their ids being set.
|
128 | parents: [Category]
|
129 | }
|
130 |
|
131 | type MoneyValue {
|
132 | # The amount in cents of this money value.
|
133 | amount: Int!
|
134 | # The country code for this money value.
|
135 | country: String
|
136 | # The currency code for this money value.
|
137 | currency: String!
|
138 | }
|
139 |
|
140 | type ProductVariant {
|
141 | # The assets for this product.
|
142 | assets: [Asset]
|
143 | # The attributes for this product.
|
144 | attributes: [Attribute]
|
145 | # Indicates if the product is available or not in the inventory.
|
146 | available: Boolean!
|
147 | # The categories for this product.
|
148 | categories: [Category]
|
149 | # The date-time when this object was created. The JSON representation must be in RFC339 / ISO8601 format
|
150 | createdAt: String
|
151 | # The description of the product.
|
152 | description: String
|
153 | # The internal unique ID of the product in the commerce backend system.
|
154 | id: String!
|
155 | # The date-time when this object was last modified. The JSON representation must be in RFC339 / ISO8601 format
|
156 | lastModifiedAt: String
|
157 | # The name of the product.
|
158 | name: String!
|
159 | # The prices for this product.
|
160 | prices: [MoneyValue]!
|
161 | # The unique SKU of the product variant assigned by the vendor or manufacturer.
|
162 | sku: String!
|
163 | }
|
164 |
|
165 | `;
|
166 |
|
167 | module.exports.schema = schema; |
\ | No newline at end of file |