-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #903 from Shopify/develop
SDK 3.1.8
- Loading branch information
Showing
38 changed files
with
1,654 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
Buy/Generated/Storefront/CheckoutGiftCardsAppendPayload.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// | ||
// CheckoutGiftCardsAppendPayload.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 CheckoutGiftCardsAppendPayloadQuery: GraphQL.AbstractQuery, GraphQLQuery { | ||
public typealias Response = CheckoutGiftCardsAppendPayload | ||
|
||
/// The updated checkout object. | ||
@discardableResult | ||
open func checkout(alias: String? = nil, _ subfields: (CheckoutQuery) -> Void) -> CheckoutGiftCardsAppendPayloadQuery { | ||
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: (UserErrorQuery) -> Void) -> CheckoutGiftCardsAppendPayloadQuery { | ||
let subquery = UserErrorQuery() | ||
subfields(subquery) | ||
|
||
addField(field: "userErrors", aliasSuffix: alias, subfields: subquery) | ||
return self | ||
} | ||
} | ||
|
||
open class CheckoutGiftCardsAppendPayload: GraphQL.AbstractResponse, GraphQLObject { | ||
public typealias Query = CheckoutGiftCardsAppendPayloadQuery | ||
|
||
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: CheckoutGiftCardsAppendPayload.self, field: fieldName, value: fieldValue) | ||
} | ||
return try Checkout(fields: value) | ||
|
||
case "userErrors": | ||
guard let value = value as? [[String: Any]] else { | ||
throw SchemaViolationError(type: CheckoutGiftCardsAppendPayload.self, field: fieldName, value: fieldValue) | ||
} | ||
return try value.map { return try UserError(fields: $0) } | ||
|
||
default: | ||
throw SchemaViolationError(type: CheckoutGiftCardsAppendPayload.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.UserError] { | ||
return internalGetUserErrors() | ||
} | ||
|
||
func internalGetUserErrors(alias: String? = nil) -> [Storefront.UserError] { | ||
return field(field: "userErrors", aliasSuffix: alias) as! [Storefront.UserError] | ||
} | ||
|
||
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.