Skip to content

Commit

Permalink
Merge pull request #1210 from Shopify/release/2023-07-auto-generated
Browse files Browse the repository at this point in the history
Update Schema to `2023-07` Release
  • Loading branch information
cocoahero authored Jul 5, 2023
2 parents a6e31d6 + aa1c2fd commit e6e85dc
Show file tree
Hide file tree
Showing 95 changed files with 2,457 additions and 180 deletions.
128 changes: 128 additions & 0 deletions Buy.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Buy/Generated/Storefront.Schema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@

extension Storefront {
enum Schema {
static let version = "2023-04"
static let version = "2023-07"
}
}
4 changes: 2 additions & 2 deletions Buy/Generated/Storefront/AppliedGiftCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extension Storefront {
return self
}

/// A globally-unique identifier.
/// A globally-unique ID.
@discardableResult
open func id(alias: String? = nil) -> AppliedGiftCardQuery {
addField(field: "id", aliasSuffix: alias)
Expand Down Expand Up @@ -190,7 +190,7 @@ extension Storefront {
return field(field: "balanceV2", aliasSuffix: alias) as! Storefront.MoneyV2
}

/// A globally-unique identifier.
/// A globally-unique ID.
open var id: GraphQL.ID {
return internalGetId()
}
Expand Down
31 changes: 28 additions & 3 deletions Buy/Generated/Storefront/Article.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ extension Storefront {
return self
}

/// A globally-unique identifier.
/// A globally-unique ID.
@discardableResult
open func id(alias: String? = nil) -> ArticleQuery {
addField(field: "id", aliasSuffix: alias)
Expand Down Expand Up @@ -264,10 +264,18 @@ extension Storefront {
addField(field: "title", aliasSuffix: alias)
return self
}

/// A URL parameters to be added to a page URL when it is linked from a GraphQL
/// result. This allows for tracking the origin of the traffic.
@discardableResult
open func trackingParameters(alias: String? = nil) -> ArticleQuery {
addField(field: "trackingParameters", aliasSuffix: alias)
return self
}
}

/// An article in an online store blog.
open class Article: GraphQL.AbstractResponse, GraphQLObject, HasMetafields, MetafieldParentResource, Node, OnlineStorePublishable {
open class Article: GraphQL.AbstractResponse, GraphQLObject, HasMetafields, MenuItemResource, MetafieldParentResource, Node, OnlineStorePublishable, SearchResultItem, Trackable {
public typealias Query = ArticleQuery

internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? {
Expand Down Expand Up @@ -392,6 +400,13 @@ extension Storefront {
}
return value

case "trackingParameters":
if value is NSNull { return nil }
guard let value = value as? String else {
throw SchemaViolationError(type: Article.self, field: fieldName, value: fieldValue)
}
return value

default:
throw SchemaViolationError(type: Article.self, field: fieldName, value: fieldValue)
}
Expand Down Expand Up @@ -492,7 +507,7 @@ extension Storefront {
return field(field: "handle", aliasSuffix: alias) as! String
}

/// A globally-unique identifier.
/// A globally-unique ID.
open var id: GraphQL.ID {
return internalGetId()
}
Expand Down Expand Up @@ -584,6 +599,16 @@ extension Storefront {
return field(field: "title", aliasSuffix: alias) as! String
}

/// A URL parameters to be added to a page URL when it is linked from a GraphQL
/// result. This allows for tracking the origin of the traffic.
open var trackingParameters: String? {
return internalGetTrackingParameters()
}

func internalGetTrackingParameters(alias: String? = nil) -> String? {
return field(field: "trackingParameters", aliasSuffix: alias) as! String?
}

internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] {
var response: [GraphQL.AbstractResponse] = []
objectMap.keys.forEach {
Expand Down
2 changes: 1 addition & 1 deletion Buy/Generated/Storefront/AttributeInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import Foundation

extension Storefront {
/// Specifies the input fields required for an attribute.
/// The input fields for an attribute.
open class AttributeInput {
/// Key or name of the attribute.
open var key: String
Expand Down
15 changes: 13 additions & 2 deletions Buy/Generated/Storefront/BaseCartLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extension Storefront {
return self
}

/// A globally-unique identifier.
/// A globally-unique ID.
@discardableResult
open func id(alias: String? = nil) -> BaseCartLineQuery {
addField(field: "id", aliasSuffix: alias)
Expand Down Expand Up @@ -167,6 +167,15 @@ extension Storefront {
addInlineFragment(on: "CartLine", subfields: subquery)
return self
}

/// Represents a cart line common fields.
@discardableResult
open func onComponentizableCartLine(subfields: (ComponentizableCartLineQuery) -> Void) -> BaseCartLineQuery {
let subquery = ComponentizableCartLineQuery()
subfields(subquery)
addInlineFragment(on: "ComponentizableCartLine", subfields: subquery)
return self
}
}

/// Represents a cart line common fields.
Expand Down Expand Up @@ -244,6 +253,8 @@ extension Storefront {
switch typeName {
case "CartLine": return try CartLine.init(fields: fields)

case "ComponentizableCartLine": return try ComponentizableCartLine.init(fields: fields)

default:
return try UnknownBaseCartLine.init(fields: fields)
}
Expand Down Expand Up @@ -303,7 +314,7 @@ extension Storefront {
return field(field: "estimatedCost", aliasSuffix: alias) as! Storefront.CartLineEstimatedCost
}

/// A globally-unique identifier.
/// A globally-unique ID.
open var id: GraphQL.ID {
return internalGetId()
}
Expand Down
6 changes: 3 additions & 3 deletions Buy/Generated/Storefront/Blog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ extension Storefront {
return self
}

/// A globally-unique identifier.
/// A globally-unique ID.
@discardableResult
open func id(alias: String? = nil) -> BlogQuery {
addField(field: "id", aliasSuffix: alias)
Expand Down Expand Up @@ -209,7 +209,7 @@ extension Storefront {
}

/// An online store blog.
open class Blog: GraphQL.AbstractResponse, GraphQLObject, HasMetafields, MetafieldParentResource, Node, OnlineStorePublishable {
open class Blog: GraphQL.AbstractResponse, GraphQLObject, HasMetafields, MenuItemResource, MetafieldParentResource, Node, OnlineStorePublishable {
public typealias Query = BlogQuery

internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? {
Expand Down Expand Up @@ -333,7 +333,7 @@ extension Storefront {
return field(field: "handle", aliasSuffix: alias) as! String
}

/// A globally-unique identifier.
/// A globally-unique ID.
open var id: GraphQL.ID {
return internalGetId()
}
Expand Down
6 changes: 4 additions & 2 deletions Buy/Generated/Storefront/Brand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import Foundation

extension Storefront {
/// The store's branding configuration.
/// The store's [branding
/// configuration](https://help.shopify.com/en/manual/promoting-marketing/managing-brand-assets).
open class BrandQuery: GraphQL.AbstractQuery, GraphQLQuery {
public typealias Response = Brand

Expand Down Expand Up @@ -86,7 +87,8 @@ extension Storefront {
}
}

/// The store's branding configuration.
/// The store's [branding
/// configuration](https://help.shopify.com/en/manual/promoting-marketing/managing-brand-assets).
open class Brand: GraphQL.AbstractResponse, GraphQLObject {
public typealias Query = BrandQuery

Expand Down
4 changes: 2 additions & 2 deletions Buy/Generated/Storefront/Cart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ extension Storefront {
return self
}

/// A globally-unique identifier.
/// A globally-unique ID.
@discardableResult
open func id(alias: String? = nil) -> CartQuery {
addField(field: "id", aliasSuffix: alias)
Expand Down Expand Up @@ -531,7 +531,7 @@ extension Storefront {
return field(field: "estimatedCost", aliasSuffix: alias) as! Storefront.CartEstimatedCost
}

/// A globally-unique identifier.
/// A globally-unique ID.
open var id: GraphQL.ID {
return internalGetId()
}
Expand Down
6 changes: 3 additions & 3 deletions Buy/Generated/Storefront/CartBuyerIdentityInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension Storefront {

/// A set of wallet preferences tied to the buyer that is interacting with the
/// cart. Preferences can be used to populate relevant payment fields in the
/// checkout flow.
/// checkout flow. Accepted value: `["shop_pay"]`.
open var walletPreferences: Input<[String]>

/// Creates the input object.
Expand All @@ -63,7 +63,7 @@ extension Storefront {
/// - countryCode: The country where the buyer is located.
/// - customerAccessToken: The access token used to identify the customer associated with the cart.
/// - deliveryAddressPreferences: An ordered set of delivery addresses tied to the buyer that is interacting with the cart. The rank of the preferences is determined by the order of the addresses in the array. Preferences can be used to populate relevant fields in the checkout flow.
/// - walletPreferences: A set of wallet preferences tied to the buyer that is interacting with the cart. Preferences can be used to populate relevant payment fields in the checkout flow.
/// - walletPreferences: A set of wallet preferences tied to the buyer that is interacting with the cart. Preferences can be used to populate relevant payment fields in the checkout flow. Accepted value: `["shop_pay"]`.
///
public static func create(email: Input<String> = .undefined, phone: Input<String> = .undefined, countryCode: Input<CountryCode> = .undefined, customerAccessToken: Input<String> = .undefined, deliveryAddressPreferences: Input<[DeliveryAddressInput]> = .undefined, walletPreferences: Input<[String]> = .undefined) -> CartBuyerIdentityInput {
return CartBuyerIdentityInput(email: email, phone: phone, countryCode: countryCode, customerAccessToken: customerAccessToken, deliveryAddressPreferences: deliveryAddressPreferences, walletPreferences: walletPreferences)
Expand All @@ -86,7 +86,7 @@ extension Storefront {
/// - countryCode: The country where the buyer is located.
/// - customerAccessToken: The access token used to identify the customer associated with the cart.
/// - deliveryAddressPreferences: An ordered set of delivery addresses tied to the buyer that is interacting with the cart. The rank of the preferences is determined by the order of the addresses in the array. Preferences can be used to populate relevant fields in the checkout flow.
/// - walletPreferences: A set of wallet preferences tied to the buyer that is interacting with the cart. Preferences can be used to populate relevant payment fields in the checkout flow.
/// - walletPreferences: A set of wallet preferences tied to the buyer that is interacting with the cart. Preferences can be used to populate relevant payment fields in the checkout flow. Accepted value: `["shop_pay"]`.
///
@available(*, deprecated, message: "Use the static create() method instead.")
public convenience init(email: String? = nil, phone: String? = nil, countryCode: CountryCode? = nil, customerAccessToken: String? = nil, deliveryAddressPreferences: [DeliveryAddressInput]? = nil, walletPreferences: [String]? = nil) {
Expand Down
38 changes: 38 additions & 0 deletions Buy/Generated/Storefront/CartCardSource.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// CartCardSource.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 {
/// Represents how credit card details are provided for a direct payment.
public enum CartCardSource: String {
/// The credit card was provided by a third party and vaulted on their system.
/// Using this value requires a separate permission from Shopify.
case savedCreditCard = "SAVED_CREDIT_CARD"

case unknownValue = ""
}
}
31 changes: 26 additions & 5 deletions Buy/Generated/Storefront/CartDirectPaymentMethodInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,36 @@ extension Storefront {
/// The session ID for the direct payment method used to create the payment.
open var sessionId: String

/// The source of the credit card payment.
open var cardSource: Input<CartCardSource>

/// Creates the input object.
///
/// - parameters:
/// - billingAddress: The customer's billing address.
/// - sessionId: The session ID for the direct payment method used to create the payment.
/// - cardSource: The source of the credit card payment.
///
public static func create(billingAddress: MailingAddressInput, sessionId: String) -> CartDirectPaymentMethodInput {
return CartDirectPaymentMethodInput(billingAddress: billingAddress, sessionId: sessionId)
public static func create(billingAddress: MailingAddressInput, sessionId: String, cardSource: Input<CartCardSource> = .undefined) -> CartDirectPaymentMethodInput {
return CartDirectPaymentMethodInput(billingAddress: billingAddress, sessionId: sessionId, cardSource: cardSource)
}

private init(billingAddress: MailingAddressInput, sessionId: String, cardSource: Input<CartCardSource> = .undefined) {
self.billingAddress = billingAddress
self.sessionId = sessionId
self.cardSource = cardSource
}

/// Creates the input object.
///
/// - parameters:
/// - billingAddress: The customer's billing address.
/// - sessionId: The session ID for the direct payment method used to create the payment.
/// - cardSource: The source of the credit card payment.
///
public init(billingAddress: MailingAddressInput, sessionId: String) {
self.billingAddress = billingAddress
self.sessionId = sessionId
@available(*, deprecated, message: "Use the static create() method instead.")
public convenience init(billingAddress: MailingAddressInput, sessionId: String, cardSource: CartCardSource? = nil) {
self.init(billingAddress: billingAddress, sessionId: sessionId, cardSource: cardSource.orUndefined)
}

internal func serialize() -> String {
Expand All @@ -64,6 +75,16 @@ extension Storefront {

fields.append("sessionId:\(GraphQL.quoteString(input: sessionId))")

switch cardSource {
case .value(let cardSource):
guard let cardSource = cardSource else {
fields.append("cardSource:null")
break
}
fields.append("cardSource:\(cardSource.rawValue)")
case .undefined: break
}

return "{\(fields.joined(separator: ","))}"
}
}
Expand Down
2 changes: 1 addition & 1 deletion Buy/Generated/Storefront/CartInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import Foundation

extension Storefront {
/// Specifies the input fields to create a cart.
/// The input fields to create a cart.
open class CartInput {
/// An array of key-value pairs that contains additional information about the
/// cart.
Expand Down
2 changes: 1 addition & 1 deletion Buy/Generated/Storefront/CartInputMetafieldInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import Foundation

extension Storefront {
/// Specifies the input fields for a cart metafield value to set.
/// The input fields for a cart metafield value to set.
open class CartInputMetafieldInput {
/// The key name of the metafield.
open var key: String
Expand Down
4 changes: 2 additions & 2 deletions Buy/Generated/Storefront/CartLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ extension Storefront {
return self
}

/// A globally-unique identifier.
/// A globally-unique ID.
@discardableResult
open func id(alias: String? = nil) -> CartLineQuery {
addField(field: "id", aliasSuffix: alias)
Expand Down Expand Up @@ -254,7 +254,7 @@ extension Storefront {
return field(field: "estimatedCost", aliasSuffix: alias) as! Storefront.CartLineEstimatedCost
}

/// A globally-unique identifier.
/// A globally-unique ID.
open var id: GraphQL.ID {
return internalGetId()
}
Expand Down
Loading

0 comments on commit e6e85dc

Please sign in to comment.