Skip to content

Commit c3d4aa6

Browse files
authored
Merge pull request #606 from Shopify/update-discount-schema
Update the JS schema for discount API
2 parents fdc964e + ab3277d commit c3d4aa6

File tree

1 file changed

+83
-85
lines changed

1 file changed

+83
-85
lines changed

discounts/javascript/discount/default/schema.graphql

Lines changed: 83 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,27 @@ type CartDeliveryOption {
213213
title: String
214214
}
215215

216+
"""
217+
The cart.delivery-options.discounts.generate.fetch target result. Refer to
218+
[network access](https://shopify.dev/apps/build/functions/input-output/network-access/graphql) for Shopify Functions.
219+
"""
220+
input CartDeliveryOptionsDiscountsGenerateFetchResult {
221+
"""
222+
The http request.
223+
"""
224+
request: HttpRequest
225+
}
226+
227+
"""
228+
The cart.delivery-options.discounts.generate.run target result.
229+
"""
230+
input CartDeliveryOptionsDiscountsGenerateRunResult {
231+
"""
232+
The list of operations to apply discounts to the delivery lines.
233+
"""
234+
operations: [DeliveryOperation!]!
235+
}
236+
216237
"""
217238
Represents information about the merchandise in the cart.
218239
"""
@@ -332,25 +353,46 @@ input CartLineTarget {
332353
quantity: Int
333354
}
334355

356+
"""
357+
The cart.lines.discounts.generate.fetch target result. Refer to [network access]
358+
(https://shopify.dev/apps/build/functions/input-output/network-access/graphql) for Shopify Functions.
359+
"""
360+
input CartLinesDiscountsGenerateFetchResult {
361+
"""
362+
The http request.
363+
"""
364+
request: HttpRequest
365+
}
366+
367+
"""
368+
The cart.lines.discounts.generate.run target result.
369+
"""
370+
input CartLinesDiscountsGenerateRunResult {
371+
"""
372+
The list of operations to apply discounts to the cart.
373+
"""
374+
operations: [CartOperation!]!
375+
}
376+
335377
"""
336378
The operations that can be performed to apply discounts to the cart.
337379
"""
338380
input CartOperation @oneOf {
339381
"""
340-
A list of valid discount codes that correspond to external discounts. This can
341-
only be used by Functions with network access.
382+
An operation that selects which entered discount codes to accept. Use this to
383+
validate discount codes from external systems.
342384
"""
343-
addDiscountCodeValidations: ValidDiscountCodes
385+
enteredDiscountCodesAccept: EnteredDiscountCodesAcceptOperation
344386

345387
"""
346-
A group of order discounts that share a selection strategy.
388+
An operation that applies order discounts to a cart that share a selection strategy.
347389
"""
348-
addOrderDiscounts: OrderDiscounts
390+
orderDiscountsAdd: OrderDiscountsAddOperation
349391

350392
"""
351-
A group of product discounts that share a selection strategy.
393+
An operation that applies product discounts to a cart that share a selection strategy.
352394
"""
353-
addProductDiscounts: ProductDiscounts
395+
productDiscountsAdd: ProductDiscountsAddOperation
354396
}
355397

356398
"""
@@ -2805,9 +2847,9 @@ enum DeliveryDiscountSelectionStrategy {
28052847
}
28062848

28072849
"""
2808-
A group of delivery discounts that share a selection strategy.
2850+
An operation that applies delivery discounts to a cart that share a selection strategy.
28092851
"""
2810-
input DeliveryDiscounts {
2852+
input DeliveryDiscountsAddOperation {
28112853
"""
28122854
The list of delivery discount candidates to be applied.
28132855
"""
@@ -2869,15 +2911,15 @@ The operations that can be performed to apply discounts to the delivery lines.
28692911
"""
28702912
input DeliveryOperation @oneOf {
28712913
"""
2872-
A group of delivery discounts that share a selection strategy.
2914+
An operation that applies delivery discounts to a cart that share a selection strategy.
28732915
"""
2874-
addDeliveryDiscounts: DeliveryDiscounts
2916+
deliveryDiscountsAdd: DeliveryDiscountsAddOperation
28752917

28762918
"""
2877-
A list of valid discount codes that correspond to external discounts. This can
2878-
only be used by Functions with network access.
2919+
An operation that selects which entered discount codes to accept. Use this to
2920+
validate discount codes from external systems.
28792921
"""
2880-
addDiscountCodeValidations: ValidDiscountCodes
2922+
enteredDiscountCodesAccept: EnteredDiscountCodesAcceptOperation
28812923
}
28822924

28832925
"""
@@ -2943,57 +2985,35 @@ enum DiscountClass {
29432985
}
29442986

29452987
"""
2946-
A fixed amount value.
2947-
"""
2948-
input FixedAmount {
2949-
"""
2950-
The fixed amount value of the discount, in the currency of the cart.
2951-
2952-
The amount must be greater than or equal to 0.
2953-
"""
2954-
amount: Decimal!
2955-
}
2956-
2957-
"""
2958-
The cart.fetch target result. Refer to [network access]
2959-
(https://shopify.dev/apps/build/functions/input-output/network-access/graphql) for Shopify Functions.
2988+
A discount code used by the buyer to add a discount to the cart.
29602989
"""
2961-
input FunctionCartFetchResult {
2990+
input DiscountCode {
29622991
"""
2963-
The http request.
2992+
The discount code.
29642993
"""
2965-
request: HttpRequest
2994+
code: String!
29662995
}
29672996

29682997
"""
2969-
The cart.run target result.
2998+
An operation that selects which entered discount codes to accept. Use this to validate discount codes from external systems.
29702999
"""
2971-
input FunctionCartRunResult {
3000+
input EnteredDiscountCodesAcceptOperation {
29723001
"""
2973-
The list of operations to apply discounts to the cart.
3002+
The list of discount codes to accept.
29743003
"""
2975-
operations: [CartOperation!]!
3004+
codes: [DiscountCode!]!
29763005
}
29773006

29783007
"""
2979-
The delivery.fetch target result. Refer to
2980-
[network access](https://shopify.dev/apps/build/functions/input-output/network-access/graphql) for Shopify Functions.
3008+
A fixed amount value.
29813009
"""
2982-
input FunctionDeliveryFetchResult {
2983-
"""
2984-
The http request.
3010+
input FixedAmount {
29853011
"""
2986-
request: HttpRequest
2987-
}
3012+
The fixed amount value of the discount, in the currency of the cart.
29883013
2989-
"""
2990-
The delivery.run target result.
2991-
"""
2992-
input FunctionDeliveryRunResult {
2993-
"""
2994-
The list of operations to apply discounts to the delivery lines.
3014+
The amount must be greater than or equal to 0.
29953015
"""
2996-
operations: [DeliveryOperation!]!
3016+
amount: Decimal!
29973017
}
29983018

29993019
"""
@@ -3070,7 +3090,7 @@ interface HasGates {
30703090
The handle of the gate configurations to search for.
30713091
"""
30723092
handle: Handle
3073-
): [GateSubject!]!
3093+
): [GateSubject!]! @deprecated(reason: "Gates API is being sunset and will be removed in a future version. Use `metafields` instead for gate configuration.")
30743094
}
30753095

30763096
"""
@@ -3216,9 +3236,9 @@ type HttpResponse {
32163236
headers: [HttpResponseHeader!]! @deprecated(reason: "Use `header` instead.")
32173237

32183238
"""
3219-
The HTTP response body parsed as JSON.
3220-
If the body is valid JSON, it will be parsed and returned as a JSON object.
3221-
If parsing fails, then raw body is returned as a string.
3239+
The HTTP response body parsed as JSON.
3240+
If the body is valid JSON, it will be parsed and returned as a JSON object.
3241+
If parsing fails, then raw body is returned as a string.
32223242
Use this field when you expect the response to be JSON, or when you're dealing
32233243
with mixed response types, meaning both JSON and non-JSON.
32243244
Using this field reduces function instruction consumption and ensures that the data is formatted in logs.
@@ -4552,7 +4572,7 @@ type MutationRoot {
45524572
"""
45534573
The result of the Function.
45544574
"""
4555-
result: FunctionDeliveryFetchResult!
4575+
result: CartDeliveryOptionsDiscountsGenerateFetchResult!
45564576
): Void!
45574577

45584578
"""
@@ -4562,7 +4582,7 @@ type MutationRoot {
45624582
"""
45634583
The result of the Function.
45644584
"""
4565-
result: FunctionDeliveryRunResult!
4585+
result: CartDeliveryOptionsDiscountsGenerateRunResult!
45664586
): Void!
45674587

45684588
"""
@@ -4572,7 +4592,7 @@ type MutationRoot {
45724592
"""
45734593
The result of the Function.
45744594
"""
4575-
result: FunctionCartFetchResult!
4595+
result: CartLinesDiscountsGenerateFetchResult!
45764596
): Void!
45774597

45784598
"""
@@ -4582,7 +4602,7 @@ type MutationRoot {
45824602
"""
45834603
The result of the Function.
45844604
"""
4585-
result: FunctionCartRunResult!
4605+
result: CartLinesDiscountsGenerateRunResult!
45864606
): Void!
45874607
}
45884608

@@ -4657,9 +4677,9 @@ enum OrderDiscountSelectionStrategy {
46574677
}
46584678

46594679
"""
4660-
A group of order discounts that share a selection strategy.
4680+
An operation that applies order discounts to a cart that share a selection strategy.
46614681
"""
4662-
input OrderDiscounts {
4682+
input OrderDiscountsAddOperation {
46634683
"""
46644684
The list of order discount candidates to be applied.
46654685
"""
@@ -4721,7 +4741,7 @@ type Product implements HasGates & HasMetafields {
47214741
The handle of the gate configurations to search for.
47224742
"""
47234743
handle: Handle
4724-
): [GateSubject!]!
4744+
): [GateSubject!]! @deprecated(reason: "Gates API is being sunset and will be removed in a future version. Use `metafields` instead for gate configuration.")
47254745

47264746
"""
47274747
A unique human-friendly string of the product's title.
@@ -4860,7 +4880,7 @@ A target of a product discount candidate, which determines which cart line(s) th
48604880
Multiple targets with the same type and ID are the same as a single target of that type and ID with their
48614881
quantities added together, or `null` if any of those targets have a quantity of `null`.
48624882
4863-
See the [Discounts API reference](https://shopify.dev/docs/api/functions/reference/product-discounts/graphql#functionrunresult) for examples.
4883+
See the [Discounts API reference](https://shopify.dev/docs/api/functions/reference/discount/graphql/functioncartrunresult) for examples.
48644884
"""
48654885
input ProductDiscountCandidateTarget @oneOf {
48664886
"""
@@ -4906,9 +4926,9 @@ enum ProductDiscountSelectionStrategy {
49064926
}
49074927

49084928
"""
4909-
A group of product discounts that share a selection strategy.
4929+
An operation that applies product discounts to a cart that share a selection strategy.
49104930
"""
4911-
input ProductDiscounts {
4931+
input ProductDiscountsAddOperation {
49124932
"""
49134933
The list of product discount candidates to be applied.
49144934
"""
@@ -5119,28 +5139,6 @@ For example, `"https://example.myshopify.com"` is a valid URL. It includes a sch
51195139
"""
51205140
scalar URL
51215141

5122-
"""
5123-
A discount code that corresponds to a valid external discount.
5124-
This can only be used by Functions with network access.
5125-
"""
5126-
input ValidDiscountCode {
5127-
"""
5128-
The discount code.
5129-
"""
5130-
code: String!
5131-
}
5132-
5133-
"""
5134-
A list of valid discount codes that correspond to external discounts. This can
5135-
only be used by Functions with network access.
5136-
"""
5137-
input ValidDiscountCodes {
5138-
"""
5139-
The list of valid discount codes.
5140-
"""
5141-
codes: [ValidDiscountCode!]!
5142-
}
5143-
51445142
"""
51455143
A void type that can be used to return a null value from a mutation.
51465144
"""

0 commit comments

Comments
 (0)