Skip to content

Commit

Permalink
Expose EstimatedMin and EstimatedMax in ShippingRule Fragment (#2116)
Browse files Browse the repository at this point in the history
* expose estimatedMin and estimatedMax in ShippingRule fragment

* fix KsApi tests

* fix library tests
  • Loading branch information
scottkicks authored Aug 14, 2024
1 parent 6a3b3f5 commit 3e1fbe1
Show file tree
Hide file tree
Showing 13 changed files with 815 additions and 38 deletions.
138 changes: 136 additions & 2 deletions KsApi/GraphAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17835,6 +17835,16 @@ public enum GraphAPI {
__typename
...LocationFragment
}
estimatedMin {
__typename
amount
currency
}
estimatedMax {
__typename
amount
currency
}
}
"""

Expand All @@ -17846,6 +17856,8 @@ public enum GraphAPI {
GraphQLField("cost", type: .object(Cost.selections)),
GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
GraphQLField("location", type: .nonNull(.object(Location.selections))),
GraphQLField("estimatedMin", type: .object(EstimatedMin.selections)),
GraphQLField("estimatedMax", type: .object(EstimatedMax.selections)),
]
}

Expand All @@ -17855,8 +17867,8 @@ public enum GraphAPI {
self.resultMap = unsafeResultMap
}

public init(cost: Cost? = nil, id: GraphQLID, location: Location) {
self.init(unsafeResultMap: ["__typename": "ShippingRule", "cost": cost.flatMap { (value: Cost) -> ResultMap in value.resultMap }, "id": id, "location": location.resultMap])
public init(cost: Cost? = nil, id: GraphQLID, location: Location, estimatedMin: EstimatedMin? = nil, estimatedMax: EstimatedMax? = nil) {
self.init(unsafeResultMap: ["__typename": "ShippingRule", "cost": cost.flatMap { (value: Cost) -> ResultMap in value.resultMap }, "id": id, "location": location.resultMap, "estimatedMin": estimatedMin.flatMap { (value: EstimatedMin) -> ResultMap in value.resultMap }, "estimatedMax": estimatedMax.flatMap { (value: EstimatedMax) -> ResultMap in value.resultMap }])
}

public var __typename: String {
Expand Down Expand Up @@ -17897,6 +17909,26 @@ public enum GraphAPI {
}
}

/// The estimated minimum shipping cost
public var estimatedMin: EstimatedMin? {
get {
return (resultMap["estimatedMin"] as? ResultMap).flatMap { EstimatedMin(unsafeResultMap: $0) }
}
set {
resultMap.updateValue(newValue?.resultMap, forKey: "estimatedMin")
}
}

/// The estimated maximum shipping cost
public var estimatedMax: EstimatedMax? {
get {
return (resultMap["estimatedMax"] as? ResultMap).flatMap { EstimatedMax(unsafeResultMap: $0) }
}
set {
resultMap.updateValue(newValue?.resultMap, forKey: "estimatedMax")
}
}

public struct Cost: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Money"]

Expand Down Expand Up @@ -18008,6 +18040,108 @@ public enum GraphAPI {
}
}
}

public struct EstimatedMin: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Money"]

public static var selections: [GraphQLSelection] {
return [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("amount", type: .scalar(String.self)),
GraphQLField("currency", type: .scalar(CurrencyCode.self)),
]
}

public private(set) var resultMap: ResultMap

public init(unsafeResultMap: ResultMap) {
self.resultMap = unsafeResultMap
}

public init(amount: String? = nil, currency: CurrencyCode? = nil) {
self.init(unsafeResultMap: ["__typename": "Money", "amount": amount, "currency": currency])
}

public var __typename: String {
get {
return resultMap["__typename"]! as! String
}
set {
resultMap.updateValue(newValue, forKey: "__typename")
}
}

/// Floating-point numeric value of monetary amount represented as a string
public var amount: String? {
get {
return resultMap["amount"] as? String
}
set {
resultMap.updateValue(newValue, forKey: "amount")
}
}

/// Currency of the monetary amount
public var currency: CurrencyCode? {
get {
return resultMap["currency"] as? CurrencyCode
}
set {
resultMap.updateValue(newValue, forKey: "currency")
}
}
}

public struct EstimatedMax: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Money"]

public static var selections: [GraphQLSelection] {
return [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("amount", type: .scalar(String.self)),
GraphQLField("currency", type: .scalar(CurrencyCode.self)),
]
}

public private(set) var resultMap: ResultMap

public init(unsafeResultMap: ResultMap) {
self.resultMap = unsafeResultMap
}

public init(amount: String? = nil, currency: CurrencyCode? = nil) {
self.init(unsafeResultMap: ["__typename": "Money", "amount": amount, "currency": currency])
}

public var __typename: String {
get {
return resultMap["__typename"]! as! String
}
set {
resultMap.updateValue(newValue, forKey: "__typename")
}
}

/// Floating-point numeric value of monetary amount represented as a string
public var amount: String? {
get {
return resultMap["amount"] as? String
}
set {
resultMap.updateValue(newValue, forKey: "amount")
}
}

/// Currency of the monetary amount
public var currency: CurrencyCode? {
get {
return resultMap["currency"] as? CurrencyCode
}
set {
resultMap.updateValue(newValue, forKey: "currency")
}
}
}
}

public struct UserEmailFragment: GraphQLFragment {
Expand Down
8 changes: 8 additions & 0 deletions KsApi/fragments/ShippingRuleFragment.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ fragment ShippingRuleFragment on ShippingRule {
location {
...LocationFragment
}
estimatedMin {
amount
currency
}
estimatedMax {
amount
currency
}
}
Loading

0 comments on commit 3e1fbe1

Please sign in to comment.