Skip to content

Commit

Permalink
Merge pull request #903 from Shopify/develop
Browse files Browse the repository at this point in the history
SDK 3.1.8
  • Loading branch information
dbart01 authored Aug 16, 2018
2 parents c3c9e69 + 1ed9c1a commit cde0450
Show file tree
Hide file tree
Showing 38 changed files with 1,654 additions and 122 deletions.
21 changes: 14 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ before_script:
- source "./Scripts/setup_simulator"
- git submodule sync --recursive && git submodule update --recursive --init

script:
- set -o pipefail
- "./Scripts/test_buy"
- "./Scripts/test_buy_tv"
- "./Scripts/test_buy_watch"
- "./Scripts/test_pay"
- "./Scripts/test_sample"
script: set -o pipefail

jobs:
include:
- script: "./Scripts/test_buy"
name: "Test Buy"
- script: "./Scripts/test_buy_tv"
name: "Test Buy TV"
- script: "./Scripts/test_buy_watch"
name: "Test Buy Watch"
- script: "./Scripts/test_pay"
name: "Test Pay"
- script: "./Scripts/test_sample"
name: "Test Sample App"
100 changes: 84 additions & 16 deletions Buy.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Buy/Generated/Storefront/Checkout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ extension Storefront {
}

/// The customer associated with the checkout.
@available(*, deprecated, message:"This field will always return null. If you have an authentication token for the customer, you can use the `customer` field on the query root to retrieve it.")
@discardableResult
open func customer(alias: String? = nil, _ subfields: (CustomerQuery) -> Void) -> CheckoutQuery {
let subquery = CustomerQuery()
Expand Down Expand Up @@ -497,6 +498,7 @@ extension Storefront {
}

/// The customer associated with the checkout.
@available(*, deprecated, message:"This field will always return null. If you have an authentication token for the customer, you can use the `customer` field on the query root to retrieve it.")
open var customer: Storefront.Customer? {
return internalGetCustomer()
}
Expand Down
4 changes: 2 additions & 2 deletions Buy/Generated/Storefront/CheckoutAttributesUpdateInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extension Storefront {
/// - parameters:
/// - note: The text of an optional note that a shop owner can attach to the checkout.
/// - customAttributes: A list of extra information that is added to the checkout.
/// - allowPartialAddresses: Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. Full validation of the addresses is still done at complete time.
/// - allowPartialAddresses: Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. Full validation of the addresses is still done at complete time.
///
public static func create(note: Input<String> = .undefined, customAttributes: Input<[AttributeInput]> = .undefined, allowPartialAddresses: Input<Bool> = .undefined) -> CheckoutAttributesUpdateInput {
return CheckoutAttributesUpdateInput(note: note, customAttributes: customAttributes, allowPartialAddresses: allowPartialAddresses)
Expand All @@ -62,7 +62,7 @@ extension Storefront {
/// - parameters:
/// - note: The text of an optional note that a shop owner can attach to the checkout.
/// - customAttributes: A list of extra information that is added to the checkout.
/// - allowPartialAddresses: Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. Full validation of the addresses is still done at complete time.
/// - allowPartialAddresses: Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. Full validation of the addresses is still done at complete time.
///
@available(*, deprecated, message: "Use the static create() method instead.")
public convenience init(note: String? = nil, customAttributes: [AttributeInput]? = nil, allowPartialAddresses: Bool? = nil) {
Expand Down
4 changes: 2 additions & 2 deletions Buy/Generated/Storefront/CheckoutCreateInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ extension Storefront {
/// - shippingAddress: The shipping address to where the line items will be shipped.
/// - note: The text of an optional note that a shop owner can attach to the checkout.
/// - customAttributes: A list of extra information that is added to the checkout.
/// - allowPartialAddresses: Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. Full validation of addresses is still done at complete time.
/// - allowPartialAddresses: Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. Full validation of addresses is still done at complete time.
///
public static func create(email: Input<String> = .undefined, lineItems: Input<[CheckoutLineItemInput]> = .undefined, shippingAddress: Input<MailingAddressInput> = .undefined, note: Input<String> = .undefined, customAttributes: Input<[AttributeInput]> = .undefined, allowPartialAddresses: Input<Bool> = .undefined) -> CheckoutCreateInput {
return CheckoutCreateInput(email: email, lineItems: lineItems, shippingAddress: shippingAddress, note: note, customAttributes: customAttributes, allowPartialAddresses: allowPartialAddresses)
Expand All @@ -81,7 +81,7 @@ extension Storefront {
/// - shippingAddress: The shipping address to where the line items will be shipped.
/// - note: The text of an optional note that a shop owner can attach to the checkout.
/// - customAttributes: A list of extra information that is added to the checkout.
/// - allowPartialAddresses: Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. Full validation of addresses is still done at complete time.
/// - allowPartialAddresses: Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. Full validation of addresses is still done at complete time.
///
@available(*, deprecated, message: "Use the static create() method instead.")
public convenience init(email: String? = nil, lineItems: [CheckoutLineItemInput]? = nil, shippingAddress: MailingAddressInput? = nil, note: String? = nil, customAttributes: [AttributeInput]? = nil, allowPartialAddresses: Bool? = nil) {
Expand Down
32 changes: 32 additions & 0 deletions Buy/Generated/Storefront/CheckoutCustomerAssociatePayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ extension Storefront {
return self
}

/// The associated customer object.
@discardableResult
open func customer(alias: String? = nil, _ subfields: (CustomerQuery) -> Void) -> CheckoutCustomerAssociatePayloadQuery {
let subquery = CustomerQuery()
subfields(subquery)

addField(field: "customer", aliasSuffix: alias, subfields: subquery)
return self
}

/// List of errors that occurred executing the mutation.
@discardableResult
open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutCustomerAssociatePayloadQuery {
Expand All @@ -63,6 +73,13 @@ extension Storefront {
}
return try Checkout(fields: value)

case "customer":
if value is NSNull { return nil }
guard let value = value as? [String: Any] else {
throw SchemaViolationError(type: CheckoutCustomerAssociatePayload.self, field: fieldName, value: fieldValue)
}
return try Customer(fields: value)

case "userErrors":
guard let value = value as? [[String: Any]] else {
throw SchemaViolationError(type: CheckoutCustomerAssociatePayload.self, field: fieldName, value: fieldValue)
Expand All @@ -83,6 +100,15 @@ extension Storefront {
return field(field: "checkout", aliasSuffix: alias) as! Storefront.Checkout
}

/// The associated customer object.
open var customer: Storefront.Customer? {
return internalGetCustomer()
}

func internalGetCustomer(alias: String? = nil) -> Storefront.Customer? {
return field(field: "customer", aliasSuffix: alias) as! Storefront.Customer?
}

/// List of errors that occurred executing the mutation.
open var userErrors: [Storefront.UserError] {
return internalGetUserErrors()
Expand All @@ -100,6 +126,12 @@ extension Storefront {
response.append(internalGetCheckout())
response.append(contentsOf: internalGetCheckout().childResponseObjectMap())

case "customer":
if let value = internalGetCustomer() {
response.append(value)
response.append(contentsOf: value.childResponseObjectMap())
}

case "userErrors":
internalGetUserErrors().forEach {
response.append($0)
Expand Down
119 changes: 119 additions & 0 deletions Buy/Generated/Storefront/CheckoutGiftCardsAppendPayload.swift
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
}
}
}
33 changes: 33 additions & 0 deletions Buy/Generated/Storefront/CustomerAccessTokenCreatePayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ extension Storefront {

/// List of errors that occurred executing the mutation.
@discardableResult
open func customerUserErrors(alias: String? = nil, _ subfields: (CustomerUserErrorQuery) -> Void) -> CustomerAccessTokenCreatePayloadQuery {
let subquery = CustomerUserErrorQuery()
subfields(subquery)

addField(field: "customerUserErrors", aliasSuffix: alias, subfields: subquery)
return self
}

/// List of errors that occurred executing the mutation.
@available(*, deprecated, message:"Use `customerUserErrors` instead")
@discardableResult
open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CustomerAccessTokenCreatePayloadQuery {
let subquery = UserErrorQuery()
subfields(subquery)
Expand All @@ -64,6 +75,12 @@ extension Storefront {
}
return try CustomerAccessToken(fields: value)

case "customerUserErrors":
guard let value = value as? [[String: Any]] else {
throw SchemaViolationError(type: CustomerAccessTokenCreatePayload.self, field: fieldName, value: fieldValue)
}
return try value.map { return try CustomerUserError(fields: $0) }

case "userErrors":
guard let value = value as? [[String: Any]] else {
throw SchemaViolationError(type: CustomerAccessTokenCreatePayload.self, field: fieldName, value: fieldValue)
Expand All @@ -85,6 +102,16 @@ extension Storefront {
}

/// List of errors that occurred executing the mutation.
open var customerUserErrors: [Storefront.CustomerUserError] {
return internalGetCustomerUserErrors()
}

func internalGetCustomerUserErrors(alias: String? = nil) -> [Storefront.CustomerUserError] {
return field(field: "customerUserErrors", aliasSuffix: alias) as! [Storefront.CustomerUserError]
}

/// List of errors that occurred executing the mutation.
@available(*, deprecated, message:"Use `customerUserErrors` instead")
open var userErrors: [Storefront.UserError] {
return internalGetUserErrors()
}
Expand All @@ -103,6 +130,12 @@ extension Storefront {
response.append(contentsOf: value.childResponseObjectMap())
}

case "customerUserErrors":
internalGetCustomerUserErrors().forEach {
response.append($0)
response.append(contentsOf: $0.childResponseObjectMap())
}

case "userErrors":
internalGetUserErrors().forEach {
response.append($0)
Expand Down
32 changes: 32 additions & 0 deletions Buy/Generated/Storefront/CustomerActivatePayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ extension Storefront {
return self
}

/// A newly created customer access token object for the customer.
@discardableResult
open func customerAccessToken(alias: String? = nil, _ subfields: (CustomerAccessTokenQuery) -> Void) -> CustomerActivatePayloadQuery {
let subquery = CustomerAccessTokenQuery()
subfields(subquery)

addField(field: "customerAccessToken", aliasSuffix: alias, subfields: subquery)
return self
}

/// List of errors that occurred executing the mutation.
@discardableResult
open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CustomerActivatePayloadQuery {
Expand All @@ -64,6 +74,13 @@ extension Storefront {
}
return try Customer(fields: value)

case "customerAccessToken":
if value is NSNull { return nil }
guard let value = value as? [String: Any] else {
throw SchemaViolationError(type: CustomerActivatePayload.self, field: fieldName, value: fieldValue)
}
return try CustomerAccessToken(fields: value)

case "userErrors":
guard let value = value as? [[String: Any]] else {
throw SchemaViolationError(type: CustomerActivatePayload.self, field: fieldName, value: fieldValue)
Expand All @@ -84,6 +101,15 @@ extension Storefront {
return field(field: "customer", aliasSuffix: alias) as! Storefront.Customer?
}

/// A newly created customer access token object for the customer.
open var customerAccessToken: Storefront.CustomerAccessToken? {
return internalGetCustomerAccessToken()
}

func internalGetCustomerAccessToken(alias: String? = nil) -> Storefront.CustomerAccessToken? {
return field(field: "customerAccessToken", aliasSuffix: alias) as! Storefront.CustomerAccessToken?
}

/// List of errors that occurred executing the mutation.
open var userErrors: [Storefront.UserError] {
return internalGetUserErrors()
Expand All @@ -103,6 +129,12 @@ extension Storefront {
response.append(contentsOf: value.childResponseObjectMap())
}

case "customerAccessToken":
if let value = internalGetCustomerAccessToken() {
response.append(value)
response.append(contentsOf: value.childResponseObjectMap())
}

case "userErrors":
internalGetUserErrors().forEach {
response.append($0)
Expand Down
Loading

0 comments on commit cde0450

Please sign in to comment.