@doswiftly/storefront-operations 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,355 @@
1
+ # ============================================
2
+ # DoSwiftly Storefront API - Queries
3
+ # SSOT: Backend defines all query operations
4
+ # ============================================
5
+
6
+ # ============================================
7
+ # Shop
8
+ # ============================================
9
+
10
+ query Shop {
11
+ shop {
12
+ ...Shop
13
+ }
14
+ }
15
+
16
+ # ============================================
17
+ # Products
18
+ # ============================================
19
+
20
+ query Product($id: ID, $handle: String) {
21
+ product(id: $id, handle: $handle) {
22
+ ...ProductFull
23
+ }
24
+ }
25
+
26
+ query Products(
27
+ $first: Int = 20
28
+ $after: String
29
+ $query: String
30
+ $sortKey: ProductSortKeys = BEST_SELLING
31
+ $reverse: Boolean = false
32
+ $filters: ProductFilterInput
33
+ ) {
34
+ products(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse, filters: $filters) {
35
+ edges {
36
+ node {
37
+ ...ProductBase
38
+ }
39
+ cursor
40
+ }
41
+ pageInfo {
42
+ ...PageInfo
43
+ }
44
+ totalCount
45
+ }
46
+ }
47
+
48
+ query ProductSearch($query: String!, $first: Int = 20, $after: String, $filters: ProductFilterInput) {
49
+ products(query: $query, first: $first, after: $after, filters: $filters) {
50
+ edges {
51
+ node {
52
+ ...ProductBase
53
+ }
54
+ cursor
55
+ }
56
+ pageInfo {
57
+ ...PageInfo
58
+ }
59
+ totalCount
60
+ }
61
+ }
62
+
63
+ # ============================================
64
+ # Collections
65
+ # ============================================
66
+
67
+ query Collection($id: ID, $handle: String, $productsFirst: Int = 20, $productsAfter: String) {
68
+ collection(id: $id, handle: $handle) {
69
+ ...Collection
70
+ products(first: $productsFirst, after: $productsAfter) {
71
+ edges {
72
+ node {
73
+ ...ProductBase
74
+ }
75
+ cursor
76
+ }
77
+ pageInfo {
78
+ ...PageInfo
79
+ }
80
+ totalCount
81
+ }
82
+ }
83
+ }
84
+
85
+ query Collections($first: Int = 20, $after: String, $sortKey: CollectionSortKeys = TITLE, $reverse: Boolean = false) {
86
+ collections(first: $first, after: $after, sortKey: $sortKey, reverse: $reverse) {
87
+ edges {
88
+ node {
89
+ ...Collection
90
+ }
91
+ cursor
92
+ }
93
+ pageInfo {
94
+ ...PageInfo
95
+ }
96
+ totalCount
97
+ }
98
+ }
99
+
100
+ # ============================================
101
+ # Categories
102
+ # ============================================
103
+
104
+ query Category($id: ID, $slug: String) {
105
+ category(id: $id, slug: $slug) {
106
+ ...Category
107
+ parent {
108
+ ...Category
109
+ }
110
+ children {
111
+ ...Category
112
+ }
113
+ }
114
+ }
115
+
116
+ query Categories {
117
+ categories {
118
+ roots {
119
+ ...Category
120
+ children {
121
+ ...Category
122
+ children {
123
+ ...Category
124
+ }
125
+ }
126
+ }
127
+ totalCount
128
+ }
129
+ }
130
+
131
+ # ============================================
132
+ # Cart
133
+ # ============================================
134
+
135
+ query Cart($id: ID!) {
136
+ cart(id: $id) {
137
+ ...Cart
138
+ }
139
+ }
140
+
141
+ # ============================================
142
+ # Customer (requires auth)
143
+ # ============================================
144
+
145
+ query Customer($customerAccessToken: String!) {
146
+ customer(customerAccessToken: $customerAccessToken) {
147
+ ...Customer
148
+ addresses(first: 10) {
149
+ ...MailingAddress
150
+ }
151
+ orders(first: 10) {
152
+ edges {
153
+ node {
154
+ ...Order
155
+ }
156
+ cursor
157
+ }
158
+ pageInfo {
159
+ ...PageInfo
160
+ }
161
+ totalCount
162
+ }
163
+ }
164
+ }
165
+
166
+ # ============================================
167
+ # Checkout
168
+ # ============================================
169
+
170
+ query Checkout($id: ID!) {
171
+ checkout(id: $id) {
172
+ ...Checkout
173
+ }
174
+ }
175
+
176
+ # ============================================
177
+ # Payment Methods (R23 - Payment Methods)
178
+ # ============================================
179
+
180
+ query AvailablePaymentMethods {
181
+ availablePaymentMethods {
182
+ ...AvailablePaymentMethods
183
+ }
184
+ }
185
+
186
+ # ============================================
187
+ # Shipments (R29 - Shipment Tracking)
188
+ # ============================================
189
+
190
+ query Shipment($id: ID!, $customerAccessToken: String!) {
191
+ shipment(id: $id, customerAccessToken: $customerAccessToken) {
192
+ shipment {
193
+ ...Shipment
194
+ }
195
+ userErrors {
196
+ ...UserError
197
+ }
198
+ }
199
+ }
200
+
201
+ query ShipmentByTrackingNumber($trackingNumber: String!) {
202
+ shipmentByTrackingNumber(trackingNumber: $trackingNumber) {
203
+ shipment {
204
+ ...ShipmentBasic
205
+ }
206
+ userErrors {
207
+ ...UserError
208
+ }
209
+ }
210
+ }
211
+
212
+ # ============================================
213
+ # Returns (R30 - Returns/RMA)
214
+ # ============================================
215
+
216
+ query Return($id: ID!, $customerAccessToken: String!) {
217
+ return(id: $id, customerAccessToken: $customerAccessToken) {
218
+ return {
219
+ ...Return
220
+ }
221
+ userErrors {
222
+ ...UserError
223
+ }
224
+ }
225
+ }
226
+
227
+ query ReturnsByOrder($orderId: ID!, $customerAccessToken: String!) {
228
+ returnsByOrder(orderId: $orderId, customerAccessToken: $customerAccessToken) {
229
+ edges {
230
+ node {
231
+ ...Return
232
+ }
233
+ cursor
234
+ }
235
+ pageInfo {
236
+ ...PageInfo
237
+ }
238
+ totalCount
239
+ }
240
+ }
241
+
242
+ query ReturnReasons {
243
+ returnReasons {
244
+ ...ReturnReasonOption
245
+ }
246
+ }
247
+
248
+ # ============================================
249
+ # Gift Cards (R32 - Gift Cards)
250
+ # ============================================
251
+
252
+ query GiftCard($code: String!) {
253
+ giftCard(code: $code) {
254
+ giftCard {
255
+ ...GiftCard
256
+ }
257
+ userErrors {
258
+ ...UserError
259
+ }
260
+ }
261
+ }
262
+
263
+ query GiftCardValidate($code: String!, $amount: Float) {
264
+ giftCardValidate(code: $code, amount: $amount) {
265
+ validation {
266
+ ...GiftCardValidation
267
+ }
268
+ userErrors {
269
+ ...UserError
270
+ }
271
+ }
272
+ }
273
+
274
+ # ============================================
275
+ # Shipping Methods (R33 - Shipping Methods)
276
+ # ============================================
277
+
278
+ query AvailableShippingMethods($address: ShippingAddressInput!, $cart: CartShippingInput) {
279
+ availableShippingMethods(address: $address, cart: $cart) {
280
+ methods {
281
+ ...AvailableShippingMethod
282
+ }
283
+ freeShippingProgress {
284
+ ...FreeShippingProgress
285
+ }
286
+ userErrors {
287
+ ...UserError
288
+ }
289
+ }
290
+ }
291
+
292
+ # ============================================
293
+ # Attribute Filters (R35 - Dynamic Attributes)
294
+ # ============================================
295
+
296
+ query AvailableFilters($input: AvailableFiltersInput) {
297
+ availableFilters(input: $input) {
298
+ ...AvailableFilters
299
+ }
300
+ }
301
+
302
+ # ============================================
303
+ # Loyalty Program (R7, R8, R10.4)
304
+ # ============================================
305
+
306
+ query LoyaltyMember {
307
+ loyaltyMember {
308
+ ...LoyaltyMember
309
+ }
310
+ }
311
+
312
+ query LoyaltyTiers {
313
+ loyaltyTiers {
314
+ ...LoyaltyTier
315
+ }
316
+ }
317
+
318
+ query LoyaltyRewards {
319
+ loyaltyRewards {
320
+ ...LoyaltyReward
321
+ }
322
+ }
323
+
324
+ query LoyaltyTransactions($first: Int = 20, $after: String) {
325
+ loyaltyTransactions(first: $first, after: $after) {
326
+ edges {
327
+ node {
328
+ ...LoyaltyTransaction
329
+ }
330
+ cursor
331
+ }
332
+ pageInfo {
333
+ ...LoyaltyPageInfo
334
+ }
335
+ totalCount
336
+ }
337
+ }
338
+
339
+ query LoyaltySettings {
340
+ loyaltySettings {
341
+ ...LoyaltySettings
342
+ }
343
+ }
344
+
345
+ query EstimatePoints($orderTotal: Float!) {
346
+ estimatePoints(orderTotal: $orderTotal) {
347
+ ...PointsEstimate
348
+ }
349
+ }
350
+
351
+ query ReferralStats {
352
+ referralStats {
353
+ ...ReferralStats
354
+ }
355
+ }