Skip to content

Commit

Permalink
Merge pull request #1175 from Shopify/release/2022-04-auto-generated
Browse files Browse the repository at this point in the history
Update Schema to `2022-04` Release
  • Loading branch information
cocoahero authored Apr 4, 2022
2 parents c90b246 + c70d1dc commit 62d2bc0
Show file tree
Hide file tree
Showing 73 changed files with 3,393 additions and 255 deletions.
88 changes: 88 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 = "2022-01"
static let version = "2022-04"
}
}
31 changes: 31 additions & 0 deletions Buy/Generated/Storefront/ArticleConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ extension Storefront {
return self
}

/// A list of the nodes contained in ArticleEdge.
@discardableResult
open func nodes(alias: String? = nil, _ subfields: (ArticleQuery) -> Void) -> ArticleConnectionQuery {
let subquery = ArticleQuery()
subfields(subquery)

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

/// Information to aid in pagination.
@discardableResult
open func pageInfo(alias: String? = nil, _ subfields: (PageInfoQuery) -> Void) -> ArticleConnectionQuery {
Expand All @@ -65,6 +75,12 @@ extension Storefront {
}
return try value.map { return try ArticleEdge(fields: $0) }

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

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

/// A list of the nodes contained in ArticleEdge.
open var nodes: [Storefront.Article] {
return internalGetNodes()
}

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

/// Information to aid in pagination.
open var pageInfo: Storefront.PageInfo {
return internalGetPageInfo()
Expand All @@ -104,6 +129,12 @@ extension Storefront {
response.append(contentsOf: $0.childResponseObjectMap())
}

case "nodes":
internalGetNodes().forEach {
response.append($0)
response.append(contentsOf: $0.childResponseObjectMap())
}

case "pageInfo":
response.append(internalGetPageInfo())
response.append(contentsOf: internalGetPageInfo().childResponseObjectMap())
Expand Down
7 changes: 3 additions & 4 deletions Buy/Generated/Storefront/ArticleSortKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ extension Storefront {
/// Sort by the `published_at` value.
case publishedAt = "PUBLISHED_AT"

/// 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.
/// Sort by relevance to the search terms when the `query` parameter is
/// specified on the connection. Don't use this sort key when no search query
/// is specified.
case relevance = "RELEVANCE"

/// Sort by the `title` value.
Expand Down
31 changes: 31 additions & 0 deletions Buy/Generated/Storefront/BlogConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ extension Storefront {
return self
}

/// A list of the nodes contained in BlogEdge.
@discardableResult
open func nodes(alias: String? = nil, _ subfields: (BlogQuery) -> Void) -> BlogConnectionQuery {
let subquery = BlogQuery()
subfields(subquery)

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

/// Information to aid in pagination.
@discardableResult
open func pageInfo(alias: String? = nil, _ subfields: (PageInfoQuery) -> Void) -> BlogConnectionQuery {
Expand All @@ -65,6 +75,12 @@ extension Storefront {
}
return try value.map { return try BlogEdge(fields: $0) }

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

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

/// A list of the nodes contained in BlogEdge.
open var nodes: [Storefront.Blog] {
return internalGetNodes()
}

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

/// Information to aid in pagination.
open var pageInfo: Storefront.PageInfo {
return internalGetPageInfo()
Expand All @@ -104,6 +129,12 @@ extension Storefront {
response.append(contentsOf: $0.childResponseObjectMap())
}

case "nodes":
internalGetNodes().forEach {
response.append($0)
response.append(contentsOf: $0.childResponseObjectMap())
}

case "pageInfo":
response.append(internalGetPageInfo())
response.append(contentsOf: internalGetPageInfo().childResponseObjectMap())
Expand Down
7 changes: 3 additions & 4 deletions Buy/Generated/Storefront/BlogSortKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ extension Storefront {
/// 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.
/// Sort by relevance to the search terms when the `query` parameter is
/// specified on the connection. Don't use this sort key when no search query
/// is specified.
case relevance = "RELEVANCE"

/// Sort by the `title` value.
Expand Down
85 changes: 79 additions & 6 deletions Buy/Generated/Storefront/Cart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import Foundation
extension Storefront {
/// A cart represents the merchandise that a buyer intends to purchase, and the
/// estimated cost associated with the cart. To learn how to interact with a
/// cart during a customer's session, refer to the [Cart
/// guide](https://shopify.dev/custom-storefronts/cart).
/// cart during a customer's session, refer to [Manage a cart with the
/// Storefront API](https://shopify.dev/api/examples/cart).
open class CartQuery: GraphQL.AbstractQuery, GraphQLQuery {
public typealias Response = Cart

Expand Down Expand Up @@ -69,6 +69,49 @@ extension Storefront {
return self
}

/// The delivery groups available for the cart, based on the default address of
/// the logged-in customer.
///
/// - 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.
///
@discardableResult
open func deliveryGroups(alias: String? = nil, first: Int32? = nil, after: String? = nil, last: Int32? = nil, before: String? = nil, reverse: Bool? = nil, _ subfields: (CartDeliveryGroupConnectionQuery) -> Void) -> CartQuery {
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)")
}

let argsString: String? = args.isEmpty ? nil : "(\(args.joined(separator: ",")))"

let subquery = CartDeliveryGroupConnectionQuery()
subfields(subquery)

addField(field: "deliveryGroups", aliasSuffix: alias, args: argsString, subfields: subquery)
return self
}

/// The discount codes that have been applied to the cart.
@discardableResult
open func discountCodes(alias: String? = nil, _ subfields: (CartDiscountCodeQuery) -> Void) -> CartQuery {
Expand All @@ -80,7 +123,10 @@ extension Storefront {
}

/// The estimated costs that the buyer will pay at checkout. The estimated
/// costs are subject to change and changes will be reflected at checkout.
/// costs are subject to change and changes will be reflected at checkout. The
/// `estimatedCost` field uses the `buyerIdentity` field to determine
/// [international
/// pricing](https://shopify.dev/api/examples/international-pricing#create-a-cart).
@discardableResult
open func estimatedCost(alias: String? = nil, _ subfields: (CartEstimatedCostQuery) -> Void) -> CartQuery {
let subquery = CartEstimatedCostQuery()
Expand Down Expand Up @@ -158,8 +204,8 @@ extension Storefront {

/// A cart represents the merchandise that a buyer intends to purchase, and the
/// estimated cost associated with the cart. To learn how to interact with a
/// cart during a customer's session, refer to the [Cart
/// guide](https://shopify.dev/custom-storefronts/cart).
/// cart during a customer's session, refer to [Manage a cart with the
/// Storefront API](https://shopify.dev/api/examples/cart).
open class Cart: GraphQL.AbstractResponse, GraphQLObject, Node {
public typealias Query = CartQuery

Expand Down Expand Up @@ -190,6 +236,12 @@ extension Storefront {
}
return GraphQL.iso8601DateParser.date(from: value)!

case "deliveryGroups":
guard let value = value as? [String: Any] else {
throw SchemaViolationError(type: Cart.self, field: fieldName, value: fieldValue)
}
return try CartDeliveryGroupConnection(fields: value)

case "discountCodes":
guard let value = value as? [[String: Any]] else {
throw SchemaViolationError(type: Cart.self, field: fieldName, value: fieldValue)
Expand Down Expand Up @@ -269,6 +321,20 @@ extension Storefront {
return field(field: "createdAt", aliasSuffix: alias) as! Date
}

/// The delivery groups available for the cart, based on the default address of
/// the logged-in customer.
open var deliveryGroups: Storefront.CartDeliveryGroupConnection {
return internalGetDeliveryGroups()
}

open func aliasedDeliveryGroups(alias: String) -> Storefront.CartDeliveryGroupConnection {
return internalGetDeliveryGroups(alias: alias)
}

func internalGetDeliveryGroups(alias: String? = nil) -> Storefront.CartDeliveryGroupConnection {
return field(field: "deliveryGroups", aliasSuffix: alias) as! Storefront.CartDeliveryGroupConnection
}

/// The discount codes that have been applied to the cart.
open var discountCodes: [Storefront.CartDiscountCode] {
return internalGetDiscountCodes()
Expand All @@ -279,7 +345,10 @@ extension Storefront {
}

/// The estimated costs that the buyer will pay at checkout. The estimated
/// costs are subject to change and changes will be reflected at checkout.
/// costs are subject to change and changes will be reflected at checkout. The
/// `estimatedCost` field uses the `buyerIdentity` field to determine
/// [international
/// pricing](https://shopify.dev/api/examples/international-pricing#create-a-cart).
open var estimatedCost: Storefront.CartEstimatedCost {
return internalGetEstimatedCost()
}
Expand Down Expand Up @@ -344,6 +413,10 @@ extension Storefront {
response.append(internalGetBuyerIdentity())
response.append(contentsOf: internalGetBuyerIdentity().childResponseObjectMap())

case "deliveryGroups":
response.append(internalGetDeliveryGroups())
response.append(contentsOf: internalGetDeliveryGroups().childResponseObjectMap())

case "discountCodes":
internalGetDiscountCodes().forEach {
response.append($0)
Expand Down
4 changes: 3 additions & 1 deletion Buy/Generated/Storefront/CartBuyerIdentityInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ import Foundation

extension Storefront {
/// Specifies the input fields to update the buyer information associated with
/// a cart.
/// a cart. Buyer identity is used to determine [international
/// pricing](https://shopify.dev/api/examples/international-pricing#create-a-checkout)
/// and should match the customer's shipping address.
open class CartBuyerIdentityInput {
/// The email address of the buyer that is interacting with the cart.
open var email: Input<String>
Expand Down
Loading

0 comments on commit 62d2bc0

Please sign in to comment.