From bfb657d785fb823563fbb88c59c453598737c66b Mon Sep 17 00:00:00 2001 From: Dima Bart Date: Wed, 19 Dec 2018 11:29:30 -0500 Subject: [PATCH 1/5] =?UTF-8?q?Use=20short=20bundle=20version,=20it?= =?UTF-8?q?=E2=80=99s=20more=20reliable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Buy/Utilities/Global.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Buy/Utilities/Global.swift b/Buy/Utilities/Global.swift index c56a6c4e..635ddde4 100644 --- a/Buy/Utilities/Global.swift +++ b/Buy/Utilities/Global.swift @@ -39,7 +39,7 @@ class Global { // MARK: - Versions - // static var frameworkVersion: String { - return self.frameworkBundle.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as! String + return self.frameworkBundle.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String } static var applicationIdentifier: String { From bdf1ddc8f844a843fc4cda2853d17aa4dc761f9c Mon Sep 17 00:00:00 2001 From: Dima Bart Date: Wed, 19 Dec 2018 12:46:51 -0500 Subject: [PATCH 2/5] Updates schema. - Adds support for setting checkout line items directly - Adds support for retrieving `Page` resources - Adds `presentmentPrices` for product variants - Remove card vault deprecations --- Buy.xcodeproj/project.pbxproj | 64 +++++ .../CheckoutAttributesUpdatePayload.swift | 2 + .../CheckoutAttributesUpdateV2Payload.swift | 2 + .../CheckoutCompleteFreePayload.swift | 2 + ...heckoutCompleteWithCreditCardPayload.swift | 2 + ...ckoutCompleteWithCreditCardV2Payload.swift | 2 + ...tCompleteWithTokenizedPaymentPayload.swift | 2 + ...ompleteWithTokenizedPaymentV2Payload.swift | 2 + .../Storefront/CheckoutCreatePayload.swift | 2 + .../CheckoutCustomerAssociatePayload.swift | 2 + .../CheckoutCustomerAssociateV2Payload.swift | 2 + .../CheckoutCustomerDisassociatePayload.swift | 2 + ...heckoutCustomerDisassociateV2Payload.swift | 2 + .../CheckoutDiscountCodeApplyPayload.swift | 2 + .../CheckoutDiscountCodeApplyV2Payload.swift | 2 + .../CheckoutDiscountCodeRemovePayload.swift | 2 + .../CheckoutEmailUpdatePayload.swift | 2 + .../CheckoutEmailUpdateV2Payload.swift | 2 + .../CheckoutGiftCardApplyPayload.swift | 2 + .../CheckoutGiftCardRemovePayload.swift | 2 + .../CheckoutGiftCardRemoveV2Payload.swift | 2 + .../CheckoutGiftCardsAppendPayload.swift | 2 + .../CheckoutLineItemsAddPayload.swift | 2 + .../CheckoutLineItemsRemovePayload.swift | 2 + .../CheckoutLineItemsReplacePayload.swift | 121 +++++++++ .../CheckoutLineItemsUpdatePayload.swift | 2 + ...CheckoutShippingAddressUpdatePayload.swift | 2 + ...eckoutShippingAddressUpdateV2Payload.swift | 2 + .../CheckoutShippingLineUpdatePayload.swift | 2 + .../CustomerAccessTokenCreatePayload.swift | 2 + .../CustomerAccessTokenDeletePayload.swift | 2 + .../CustomerAccessTokenRenewPayload.swift | 2 + .../Storefront/CustomerActivatePayload.swift | 2 + .../CustomerAddressCreatePayload.swift | 2 + .../CustomerAddressDeletePayload.swift | 2 + .../CustomerAddressUpdatePayload.swift | 2 + .../Storefront/CustomerCreatePayload.swift | 2 + .../CustomerDefaultAddressUpdatePayload.swift | 2 + .../Storefront/CustomerRecoverPayload.swift | 2 + .../CustomerResetByUrlPayload.swift | 2 + .../Storefront/CustomerResetPayload.swift | 2 + .../Storefront/CustomerUpdatePayload.swift | 2 + Buy/Generated/Storefront/Mutation.swift | 61 +++++ Buy/Generated/Storefront/Node.swift | 11 + Buy/Generated/Storefront/Page.swift | 231 ++++++++++++++++++ Buy/Generated/Storefront/PageConnection.swift | 116 +++++++++ Buy/Generated/Storefront/PageEdge.swift | 107 ++++++++ Buy/Generated/Storefront/PageSortKeys.swift | 49 ++++ Buy/Generated/Storefront/ProductVariant.swift | 72 ++++++ .../Storefront/ProductVariantPricePair.swift | 119 +++++++++ .../ProductVariantPricePairConnection.swift | 116 +++++++++ .../ProductVariantPricePairEdge.swift | 107 ++++++++ Buy/Generated/Storefront/QueryRoot.swift | 133 +++++++++- Buy/Generated/Storefront/Shop.swift | 40 +-- 54 files changed, 1392 insertions(+), 35 deletions(-) create mode 100644 Buy/Generated/Storefront/CheckoutLineItemsReplacePayload.swift create mode 100644 Buy/Generated/Storefront/Page.swift create mode 100644 Buy/Generated/Storefront/PageConnection.swift create mode 100644 Buy/Generated/Storefront/PageEdge.swift create mode 100644 Buy/Generated/Storefront/PageSortKeys.swift create mode 100644 Buy/Generated/Storefront/ProductVariantPricePair.swift create mode 100644 Buy/Generated/Storefront/ProductVariantPricePairConnection.swift create mode 100644 Buy/Generated/Storefront/ProductVariantPricePairEdge.swift diff --git a/Buy.xcodeproj/project.pbxproj b/Buy.xcodeproj/project.pbxproj index 702b1f81..c47bea78 100644 --- a/Buy.xcodeproj/project.pbxproj +++ b/Buy.xcodeproj/project.pbxproj @@ -148,6 +148,30 @@ 9A0C81071EBA66800020F187 /* Graph.CachePolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A0C81061EBA66800020F187 /* Graph.CachePolicy.swift */; }; 9A125CFF1F16A0E0008DCF38 /* StringConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A125CFE1F16A0D7008DCF38 /* StringConnection.swift */; }; 9A125D001F16A0E0008DCF38 /* StringEdge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A125CFD1F16A0D7008DCF38 /* StringEdge.swift */; }; + 9A2ACDC521CABAC200C09FF7 /* ProductVariantPricePair.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDBE21CABAC100C09FF7 /* ProductVariantPricePair.swift */; }; + 9A2ACDC621CABAC200C09FF7 /* ProductVariantPricePair.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDBE21CABAC100C09FF7 /* ProductVariantPricePair.swift */; }; + 9A2ACDC721CABAC200C09FF7 /* ProductVariantPricePair.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDBE21CABAC100C09FF7 /* ProductVariantPricePair.swift */; }; + 9A2ACDC821CABAC200C09FF7 /* PageConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDBF21CABAC100C09FF7 /* PageConnection.swift */; }; + 9A2ACDC921CABAC200C09FF7 /* PageConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDBF21CABAC100C09FF7 /* PageConnection.swift */; }; + 9A2ACDCA21CABAC200C09FF7 /* PageConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDBF21CABAC100C09FF7 /* PageConnection.swift */; }; + 9A2ACDCB21CABAC200C09FF7 /* ProductVariantPricePairEdge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC021CABAC100C09FF7 /* ProductVariantPricePairEdge.swift */; }; + 9A2ACDCC21CABAC200C09FF7 /* ProductVariantPricePairEdge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC021CABAC100C09FF7 /* ProductVariantPricePairEdge.swift */; }; + 9A2ACDCD21CABAC200C09FF7 /* ProductVariantPricePairEdge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC021CABAC100C09FF7 /* ProductVariantPricePairEdge.swift */; }; + 9A2ACDCE21CABAC200C09FF7 /* ProductVariantPricePairConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC121CABAC100C09FF7 /* ProductVariantPricePairConnection.swift */; }; + 9A2ACDCF21CABAC200C09FF7 /* ProductVariantPricePairConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC121CABAC100C09FF7 /* ProductVariantPricePairConnection.swift */; }; + 9A2ACDD021CABAC200C09FF7 /* ProductVariantPricePairConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC121CABAC100C09FF7 /* ProductVariantPricePairConnection.swift */; }; + 9A2ACDD121CABAC200C09FF7 /* PageEdge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC221CABAC100C09FF7 /* PageEdge.swift */; }; + 9A2ACDD221CABAC200C09FF7 /* PageEdge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC221CABAC100C09FF7 /* PageEdge.swift */; }; + 9A2ACDD321CABAC200C09FF7 /* PageEdge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC221CABAC100C09FF7 /* PageEdge.swift */; }; + 9A2ACDD421CABAC200C09FF7 /* Page.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC321CABAC200C09FF7 /* Page.swift */; }; + 9A2ACDD521CABAC200C09FF7 /* Page.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC321CABAC200C09FF7 /* Page.swift */; }; + 9A2ACDD621CABAC200C09FF7 /* Page.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC321CABAC200C09FF7 /* Page.swift */; }; + 9A2ACDD721CABAC200C09FF7 /* PageSortKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC421CABAC200C09FF7 /* PageSortKeys.swift */; }; + 9A2ACDD821CABAC200C09FF7 /* PageSortKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC421CABAC200C09FF7 /* PageSortKeys.swift */; }; + 9A2ACDD921CABAC200C09FF7 /* PageSortKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDC421CABAC200C09FF7 /* PageSortKeys.swift */; }; + 9A2ACDDB21CABB7100C09FF7 /* CheckoutLineItemsReplacePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDDA21CABB7000C09FF7 /* CheckoutLineItemsReplacePayload.swift */; }; + 9A2ACDDC21CABB7100C09FF7 /* CheckoutLineItemsReplacePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDDA21CABB7000C09FF7 /* CheckoutLineItemsReplacePayload.swift */; }; + 9A2ACDDD21CABB7100C09FF7 /* CheckoutLineItemsReplacePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDDA21CABB7000C09FF7 /* CheckoutLineItemsReplacePayload.swift */; }; 9A4068E51E8E7659000254CD /* Pay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A4068DC1E8E7658000254CD /* Pay.framework */; }; 9A4068EA1E8E7659000254CD /* PaySessionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A4068E91E8E7659000254CD /* PaySessionTests.swift */; }; 9A4068EC1E8E7659000254CD /* Pay.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A4068DE1E8E7659000254CD /* Pay.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -745,6 +769,14 @@ 9A0C81061EBA66800020F187 /* Graph.CachePolicy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Graph.CachePolicy.swift; sourceTree = ""; }; 9A125CFD1F16A0D7008DCF38 /* StringEdge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringEdge.swift; sourceTree = ""; }; 9A125CFE1F16A0D7008DCF38 /* StringConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringConnection.swift; sourceTree = ""; }; + 9A2ACDBE21CABAC100C09FF7 /* ProductVariantPricePair.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductVariantPricePair.swift; sourceTree = ""; }; + 9A2ACDBF21CABAC100C09FF7 /* PageConnection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageConnection.swift; sourceTree = ""; }; + 9A2ACDC021CABAC100C09FF7 /* ProductVariantPricePairEdge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductVariantPricePairEdge.swift; sourceTree = ""; }; + 9A2ACDC121CABAC100C09FF7 /* ProductVariantPricePairConnection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductVariantPricePairConnection.swift; sourceTree = ""; }; + 9A2ACDC221CABAC100C09FF7 /* PageEdge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageEdge.swift; sourceTree = ""; }; + 9A2ACDC321CABAC200C09FF7 /* Page.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Page.swift; sourceTree = ""; }; + 9A2ACDC421CABAC200C09FF7 /* PageSortKeys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageSortKeys.swift; sourceTree = ""; }; + 9A2ACDDA21CABB7000C09FF7 /* CheckoutLineItemsReplacePayload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckoutLineItemsReplacePayload.swift; sourceTree = ""; }; 9A4068DC1E8E7658000254CD /* Pay.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pay.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9A4068DE1E8E7659000254CD /* Pay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Pay.h; sourceTree = ""; }; 9A4068DF1E8E7659000254CD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -963,6 +995,7 @@ 9A0C800D1EAA51C50020F187 /* CheckoutLineItemInput.swift */, 9A0C800E1EAA51C50020F187 /* CheckoutLineItemsAddPayload.swift */, 9A0C800F1EAA51C50020F187 /* CheckoutLineItemsRemovePayload.swift */, + 9A2ACDDA21CABB7000C09FF7 /* CheckoutLineItemsReplacePayload.swift */, 9A0C80101EAA51C50020F187 /* CheckoutLineItemsUpdatePayload.swift */, 9A0C80111EAA51C50020F187 /* CheckoutLineItemUpdateInput.swift */, 9A0C80121EAA51C50020F187 /* CheckoutShippingAddressUpdatePayload.swift */, @@ -1044,7 +1077,11 @@ 9A0C803F1EAA51C50020F187 /* OrderLineItemConnection.swift */, 9A0C80401EAA51C50020F187 /* OrderLineItemEdge.swift */, 9A0C80411EAA51C50020F187 /* OrderSortKeys.swift */, + 9A2ACDC321CABAC200C09FF7 /* Page.swift */, + 9A2ACDBF21CABAC100C09FF7 /* PageConnection.swift */, + 9A2ACDC221CABAC100C09FF7 /* PageEdge.swift */, 9A0C80421EAA51C50020F187 /* PageInfo.swift */, + 9A2ACDC421CABAC200C09FF7 /* PageSortKeys.swift */, 9A0C80431EAA51C50020F187 /* Payment.swift */, 9AF1C1851F13ACCF0064AEA0 /* PaymentSettings.swift */, 9A67115021666AB000A57A3F /* PricingPercentageValue.swift */, @@ -1060,6 +1097,9 @@ 9A0C80491EAA51C50020F187 /* ProductVariant.swift */, 9A0C804A1EAA51C50020F187 /* ProductVariantConnection.swift */, 9A0C804B1EAA51C50020F187 /* ProductVariantEdge.swift */, + 9A2ACDBE21CABAC100C09FF7 /* ProductVariantPricePair.swift */, + 9A2ACDC121CABAC100C09FF7 /* ProductVariantPricePairConnection.swift */, + 9A2ACDC021CABAC100C09FF7 /* ProductVariantPricePairEdge.swift */, 9AE1F8151F605F8F00147E77 /* ProductVariantSortKeys.swift */, 9A0C804C1EAA51C50020F187 /* QueryRoot.swift */, 9A67114921666AAE00A57A3F /* ScriptDiscountApplication.swift */, @@ -1649,6 +1689,7 @@ 9AC2EF3C1F6818180037E0D7 /* OrderCancelReason.swift in Sources */, 9AC2EF3D1F6818180037E0D7 /* ProductVariantSortKeys.swift in Sources */, 9AC2EF3E1F6818180037E0D7 /* ProductOption.swift in Sources */, + 9A2ACDDC21CABB7100C09FF7 /* CheckoutLineItemsReplacePayload.swift in Sources */, 9A67116521666AB200A57A3F /* ManualDiscountApplication.swift in Sources */, 9AC2EF3F1F6818180037E0D7 /* QueryRoot.swift in Sources */, 9AC2EF401F6818180037E0D7 /* ShippingRate.swift in Sources */, @@ -1657,6 +1698,7 @@ 9A67116B21666AB200A57A3F /* PricingPercentageValue.swift in Sources */, 9AC2EF431F6818180037E0D7 /* AvailableShippingRates.swift in Sources */, 9AC2EF441F6818180037E0D7 /* CollectionConnection.swift in Sources */, + 9A2ACDD821CABAC200C09FF7 /* PageSortKeys.swift in Sources */, 9AC2EF451F6818180037E0D7 /* CheckoutGiftCardApplyPayload.swift in Sources */, 9AC2EF461F6818180037E0D7 /* OrderDisplayFulfillmentStatus.swift in Sources */, 9AC2EF471F6818180037E0D7 /* ProductEdge.swift in Sources */, @@ -1704,6 +1746,7 @@ 9ABEB3B32122FF7700A373F2 /* FulfillmentTrackingInfo.swift in Sources */, 9ABEB3BB2122FF8000A373F2 /* CustomerUserError.swift in Sources */, 9A035E112177B764008596C9 /* TokenizedPaymentInputV2.swift in Sources */, + 9A2ACDC621CABAC200C09FF7 /* ProductVariantPricePair.swift in Sources */, 9AC2EF661F6818180037E0D7 /* BlogEdge.swift in Sources */, 9A67114721666A7700A57A3F /* CheckoutUserError.swift in Sources */, 9AC2EF671F6818180037E0D7 /* Shop.swift in Sources */, @@ -1725,6 +1768,7 @@ 9AC2EF721F6818180037E0D7 /* CheckoutCompleteWithTokenizedPaymentPayload.swift in Sources */, 9AC2EF731F6818180037E0D7 /* BlogConnection.swift in Sources */, 9A67117121666AB200A57A3F /* DiscountApplicationAllocationMethod.swift in Sources */, + 9A2ACDD221CABAC200C09FF7 /* PageEdge.swift in Sources */, 9AC2EF741F6818180037E0D7 /* CreditCard.swift in Sources */, 9AC2EF751F6818180037E0D7 /* GraphQL.swift in Sources */, 9AC2EF761F6818180037E0D7 /* Image.swift in Sources */, @@ -1748,6 +1792,7 @@ 9AC2EF861F6818180037E0D7 /* CustomerCreatePayload.swift in Sources */, 9AC2EF871F6818180037E0D7 /* Article.swift in Sources */, 9AC2EF881F6818180037E0D7 /* MailingAddress.swift in Sources */, + 9A2ACDCF21CABAC200C09FF7 /* ProductVariantPricePairConnection.swift in Sources */, 9AC2EF891F6818180037E0D7 /* ArticleConnection.swift in Sources */, 9AC2EF8A1F6818180037E0D7 /* CropRegion.swift in Sources */, 9A41E2A61F85096B0059485A /* CheckoutDiscountCodeApplyPayload.swift in Sources */, @@ -1768,6 +1813,7 @@ 9AC2EF951F6818180037E0D7 /* ArticleEdge.swift in Sources */, 9AC2EF961F6818180037E0D7 /* UserError.swift in Sources */, 9AC2EF971F6818180037E0D7 /* CustomerActivateInput.swift in Sources */, + 9A2ACDCC21CABAC200C09FF7 /* ProductVariantPricePairEdge.swift in Sources */, 9A47C04A218087880043525D /* CheckoutCustomerAssociateV2Payload.swift in Sources */, 9AC2EF981F6818180037E0D7 /* CustomerActivatePayload.swift in Sources */, 9AC2EF991F6818180037E0D7 /* AttributeInput.swift in Sources */, @@ -1795,6 +1841,7 @@ 9AC2EFAC1F6818180037E0D7 /* Collection.swift in Sources */, 9ABEB3B62122FF7700A373F2 /* FulfillmentLineItemEdge.swift in Sources */, 9AC2EFAD1F6818180037E0D7 /* CustomerResetPayload.swift in Sources */, + 9A2ACDC921CABAC200C09FF7 /* PageConnection.swift in Sources */, 9A656CC12183B04700D3A41C /* CheckoutEmailUpdateV2Payload.swift in Sources */, 9AC2EFAE1F6818180037E0D7 /* ArticleSortKeys.swift in Sources */, 9AD577662153E315006BD1C5 /* CheckoutAttributesUpdateV2Payload.swift in Sources */, @@ -1822,6 +1869,7 @@ 9AC2EFBD1F6818180037E0D7 /* CheckoutCustomerDisassociatePayload.swift in Sources */, 9AC2EFBE1F6818180037E0D7 /* CommentEdge.swift in Sources */, 9AC2EFBF1F6818180037E0D7 /* GraphQL+ScalarSupport.swift in Sources */, + 9A2ACDD521CABAC200C09FF7 /* Page.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1835,6 +1883,7 @@ 9A0C80981EAA51C50020F187 /* OrderCancelReason.swift in Sources */, 9AE1F8161F605F8F00147E77 /* ProductVariantSortKeys.swift in Sources */, 9A0C80A61EAA51C50020F187 /* ProductOption.swift in Sources */, + 9A2ACDDB21CABB7100C09FF7 /* CheckoutLineItemsReplacePayload.swift in Sources */, 9A67116421666AB200A57A3F /* ManualDiscountApplication.swift in Sources */, 9A0C80AB1EAA51C50020F187 /* QueryRoot.swift in Sources */, 9A0C80AD1EAA51C50020F187 /* ShippingRate.swift in Sources */, @@ -1843,6 +1892,7 @@ 9A67116A21666AB200A57A3F /* PricingPercentageValue.swift in Sources */, 9A0C805B1EAA51C50020F187 /* AvailableShippingRates.swift in Sources */, 9A0C80741EAA51C50020F187 /* CollectionConnection.swift in Sources */, + 9A2ACDD721CABAC200C09FF7 /* PageSortKeys.swift in Sources */, 9A0C80671EAA51C50020F187 /* CheckoutGiftCardApplyPayload.swift in Sources */, 9A0C809B1EAA51C50020F187 /* OrderDisplayFulfillmentStatus.swift in Sources */, 9A0C80A51EAA51C50020F187 /* ProductEdge.swift in Sources */, @@ -1890,6 +1940,7 @@ 9ABEB3B22122FF7700A373F2 /* FulfillmentTrackingInfo.swift in Sources */, 9ABEB3BA2122FF8000A373F2 /* CustomerUserError.swift in Sources */, 9A035E102177B764008596C9 /* TokenizedPaymentInputV2.swift in Sources */, + 9A2ACDC521CABAC200C09FF7 /* ProductVariantPricePair.swift in Sources */, 9AA416D21EE095B20060029B /* BlogEdge.swift in Sources */, 9A67114621666A7700A57A3F /* CheckoutUserError.swift in Sources */, 9A0C80AE1EAA51C50020F187 /* Shop.swift in Sources */, @@ -1911,6 +1962,7 @@ 9A0C80611EAA51C50020F187 /* CheckoutCompleteWithTokenizedPaymentPayload.swift in Sources */, 9AA416D11EE095B20060029B /* BlogConnection.swift in Sources */, 9A67117021666AB200A57A3F /* DiscountApplicationAllocationMethod.swift in Sources */, + 9A2ACDD121CABAC200C09FF7 /* PageEdge.swift in Sources */, 9A0C80771EAA51C50020F187 /* CreditCard.swift in Sources */, 9AFA3B6D1E6D9A5E0056C5AA /* GraphQL.swift in Sources */, 9A0C808E1EAA51C50020F187 /* Image.swift in Sources */, @@ -1934,6 +1986,7 @@ 9A0C80871EAA51C50020F187 /* CustomerCreatePayload.swift in Sources */, 9AA416C71EE095AA0060029B /* Article.swift in Sources */, 9A0C80911EAA51C50020F187 /* MailingAddress.swift in Sources */, + 9A2ACDCE21CABAC200C09FF7 /* ProductVariantPricePairConnection.swift in Sources */, 9AA416C91EE095AA0060029B /* ArticleConnection.swift in Sources */, 9A0C80791EAA51C50020F187 /* CropRegion.swift in Sources */, 9A41E2A71F85096B0059485A /* CheckoutDiscountCodeApplyPayload.swift in Sources */, @@ -1954,6 +2007,7 @@ 9AA416CA1EE095AA0060029B /* ArticleEdge.swift in Sources */, 9A0C80B41EAA51C50020F187 /* UserError.swift in Sources */, 9A0C80811EAA51C50020F187 /* CustomerActivateInput.swift in Sources */, + 9A2ACDCB21CABAC200C09FF7 /* ProductVariantPricePairEdge.swift in Sources */, 9A47C049218087880043525D /* CheckoutCustomerAssociateV2Payload.swift in Sources */, 9A0C80821EAA51C50020F187 /* CustomerActivatePayload.swift in Sources */, 9A0C805A1EAA51C50020F187 /* AttributeInput.swift in Sources */, @@ -1981,6 +2035,7 @@ 9A0C80731EAA51C50020F187 /* Collection.swift in Sources */, 9ABEB3B52122FF7700A373F2 /* FulfillmentLineItemEdge.swift in Sources */, 9A0C808A1EAA51C50020F187 /* CustomerResetPayload.swift in Sources */, + 9A2ACDC821CABAC200C09FF7 /* PageConnection.swift in Sources */, 9A656CC02183B04700D3A41C /* CheckoutEmailUpdateV2Payload.swift in Sources */, 9AA416CB1EE095AA0060029B /* ArticleSortKeys.swift in Sources */, 9AD577652153E315006BD1C5 /* CheckoutAttributesUpdateV2Payload.swift in Sources */, @@ -2008,6 +2063,7 @@ 9A0C80651EAA51C50020F187 /* CheckoutCustomerDisassociatePayload.swift in Sources */, 9AA416DB1EE095BB0060029B /* CommentEdge.swift in Sources */, 9AEF61A11E5F5A190067FA90 /* GraphQL+ScalarSupport.swift in Sources */, + 9A2ACDD421CABAC200C09FF7 /* Page.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2021,6 +2077,7 @@ 9AF255B61F6FEE50005BB0C9 /* OrderCancelReason.swift in Sources */, 9AF255B71F6FEE50005BB0C9 /* ProductVariantSortKeys.swift in Sources */, 9AF255B81F6FEE50005BB0C9 /* ProductOption.swift in Sources */, + 9A2ACDDD21CABB7100C09FF7 /* CheckoutLineItemsReplacePayload.swift in Sources */, 9A67116621666AB200A57A3F /* ManualDiscountApplication.swift in Sources */, 9AF255B91F6FEE50005BB0C9 /* QueryRoot.swift in Sources */, 9AF255BA1F6FEE50005BB0C9 /* ShippingRate.swift in Sources */, @@ -2029,6 +2086,7 @@ 9A67116C21666AB200A57A3F /* PricingPercentageValue.swift in Sources */, 9AF255BD1F6FEE50005BB0C9 /* AvailableShippingRates.swift in Sources */, 9AF255BE1F6FEE50005BB0C9 /* CollectionConnection.swift in Sources */, + 9A2ACDD921CABAC200C09FF7 /* PageSortKeys.swift in Sources */, 9AF255BF1F6FEE50005BB0C9 /* CheckoutGiftCardApplyPayload.swift in Sources */, 9AF255C01F6FEE50005BB0C9 /* OrderDisplayFulfillmentStatus.swift in Sources */, 9AF255C11F6FEE50005BB0C9 /* ProductEdge.swift in Sources */, @@ -2076,6 +2134,7 @@ 9ABEB3B42122FF7700A373F2 /* FulfillmentTrackingInfo.swift in Sources */, 9ABEB3BC2122FF8000A373F2 /* CustomerUserError.swift in Sources */, 9A035E122177B764008596C9 /* TokenizedPaymentInputV2.swift in Sources */, + 9A2ACDC721CABAC200C09FF7 /* ProductVariantPricePair.swift in Sources */, 9AF255E01F6FEE50005BB0C9 /* BlogEdge.swift in Sources */, 9A67114821666A7700A57A3F /* CheckoutUserError.swift in Sources */, 9AF255E11F6FEE50005BB0C9 /* Shop.swift in Sources */, @@ -2097,6 +2156,7 @@ 9AF255EC1F6FEE50005BB0C9 /* CheckoutCompleteWithTokenizedPaymentPayload.swift in Sources */, 9AF255ED1F6FEE50005BB0C9 /* BlogConnection.swift in Sources */, 9A67117221666AB200A57A3F /* DiscountApplicationAllocationMethod.swift in Sources */, + 9A2ACDD321CABAC200C09FF7 /* PageEdge.swift in Sources */, 9AF255EE1F6FEE50005BB0C9 /* CreditCard.swift in Sources */, 9AF255EF1F6FEE50005BB0C9 /* GraphQL.swift in Sources */, 9AF255F01F6FEE50005BB0C9 /* Image.swift in Sources */, @@ -2120,6 +2180,7 @@ 9AF256001F6FEE50005BB0C9 /* CustomerCreatePayload.swift in Sources */, 9AF256011F6FEE50005BB0C9 /* Article.swift in Sources */, 9AF256021F6FEE50005BB0C9 /* MailingAddress.swift in Sources */, + 9A2ACDD021CABAC200C09FF7 /* ProductVariantPricePairConnection.swift in Sources */, 9AF256031F6FEE50005BB0C9 /* ArticleConnection.swift in Sources */, 9AF256041F6FEE50005BB0C9 /* CropRegion.swift in Sources */, 9A41E2A81F85096B0059485A /* CheckoutDiscountCodeApplyPayload.swift in Sources */, @@ -2140,6 +2201,7 @@ 9AF2560F1F6FEE50005BB0C9 /* ArticleEdge.swift in Sources */, 9AF256101F6FEE50005BB0C9 /* UserError.swift in Sources */, 9AF256111F6FEE50005BB0C9 /* CustomerActivateInput.swift in Sources */, + 9A2ACDCD21CABAC200C09FF7 /* ProductVariantPricePairEdge.swift in Sources */, 9A47C04B218087880043525D /* CheckoutCustomerAssociateV2Payload.swift in Sources */, 9AF256121F6FEE50005BB0C9 /* CustomerActivatePayload.swift in Sources */, 9AF256131F6FEE50005BB0C9 /* AttributeInput.swift in Sources */, @@ -2167,6 +2229,7 @@ 9AF256261F6FEE50005BB0C9 /* Collection.swift in Sources */, 9ABEB3B72122FF7700A373F2 /* FulfillmentLineItemEdge.swift in Sources */, 9AF256271F6FEE50005BB0C9 /* CustomerResetPayload.swift in Sources */, + 9A2ACDCA21CABAC200C09FF7 /* PageConnection.swift in Sources */, 9A656CC22183B04700D3A41C /* CheckoutEmailUpdateV2Payload.swift in Sources */, 9AF256281F6FEE50005BB0C9 /* ArticleSortKeys.swift in Sources */, 9AD577672153E315006BD1C5 /* CheckoutAttributesUpdateV2Payload.swift in Sources */, @@ -2194,6 +2257,7 @@ 9AF256371F6FEE50005BB0C9 /* CheckoutCustomerDisassociatePayload.swift in Sources */, 9AF256381F6FEE50005BB0C9 /* CommentEdge.swift in Sources */, 9AF256391F6FEE50005BB0C9 /* GraphQL+ScalarSupport.swift in Sources */, + 9A2ACDD621CABAC200C09FF7 /* Page.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Buy/Generated/Storefront/CheckoutAttributesUpdatePayload.swift b/Buy/Generated/Storefront/CheckoutAttributesUpdatePayload.swift index 17bbc117..e4911e03 100644 --- a/Buy/Generated/Storefront/CheckoutAttributesUpdatePayload.swift +++ b/Buy/Generated/Storefront/CheckoutAttributesUpdatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutAttributesUpdate` mutation. open class CheckoutAttributesUpdatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutAttributesUpdatePayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutAttributesUpdate` mutation. open class CheckoutAttributesUpdatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutAttributesUpdatePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutAttributesUpdateV2Payload.swift b/Buy/Generated/Storefront/CheckoutAttributesUpdateV2Payload.swift index 9448bed2..0f5bd5ae 100644 --- a/Buy/Generated/Storefront/CheckoutAttributesUpdateV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutAttributesUpdateV2Payload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutAttributesUpdateV2` mutation. open class CheckoutAttributesUpdateV2PayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutAttributesUpdateV2Payload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutAttributesUpdateV2` mutation. open class CheckoutAttributesUpdateV2Payload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutAttributesUpdateV2PayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCompleteFreePayload.swift b/Buy/Generated/Storefront/CheckoutCompleteFreePayload.swift index 6f2351cb..e19dfa51 100644 --- a/Buy/Generated/Storefront/CheckoutCompleteFreePayload.swift +++ b/Buy/Generated/Storefront/CheckoutCompleteFreePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCompleteFree` mutation. open class CheckoutCompleteFreePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCompleteFreePayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutCompleteFree` mutation. open class CheckoutCompleteFreePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCompleteFreePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardPayload.swift b/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardPayload.swift index 7b514a21..3aaae332 100644 --- a/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardPayload.swift +++ b/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCompleteWithCreditCard` mutation. open class CheckoutCompleteWithCreditCardPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCompleteWithCreditCardPayload @@ -61,6 +62,7 @@ extension Storefront { } } + /// Return type for `checkoutCompleteWithCreditCard` mutation. open class CheckoutCompleteWithCreditCardPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCompleteWithCreditCardPayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardV2Payload.swift b/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardV2Payload.swift index 7660e8b1..5742acf9 100644 --- a/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardV2Payload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCompleteWithCreditCardV2` mutation. open class CheckoutCompleteWithCreditCardV2PayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCompleteWithCreditCardV2Payload @@ -61,6 +62,7 @@ extension Storefront { } } + /// Return type for `checkoutCompleteWithCreditCardV2` mutation. open class CheckoutCompleteWithCreditCardV2Payload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCompleteWithCreditCardV2PayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCompleteWithTokenizedPaymentPayload.swift b/Buy/Generated/Storefront/CheckoutCompleteWithTokenizedPaymentPayload.swift index 2d855de5..195efef6 100644 --- a/Buy/Generated/Storefront/CheckoutCompleteWithTokenizedPaymentPayload.swift +++ b/Buy/Generated/Storefront/CheckoutCompleteWithTokenizedPaymentPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCompleteWithTokenizedPayment` mutation. open class CheckoutCompleteWithTokenizedPaymentPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCompleteWithTokenizedPaymentPayload @@ -61,6 +62,7 @@ extension Storefront { } } + /// Return type for `checkoutCompleteWithTokenizedPayment` mutation. open class CheckoutCompleteWithTokenizedPaymentPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCompleteWithTokenizedPaymentPayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCompleteWithTokenizedPaymentV2Payload.swift b/Buy/Generated/Storefront/CheckoutCompleteWithTokenizedPaymentV2Payload.swift index 96cd2f4b..c4302ae5 100644 --- a/Buy/Generated/Storefront/CheckoutCompleteWithTokenizedPaymentV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutCompleteWithTokenizedPaymentV2Payload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCompleteWithTokenizedPaymentV2` mutation. open class CheckoutCompleteWithTokenizedPaymentV2PayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCompleteWithTokenizedPaymentV2Payload @@ -61,6 +62,7 @@ extension Storefront { } } + /// Return type for `checkoutCompleteWithTokenizedPaymentV2` mutation. open class CheckoutCompleteWithTokenizedPaymentV2Payload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCompleteWithTokenizedPaymentV2PayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCreatePayload.swift b/Buy/Generated/Storefront/CheckoutCreatePayload.swift index ab103cec..4fd7956c 100644 --- a/Buy/Generated/Storefront/CheckoutCreatePayload.swift +++ b/Buy/Generated/Storefront/CheckoutCreatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCreate` mutation. open class CheckoutCreatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCreatePayload @@ -62,6 +63,7 @@ extension Storefront { } } + /// Return type for `checkoutCreate` mutation. open class CheckoutCreatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCreatePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCustomerAssociatePayload.swift b/Buy/Generated/Storefront/CheckoutCustomerAssociatePayload.swift index 546b8f34..e040613f 100644 --- a/Buy/Generated/Storefront/CheckoutCustomerAssociatePayload.swift +++ b/Buy/Generated/Storefront/CheckoutCustomerAssociatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCustomerAssociate` mutation. open class CheckoutCustomerAssociatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCustomerAssociatePayload @@ -61,6 +62,7 @@ extension Storefront { } } + /// Return type for `checkoutCustomerAssociate` mutation. open class CheckoutCustomerAssociatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCustomerAssociatePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCustomerAssociateV2Payload.swift b/Buy/Generated/Storefront/CheckoutCustomerAssociateV2Payload.swift index e90cd1fb..3e8e3e19 100644 --- a/Buy/Generated/Storefront/CheckoutCustomerAssociateV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutCustomerAssociateV2Payload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCustomerAssociateV2` mutation. open class CheckoutCustomerAssociateV2PayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCustomerAssociateV2Payload @@ -61,6 +62,7 @@ extension Storefront { } } + /// Return type for `checkoutCustomerAssociateV2` mutation. open class CheckoutCustomerAssociateV2Payload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCustomerAssociateV2PayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCustomerDisassociatePayload.swift b/Buy/Generated/Storefront/CheckoutCustomerDisassociatePayload.swift index 6a619c49..8d187c29 100644 --- a/Buy/Generated/Storefront/CheckoutCustomerDisassociatePayload.swift +++ b/Buy/Generated/Storefront/CheckoutCustomerDisassociatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCustomerDisassociate` mutation. open class CheckoutCustomerDisassociatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCustomerDisassociatePayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutCustomerDisassociate` mutation. open class CheckoutCustomerDisassociatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCustomerDisassociatePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutCustomerDisassociateV2Payload.swift b/Buy/Generated/Storefront/CheckoutCustomerDisassociateV2Payload.swift index fbd8f1cd..b6df146c 100644 --- a/Buy/Generated/Storefront/CheckoutCustomerDisassociateV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutCustomerDisassociateV2Payload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutCustomerDisassociateV2` mutation. open class CheckoutCustomerDisassociateV2PayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutCustomerDisassociateV2Payload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutCustomerDisassociateV2` mutation. open class CheckoutCustomerDisassociateV2Payload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutCustomerDisassociateV2PayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutDiscountCodeApplyPayload.swift b/Buy/Generated/Storefront/CheckoutDiscountCodeApplyPayload.swift index a7eebd8a..3ced2c2c 100644 --- a/Buy/Generated/Storefront/CheckoutDiscountCodeApplyPayload.swift +++ b/Buy/Generated/Storefront/CheckoutDiscountCodeApplyPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutDiscountCodeApply` mutation. open class CheckoutDiscountCodeApplyPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutDiscountCodeApplyPayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutDiscountCodeApply` mutation. open class CheckoutDiscountCodeApplyPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutDiscountCodeApplyPayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutDiscountCodeApplyV2Payload.swift b/Buy/Generated/Storefront/CheckoutDiscountCodeApplyV2Payload.swift index a5f83fad..6edfcf9c 100644 --- a/Buy/Generated/Storefront/CheckoutDiscountCodeApplyV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutDiscountCodeApplyV2Payload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutDiscountCodeApplyV2` mutation. open class CheckoutDiscountCodeApplyV2PayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutDiscountCodeApplyV2Payload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutDiscountCodeApplyV2` mutation. open class CheckoutDiscountCodeApplyV2Payload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutDiscountCodeApplyV2PayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutDiscountCodeRemovePayload.swift b/Buy/Generated/Storefront/CheckoutDiscountCodeRemovePayload.swift index 62cc7548..a8f94e82 100644 --- a/Buy/Generated/Storefront/CheckoutDiscountCodeRemovePayload.swift +++ b/Buy/Generated/Storefront/CheckoutDiscountCodeRemovePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutDiscountCodeRemove` mutation. open class CheckoutDiscountCodeRemovePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutDiscountCodeRemovePayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutDiscountCodeRemove` mutation. open class CheckoutDiscountCodeRemovePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutDiscountCodeRemovePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutEmailUpdatePayload.swift b/Buy/Generated/Storefront/CheckoutEmailUpdatePayload.swift index 606b2031..6867a057 100644 --- a/Buy/Generated/Storefront/CheckoutEmailUpdatePayload.swift +++ b/Buy/Generated/Storefront/CheckoutEmailUpdatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutEmailUpdate` mutation. open class CheckoutEmailUpdatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutEmailUpdatePayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutEmailUpdate` mutation. open class CheckoutEmailUpdatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutEmailUpdatePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutEmailUpdateV2Payload.swift b/Buy/Generated/Storefront/CheckoutEmailUpdateV2Payload.swift index 918491b1..d9448f29 100644 --- a/Buy/Generated/Storefront/CheckoutEmailUpdateV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutEmailUpdateV2Payload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutEmailUpdateV2` mutation. open class CheckoutEmailUpdateV2PayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutEmailUpdateV2Payload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutEmailUpdateV2` mutation. open class CheckoutEmailUpdateV2Payload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutEmailUpdateV2PayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutGiftCardApplyPayload.swift b/Buy/Generated/Storefront/CheckoutGiftCardApplyPayload.swift index 93c92e4a..d40368dc 100644 --- a/Buy/Generated/Storefront/CheckoutGiftCardApplyPayload.swift +++ b/Buy/Generated/Storefront/CheckoutGiftCardApplyPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutGiftCardApply` mutation. open class CheckoutGiftCardApplyPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutGiftCardApplyPayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutGiftCardApply` mutation. open class CheckoutGiftCardApplyPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutGiftCardApplyPayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutGiftCardRemovePayload.swift b/Buy/Generated/Storefront/CheckoutGiftCardRemovePayload.swift index 9e2a0427..08b95407 100644 --- a/Buy/Generated/Storefront/CheckoutGiftCardRemovePayload.swift +++ b/Buy/Generated/Storefront/CheckoutGiftCardRemovePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutGiftCardRemove` mutation. open class CheckoutGiftCardRemovePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutGiftCardRemovePayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutGiftCardRemove` mutation. open class CheckoutGiftCardRemovePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutGiftCardRemovePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutGiftCardRemoveV2Payload.swift b/Buy/Generated/Storefront/CheckoutGiftCardRemoveV2Payload.swift index 25dfe71d..27f40204 100644 --- a/Buy/Generated/Storefront/CheckoutGiftCardRemoveV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutGiftCardRemoveV2Payload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutGiftCardRemoveV2` mutation. open class CheckoutGiftCardRemoveV2PayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutGiftCardRemoveV2Payload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutGiftCardRemoveV2` mutation. open class CheckoutGiftCardRemoveV2Payload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutGiftCardRemoveV2PayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutGiftCardsAppendPayload.swift b/Buy/Generated/Storefront/CheckoutGiftCardsAppendPayload.swift index db3f5d90..a22ff12f 100644 --- a/Buy/Generated/Storefront/CheckoutGiftCardsAppendPayload.swift +++ b/Buy/Generated/Storefront/CheckoutGiftCardsAppendPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutGiftCardsAppend` mutation. open class CheckoutGiftCardsAppendPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutGiftCardsAppendPayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutGiftCardsAppend` mutation. open class CheckoutGiftCardsAppendPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutGiftCardsAppendPayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutLineItemsAddPayload.swift b/Buy/Generated/Storefront/CheckoutLineItemsAddPayload.swift index 4bd3de4c..5ad030cc 100644 --- a/Buy/Generated/Storefront/CheckoutLineItemsAddPayload.swift +++ b/Buy/Generated/Storefront/CheckoutLineItemsAddPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutLineItemsAdd` mutation. open class CheckoutLineItemsAddPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutLineItemsAddPayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutLineItemsAdd` mutation. open class CheckoutLineItemsAddPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutLineItemsAddPayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutLineItemsRemovePayload.swift b/Buy/Generated/Storefront/CheckoutLineItemsRemovePayload.swift index 5f59bca2..9e04f54c 100644 --- a/Buy/Generated/Storefront/CheckoutLineItemsRemovePayload.swift +++ b/Buy/Generated/Storefront/CheckoutLineItemsRemovePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutLineItemsRemove` mutation. open class CheckoutLineItemsRemovePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutLineItemsRemovePayload @@ -50,6 +51,7 @@ extension Storefront { } } + /// Return type for `checkoutLineItemsRemove` mutation. open class CheckoutLineItemsRemovePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutLineItemsRemovePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutLineItemsReplacePayload.swift b/Buy/Generated/Storefront/CheckoutLineItemsReplacePayload.swift new file mode 100644 index 00000000..ad7d5822 --- /dev/null +++ b/Buy/Generated/Storefront/CheckoutLineItemsReplacePayload.swift @@ -0,0 +1,121 @@ +// +// CheckoutLineItemsReplacePayload.swift +// Buy +// +// Created by Shopify. +// Copyright (c) 2017 Shopify Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Storefront { + /// Return type for `checkoutLineItemsReplace` mutation. + open class CheckoutLineItemsReplacePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { + public typealias Response = CheckoutLineItemsReplacePayload + + /// The updated checkout object. + @discardableResult + open func checkout(alias: String? = nil, _ subfields: (CheckoutQuery) -> Void) -> CheckoutLineItemsReplacePayloadQuery { + let subquery = CheckoutQuery() + subfields(subquery) + + addField(field: "checkout", aliasSuffix: alias, subfields: subquery) + return self + } + + /// List of errors that occurred executing the mutation. + @discardableResult + open func userErrors(alias: String? = nil, _ subfields: (CheckoutUserErrorQuery) -> Void) -> CheckoutLineItemsReplacePayloadQuery { + let subquery = CheckoutUserErrorQuery() + subfields(subquery) + + addField(field: "userErrors", aliasSuffix: alias, subfields: subquery) + return self + } + } + + /// Return type for `checkoutLineItemsReplace` mutation. + open class CheckoutLineItemsReplacePayload: GraphQL.AbstractResponse, GraphQLObject { + public typealias Query = CheckoutLineItemsReplacePayloadQuery + + internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? { + let fieldValue = value + switch fieldName { + case "checkout": + if value is NSNull { return nil } + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: CheckoutLineItemsReplacePayload.self, field: fieldName, value: fieldValue) + } + return try Checkout(fields: value) + + case "userErrors": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: CheckoutLineItemsReplacePayload.self, field: fieldName, value: fieldValue) + } + return try value.map { return try CheckoutUserError(fields: $0) } + + default: + throw SchemaViolationError(type: CheckoutLineItemsReplacePayload.self, field: fieldName, value: fieldValue) + } + } + + /// The updated checkout object. + open var checkout: Storefront.Checkout? { + return internalGetCheckout() + } + + func internalGetCheckout(alias: String? = nil) -> Storefront.Checkout? { + return field(field: "checkout", aliasSuffix: alias) as! Storefront.Checkout? + } + + /// List of errors that occurred executing the mutation. + open var userErrors: [Storefront.CheckoutUserError] { + return internalGetUserErrors() + } + + func internalGetUserErrors(alias: String? = nil) -> [Storefront.CheckoutUserError] { + return field(field: "userErrors", aliasSuffix: alias) as! [Storefront.CheckoutUserError] + } + + internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] { + var response: [GraphQL.AbstractResponse] = [] + objectMap.keys.forEach { + switch($0) { + case "checkout": + if let value = internalGetCheckout() { + response.append(value) + response.append(contentsOf: value.childResponseObjectMap()) + } + + case "userErrors": + internalGetUserErrors().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + + default: + break + } + } + return response + } + } +} diff --git a/Buy/Generated/Storefront/CheckoutLineItemsUpdatePayload.swift b/Buy/Generated/Storefront/CheckoutLineItemsUpdatePayload.swift index 5e4b1a07..9a4b353c 100644 --- a/Buy/Generated/Storefront/CheckoutLineItemsUpdatePayload.swift +++ b/Buy/Generated/Storefront/CheckoutLineItemsUpdatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutLineItemsUpdate` mutation. open class CheckoutLineItemsUpdatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutLineItemsUpdatePayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutLineItemsUpdate` mutation. open class CheckoutLineItemsUpdatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutLineItemsUpdatePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutShippingAddressUpdatePayload.swift b/Buy/Generated/Storefront/CheckoutShippingAddressUpdatePayload.swift index 432e5e64..67d1f35c 100644 --- a/Buy/Generated/Storefront/CheckoutShippingAddressUpdatePayload.swift +++ b/Buy/Generated/Storefront/CheckoutShippingAddressUpdatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutShippingAddressUpdate` mutation. open class CheckoutShippingAddressUpdatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutShippingAddressUpdatePayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutShippingAddressUpdate` mutation. open class CheckoutShippingAddressUpdatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutShippingAddressUpdatePayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutShippingAddressUpdateV2Payload.swift b/Buy/Generated/Storefront/CheckoutShippingAddressUpdateV2Payload.swift index 411b09b4..e8af5bdb 100644 --- a/Buy/Generated/Storefront/CheckoutShippingAddressUpdateV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutShippingAddressUpdateV2Payload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutShippingAddressUpdateV2` mutation. open class CheckoutShippingAddressUpdateV2PayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutShippingAddressUpdateV2Payload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutShippingAddressUpdateV2` mutation. open class CheckoutShippingAddressUpdateV2Payload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutShippingAddressUpdateV2PayloadQuery diff --git a/Buy/Generated/Storefront/CheckoutShippingLineUpdatePayload.swift b/Buy/Generated/Storefront/CheckoutShippingLineUpdatePayload.swift index 5bacbe34..55a09133 100644 --- a/Buy/Generated/Storefront/CheckoutShippingLineUpdatePayload.swift +++ b/Buy/Generated/Storefront/CheckoutShippingLineUpdatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `checkoutShippingLineUpdate` mutation. open class CheckoutShippingLineUpdatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CheckoutShippingLineUpdatePayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `checkoutShippingLineUpdate` mutation. open class CheckoutShippingLineUpdatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CheckoutShippingLineUpdatePayloadQuery diff --git a/Buy/Generated/Storefront/CustomerAccessTokenCreatePayload.swift b/Buy/Generated/Storefront/CustomerAccessTokenCreatePayload.swift index d629817b..97a530d3 100644 --- a/Buy/Generated/Storefront/CustomerAccessTokenCreatePayload.swift +++ b/Buy/Generated/Storefront/CustomerAccessTokenCreatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerAccessTokenCreate` mutation. open class CustomerAccessTokenCreatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerAccessTokenCreatePayload @@ -62,6 +63,7 @@ extension Storefront { } } + /// Return type for `customerAccessTokenCreate` mutation. open class CustomerAccessTokenCreatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerAccessTokenCreatePayloadQuery diff --git a/Buy/Generated/Storefront/CustomerAccessTokenDeletePayload.swift b/Buy/Generated/Storefront/CustomerAccessTokenDeletePayload.swift index 327e0d5b..7fd7bb8a 100644 --- a/Buy/Generated/Storefront/CustomerAccessTokenDeletePayload.swift +++ b/Buy/Generated/Storefront/CustomerAccessTokenDeletePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerAccessTokenDelete` mutation. open class CustomerAccessTokenDeletePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerAccessTokenDeletePayload @@ -55,6 +56,7 @@ extension Storefront { } } + /// Return type for `customerAccessTokenDelete` mutation. open class CustomerAccessTokenDeletePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerAccessTokenDeletePayloadQuery diff --git a/Buy/Generated/Storefront/CustomerAccessTokenRenewPayload.swift b/Buy/Generated/Storefront/CustomerAccessTokenRenewPayload.swift index aa484164..36b18629 100644 --- a/Buy/Generated/Storefront/CustomerAccessTokenRenewPayload.swift +++ b/Buy/Generated/Storefront/CustomerAccessTokenRenewPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerAccessTokenRenew` mutation. open class CustomerAccessTokenRenewPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerAccessTokenRenewPayload @@ -51,6 +52,7 @@ extension Storefront { } } + /// Return type for `customerAccessTokenRenew` mutation. open class CustomerAccessTokenRenewPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerAccessTokenRenewPayloadQuery diff --git a/Buy/Generated/Storefront/CustomerActivatePayload.swift b/Buy/Generated/Storefront/CustomerActivatePayload.swift index bc3c46b8..b553b498 100644 --- a/Buy/Generated/Storefront/CustomerActivatePayload.swift +++ b/Buy/Generated/Storefront/CustomerActivatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerActivate` mutation. open class CustomerActivatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerActivatePayload @@ -72,6 +73,7 @@ extension Storefront { } } + /// Return type for `customerActivate` mutation. open class CustomerActivatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerActivatePayloadQuery diff --git a/Buy/Generated/Storefront/CustomerAddressCreatePayload.swift b/Buy/Generated/Storefront/CustomerAddressCreatePayload.swift index 5f564757..b62616a8 100644 --- a/Buy/Generated/Storefront/CustomerAddressCreatePayload.swift +++ b/Buy/Generated/Storefront/CustomerAddressCreatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerAddressCreate` mutation. open class CustomerAddressCreatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerAddressCreatePayload @@ -62,6 +63,7 @@ extension Storefront { } } + /// Return type for `customerAddressCreate` mutation. open class CustomerAddressCreatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerAddressCreatePayloadQuery diff --git a/Buy/Generated/Storefront/CustomerAddressDeletePayload.swift b/Buy/Generated/Storefront/CustomerAddressDeletePayload.swift index 886bf892..048bb3cc 100644 --- a/Buy/Generated/Storefront/CustomerAddressDeletePayload.swift +++ b/Buy/Generated/Storefront/CustomerAddressDeletePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerAddressDelete` mutation. open class CustomerAddressDeletePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerAddressDeletePayload @@ -59,6 +60,7 @@ extension Storefront { } } + /// Return type for `customerAddressDelete` mutation. open class CustomerAddressDeletePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerAddressDeletePayloadQuery diff --git a/Buy/Generated/Storefront/CustomerAddressUpdatePayload.swift b/Buy/Generated/Storefront/CustomerAddressUpdatePayload.swift index 742ab2de..2eafa8b8 100644 --- a/Buy/Generated/Storefront/CustomerAddressUpdatePayload.swift +++ b/Buy/Generated/Storefront/CustomerAddressUpdatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerAddressUpdate` mutation. open class CustomerAddressUpdatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerAddressUpdatePayload @@ -62,6 +63,7 @@ extension Storefront { } } + /// Return type for `customerAddressUpdate` mutation. open class CustomerAddressUpdatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerAddressUpdatePayloadQuery diff --git a/Buy/Generated/Storefront/CustomerCreatePayload.swift b/Buy/Generated/Storefront/CustomerCreatePayload.swift index dc625547..7f1b9bbd 100644 --- a/Buy/Generated/Storefront/CustomerCreatePayload.swift +++ b/Buy/Generated/Storefront/CustomerCreatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerCreate` mutation. open class CustomerCreatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerCreatePayload @@ -62,6 +63,7 @@ extension Storefront { } } + /// Return type for `customerCreate` mutation. open class CustomerCreatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerCreatePayloadQuery diff --git a/Buy/Generated/Storefront/CustomerDefaultAddressUpdatePayload.swift b/Buy/Generated/Storefront/CustomerDefaultAddressUpdatePayload.swift index dd03ba56..a51dd35b 100644 --- a/Buy/Generated/Storefront/CustomerDefaultAddressUpdatePayload.swift +++ b/Buy/Generated/Storefront/CustomerDefaultAddressUpdatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerDefaultAddressUpdate` mutation. open class CustomerDefaultAddressUpdatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerDefaultAddressUpdatePayload @@ -62,6 +63,7 @@ extension Storefront { } } + /// Return type for `customerDefaultAddressUpdate` mutation. open class CustomerDefaultAddressUpdatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerDefaultAddressUpdatePayloadQuery diff --git a/Buy/Generated/Storefront/CustomerRecoverPayload.swift b/Buy/Generated/Storefront/CustomerRecoverPayload.swift index 17f255ff..ab948f5d 100644 --- a/Buy/Generated/Storefront/CustomerRecoverPayload.swift +++ b/Buy/Generated/Storefront/CustomerRecoverPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerRecover` mutation. open class CustomerRecoverPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerRecoverPayload @@ -52,6 +53,7 @@ extension Storefront { } } + /// Return type for `customerRecover` mutation. open class CustomerRecoverPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerRecoverPayloadQuery diff --git a/Buy/Generated/Storefront/CustomerResetByUrlPayload.swift b/Buy/Generated/Storefront/CustomerResetByUrlPayload.swift index ad69493a..b86efb9e 100644 --- a/Buy/Generated/Storefront/CustomerResetByUrlPayload.swift +++ b/Buy/Generated/Storefront/CustomerResetByUrlPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerResetByUrl` mutation. open class CustomerResetByUrlPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerResetByUrlPayload @@ -72,6 +73,7 @@ extension Storefront { } } + /// Return type for `customerResetByUrl` mutation. open class CustomerResetByUrlPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerResetByUrlPayloadQuery diff --git a/Buy/Generated/Storefront/CustomerResetPayload.swift b/Buy/Generated/Storefront/CustomerResetPayload.swift index 6ff35bbb..e2426bfc 100644 --- a/Buy/Generated/Storefront/CustomerResetPayload.swift +++ b/Buy/Generated/Storefront/CustomerResetPayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerReset` mutation. open class CustomerResetPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerResetPayload @@ -72,6 +73,7 @@ extension Storefront { } } + /// Return type for `customerReset` mutation. open class CustomerResetPayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerResetPayloadQuery diff --git a/Buy/Generated/Storefront/CustomerUpdatePayload.swift b/Buy/Generated/Storefront/CustomerUpdatePayload.swift index 13035c43..943afb08 100644 --- a/Buy/Generated/Storefront/CustomerUpdatePayload.swift +++ b/Buy/Generated/Storefront/CustomerUpdatePayload.swift @@ -27,6 +27,7 @@ import Foundation extension Storefront { + /// Return type for `customerUpdate` mutation. open class CustomerUpdatePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { public typealias Response = CustomerUpdatePayload @@ -74,6 +75,7 @@ extension Storefront { } } + /// Return type for `customerUpdate` mutation. open class CustomerUpdatePayload: GraphQL.AbstractResponse, GraphQLObject { public typealias Query = CustomerUpdatePayloadQuery diff --git a/Buy/Generated/Storefront/Mutation.swift b/Buy/Generated/Storefront/Mutation.swift index 50045d66..b22c2e87 100644 --- a/Buy/Generated/Storefront/Mutation.swift +++ b/Buy/Generated/Storefront/Mutation.swift @@ -519,6 +519,7 @@ extension Storefront { /// - lineItems: A list of line item objects to add to the checkout. /// - checkoutId: The ID of the checkout. /// + @available(*, deprecated, message:"Use `checkoutLineItemsReplace` instead") @discardableResult open func checkoutLineItemsAdd(alias: String? = nil, lineItems: [CheckoutLineItemInput], checkoutId: GraphQL.ID, _ subfields: (CheckoutLineItemsAddPayloadQuery) -> Void) -> MutationQuery { var args: [String] = [] @@ -542,6 +543,7 @@ extension Storefront { /// - checkoutId: the checkout on which to remove line items /// - lineItemIds: line item ids to remove /// + @available(*, deprecated, message:"Use `checkoutLineItemsReplace` instead") @discardableResult open func checkoutLineItemsRemove(alias: String? = nil, checkoutId: GraphQL.ID, lineItemIds: [GraphQL.ID], _ subfields: (CheckoutLineItemsRemovePayloadQuery) -> Void) -> MutationQuery { var args: [String] = [] @@ -559,12 +561,36 @@ extension Storefront { return self } + /// Sets a list of line items to a checkout. + /// + /// - parameters: + /// - lineItems: A list of line item objects to set on the checkout. + /// - checkoutId: The ID of the checkout. + /// + @discardableResult + open func checkoutLineItemsReplace(alias: String? = nil, lineItems: [CheckoutLineItemInput], checkoutId: GraphQL.ID, _ subfields: (CheckoutLineItemsReplacePayloadQuery) -> Void) -> MutationQuery { + var args: [String] = [] + + args.append("lineItems:[\(lineItems.map{ "\($0.serialize())" }.joined(separator: ","))]") + + args.append("checkoutId:\(GraphQL.quoteString(input: "\(checkoutId.rawValue)"))") + + let argsString = "(\(args.joined(separator: ",")))" + + let subquery = CheckoutLineItemsReplacePayloadQuery() + subfields(subquery) + + addField(field: "checkoutLineItemsReplace", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + /// Updates line items on a checkout. /// /// - parameters: /// - checkoutId: the checkout on which to update line items. /// - lineItems: line items to update. /// + @available(*, deprecated, message:"Use `checkoutLineItemsReplace` instead") @discardableResult open func checkoutLineItemsUpdate(alias: String? = nil, checkoutId: GraphQL.ID, lineItems: [CheckoutLineItemUpdateInput], _ subfields: (CheckoutLineItemsUpdatePayloadQuery) -> Void) -> MutationQuery { var args: [String] = [] @@ -1114,6 +1140,13 @@ extension Storefront { } return try CheckoutLineItemsRemovePayload(fields: value) + case "checkoutLineItemsReplace": + if value is NSNull { return nil } + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: Mutation.self, field: fieldName, value: fieldValue) + } + return try CheckoutLineItemsReplacePayload(fields: value) + case "checkoutLineItemsUpdate": if value is NSNull { return nil } guard let value = value as? [String: Any] else { @@ -1539,10 +1572,13 @@ extension Storefront { } /// Adds a list of line items to a checkout. + @available(*, deprecated, message:"Use `checkoutLineItemsReplace` instead") open var checkoutLineItemsAdd: Storefront.CheckoutLineItemsAddPayload? { return internalGetCheckoutLineItemsAdd() } + @available(*, deprecated, message:"Use `checkoutLineItemsReplace` instead") + open func aliasedCheckoutLineItemsAdd(alias: String) -> Storefront.CheckoutLineItemsAddPayload? { return internalGetCheckoutLineItemsAdd(alias: alias) } @@ -1552,10 +1588,13 @@ extension Storefront { } /// Removes line items from an existing checkout + @available(*, deprecated, message:"Use `checkoutLineItemsReplace` instead") open var checkoutLineItemsRemove: Storefront.CheckoutLineItemsRemovePayload? { return internalGetCheckoutLineItemsRemove() } + @available(*, deprecated, message:"Use `checkoutLineItemsReplace` instead") + open func aliasedCheckoutLineItemsRemove(alias: String) -> Storefront.CheckoutLineItemsRemovePayload? { return internalGetCheckoutLineItemsRemove(alias: alias) } @@ -1564,11 +1603,27 @@ extension Storefront { return field(field: "checkoutLineItemsRemove", aliasSuffix: alias) as! Storefront.CheckoutLineItemsRemovePayload? } + /// Sets a list of line items to a checkout. + open var checkoutLineItemsReplace: Storefront.CheckoutLineItemsReplacePayload? { + return internalGetCheckoutLineItemsReplace() + } + + open func aliasedCheckoutLineItemsReplace(alias: String) -> Storefront.CheckoutLineItemsReplacePayload? { + return internalGetCheckoutLineItemsReplace(alias: alias) + } + + func internalGetCheckoutLineItemsReplace(alias: String? = nil) -> Storefront.CheckoutLineItemsReplacePayload? { + return field(field: "checkoutLineItemsReplace", aliasSuffix: alias) as! Storefront.CheckoutLineItemsReplacePayload? + } + /// Updates line items on a checkout. + @available(*, deprecated, message:"Use `checkoutLineItemsReplace` instead") open var checkoutLineItemsUpdate: Storefront.CheckoutLineItemsUpdatePayload? { return internalGetCheckoutLineItemsUpdate() } + @available(*, deprecated, message:"Use `checkoutLineItemsReplace` instead") + open func aliasedCheckoutLineItemsUpdate(alias: String) -> Storefront.CheckoutLineItemsUpdatePayload? { return internalGetCheckoutLineItemsUpdate(alias: alias) } @@ -1935,6 +1990,12 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "checkoutLineItemsReplace": + if let value = internalGetCheckoutLineItemsReplace() { + response.append(value) + response.append(contentsOf: value.childResponseObjectMap()) + } + case "checkoutLineItemsUpdate": if let value = internalGetCheckoutLineItemsUpdate() { response.append(value) diff --git a/Buy/Generated/Storefront/Node.swift b/Buy/Generated/Storefront/Node.swift index 4cefe523..7a24af1d 100644 --- a/Buy/Generated/Storefront/Node.swift +++ b/Buy/Generated/Storefront/Node.swift @@ -129,6 +129,15 @@ extension Storefront { return self } + /// An object with an ID to support global identification. + @discardableResult + open func onPage(subfields: (PageQuery) -> Void) -> NodeQuery { + let subquery = PageQuery() + subfields(subquery) + addInlineFragment(on: "Page", subfields: subquery) + return self + } + /// An object with an ID to support global identification. @discardableResult open func onPayment(subfields: (PaymentQuery) -> Void) -> NodeQuery { @@ -216,6 +225,8 @@ extension Storefront { case "Order": return try Order.init(fields: fields) + case "Page": return try Page.init(fields: fields) + case "Payment": return try Payment.init(fields: fields) case "Product": return try Product.init(fields: fields) diff --git a/Buy/Generated/Storefront/Page.swift b/Buy/Generated/Storefront/Page.swift new file mode 100644 index 00000000..a01ba47f --- /dev/null +++ b/Buy/Generated/Storefront/Page.swift @@ -0,0 +1,231 @@ +// +// Page.swift +// Buy +// +// Created by Shopify. +// Copyright (c) 2017 Shopify Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Storefront { + /// Shopify merchants can create pages to hold static HTML content. Each Page + /// object represents a custom page on the online store. + open class PageQuery: GraphQL.AbstractQuery, GraphQLQuery { + public typealias Response = Page + + /// The description of the page, complete with HTML formatting. + @discardableResult + open func body(alias: String? = nil) -> PageQuery { + addField(field: "body", aliasSuffix: alias) + return self + } + + /// Summary of the page body. + @discardableResult + open func bodySummary(alias: String? = nil) -> PageQuery { + addField(field: "bodySummary", aliasSuffix: alias) + return self + } + + /// The timestamp of the page creation. + @discardableResult + open func createdAt(alias: String? = nil) -> PageQuery { + addField(field: "createdAt", aliasSuffix: alias) + return self + } + + /// A human-friendly unique string for the page automatically generated from + /// its title. + @discardableResult + open func handle(alias: String? = nil) -> PageQuery { + addField(field: "handle", aliasSuffix: alias) + return self + } + + /// Globally unique identifier. + @discardableResult + open func id(alias: String? = nil) -> PageQuery { + addField(field: "id", aliasSuffix: alias) + return self + } + + /// The title of the page. + @discardableResult + open func title(alias: String? = nil) -> PageQuery { + addField(field: "title", aliasSuffix: alias) + return self + } + + /// The timestamp of the latest page update. + @discardableResult + open func updatedAt(alias: String? = nil) -> PageQuery { + addField(field: "updatedAt", aliasSuffix: alias) + return self + } + + /// The url pointing to the page accessible from the web. + @discardableResult + open func url(alias: String? = nil) -> PageQuery { + addField(field: "url", aliasSuffix: alias) + return self + } + } + + /// Shopify merchants can create pages to hold static HTML content. Each Page + /// object represents a custom page on the online store. + open class Page: GraphQL.AbstractResponse, GraphQLObject, Node { + public typealias Query = PageQuery + + internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? { + let fieldValue = value + switch fieldName { + case "body": + guard let value = value as? String else { + throw SchemaViolationError(type: Page.self, field: fieldName, value: fieldValue) + } + return value + + case "bodySummary": + guard let value = value as? String else { + throw SchemaViolationError(type: Page.self, field: fieldName, value: fieldValue) + } + return value + + case "createdAt": + guard let value = value as? String else { + throw SchemaViolationError(type: Page.self, field: fieldName, value: fieldValue) + } + return GraphQL.iso8601DateParser.date(from: value)! + + case "handle": + guard let value = value as? String else { + throw SchemaViolationError(type: Page.self, field: fieldName, value: fieldValue) + } + return value + + case "id": + guard let value = value as? String else { + throw SchemaViolationError(type: Page.self, field: fieldName, value: fieldValue) + } + return GraphQL.ID(rawValue: value) + + case "title": + guard let value = value as? String else { + throw SchemaViolationError(type: Page.self, field: fieldName, value: fieldValue) + } + return value + + case "updatedAt": + guard let value = value as? String else { + throw SchemaViolationError(type: Page.self, field: fieldName, value: fieldValue) + } + return GraphQL.iso8601DateParser.date(from: value)! + + case "url": + guard let value = value as? String else { + throw SchemaViolationError(type: Page.self, field: fieldName, value: fieldValue) + } + return URL(string: value)! + + default: + throw SchemaViolationError(type: Page.self, field: fieldName, value: fieldValue) + } + } + + /// The description of the page, complete with HTML formatting. + open var body: String { + return internalGetBody() + } + + func internalGetBody(alias: String? = nil) -> String { + return field(field: "body", aliasSuffix: alias) as! String + } + + /// Summary of the page body. + open var bodySummary: String { + return internalGetBodySummary() + } + + func internalGetBodySummary(alias: String? = nil) -> String { + return field(field: "bodySummary", aliasSuffix: alias) as! String + } + + /// The timestamp of the page creation. + open var createdAt: Date { + return internalGetCreatedAt() + } + + func internalGetCreatedAt(alias: String? = nil) -> Date { + return field(field: "createdAt", aliasSuffix: alias) as! Date + } + + /// A human-friendly unique string for the page automatically generated from + /// its title. + open var handle: String { + return internalGetHandle() + } + + func internalGetHandle(alias: String? = nil) -> String { + return field(field: "handle", aliasSuffix: alias) as! String + } + + /// Globally unique identifier. + open var id: GraphQL.ID { + return internalGetId() + } + + func internalGetId(alias: String? = nil) -> GraphQL.ID { + return field(field: "id", aliasSuffix: alias) as! GraphQL.ID + } + + /// The title of the page. + open var title: String { + return internalGetTitle() + } + + func internalGetTitle(alias: String? = nil) -> String { + return field(field: "title", aliasSuffix: alias) as! String + } + + /// The timestamp of the latest page update. + open var updatedAt: Date { + return internalGetUpdatedAt() + } + + func internalGetUpdatedAt(alias: String? = nil) -> Date { + return field(field: "updatedAt", aliasSuffix: alias) as! Date + } + + /// The url pointing to the page accessible from the web. + open var url: URL { + return internalGetUrl() + } + + func internalGetUrl(alias: String? = nil) -> URL { + return field(field: "url", aliasSuffix: alias) as! URL + } + + internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] { + return [] + } + } +} diff --git a/Buy/Generated/Storefront/PageConnection.swift b/Buy/Generated/Storefront/PageConnection.swift new file mode 100644 index 00000000..09f20d74 --- /dev/null +++ b/Buy/Generated/Storefront/PageConnection.swift @@ -0,0 +1,116 @@ +// +// PageConnection.swift +// Buy +// +// Created by Shopify. +// Copyright (c) 2017 Shopify Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Storefront { + open class PageConnectionQuery: GraphQL.AbstractQuery, GraphQLQuery { + public typealias Response = PageConnection + + /// A list of edges. + @discardableResult + open func edges(alias: String? = nil, _ subfields: (PageEdgeQuery) -> Void) -> PageConnectionQuery { + let subquery = PageEdgeQuery() + subfields(subquery) + + addField(field: "edges", aliasSuffix: alias, subfields: subquery) + return self + } + + /// Information to aid in pagination. + @discardableResult + open func pageInfo(alias: String? = nil, _ subfields: (PageInfoQuery) -> Void) -> PageConnectionQuery { + let subquery = PageInfoQuery() + subfields(subquery) + + addField(field: "pageInfo", aliasSuffix: alias, subfields: subquery) + return self + } + } + + open class PageConnection: GraphQL.AbstractResponse, GraphQLObject { + public typealias Query = PageConnectionQuery + + internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? { + let fieldValue = value + switch fieldName { + case "edges": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: PageConnection.self, field: fieldName, value: fieldValue) + } + return try value.map { return try PageEdge(fields: $0) } + + case "pageInfo": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: PageConnection.self, field: fieldName, value: fieldValue) + } + return try PageInfo(fields: value) + + default: + throw SchemaViolationError(type: PageConnection.self, field: fieldName, value: fieldValue) + } + } + + /// A list of edges. + open var edges: [Storefront.PageEdge] { + return internalGetEdges() + } + + func internalGetEdges(alias: String? = nil) -> [Storefront.PageEdge] { + return field(field: "edges", aliasSuffix: alias) as! [Storefront.PageEdge] + } + + /// Information to aid in pagination. + open var pageInfo: Storefront.PageInfo { + return internalGetPageInfo() + } + + func internalGetPageInfo(alias: String? = nil) -> Storefront.PageInfo { + return field(field: "pageInfo", aliasSuffix: alias) as! Storefront.PageInfo + } + + internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] { + var response: [GraphQL.AbstractResponse] = [] + objectMap.keys.forEach { + switch($0) { + case "edges": + internalGetEdges().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + + case "pageInfo": + response.append(internalGetPageInfo()) + response.append(contentsOf: internalGetPageInfo().childResponseObjectMap()) + + default: + break + } + } + return response + } + } +} diff --git a/Buy/Generated/Storefront/PageEdge.swift b/Buy/Generated/Storefront/PageEdge.swift new file mode 100644 index 00000000..7b743179 --- /dev/null +++ b/Buy/Generated/Storefront/PageEdge.swift @@ -0,0 +1,107 @@ +// +// PageEdge.swift +// Buy +// +// Created by Shopify. +// Copyright (c) 2017 Shopify Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Storefront { + open class PageEdgeQuery: GraphQL.AbstractQuery, GraphQLQuery { + public typealias Response = PageEdge + + /// A cursor for use in pagination. + @discardableResult + open func cursor(alias: String? = nil) -> PageEdgeQuery { + addField(field: "cursor", aliasSuffix: alias) + return self + } + + /// The item at the end of PageEdge. + @discardableResult + open func node(alias: String? = nil, _ subfields: (PageQuery) -> Void) -> PageEdgeQuery { + let subquery = PageQuery() + subfields(subquery) + + addField(field: "node", aliasSuffix: alias, subfields: subquery) + return self + } + } + + open class PageEdge: GraphQL.AbstractResponse, GraphQLObject { + public typealias Query = PageEdgeQuery + + internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? { + let fieldValue = value + switch fieldName { + case "cursor": + guard let value = value as? String else { + throw SchemaViolationError(type: PageEdge.self, field: fieldName, value: fieldValue) + } + return value + + case "node": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: PageEdge.self, field: fieldName, value: fieldValue) + } + return try Page(fields: value) + + default: + throw SchemaViolationError(type: PageEdge.self, field: fieldName, value: fieldValue) + } + } + + /// A cursor for use in pagination. + open var cursor: String { + return internalGetCursor() + } + + func internalGetCursor(alias: String? = nil) -> String { + return field(field: "cursor", aliasSuffix: alias) as! String + } + + /// The item at the end of PageEdge. + open var node: Storefront.Page { + return internalGetNode() + } + + func internalGetNode(alias: String? = nil) -> Storefront.Page { + return field(field: "node", aliasSuffix: alias) as! Storefront.Page + } + + internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] { + var response: [GraphQL.AbstractResponse] = [] + objectMap.keys.forEach { + switch($0) { + case "node": + response.append(internalGetNode()) + response.append(contentsOf: internalGetNode().childResponseObjectMap()) + + default: + break + } + } + return response + } + } +} diff --git a/Buy/Generated/Storefront/PageSortKeys.swift b/Buy/Generated/Storefront/PageSortKeys.swift new file mode 100644 index 00000000..495e02b2 --- /dev/null +++ b/Buy/Generated/Storefront/PageSortKeys.swift @@ -0,0 +1,49 @@ +// +// PageSortKeys.swift +// Buy +// +// Created by Shopify. +// Copyright (c) 2017 Shopify Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Storefront { + /// The set of valid sort keys for the pages query. + public enum PageSortKeys: String { + /// Sort by the `id` value. + case id = "ID" + + /// During a search (i.e. when the `query` parameter has been specified on the + /// connection) this sorts the results by relevance to the search term(s). When + /// no search query is specified, this sort key is not deterministic and should + /// not be used. + case relevance = "RELEVANCE" + + /// Sort by the `title` value. + case title = "TITLE" + + /// Sort by the `updated_at` value. + case updatedAt = "UPDATED_AT" + + case unknownValue = "" + } +} diff --git a/Buy/Generated/Storefront/ProductVariant.swift b/Buy/Generated/Storefront/ProductVariant.swift index b92ff224..e63904d8 100644 --- a/Buy/Generated/Storefront/ProductVariant.swift +++ b/Buy/Generated/Storefront/ProductVariant.swift @@ -100,6 +100,54 @@ extension Storefront { return self } + /// List of prices and compare-at prices in the presentment currencies for this + /// shop. + /// + /// - parameters: + /// - presentmentCurrencies: The presentment currencies prices should return in. + /// - first: Returns up to the first `n` elements from the list. + /// - after: Returns the elements that come after the specified cursor. + /// - last: Returns up to the last `n` elements from the list. + /// - before: Returns the elements that come before the specified cursor. + /// - reverse: Reverse the order of the underlying list. + /// + @discardableResult + open func presentmentPrices(alias: String? = nil, presentmentCurrencies: [CurrencyCode]? = nil, first: Int32? = nil, after: String? = nil, last: Int32? = nil, before: String? = nil, reverse: Bool? = nil, _ subfields: (ProductVariantPricePairConnectionQuery) -> Void) -> ProductVariantQuery { + var args: [String] = [] + + if let presentmentCurrencies = presentmentCurrencies { + args.append("presentmentCurrencies:[\(presentmentCurrencies.map{ "\($0.rawValue)" }.joined(separator: ","))]") + } + + if let first = first { + args.append("first:\(first)") + } + + if let after = after { + args.append("after:\(GraphQL.quoteString(input: after))") + } + + if let last = last { + args.append("last:\(last)") + } + + if let before = before { + args.append("before:\(GraphQL.quoteString(input: before))") + } + + if let reverse = reverse { + args.append("reverse:\(reverse)") + } + + let argsString: String? = args.isEmpty ? nil : "(\(args.joined(separator: ",")))" + + let subquery = ProductVariantPricePairConnectionQuery() + subfields(subquery) + + addField(field: "presentmentPrices", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + /// The product variant’s price. @discardableResult open func price(alias: String? = nil) -> ProductVariantQuery { @@ -198,6 +246,12 @@ extension Storefront { } return try Image(fields: value) + case "presentmentPrices": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: ProductVariant.self, field: fieldName, value: fieldValue) + } + return try ProductVariantPricePairConnection(fields: value) + case "price": guard let value = value as? String else { throw SchemaViolationError(type: ProductVariant.self, field: fieldName, value: fieldValue) @@ -299,6 +353,20 @@ extension Storefront { return field(field: "image", aliasSuffix: alias) as! Storefront.Image? } + /// List of prices and compare-at prices in the presentment currencies for this + /// shop. + open var presentmentPrices: Storefront.ProductVariantPricePairConnection { + return internalGetPresentmentPrices() + } + + open func aliasedPresentmentPrices(alias: String) -> Storefront.ProductVariantPricePairConnection { + return internalGetPresentmentPrices(alias: alias) + } + + func internalGetPresentmentPrices(alias: String? = nil) -> Storefront.ProductVariantPricePairConnection { + return field(field: "presentmentPrices", aliasSuffix: alias) as! Storefront.ProductVariantPricePairConnection + } + /// The product variant’s price. open var price: Decimal { return internalGetPrice() @@ -373,6 +441,10 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "presentmentPrices": + response.append(internalGetPresentmentPrices()) + response.append(contentsOf: internalGetPresentmentPrices().childResponseObjectMap()) + case "product": response.append(internalGetProduct()) response.append(contentsOf: internalGetProduct().childResponseObjectMap()) diff --git a/Buy/Generated/Storefront/ProductVariantPricePair.swift b/Buy/Generated/Storefront/ProductVariantPricePair.swift new file mode 100644 index 00000000..8a769e4f --- /dev/null +++ b/Buy/Generated/Storefront/ProductVariantPricePair.swift @@ -0,0 +1,119 @@ +// +// ProductVariantPricePair.swift +// Buy +// +// Created by Shopify. +// Copyright (c) 2017 Shopify Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Storefront { + /// The compare-at price and price of a variant sharing a currency. + open class ProductVariantPricePairQuery: GraphQL.AbstractQuery, GraphQLQuery { + public typealias Response = ProductVariantPricePair + + /// The compare-at price of the variant with associated currency. + @discardableResult + open func compareAtPrice(alias: String? = nil, _ subfields: (MoneyV2Query) -> Void) -> ProductVariantPricePairQuery { + let subquery = MoneyV2Query() + subfields(subquery) + + addField(field: "compareAtPrice", aliasSuffix: alias, subfields: subquery) + return self + } + + /// The price of the variant with associated currency. + @discardableResult + open func price(alias: String? = nil, _ subfields: (MoneyV2Query) -> Void) -> ProductVariantPricePairQuery { + let subquery = MoneyV2Query() + subfields(subquery) + + addField(field: "price", aliasSuffix: alias, subfields: subquery) + return self + } + } + + /// The compare-at price and price of a variant sharing a currency. + open class ProductVariantPricePair: GraphQL.AbstractResponse, GraphQLObject { + public typealias Query = ProductVariantPricePairQuery + + internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? { + let fieldValue = value + switch fieldName { + case "compareAtPrice": + if value is NSNull { return nil } + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: ProductVariantPricePair.self, field: fieldName, value: fieldValue) + } + return try MoneyV2(fields: value) + + case "price": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: ProductVariantPricePair.self, field: fieldName, value: fieldValue) + } + return try MoneyV2(fields: value) + + default: + throw SchemaViolationError(type: ProductVariantPricePair.self, field: fieldName, value: fieldValue) + } + } + + /// The compare-at price of the variant with associated currency. + open var compareAtPrice: Storefront.MoneyV2? { + return internalGetCompareAtPrice() + } + + func internalGetCompareAtPrice(alias: String? = nil) -> Storefront.MoneyV2? { + return field(field: "compareAtPrice", aliasSuffix: alias) as! Storefront.MoneyV2? + } + + /// The price of the variant with associated currency. + open var price: Storefront.MoneyV2 { + return internalGetPrice() + } + + func internalGetPrice(alias: String? = nil) -> Storefront.MoneyV2 { + return field(field: "price", aliasSuffix: alias) as! Storefront.MoneyV2 + } + + internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] { + var response: [GraphQL.AbstractResponse] = [] + objectMap.keys.forEach { + switch($0) { + case "compareAtPrice": + if let value = internalGetCompareAtPrice() { + response.append(value) + response.append(contentsOf: value.childResponseObjectMap()) + } + + case "price": + response.append(internalGetPrice()) + response.append(contentsOf: internalGetPrice().childResponseObjectMap()) + + default: + break + } + } + return response + } + } +} diff --git a/Buy/Generated/Storefront/ProductVariantPricePairConnection.swift b/Buy/Generated/Storefront/ProductVariantPricePairConnection.swift new file mode 100644 index 00000000..3de0a42a --- /dev/null +++ b/Buy/Generated/Storefront/ProductVariantPricePairConnection.swift @@ -0,0 +1,116 @@ +// +// ProductVariantPricePairConnection.swift +// Buy +// +// Created by Shopify. +// Copyright (c) 2017 Shopify Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Storefront { + open class ProductVariantPricePairConnectionQuery: GraphQL.AbstractQuery, GraphQLQuery { + public typealias Response = ProductVariantPricePairConnection + + /// A list of edges. + @discardableResult + open func edges(alias: String? = nil, _ subfields: (ProductVariantPricePairEdgeQuery) -> Void) -> ProductVariantPricePairConnectionQuery { + let subquery = ProductVariantPricePairEdgeQuery() + subfields(subquery) + + addField(field: "edges", aliasSuffix: alias, subfields: subquery) + return self + } + + /// Information to aid in pagination. + @discardableResult + open func pageInfo(alias: String? = nil, _ subfields: (PageInfoQuery) -> Void) -> ProductVariantPricePairConnectionQuery { + let subquery = PageInfoQuery() + subfields(subquery) + + addField(field: "pageInfo", aliasSuffix: alias, subfields: subquery) + return self + } + } + + open class ProductVariantPricePairConnection: GraphQL.AbstractResponse, GraphQLObject { + public typealias Query = ProductVariantPricePairConnectionQuery + + internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? { + let fieldValue = value + switch fieldName { + case "edges": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: ProductVariantPricePairConnection.self, field: fieldName, value: fieldValue) + } + return try value.map { return try ProductVariantPricePairEdge(fields: $0) } + + case "pageInfo": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: ProductVariantPricePairConnection.self, field: fieldName, value: fieldValue) + } + return try PageInfo(fields: value) + + default: + throw SchemaViolationError(type: ProductVariantPricePairConnection.self, field: fieldName, value: fieldValue) + } + } + + /// A list of edges. + open var edges: [Storefront.ProductVariantPricePairEdge] { + return internalGetEdges() + } + + func internalGetEdges(alias: String? = nil) -> [Storefront.ProductVariantPricePairEdge] { + return field(field: "edges", aliasSuffix: alias) as! [Storefront.ProductVariantPricePairEdge] + } + + /// Information to aid in pagination. + open var pageInfo: Storefront.PageInfo { + return internalGetPageInfo() + } + + func internalGetPageInfo(alias: String? = nil) -> Storefront.PageInfo { + return field(field: "pageInfo", aliasSuffix: alias) as! Storefront.PageInfo + } + + internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] { + var response: [GraphQL.AbstractResponse] = [] + objectMap.keys.forEach { + switch($0) { + case "edges": + internalGetEdges().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + + case "pageInfo": + response.append(internalGetPageInfo()) + response.append(contentsOf: internalGetPageInfo().childResponseObjectMap()) + + default: + break + } + } + return response + } + } +} diff --git a/Buy/Generated/Storefront/ProductVariantPricePairEdge.swift b/Buy/Generated/Storefront/ProductVariantPricePairEdge.swift new file mode 100644 index 00000000..fbafefa0 --- /dev/null +++ b/Buy/Generated/Storefront/ProductVariantPricePairEdge.swift @@ -0,0 +1,107 @@ +// +// ProductVariantPricePairEdge.swift +// Buy +// +// Created by Shopify. +// Copyright (c) 2017 Shopify Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Storefront { + open class ProductVariantPricePairEdgeQuery: GraphQL.AbstractQuery, GraphQLQuery { + public typealias Response = ProductVariantPricePairEdge + + /// A cursor for use in pagination. + @discardableResult + open func cursor(alias: String? = nil) -> ProductVariantPricePairEdgeQuery { + addField(field: "cursor", aliasSuffix: alias) + return self + } + + /// The item at the end of ProductVariantPricePairEdge. + @discardableResult + open func node(alias: String? = nil, _ subfields: (ProductVariantPricePairQuery) -> Void) -> ProductVariantPricePairEdgeQuery { + let subquery = ProductVariantPricePairQuery() + subfields(subquery) + + addField(field: "node", aliasSuffix: alias, subfields: subquery) + return self + } + } + + open class ProductVariantPricePairEdge: GraphQL.AbstractResponse, GraphQLObject { + public typealias Query = ProductVariantPricePairEdgeQuery + + internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? { + let fieldValue = value + switch fieldName { + case "cursor": + guard let value = value as? String else { + throw SchemaViolationError(type: ProductVariantPricePairEdge.self, field: fieldName, value: fieldValue) + } + return value + + case "node": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: ProductVariantPricePairEdge.self, field: fieldName, value: fieldValue) + } + return try ProductVariantPricePair(fields: value) + + default: + throw SchemaViolationError(type: ProductVariantPricePairEdge.self, field: fieldName, value: fieldValue) + } + } + + /// A cursor for use in pagination. + open var cursor: String { + return internalGetCursor() + } + + func internalGetCursor(alias: String? = nil) -> String { + return field(field: "cursor", aliasSuffix: alias) as! String + } + + /// The item at the end of ProductVariantPricePairEdge. + open var node: Storefront.ProductVariantPricePair { + return internalGetNode() + } + + func internalGetNode(alias: String? = nil) -> Storefront.ProductVariantPricePair { + return field(field: "node", aliasSuffix: alias) as! Storefront.ProductVariantPricePair + } + + internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] { + var response: [GraphQL.AbstractResponse] = [] + objectMap.keys.forEach { + switch($0) { + case "node": + response.append(internalGetNode()) + response.append(contentsOf: internalGetNode().childResponseObjectMap()) + + default: + break + } + } + return response + } + } +} diff --git a/Buy/Generated/Storefront/QueryRoot.swift b/Buy/Generated/Storefront/QueryRoot.swift index e075c51e..06236d71 100644 --- a/Buy/Generated/Storefront/QueryRoot.swift +++ b/Buy/Generated/Storefront/QueryRoot.swift @@ -43,10 +43,10 @@ extension Storefront { /// - sortKey: Sort the underlying list by the given key. /// - query: Supported filter parameters: /// - `author` - /// - `updated_at` - /// - `created_at` /// - `blog_title` + /// - `created_at` /// - `tag` + /// - `updated_at` /// /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). /// @@ -121,10 +121,10 @@ extension Storefront { /// - reverse: Reverse the order of the underlying list. /// - sortKey: Sort the underlying list by the given key. /// - query: Supported filter parameters: + /// - `created_at` /// - `handle` /// - `title` /// - `updated_at` - /// - `created_at` /// /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). /// @@ -226,6 +226,84 @@ extension Storefront { return self } + /// Find a page by its handle. + /// + /// - parameters: + /// - handle: The handle of the page. + /// + @discardableResult + open func pageByHandle(alias: String? = nil, handle: String, _ subfields: (PageQuery) -> Void) -> QueryRootQuery { + var args: [String] = [] + + args.append("handle:\(GraphQL.quoteString(input: handle))") + + let argsString = "(\(args.joined(separator: ",")))" + + let subquery = PageQuery() + subfields(subquery) + + addField(field: "pageByHandle", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + + /// List of the shop's pages. + /// + /// - parameters: + /// - first: Returns up to the first `n` elements from the list. + /// - after: Returns the elements that come after the specified cursor. + /// - last: Returns up to the last `n` elements from the list. + /// - before: Returns the elements that come before the specified cursor. + /// - reverse: Reverse the order of the underlying list. + /// - sortKey: Sort the underlying list by the given key. + /// - query: Supported filter parameters: + /// - `created_at` + /// - `handle` + /// - `title` + /// - `updated_at` + /// + /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). + /// + @discardableResult + open func pages(alias: String? = nil, first: Int32? = nil, after: String? = nil, last: Int32? = nil, before: String? = nil, reverse: Bool? = nil, sortKey: PageSortKeys? = nil, query: String? = nil, _ subfields: (PageConnectionQuery) -> Void) -> QueryRootQuery { + var args: [String] = [] + + if let first = first { + args.append("first:\(first)") + } + + if let after = after { + args.append("after:\(GraphQL.quoteString(input: after))") + } + + if let last = last { + args.append("last:\(last)") + } + + if let before = before { + args.append("before:\(GraphQL.quoteString(input: before))") + } + + if let reverse = reverse { + args.append("reverse:\(reverse)") + } + + if let sortKey = sortKey { + args.append("sortKey:\(sortKey.rawValue)") + } + + if let query = query { + args.append("query:\(GraphQL.quoteString(input: query))") + } + + let argsString: String? = args.isEmpty ? nil : "(\(args.joined(separator: ",")))" + + let subquery = PageConnectionQuery() + subfields(subquery) + + addField(field: "pages", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + @discardableResult open func shop(alias: String? = nil, _ subfields: (ShopQuery) -> Void) -> QueryRootQuery { let subquery = ShopQuery() @@ -287,6 +365,19 @@ extension Storefront { } return try UnknownNode.create(fields: value) } as [Any?] + case "pageByHandle": + if value is NSNull { return nil } + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) + } + return try Page(fields: value) + + case "pages": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) + } + return try PageConnection(fields: value) + case "shop": guard let value = value as? [String: Any] else { throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) @@ -373,6 +464,32 @@ extension Storefront { return field(field: "nodes", aliasSuffix: alias) as! [Node?] } + /// Find a page by its handle. + open var pageByHandle: Storefront.Page? { + return internalGetPageByHandle() + } + + open func aliasedPageByHandle(alias: String) -> Storefront.Page? { + return internalGetPageByHandle(alias: alias) + } + + func internalGetPageByHandle(alias: String? = nil) -> Storefront.Page? { + return field(field: "pageByHandle", aliasSuffix: alias) as! Storefront.Page? + } + + /// List of the shop's pages. + open var pages: Storefront.PageConnection { + return internalGetPages() + } + + open func aliasedPages(alias: String) -> Storefront.PageConnection { + return internalGetPages(alias: alias) + } + + func internalGetPages(alias: String? = nil) -> Storefront.PageConnection { + return field(field: "pages", aliasSuffix: alias) as! Storefront.PageConnection + } + open var shop: Storefront.Shop { return internalGetShop() } @@ -419,6 +536,16 @@ extension Storefront { } } + case "pageByHandle": + if let value = internalGetPageByHandle() { + response.append(value) + response.append(contentsOf: value.childResponseObjectMap()) + } + + case "pages": + response.append(internalGetPages()) + response.append(contentsOf: internalGetPages().childResponseObjectMap()) + case "shop": response.append(internalGetShop()) response.append(contentsOf: internalGetShop().childResponseObjectMap()) diff --git a/Buy/Generated/Storefront/Shop.swift b/Buy/Generated/Storefront/Shop.swift index a5a58d5e..6c8ad892 100644 --- a/Buy/Generated/Storefront/Shop.swift +++ b/Buy/Generated/Storefront/Shop.swift @@ -43,10 +43,10 @@ extension Storefront { /// - sortKey: Sort the underlying list by the given key. /// - query: Supported filter parameters: /// - `author` - /// - `updated_at` - /// - `created_at` /// - `blog_title` + /// - `created_at` /// - `tag` + /// - `updated_at` /// /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). /// @@ -102,10 +102,10 @@ extension Storefront { /// - reverse: Reverse the order of the underlying list. /// - sortKey: Sort the underlying list by the given key. /// - query: Supported filter parameters: + /// - `created_at` /// - `handle` /// - `title` /// - `updated_at` - /// - `created_at` /// /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). /// @@ -151,14 +151,6 @@ extension Storefront { return self } - /// The url pointing to the endpoint to vault credit cards. - @available(*, deprecated, message:"Use `paymentSettings` instead") - @discardableResult - open func cardVaultUrl(alias: String? = nil) -> ShopQuery { - addField(field: "cardVaultUrl", aliasSuffix: alias) - return self - } - /// Find a collection by its handle. /// /// - parameters: @@ -189,8 +181,8 @@ extension Storefront { /// - reverse: Reverse the order of the underlying list. /// - sortKey: Sort the underlying list by the given key. /// - query: Supported filter parameters: - /// - `title` /// - `collection_type` + /// - `title` /// - `updated_at` /// /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). @@ -367,13 +359,13 @@ extension Storefront { /// - reverse: Reverse the order of the underlying list. /// - sortKey: Sort the underlying list by the given key. /// - query: Supported filter parameters: - /// - `title` - /// - `product_type` - /// - `vendor` /// - `created_at` + /// - `product_type` + /// - `tag` + /// - `title` /// - `updated_at` /// - `variants.price` - /// - `tag` + /// - `vendor` /// /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). /// @@ -474,12 +466,6 @@ extension Storefront { } return try BlogConnection(fields: value) - case "cardVaultUrl": - guard let value = value as? String else { - throw SchemaViolationError(type: Shop.self, field: fieldName, value: fieldValue) - } - return URL(string: value)! - case "collectionByHandle": if value is NSNull { return nil } guard let value = value as? [String: Any] else { @@ -626,16 +612,6 @@ extension Storefront { return field(field: "blogs", aliasSuffix: alias) as! Storefront.BlogConnection } - /// The url pointing to the endpoint to vault credit cards. - @available(*, deprecated, message:"Use `paymentSettings` instead") - open var cardVaultUrl: URL { - return internalGetCardVaultUrl() - } - - func internalGetCardVaultUrl(alias: String? = nil) -> URL { - return field(field: "cardVaultUrl", aliasSuffix: alias) as! URL - } - /// Find a collection by its handle. open var collectionByHandle: Storefront.Collection? { return internalGetCollectionByHandle() From 83306cab92b34e5ad6ebcbd66d28bbf54a40e157 Mon Sep 17 00:00:00 2001 From: Dima Bart Date: Fri, 21 Dec 2018 10:34:33 -0500 Subject: [PATCH 3/5] Update schema. - Add support for automatic discounts applications. - Add updated `checkoutUserError` fields, deprecates `userError` field. --- Buy.xcodeproj/project.pbxproj | 8 + .../AutomaticDiscountApplication.swift | 168 +++++++++ .../CheckoutAttributesUpdateV2Payload.swift | 33 ++ .../CheckoutCompleteFreePayload.swift | 33 ++ ...ckoutCompleteWithCreditCardV2Payload.swift | 33 ++ .../CheckoutCustomerAssociateV2Payload.swift | 33 ++ ...heckoutCustomerDisassociateV2Payload.swift | 33 ++ .../CheckoutDiscountCodeApplyV2Payload.swift | 33 ++ .../CheckoutDiscountCodeRemovePayload.swift | 33 ++ .../CheckoutEmailUpdateV2Payload.swift | 33 ++ .../Storefront/CheckoutErrorCode.swift | 3 + .../Storefront/DiscountApplication.swift | 12 + Buy/Generated/Storefront/QueryRoot.swift | 344 ++++++++++++++++++ Buy/Generated/Storefront/Shop.swift | 24 ++ 14 files changed, 823 insertions(+) create mode 100644 Buy/Generated/Storefront/AutomaticDiscountApplication.swift diff --git a/Buy.xcodeproj/project.pbxproj b/Buy.xcodeproj/project.pbxproj index c47bea78..fbbc1181 100644 --- a/Buy.xcodeproj/project.pbxproj +++ b/Buy.xcodeproj/project.pbxproj @@ -172,6 +172,9 @@ 9A2ACDDB21CABB7100C09FF7 /* CheckoutLineItemsReplacePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDDA21CABB7000C09FF7 /* CheckoutLineItemsReplacePayload.swift */; }; 9A2ACDDC21CABB7100C09FF7 /* CheckoutLineItemsReplacePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDDA21CABB7000C09FF7 /* CheckoutLineItemsReplacePayload.swift */; }; 9A2ACDDD21CABB7100C09FF7 /* CheckoutLineItemsReplacePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACDDA21CABB7000C09FF7 /* CheckoutLineItemsReplacePayload.swift */; }; + 9A2ACE2D21CD3C8700C09FF7 /* AutomaticDiscountApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACE2C21CD3C8600C09FF7 /* AutomaticDiscountApplication.swift */; }; + 9A2ACE2E21CD3C8700C09FF7 /* AutomaticDiscountApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACE2C21CD3C8600C09FF7 /* AutomaticDiscountApplication.swift */; }; + 9A2ACE2F21CD3C8700C09FF7 /* AutomaticDiscountApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2ACE2C21CD3C8600C09FF7 /* AutomaticDiscountApplication.swift */; }; 9A4068E51E8E7659000254CD /* Pay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A4068DC1E8E7658000254CD /* Pay.framework */; }; 9A4068EA1E8E7659000254CD /* PaySessionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A4068E91E8E7659000254CD /* PaySessionTests.swift */; }; 9A4068EC1E8E7659000254CD /* Pay.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A4068DE1E8E7659000254CD /* Pay.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -777,6 +780,7 @@ 9A2ACDC321CABAC200C09FF7 /* Page.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Page.swift; sourceTree = ""; }; 9A2ACDC421CABAC200C09FF7 /* PageSortKeys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageSortKeys.swift; sourceTree = ""; }; 9A2ACDDA21CABB7000C09FF7 /* CheckoutLineItemsReplacePayload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckoutLineItemsReplacePayload.swift; sourceTree = ""; }; + 9A2ACE2C21CD3C8600C09FF7 /* AutomaticDiscountApplication.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutomaticDiscountApplication.swift; sourceTree = ""; }; 9A4068DC1E8E7658000254CD /* Pay.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pay.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9A4068DE1E8E7659000254CD /* Pay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Pay.h; sourceTree = ""; }; 9A4068DF1E8E7659000254CD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -957,6 +961,7 @@ 9AA416C61EE095AA0060029B /* ArticleSortKeys.swift */, 9A0C7FFA1EAA51C50020F187 /* Attribute.swift */, 9A0C7FFB1EAA51C50020F187 /* AttributeInput.swift */, + 9A2ACE2C21CD3C8600C09FF7 /* AutomaticDiscountApplication.swift */, 9A0C7FFC1EAA51C50020F187 /* AvailableShippingRates.swift */, 9AA416CC1EE095B20060029B /* Blog.swift */, 9AA416CD1EE095B20060029B /* BlogConnection.swift */, @@ -1704,6 +1709,7 @@ 9AC2EF471F6818180037E0D7 /* ProductEdge.swift in Sources */, 9AC2EF481F6818180037E0D7 /* CheckoutAttributesUpdatePayload.swift in Sources */, 9AC2EF491F6818180037E0D7 /* WeightUnit.swift in Sources */, + 9A2ACE2E21CD3C8700C09FF7 /* AutomaticDiscountApplication.swift in Sources */, 9AC2EF4A1F6818180037E0D7 /* CustomerUpdatePayload.swift in Sources */, 9AC2EF4B1F6818180037E0D7 /* Graph.Task.swift in Sources */, 9AC2EF4C1F6818180037E0D7 /* Customer.swift in Sources */, @@ -1898,6 +1904,7 @@ 9A0C80A51EAA51C50020F187 /* ProductEdge.swift in Sources */, 9A0C805E1EAA51C50020F187 /* CheckoutAttributesUpdatePayload.swift in Sources */, 9A0C80B51EAA51C50020F187 /* WeightUnit.swift in Sources */, + 9A2ACE2D21CD3C8700C09FF7 /* AutomaticDiscountApplication.swift in Sources */, 9A0C808C1EAA51C50020F187 /* CustomerUpdatePayload.swift in Sources */, 9A4069CF1E8ED98A000254CD /* Graph.Task.swift in Sources */, 9A0C807B1EAA51C50020F187 /* Customer.swift in Sources */, @@ -2092,6 +2099,7 @@ 9AF255C11F6FEE50005BB0C9 /* ProductEdge.swift in Sources */, 9AF255C21F6FEE50005BB0C9 /* CheckoutAttributesUpdatePayload.swift in Sources */, 9AF255C31F6FEE50005BB0C9 /* WeightUnit.swift in Sources */, + 9A2ACE2F21CD3C8700C09FF7 /* AutomaticDiscountApplication.swift in Sources */, 9AF255C41F6FEE50005BB0C9 /* CustomerUpdatePayload.swift in Sources */, 9AF255C51F6FEE50005BB0C9 /* Graph.Task.swift in Sources */, 9AF255C61F6FEE50005BB0C9 /* Customer.swift in Sources */, diff --git a/Buy/Generated/Storefront/AutomaticDiscountApplication.swift b/Buy/Generated/Storefront/AutomaticDiscountApplication.swift new file mode 100644 index 00000000..d51dd288 --- /dev/null +++ b/Buy/Generated/Storefront/AutomaticDiscountApplication.swift @@ -0,0 +1,168 @@ +// +// AutomaticDiscountApplication.swift +// Buy +// +// Created by Shopify. +// Copyright (c) 2017 Shopify Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Storefront { + /// Automatic discount applications capture the intentions of a discount that + /// was automatically applied. + open class AutomaticDiscountApplicationQuery: GraphQL.AbstractQuery, GraphQLQuery { + public typealias Response = AutomaticDiscountApplication + + /// The method by which the discount's value is allocated to its entitled + /// items. + @discardableResult + open func allocationMethod(alias: String? = nil) -> AutomaticDiscountApplicationQuery { + addField(field: "allocationMethod", aliasSuffix: alias) + return self + } + + /// Which lines of targetType that the discount is allocated over. + @discardableResult + open func targetSelection(alias: String? = nil) -> AutomaticDiscountApplicationQuery { + addField(field: "targetSelection", aliasSuffix: alias) + return self + } + + /// The type of line that the discount is applicable towards. + @discardableResult + open func targetType(alias: String? = nil) -> AutomaticDiscountApplicationQuery { + addField(field: "targetType", aliasSuffix: alias) + return self + } + + /// The title of the application. + @discardableResult + open func title(alias: String? = nil) -> AutomaticDiscountApplicationQuery { + addField(field: "title", aliasSuffix: alias) + return self + } + + /// The value of the discount application. + @discardableResult + open func value(alias: String? = nil, _ subfields: (PricingValueQuery) -> Void) -> AutomaticDiscountApplicationQuery { + let subquery = PricingValueQuery() + subfields(subquery) + + addField(field: "value", aliasSuffix: alias, subfields: subquery) + return self + } + } + + /// Automatic discount applications capture the intentions of a discount that + /// was automatically applied. + open class AutomaticDiscountApplication: GraphQL.AbstractResponse, GraphQLObject, DiscountApplication { + public typealias Query = AutomaticDiscountApplicationQuery + + internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? { + let fieldValue = value + switch fieldName { + case "allocationMethod": + guard let value = value as? String else { + throw SchemaViolationError(type: AutomaticDiscountApplication.self, field: fieldName, value: fieldValue) + } + return DiscountApplicationAllocationMethod(rawValue: value) ?? .unknownValue + + case "targetSelection": + guard let value = value as? String else { + throw SchemaViolationError(type: AutomaticDiscountApplication.self, field: fieldName, value: fieldValue) + } + return DiscountApplicationTargetSelection(rawValue: value) ?? .unknownValue + + case "targetType": + guard let value = value as? String else { + throw SchemaViolationError(type: AutomaticDiscountApplication.self, field: fieldName, value: fieldValue) + } + return DiscountApplicationTargetType(rawValue: value) ?? .unknownValue + + case "title": + guard let value = value as? String else { + throw SchemaViolationError(type: AutomaticDiscountApplication.self, field: fieldName, value: fieldValue) + } + return value + + case "value": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: AutomaticDiscountApplication.self, field: fieldName, value: fieldValue) + } + return try UnknownPricingValue.create(fields: value) + + default: + throw SchemaViolationError(type: AutomaticDiscountApplication.self, field: fieldName, value: fieldValue) + } + } + + /// The method by which the discount's value is allocated to its entitled + /// items. + open var allocationMethod: Storefront.DiscountApplicationAllocationMethod { + return internalGetAllocationMethod() + } + + func internalGetAllocationMethod(alias: String? = nil) -> Storefront.DiscountApplicationAllocationMethod { + return field(field: "allocationMethod", aliasSuffix: alias) as! Storefront.DiscountApplicationAllocationMethod + } + + /// Which lines of targetType that the discount is allocated over. + open var targetSelection: Storefront.DiscountApplicationTargetSelection { + return internalGetTargetSelection() + } + + func internalGetTargetSelection(alias: String? = nil) -> Storefront.DiscountApplicationTargetSelection { + return field(field: "targetSelection", aliasSuffix: alias) as! Storefront.DiscountApplicationTargetSelection + } + + /// The type of line that the discount is applicable towards. + open var targetType: Storefront.DiscountApplicationTargetType { + return internalGetTargetType() + } + + func internalGetTargetType(alias: String? = nil) -> Storefront.DiscountApplicationTargetType { + return field(field: "targetType", aliasSuffix: alias) as! Storefront.DiscountApplicationTargetType + } + + /// The title of the application. + open var title: String { + return internalGetTitle() + } + + func internalGetTitle(alias: String? = nil) -> String { + return field(field: "title", aliasSuffix: alias) as! String + } + + /// The value of the discount application. + open var value: PricingValue { + return internalGetValue() + } + + func internalGetValue(alias: String? = nil) -> PricingValue { + return field(field: "value", aliasSuffix: alias) as! PricingValue + } + + internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] { + return [] + } + } +} diff --git a/Buy/Generated/Storefront/CheckoutAttributesUpdateV2Payload.swift b/Buy/Generated/Storefront/CheckoutAttributesUpdateV2Payload.swift index 0f5bd5ae..c1a989df 100644 --- a/Buy/Generated/Storefront/CheckoutAttributesUpdateV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutAttributesUpdateV2Payload.swift @@ -43,6 +43,17 @@ extension Storefront { /// List of errors that occurred executing the mutation. @discardableResult + open func checkoutUserErrors(alias: String? = nil, _ subfields: (CheckoutUserErrorQuery) -> Void) -> CheckoutAttributesUpdateV2PayloadQuery { + let subquery = CheckoutUserErrorQuery() + subfields(subquery) + + addField(field: "checkoutUserErrors", aliasSuffix: alias, subfields: subquery) + return self + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") + @discardableResult open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutAttributesUpdateV2PayloadQuery { let subquery = UserErrorQuery() subfields(subquery) @@ -66,6 +77,12 @@ extension Storefront { } return try Checkout(fields: value) + case "checkoutUserErrors": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: CheckoutAttributesUpdateV2Payload.self, field: fieldName, value: fieldValue) + } + return try value.map { return try CheckoutUserError(fields: $0) } + case "userErrors": guard let value = value as? [[String: Any]] else { throw SchemaViolationError(type: CheckoutAttributesUpdateV2Payload.self, field: fieldName, value: fieldValue) @@ -87,6 +104,16 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + open var checkoutUserErrors: [Storefront.CheckoutUserError] { + return internalGetCheckoutUserErrors() + } + + func internalGetCheckoutUserErrors(alias: String? = nil) -> [Storefront.CheckoutUserError] { + return field(field: "checkoutUserErrors", aliasSuffix: alias) as! [Storefront.CheckoutUserError] + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") open var userErrors: [Storefront.UserError] { return internalGetUserErrors() } @@ -105,6 +132,12 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "checkoutUserErrors": + internalGetCheckoutUserErrors().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + case "userErrors": internalGetUserErrors().forEach { response.append($0) diff --git a/Buy/Generated/Storefront/CheckoutCompleteFreePayload.swift b/Buy/Generated/Storefront/CheckoutCompleteFreePayload.swift index e19dfa51..11d081cd 100644 --- a/Buy/Generated/Storefront/CheckoutCompleteFreePayload.swift +++ b/Buy/Generated/Storefront/CheckoutCompleteFreePayload.swift @@ -43,6 +43,17 @@ extension Storefront { /// List of errors that occurred executing the mutation. @discardableResult + open func checkoutUserErrors(alias: String? = nil, _ subfields: (CheckoutUserErrorQuery) -> Void) -> CheckoutCompleteFreePayloadQuery { + let subquery = CheckoutUserErrorQuery() + subfields(subquery) + + addField(field: "checkoutUserErrors", aliasSuffix: alias, subfields: subquery) + return self + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") + @discardableResult open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutCompleteFreePayloadQuery { let subquery = UserErrorQuery() subfields(subquery) @@ -66,6 +77,12 @@ extension Storefront { } return try Checkout(fields: value) + case "checkoutUserErrors": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: CheckoutCompleteFreePayload.self, field: fieldName, value: fieldValue) + } + return try value.map { return try CheckoutUserError(fields: $0) } + case "userErrors": guard let value = value as? [[String: Any]] else { throw SchemaViolationError(type: CheckoutCompleteFreePayload.self, field: fieldName, value: fieldValue) @@ -87,6 +104,16 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + open var checkoutUserErrors: [Storefront.CheckoutUserError] { + return internalGetCheckoutUserErrors() + } + + func internalGetCheckoutUserErrors(alias: String? = nil) -> [Storefront.CheckoutUserError] { + return field(field: "checkoutUserErrors", aliasSuffix: alias) as! [Storefront.CheckoutUserError] + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") open var userErrors: [Storefront.UserError] { return internalGetUserErrors() } @@ -105,6 +132,12 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "checkoutUserErrors": + internalGetCheckoutUserErrors().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + case "userErrors": internalGetUserErrors().forEach { response.append($0) diff --git a/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardV2Payload.swift b/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardV2Payload.swift index 5742acf9..b588e848 100644 --- a/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutCompleteWithCreditCardV2Payload.swift @@ -41,6 +41,16 @@ extension Storefront { return self } + /// List of errors that occurred executing the mutation. + @discardableResult + open func checkoutUserErrors(alias: String? = nil, _ subfields: (CheckoutUserErrorQuery) -> Void) -> CheckoutCompleteWithCreditCardV2PayloadQuery { + let subquery = CheckoutUserErrorQuery() + subfields(subquery) + + addField(field: "checkoutUserErrors", aliasSuffix: alias, subfields: subquery) + return self + } + /// A representation of the attempted payment. @discardableResult open func payment(alias: String? = nil, _ subfields: (PaymentQuery) -> Void) -> CheckoutCompleteWithCreditCardV2PayloadQuery { @@ -52,6 +62,7 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") @discardableResult open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutCompleteWithCreditCardV2PayloadQuery { let subquery = UserErrorQuery() @@ -76,6 +87,12 @@ extension Storefront { } return try Checkout(fields: value) + case "checkoutUserErrors": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: CheckoutCompleteWithCreditCardV2Payload.self, field: fieldName, value: fieldValue) + } + return try value.map { return try CheckoutUserError(fields: $0) } + case "payment": if value is NSNull { return nil } guard let value = value as? [String: Any] else { @@ -103,6 +120,15 @@ extension Storefront { return field(field: "checkout", aliasSuffix: alias) as! Storefront.Checkout? } + /// List of errors that occurred executing the mutation. + open var checkoutUserErrors: [Storefront.CheckoutUserError] { + return internalGetCheckoutUserErrors() + } + + func internalGetCheckoutUserErrors(alias: String? = nil) -> [Storefront.CheckoutUserError] { + return field(field: "checkoutUserErrors", aliasSuffix: alias) as! [Storefront.CheckoutUserError] + } + /// A representation of the attempted payment. open var payment: Storefront.Payment? { return internalGetPayment() @@ -113,6 +139,7 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") open var userErrors: [Storefront.UserError] { return internalGetUserErrors() } @@ -131,6 +158,12 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "checkoutUserErrors": + internalGetCheckoutUserErrors().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + case "payment": if let value = internalGetPayment() { response.append(value) diff --git a/Buy/Generated/Storefront/CheckoutCustomerAssociateV2Payload.swift b/Buy/Generated/Storefront/CheckoutCustomerAssociateV2Payload.swift index 3e8e3e19..06969a3b 100644 --- a/Buy/Generated/Storefront/CheckoutCustomerAssociateV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutCustomerAssociateV2Payload.swift @@ -41,6 +41,16 @@ extension Storefront { return self } + /// List of errors that occurred executing the mutation. + @discardableResult + open func checkoutUserErrors(alias: String? = nil, _ subfields: (CheckoutUserErrorQuery) -> Void) -> CheckoutCustomerAssociateV2PayloadQuery { + let subquery = CheckoutUserErrorQuery() + subfields(subquery) + + addField(field: "checkoutUserErrors", aliasSuffix: alias, subfields: subquery) + return self + } + /// The associated customer object. @discardableResult open func customer(alias: String? = nil, _ subfields: (CustomerQuery) -> Void) -> CheckoutCustomerAssociateV2PayloadQuery { @@ -52,6 +62,7 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") @discardableResult open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutCustomerAssociateV2PayloadQuery { let subquery = UserErrorQuery() @@ -76,6 +87,12 @@ extension Storefront { } return try Checkout(fields: value) + case "checkoutUserErrors": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: CheckoutCustomerAssociateV2Payload.self, field: fieldName, value: fieldValue) + } + return try value.map { return try CheckoutUserError(fields: $0) } + case "customer": if value is NSNull { return nil } guard let value = value as? [String: Any] else { @@ -103,6 +120,15 @@ extension Storefront { return field(field: "checkout", aliasSuffix: alias) as! Storefront.Checkout? } + /// List of errors that occurred executing the mutation. + open var checkoutUserErrors: [Storefront.CheckoutUserError] { + return internalGetCheckoutUserErrors() + } + + func internalGetCheckoutUserErrors(alias: String? = nil) -> [Storefront.CheckoutUserError] { + return field(field: "checkoutUserErrors", aliasSuffix: alias) as! [Storefront.CheckoutUserError] + } + /// The associated customer object. open var customer: Storefront.Customer? { return internalGetCustomer() @@ -113,6 +139,7 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") open var userErrors: [Storefront.UserError] { return internalGetUserErrors() } @@ -131,6 +158,12 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "checkoutUserErrors": + internalGetCheckoutUserErrors().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + case "customer": if let value = internalGetCustomer() { response.append(value) diff --git a/Buy/Generated/Storefront/CheckoutCustomerDisassociateV2Payload.swift b/Buy/Generated/Storefront/CheckoutCustomerDisassociateV2Payload.swift index b6df146c..d645a4da 100644 --- a/Buy/Generated/Storefront/CheckoutCustomerDisassociateV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutCustomerDisassociateV2Payload.swift @@ -43,6 +43,17 @@ extension Storefront { /// List of errors that occurred executing the mutation. @discardableResult + open func checkoutUserErrors(alias: String? = nil, _ subfields: (CheckoutUserErrorQuery) -> Void) -> CheckoutCustomerDisassociateV2PayloadQuery { + let subquery = CheckoutUserErrorQuery() + subfields(subquery) + + addField(field: "checkoutUserErrors", aliasSuffix: alias, subfields: subquery) + return self + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") + @discardableResult open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutCustomerDisassociateV2PayloadQuery { let subquery = UserErrorQuery() subfields(subquery) @@ -66,6 +77,12 @@ extension Storefront { } return try Checkout(fields: value) + case "checkoutUserErrors": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: CheckoutCustomerDisassociateV2Payload.self, field: fieldName, value: fieldValue) + } + return try value.map { return try CheckoutUserError(fields: $0) } + case "userErrors": guard let value = value as? [[String: Any]] else { throw SchemaViolationError(type: CheckoutCustomerDisassociateV2Payload.self, field: fieldName, value: fieldValue) @@ -87,6 +104,16 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + open var checkoutUserErrors: [Storefront.CheckoutUserError] { + return internalGetCheckoutUserErrors() + } + + func internalGetCheckoutUserErrors(alias: String? = nil) -> [Storefront.CheckoutUserError] { + return field(field: "checkoutUserErrors", aliasSuffix: alias) as! [Storefront.CheckoutUserError] + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") open var userErrors: [Storefront.UserError] { return internalGetUserErrors() } @@ -105,6 +132,12 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "checkoutUserErrors": + internalGetCheckoutUserErrors().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + case "userErrors": internalGetUserErrors().forEach { response.append($0) diff --git a/Buy/Generated/Storefront/CheckoutDiscountCodeApplyV2Payload.swift b/Buy/Generated/Storefront/CheckoutDiscountCodeApplyV2Payload.swift index 6edfcf9c..a2a981f6 100644 --- a/Buy/Generated/Storefront/CheckoutDiscountCodeApplyV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutDiscountCodeApplyV2Payload.swift @@ -43,6 +43,17 @@ extension Storefront { /// List of errors that occurred executing the mutation. @discardableResult + open func checkoutUserErrors(alias: String? = nil, _ subfields: (CheckoutUserErrorQuery) -> Void) -> CheckoutDiscountCodeApplyV2PayloadQuery { + let subquery = CheckoutUserErrorQuery() + subfields(subquery) + + addField(field: "checkoutUserErrors", aliasSuffix: alias, subfields: subquery) + return self + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") + @discardableResult open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutDiscountCodeApplyV2PayloadQuery { let subquery = UserErrorQuery() subfields(subquery) @@ -66,6 +77,12 @@ extension Storefront { } return try Checkout(fields: value) + case "checkoutUserErrors": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: CheckoutDiscountCodeApplyV2Payload.self, field: fieldName, value: fieldValue) + } + return try value.map { return try CheckoutUserError(fields: $0) } + case "userErrors": guard let value = value as? [[String: Any]] else { throw SchemaViolationError(type: CheckoutDiscountCodeApplyV2Payload.self, field: fieldName, value: fieldValue) @@ -87,6 +104,16 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + open var checkoutUserErrors: [Storefront.CheckoutUserError] { + return internalGetCheckoutUserErrors() + } + + func internalGetCheckoutUserErrors(alias: String? = nil) -> [Storefront.CheckoutUserError] { + return field(field: "checkoutUserErrors", aliasSuffix: alias) as! [Storefront.CheckoutUserError] + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") open var userErrors: [Storefront.UserError] { return internalGetUserErrors() } @@ -105,6 +132,12 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "checkoutUserErrors": + internalGetCheckoutUserErrors().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + case "userErrors": internalGetUserErrors().forEach { response.append($0) diff --git a/Buy/Generated/Storefront/CheckoutDiscountCodeRemovePayload.swift b/Buy/Generated/Storefront/CheckoutDiscountCodeRemovePayload.swift index a8f94e82..3f0ee539 100644 --- a/Buy/Generated/Storefront/CheckoutDiscountCodeRemovePayload.swift +++ b/Buy/Generated/Storefront/CheckoutDiscountCodeRemovePayload.swift @@ -43,6 +43,17 @@ extension Storefront { /// List of errors that occurred executing the mutation. @discardableResult + open func checkoutUserErrors(alias: String? = nil, _ subfields: (CheckoutUserErrorQuery) -> Void) -> CheckoutDiscountCodeRemovePayloadQuery { + let subquery = CheckoutUserErrorQuery() + subfields(subquery) + + addField(field: "checkoutUserErrors", aliasSuffix: alias, subfields: subquery) + return self + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") + @discardableResult open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutDiscountCodeRemovePayloadQuery { let subquery = UserErrorQuery() subfields(subquery) @@ -66,6 +77,12 @@ extension Storefront { } return try Checkout(fields: value) + case "checkoutUserErrors": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: CheckoutDiscountCodeRemovePayload.self, field: fieldName, value: fieldValue) + } + return try value.map { return try CheckoutUserError(fields: $0) } + case "userErrors": guard let value = value as? [[String: Any]] else { throw SchemaViolationError(type: CheckoutDiscountCodeRemovePayload.self, field: fieldName, value: fieldValue) @@ -87,6 +104,16 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + open var checkoutUserErrors: [Storefront.CheckoutUserError] { + return internalGetCheckoutUserErrors() + } + + func internalGetCheckoutUserErrors(alias: String? = nil) -> [Storefront.CheckoutUserError] { + return field(field: "checkoutUserErrors", aliasSuffix: alias) as! [Storefront.CheckoutUserError] + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") open var userErrors: [Storefront.UserError] { return internalGetUserErrors() } @@ -105,6 +132,12 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "checkoutUserErrors": + internalGetCheckoutUserErrors().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + case "userErrors": internalGetUserErrors().forEach { response.append($0) diff --git a/Buy/Generated/Storefront/CheckoutEmailUpdateV2Payload.swift b/Buy/Generated/Storefront/CheckoutEmailUpdateV2Payload.swift index d9448f29..577a642d 100644 --- a/Buy/Generated/Storefront/CheckoutEmailUpdateV2Payload.swift +++ b/Buy/Generated/Storefront/CheckoutEmailUpdateV2Payload.swift @@ -43,6 +43,17 @@ extension Storefront { /// List of errors that occurred executing the mutation. @discardableResult + open func checkoutUserErrors(alias: String? = nil, _ subfields: (CheckoutUserErrorQuery) -> Void) -> CheckoutEmailUpdateV2PayloadQuery { + let subquery = CheckoutUserErrorQuery() + subfields(subquery) + + addField(field: "checkoutUserErrors", aliasSuffix: alias, subfields: subquery) + return self + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") + @discardableResult open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutEmailUpdateV2PayloadQuery { let subquery = UserErrorQuery() subfields(subquery) @@ -66,6 +77,12 @@ extension Storefront { } return try Checkout(fields: value) + case "checkoutUserErrors": + guard let value = value as? [[String: Any]] else { + throw SchemaViolationError(type: CheckoutEmailUpdateV2Payload.self, field: fieldName, value: fieldValue) + } + return try value.map { return try CheckoutUserError(fields: $0) } + case "userErrors": guard let value = value as? [[String: Any]] else { throw SchemaViolationError(type: CheckoutEmailUpdateV2Payload.self, field: fieldName, value: fieldValue) @@ -87,6 +104,16 @@ extension Storefront { } /// List of errors that occurred executing the mutation. + open var checkoutUserErrors: [Storefront.CheckoutUserError] { + return internalGetCheckoutUserErrors() + } + + func internalGetCheckoutUserErrors(alias: String? = nil) -> [Storefront.CheckoutUserError] { + return field(field: "checkoutUserErrors", aliasSuffix: alias) as! [Storefront.CheckoutUserError] + } + + /// List of errors that occurred executing the mutation. + @available(*, deprecated, message:"Use `checkoutUserErrors` instead") open var userErrors: [Storefront.UserError] { return internalGetUserErrors() } @@ -105,6 +132,12 @@ extension Storefront { response.append(contentsOf: value.childResponseObjectMap()) } + case "checkoutUserErrors": + internalGetCheckoutUserErrors().forEach { + response.append($0) + response.append(contentsOf: $0.childResponseObjectMap()) + } + case "userErrors": internalGetUserErrors().forEach { response.append($0) diff --git a/Buy/Generated/Storefront/CheckoutErrorCode.swift b/Buy/Generated/Storefront/CheckoutErrorCode.swift index 0b40e344..301f512a 100644 --- a/Buy/Generated/Storefront/CheckoutErrorCode.swift +++ b/Buy/Generated/Storefront/CheckoutErrorCode.swift @@ -80,6 +80,9 @@ extension Storefront { /// Checkout is locked. case locked = "LOCKED" + /// Missing payment input. + case missingPaymentInput = "MISSING_PAYMENT_INPUT" + /// Not enough in stock. case notEnoughInStock = "NOT_ENOUGH_IN_STOCK" diff --git a/Buy/Generated/Storefront/DiscountApplication.swift b/Buy/Generated/Storefront/DiscountApplication.swift index 6f8a369e..a1862a3c 100644 --- a/Buy/Generated/Storefront/DiscountApplication.swift +++ b/Buy/Generated/Storefront/DiscountApplication.swift @@ -81,6 +81,16 @@ extension Storefront { addField(field: "__typename") } + /// Discount applications capture the intentions of a discount source at the + /// time of application. + @discardableResult + open func onAutomaticDiscountApplication(subfields: (AutomaticDiscountApplicationQuery) -> Void) -> DiscountApplicationQuery { + let subquery = AutomaticDiscountApplicationQuery() + subfields(subquery) + addInlineFragment(on: "AutomaticDiscountApplication", subfields: subquery) + return self + } + /// Discount applications capture the intentions of a discount source at the /// time of application. @discardableResult @@ -154,6 +164,8 @@ extension Storefront { throw SchemaViolationError(type: UnknownDiscountApplication.self, field: "__typename", value: fields["__typename"] ?? NSNull()) } switch typeName { + case "AutomaticDiscountApplication": return try AutomaticDiscountApplication.init(fields: fields) + case "DiscountCodeApplication": return try DiscountCodeApplication.init(fields: fields) case "ManualDiscountApplication": return try ManualDiscountApplication.init(fields: fields) diff --git a/Buy/Generated/Storefront/QueryRoot.swift b/Buy/Generated/Storefront/QueryRoot.swift index 06236d71..5c10f7f0 100644 --- a/Buy/Generated/Storefront/QueryRoot.swift +++ b/Buy/Generated/Storefront/QueryRoot.swift @@ -169,6 +169,83 @@ extension Storefront { return self } + /// Find a collection by its handle. + /// + /// - parameters: + /// - handle: The handle of the collection. + /// + @discardableResult + open func collectionByHandle(alias: String? = nil, handle: String, _ subfields: (CollectionQuery) -> Void) -> QueryRootQuery { + var args: [String] = [] + + args.append("handle:\(GraphQL.quoteString(input: handle))") + + let argsString = "(\(args.joined(separator: ",")))" + + let subquery = CollectionQuery() + subfields(subquery) + + addField(field: "collectionByHandle", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + + /// List of the shop’s collections. + /// + /// - parameters: + /// - first: Returns up to the first `n` elements from the list. + /// - after: Returns the elements that come after the specified cursor. + /// - last: Returns up to the last `n` elements from the list. + /// - before: Returns the elements that come before the specified cursor. + /// - reverse: Reverse the order of the underlying list. + /// - sortKey: Sort the underlying list by the given key. + /// - query: Supported filter parameters: + /// - `collection_type` + /// - `title` + /// - `updated_at` + /// + /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). + /// + @discardableResult + open func collections(alias: String? = nil, first: Int32? = nil, after: String? = nil, last: Int32? = nil, before: String? = nil, reverse: Bool? = nil, sortKey: CollectionSortKeys? = nil, query: String? = nil, _ subfields: (CollectionConnectionQuery) -> Void) -> QueryRootQuery { + var args: [String] = [] + + if let first = first { + args.append("first:\(first)") + } + + if let after = after { + args.append("after:\(GraphQL.quoteString(input: after))") + } + + if let last = last { + args.append("last:\(last)") + } + + if let before = before { + args.append("before:\(GraphQL.quoteString(input: before))") + } + + if let reverse = reverse { + args.append("reverse:\(reverse)") + } + + if let sortKey = sortKey { + args.append("sortKey:\(sortKey.rawValue)") + } + + if let query = query { + args.append("query:\(GraphQL.quoteString(input: query))") + } + + let argsString: String? = args.isEmpty ? nil : "(\(args.joined(separator: ",")))" + + let subquery = CollectionConnectionQuery() + subfields(subquery) + + addField(field: "collections", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + /// /// - parameters: /// - customerAccessToken: The customer access token @@ -304,6 +381,128 @@ extension Storefront { return self } + /// Find a product by its handle. + /// + /// - parameters: + /// - handle: The handle of the product. + /// + @discardableResult + open func productByHandle(alias: String? = nil, handle: String, _ subfields: (ProductQuery) -> Void) -> QueryRootQuery { + var args: [String] = [] + + args.append("handle:\(GraphQL.quoteString(input: handle))") + + let argsString = "(\(args.joined(separator: ",")))" + + let subquery = ProductQuery() + subfields(subquery) + + addField(field: "productByHandle", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + + /// Tags added to products. Additional access scope required: + /// unauthenticated_read_product_tags. + /// + /// - parameters: + /// - first: Returns up to the first `n` elements from the list. + /// + @discardableResult + open func productTags(alias: String? = nil, first: Int32, _ subfields: (StringConnectionQuery) -> Void) -> QueryRootQuery { + var args: [String] = [] + + args.append("first:\(first)") + + let argsString = "(\(args.joined(separator: ",")))" + + let subquery = StringConnectionQuery() + subfields(subquery) + + addField(field: "productTags", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + + /// List of the shop’s product types. + /// + /// - parameters: + /// - first: Returns up to the first `n` elements from the list. + /// + @discardableResult + open func productTypes(alias: String? = nil, first: Int32, _ subfields: (StringConnectionQuery) -> Void) -> QueryRootQuery { + var args: [String] = [] + + args.append("first:\(first)") + + let argsString = "(\(args.joined(separator: ",")))" + + let subquery = StringConnectionQuery() + subfields(subquery) + + addField(field: "productTypes", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + + /// List of the shop’s products. + /// + /// - parameters: + /// - first: Returns up to the first `n` elements from the list. + /// - after: Returns the elements that come after the specified cursor. + /// - last: Returns up to the last `n` elements from the list. + /// - before: Returns the elements that come before the specified cursor. + /// - reverse: Reverse the order of the underlying list. + /// - sortKey: Sort the underlying list by the given key. + /// - query: Supported filter parameters: + /// - `created_at` + /// - `product_type` + /// - `tag` + /// - `title` + /// - `updated_at` + /// - `variants.price` + /// - `vendor` + /// + /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). + /// + @discardableResult + open func products(alias: String? = nil, first: Int32? = nil, after: String? = nil, last: Int32? = nil, before: String? = nil, reverse: Bool? = nil, sortKey: ProductSortKeys? = nil, query: String? = nil, _ subfields: (ProductConnectionQuery) -> Void) -> QueryRootQuery { + var args: [String] = [] + + if let first = first { + args.append("first:\(first)") + } + + if let after = after { + args.append("after:\(GraphQL.quoteString(input: after))") + } + + if let last = last { + args.append("last:\(last)") + } + + if let before = before { + args.append("before:\(GraphQL.quoteString(input: before))") + } + + if let reverse = reverse { + args.append("reverse:\(reverse)") + } + + if let sortKey = sortKey { + args.append("sortKey:\(sortKey.rawValue)") + } + + if let query = query { + args.append("query:\(GraphQL.quoteString(input: query))") + } + + let argsString: String? = args.isEmpty ? nil : "(\(args.joined(separator: ",")))" + + let subquery = ProductConnectionQuery() + subfields(subquery) + + addField(field: "products", aliasSuffix: alias, args: argsString, subfields: subquery) + return self + } + @discardableResult open func shop(alias: String? = nil, _ subfields: (ShopQuery) -> Void) -> QueryRootQuery { let subquery = ShopQuery() @@ -341,6 +540,19 @@ extension Storefront { } return try BlogConnection(fields: value) + case "collectionByHandle": + if value is NSNull { return nil } + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) + } + return try Collection(fields: value) + + case "collections": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) + } + return try CollectionConnection(fields: value) + case "customer": if value is NSNull { return nil } guard let value = value as? [String: Any] else { @@ -378,6 +590,31 @@ extension Storefront { } return try PageConnection(fields: value) + case "productByHandle": + if value is NSNull { return nil } + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) + } + return try Product(fields: value) + + case "productTags": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) + } + return try StringConnection(fields: value) + + case "productTypes": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) + } + return try StringConnection(fields: value) + + case "products": + guard let value = value as? [String: Any] else { + throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) + } + return try ProductConnection(fields: value) + case "shop": guard let value = value as? [String: Any] else { throw SchemaViolationError(type: QueryRoot.self, field: fieldName, value: fieldValue) @@ -428,6 +665,32 @@ extension Storefront { return field(field: "blogs", aliasSuffix: alias) as! Storefront.BlogConnection } + /// Find a collection by its handle. + open var collectionByHandle: Storefront.Collection? { + return internalGetCollectionByHandle() + } + + open func aliasedCollectionByHandle(alias: String) -> Storefront.Collection? { + return internalGetCollectionByHandle(alias: alias) + } + + func internalGetCollectionByHandle(alias: String? = nil) -> Storefront.Collection? { + return field(field: "collectionByHandle", aliasSuffix: alias) as! Storefront.Collection? + } + + /// List of the shop’s collections. + open var collections: Storefront.CollectionConnection { + return internalGetCollections() + } + + open func aliasedCollections(alias: String) -> Storefront.CollectionConnection { + return internalGetCollections(alias: alias) + } + + func internalGetCollections(alias: String? = nil) -> Storefront.CollectionConnection { + return field(field: "collections", aliasSuffix: alias) as! Storefront.CollectionConnection + } + open var customer: Storefront.Customer? { return internalGetCustomer() } @@ -490,6 +753,59 @@ extension Storefront { return field(field: "pages", aliasSuffix: alias) as! Storefront.PageConnection } + /// Find a product by its handle. + open var productByHandle: Storefront.Product? { + return internalGetProductByHandle() + } + + open func aliasedProductByHandle(alias: String) -> Storefront.Product? { + return internalGetProductByHandle(alias: alias) + } + + func internalGetProductByHandle(alias: String? = nil) -> Storefront.Product? { + return field(field: "productByHandle", aliasSuffix: alias) as! Storefront.Product? + } + + /// Tags added to products. Additional access scope required: + /// unauthenticated_read_product_tags. + open var productTags: Storefront.StringConnection { + return internalGetProductTags() + } + + open func aliasedProductTags(alias: String) -> Storefront.StringConnection { + return internalGetProductTags(alias: alias) + } + + func internalGetProductTags(alias: String? = nil) -> Storefront.StringConnection { + return field(field: "productTags", aliasSuffix: alias) as! Storefront.StringConnection + } + + /// List of the shop’s product types. + open var productTypes: Storefront.StringConnection { + return internalGetProductTypes() + } + + open func aliasedProductTypes(alias: String) -> Storefront.StringConnection { + return internalGetProductTypes(alias: alias) + } + + func internalGetProductTypes(alias: String? = nil) -> Storefront.StringConnection { + return field(field: "productTypes", aliasSuffix: alias) as! Storefront.StringConnection + } + + /// List of the shop’s products. + open var products: Storefront.ProductConnection { + return internalGetProducts() + } + + open func aliasedProducts(alias: String) -> Storefront.ProductConnection { + return internalGetProducts(alias: alias) + } + + func internalGetProducts(alias: String? = nil) -> Storefront.ProductConnection { + return field(field: "products", aliasSuffix: alias) as! Storefront.ProductConnection + } + open var shop: Storefront.Shop { return internalGetShop() } @@ -516,6 +832,16 @@ extension Storefront { response.append(internalGetBlogs()) response.append(contentsOf: internalGetBlogs().childResponseObjectMap()) + case "collectionByHandle": + if let value = internalGetCollectionByHandle() { + response.append(value) + response.append(contentsOf: value.childResponseObjectMap()) + } + + case "collections": + response.append(internalGetCollections()) + response.append(contentsOf: internalGetCollections().childResponseObjectMap()) + case "customer": if let value = internalGetCustomer() { response.append(value) @@ -546,6 +872,24 @@ extension Storefront { response.append(internalGetPages()) response.append(contentsOf: internalGetPages().childResponseObjectMap()) + case "productByHandle": + if let value = internalGetProductByHandle() { + response.append(value) + response.append(contentsOf: value.childResponseObjectMap()) + } + + case "productTags": + response.append(internalGetProductTags()) + response.append(contentsOf: internalGetProductTags().childResponseObjectMap()) + + case "productTypes": + response.append(internalGetProductTypes()) + response.append(contentsOf: internalGetProductTypes().childResponseObjectMap()) + + case "products": + response.append(internalGetProducts()) + response.append(contentsOf: internalGetProducts().childResponseObjectMap()) + case "shop": response.append(internalGetShop()) response.append(contentsOf: internalGetShop().childResponseObjectMap()) diff --git a/Buy/Generated/Storefront/Shop.swift b/Buy/Generated/Storefront/Shop.swift index 6c8ad892..cdba960d 100644 --- a/Buy/Generated/Storefront/Shop.swift +++ b/Buy/Generated/Storefront/Shop.swift @@ -156,6 +156,7 @@ extension Storefront { /// - parameters: /// - handle: The handle of the collection. /// + @available(*, deprecated, message:"Use `QueryRoot.collectionByHandle` instead.") @discardableResult open func collectionByHandle(alias: String? = nil, handle: String, _ subfields: (CollectionQuery) -> Void) -> ShopQuery { var args: [String] = [] @@ -187,6 +188,7 @@ extension Storefront { /// /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). /// + @available(*, deprecated, message:"Use `QueryRoot.collections` instead.") @discardableResult open func collections(alias: String? = nil, first: Int32? = nil, after: String? = nil, last: Int32? = nil, before: String? = nil, reverse: Bool? = nil, sortKey: CollectionSortKeys? = nil, query: String? = nil, _ subfields: (CollectionConnectionQuery) -> Void) -> ShopQuery { var args: [String] = [] @@ -293,6 +295,7 @@ extension Storefront { /// - parameters: /// - handle: The handle of the product. /// + @available(*, deprecated, message:"Use `QueryRoot.productByHandle` instead.") @discardableResult open func productByHandle(alias: String? = nil, handle: String, _ subfields: (ProductQuery) -> Void) -> ShopQuery { var args: [String] = [] @@ -314,6 +317,7 @@ extension Storefront { /// - parameters: /// - first: Returns up to the first `n` elements from the list. /// + @available(*, deprecated, message:"Use `QueryRoot.productTags` instead.") @discardableResult open func productTags(alias: String? = nil, first: Int32, _ subfields: (StringConnectionQuery) -> Void) -> ShopQuery { var args: [String] = [] @@ -334,6 +338,7 @@ extension Storefront { /// - parameters: /// - first: Returns up to the first `n` elements from the list. /// + @available(*, deprecated, message:"Use `QueryRoot.productTypes` instead.") @discardableResult open func productTypes(alias: String? = nil, first: Int32, _ subfields: (StringConnectionQuery) -> Void) -> ShopQuery { var args: [String] = [] @@ -369,6 +374,7 @@ extension Storefront { /// /// See the detailed [search syntax](https://help.shopify.com/api/getting-started/search-syntax). /// + @available(*, deprecated, message:"Use `QueryRoot.products` instead.") @discardableResult open func products(alias: String? = nil, first: Int32? = nil, after: String? = nil, last: Int32? = nil, before: String? = nil, reverse: Bool? = nil, sortKey: ProductSortKeys? = nil, query: String? = nil, _ subfields: (ProductConnectionQuery) -> Void) -> ShopQuery { var args: [String] = [] @@ -613,10 +619,13 @@ extension Storefront { } /// Find a collection by its handle. + @available(*, deprecated, message:"Use `QueryRoot.collectionByHandle` instead.") open var collectionByHandle: Storefront.Collection? { return internalGetCollectionByHandle() } + @available(*, deprecated, message:"Use `QueryRoot.collectionByHandle` instead.") + open func aliasedCollectionByHandle(alias: String) -> Storefront.Collection? { return internalGetCollectionByHandle(alias: alias) } @@ -626,10 +635,13 @@ extension Storefront { } /// List of the shop’s collections. + @available(*, deprecated, message:"Use `QueryRoot.collections` instead.") open var collections: Storefront.CollectionConnection { return internalGetCollections() } + @available(*, deprecated, message:"Use `QueryRoot.collections` instead.") + open func aliasedCollections(alias: String) -> Storefront.CollectionConnection { return internalGetCollections(alias: alias) } @@ -704,10 +716,13 @@ extension Storefront { } /// Find a product by its handle. + @available(*, deprecated, message:"Use `QueryRoot.productByHandle` instead.") open var productByHandle: Storefront.Product? { return internalGetProductByHandle() } + @available(*, deprecated, message:"Use `QueryRoot.productByHandle` instead.") + open func aliasedProductByHandle(alias: String) -> Storefront.Product? { return internalGetProductByHandle(alias: alias) } @@ -718,10 +733,13 @@ extension Storefront { /// Tags added to products. Additional access scope required: /// unauthenticated_read_product_tags. + @available(*, deprecated, message:"Use `QueryRoot.productTags` instead.") open var productTags: Storefront.StringConnection { return internalGetProductTags() } + @available(*, deprecated, message:"Use `QueryRoot.productTags` instead.") + open func aliasedProductTags(alias: String) -> Storefront.StringConnection { return internalGetProductTags(alias: alias) } @@ -731,10 +749,13 @@ extension Storefront { } /// List of the shop’s product types. + @available(*, deprecated, message:"Use `QueryRoot.productTypes` instead.") open var productTypes: Storefront.StringConnection { return internalGetProductTypes() } + @available(*, deprecated, message:"Use `QueryRoot.productTypes` instead.") + open func aliasedProductTypes(alias: String) -> Storefront.StringConnection { return internalGetProductTypes(alias: alias) } @@ -744,10 +765,13 @@ extension Storefront { } /// List of the shop’s products. + @available(*, deprecated, message:"Use `QueryRoot.products` instead.") open var products: Storefront.ProductConnection { return internalGetProducts() } + @available(*, deprecated, message:"Use `QueryRoot.products` instead.") + open func aliasedProducts(alias: String) -> Storefront.ProductConnection { return internalGetProducts(alias: alias) } From 9d986860a3903a37858e5f6e8e286561e8c83888 Mon Sep 17 00:00:00 2001 From: Dima Bart Date: Fri, 21 Dec 2018 10:41:17 -0500 Subject: [PATCH 4/5] Update sample app to remove deprecations. --- .../Storefront/Storefront/Client.swift | 4 +- .../Storefront/Storefront/ClientQuery.swift | 40 +++++++++---------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Sample Apps/Storefront/Storefront/Client.swift b/Sample Apps/Storefront/Storefront/Client.swift index 47619ed8..1d54f353 100644 --- a/Sample Apps/Storefront/Storefront/Client.swift +++ b/Sample Apps/Storefront/Storefront/Client.swift @@ -146,8 +146,8 @@ final class Client { if let query = query { let collections = PageableArray( - with: query.shop.collections.edges, - pageInfo: query.shop.collections.pageInfo + with: query.collections.edges, + pageInfo: query.collections.pageInfo ) completion(collections) } else { diff --git a/Sample Apps/Storefront/Storefront/ClientQuery.swift b/Sample Apps/Storefront/Storefront/ClientQuery.swift index 9b27040a..4df566ef 100644 --- a/Sample Apps/Storefront/Storefront/ClientQuery.swift +++ b/Sample Apps/Storefront/Storefront/ClientQuery.swift @@ -97,24 +97,22 @@ final class ClientQuery { // static func queryForCollections(limit: Int, after cursor: String? = nil, productLimit: Int = 25, productCursor: String? = nil) -> Storefront.QueryRootQuery { return Storefront.buildQuery { $0 - .shop { $0 - .collections(first: Int32(limit), after: cursor) { $0 - .pageInfo { $0 - .hasNextPage() - } - .edges { $0 - .cursor() - .node { $0 - .id() - .title() - .descriptionHtml() - .image(maxWidth: ClientQuery.maxImageDimension, maxHeight: ClientQuery.maxImageDimension) { $0 - .transformedSrc() - } - - .products(first: Int32(productLimit), after: productCursor) { $0 - .fragmentForStandardProduct() - } + .collections(first: Int32(limit), after: cursor) { $0 + .pageInfo { $0 + .hasNextPage() + } + .edges { $0 + .cursor() + .node { $0 + .id() + .title() + .descriptionHtml() + .image(maxWidth: ClientQuery.maxImageDimension, maxHeight: ClientQuery.maxImageDimension) { $0 + .transformedSrc() + } + + .products(first: Int32(productLimit), after: productCursor) { $0 + .fragmentForStandardProduct() } } } @@ -142,7 +140,7 @@ final class ClientQuery { let id = GraphQL.ID(rawValue: checkoutID) return Storefront.buildMutation { $0 .checkoutDiscountCodeApplyV2(discountCode: discountCode, checkoutId: id) { $0 - .userErrors { $0 + .checkoutUserErrors { $0 .field() .message() } @@ -263,7 +261,7 @@ final class ClientQuery { return Storefront.buildMutation { $0 .checkoutEmailUpdateV2(checkoutId: GraphQL.ID(rawValue: id), email: email) { $0 - .userErrors { $0 + .checkoutUserErrors { $0 .field() .message() } @@ -278,7 +276,7 @@ final class ClientQuery { let id = GraphQL.ID(rawValue: checkoutID) return Storefront.buildMutation { $0 .checkoutCustomerAssociateV2(checkoutId: id, customerAccessToken: accessToken) { $0 - .userErrors { $0 + .checkoutUserErrors { $0 .field() .message() } From f56bbe4d6f6e9e57e39b091dc04977849ba79adc Mon Sep 17 00:00:00 2001 From: Dima Bart Date: Fri, 21 Dec 2018 10:48:44 -0500 Subject: [PATCH 5/5] Bump version. --- Buy.xcodeproj/project.pbxproj | 32 ++++++++++++++++---------------- Mobile-Buy-SDK.podspec | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Buy.xcodeproj/project.pbxproj b/Buy.xcodeproj/project.pbxproj index fbbc1181..1ec1d8a9 100644 --- a/Buy.xcodeproj/project.pbxproj +++ b/Buy.xcodeproj/project.pbxproj @@ -2327,11 +2327,11 @@ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 3.2; + CURRENT_PROJECT_VERSION = 3.3; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 3.2; + DYLIB_CURRENT_VERSION = 3.3; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Pay/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -2352,11 +2352,11 @@ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 3.2; + CURRENT_PROJECT_VERSION = 3.3; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 3.2; + DYLIB_CURRENT_VERSION = 3.3; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Pay/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -2405,11 +2405,11 @@ CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3.2; + CURRENT_PROJECT_VERSION = 3.3; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 3.2; + DYLIB_CURRENT_VERSION = 3.3; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Buy/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -2432,11 +2432,11 @@ CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3.2; + CURRENT_PROJECT_VERSION = 3.3; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 3.2; + DYLIB_CURRENT_VERSION = 3.3; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Buy/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -2571,11 +2571,11 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 3.2; + CURRENT_PROJECT_VERSION = 3.3; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 3.2; + DYLIB_CURRENT_VERSION = 3.3; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Buy/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -2593,11 +2593,11 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 3.2; + CURRENT_PROJECT_VERSION = 3.3; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 3.2; + DYLIB_CURRENT_VERSION = 3.3; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Buy/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -2616,11 +2616,11 @@ CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3.2; + CURRENT_PROJECT_VERSION = 3.3; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 3.2; + DYLIB_CURRENT_VERSION = 3.3; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Buy/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -2644,11 +2644,11 @@ CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3.2; + CURRENT_PROJECT_VERSION = 3.3; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 3.2; + DYLIB_CURRENT_VERSION = 3.3; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Buy/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; diff --git a/Mobile-Buy-SDK.podspec b/Mobile-Buy-SDK.podspec index 702371db..3cabd3f1 100644 --- a/Mobile-Buy-SDK.podspec +++ b/Mobile-Buy-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'Mobile-Buy-SDK' - s.version = '3.2' + s.version = '3.3' s.summary = 'Create custom Shopify storefront on iOS.' s.description = 'Shopify’s Mobile Buy SDK makes it simple to create custom storefronts in your mobile app. Utitlizing the power and flexibility of GraphQL you can build native storefront experiences using the Shopify platform.' s.homepage = 'https://github.com/Shopify/mobile-buy-sdk-ios'