Skip to content

Commit

Permalink
[MBL-1196] Add post campaign bool to the reward fragment (#1934)
Browse files Browse the repository at this point in the history
* Add postCampaign to reward and update graphql schema

* Add postCampaignPledgingEnabled field to Reward class

* Fix tests

Update rewardTests

* Default to false if postCampaignPledgingEnabled bool isn't set
  • Loading branch information
ifosli committed Feb 7, 2024
1 parent 662f95f commit 9dd3062
Show file tree
Hide file tree
Showing 13 changed files with 432 additions and 28 deletions.
16 changes: 14 additions & 2 deletions KsApi/GraphAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14564,6 +14564,7 @@ public enum GraphAPI {
...LocationFragment
}
name
postCampaignPledgingEnabled
project {
__typename
id
Expand Down Expand Up @@ -14601,6 +14602,7 @@ public enum GraphAPI {
GraphQLField("localReceiptLocation", type: .object(LocalReceiptLocation.selections)),
]),
GraphQLField("name", type: .scalar(String.self)),
GraphQLField("postCampaignPledgingEnabled", type: .nonNull(.scalar(Bool.self))),
GraphQLField("project", type: .object(Project.selections)),
GraphQLField("remainingQuantity", type: .scalar(Int.self)),
GraphQLField("shippingPreference", type: .scalar(ShippingPreference.self)),
Expand All @@ -14618,8 +14620,8 @@ public enum GraphAPI {
self.resultMap = unsafeResultMap
}

public init(amount: Amount, backersCount: Int? = nil, convertedAmount: ConvertedAmount, allowedAddons: AllowedAddon, description: String, displayName: String, endsAt: String? = nil, estimatedDeliveryOn: String? = nil, id: GraphQLID, isMaxPledge: Bool, items: Item? = nil, limit: Int? = nil, limitPerBacker: Int? = nil, localReceiptLocation: LocalReceiptLocation? = nil, name: String? = nil, project: Project? = nil, remainingQuantity: Int? = nil, shippingPreference: ShippingPreference? = nil, shippingSummary: String? = nil, shippingRules: [ShippingRule?]? = nil, startsAt: String? = nil) {
self.init(unsafeResultMap: ["__typename": "Reward", "amount": amount.resultMap, "backersCount": backersCount, "convertedAmount": convertedAmount.resultMap, "allowedAddons": allowedAddons.resultMap, "description": description, "displayName": displayName, "endsAt": endsAt, "estimatedDeliveryOn": estimatedDeliveryOn, "id": id, "isMaxPledge": isMaxPledge, "items": items.flatMap { (value: Item) -> ResultMap in value.resultMap }, "limit": limit, "limitPerBacker": limitPerBacker, "localReceiptLocation": localReceiptLocation.flatMap { (value: LocalReceiptLocation) -> ResultMap in value.resultMap }, "name": name, "project": project.flatMap { (value: Project) -> ResultMap in value.resultMap }, "remainingQuantity": remainingQuantity, "shippingPreference": shippingPreference, "shippingSummary": shippingSummary, "shippingRules": shippingRules.flatMap { (value: [ShippingRule?]) -> [ResultMap?] in value.map { (value: ShippingRule?) -> ResultMap? in value.flatMap { (value: ShippingRule) -> ResultMap in value.resultMap } } }, "startsAt": startsAt])
public init(amount: Amount, backersCount: Int? = nil, convertedAmount: ConvertedAmount, allowedAddons: AllowedAddon, description: String, displayName: String, endsAt: String? = nil, estimatedDeliveryOn: String? = nil, id: GraphQLID, isMaxPledge: Bool, items: Item? = nil, limit: Int? = nil, limitPerBacker: Int? = nil, localReceiptLocation: LocalReceiptLocation? = nil, name: String? = nil, postCampaignPledgingEnabled: Bool, project: Project? = nil, remainingQuantity: Int? = nil, shippingPreference: ShippingPreference? = nil, shippingSummary: String? = nil, shippingRules: [ShippingRule?]? = nil, startsAt: String? = nil) {
self.init(unsafeResultMap: ["__typename": "Reward", "amount": amount.resultMap, "backersCount": backersCount, "convertedAmount": convertedAmount.resultMap, "allowedAddons": allowedAddons.resultMap, "description": description, "displayName": displayName, "endsAt": endsAt, "estimatedDeliveryOn": estimatedDeliveryOn, "id": id, "isMaxPledge": isMaxPledge, "items": items.flatMap { (value: Item) -> ResultMap in value.resultMap }, "limit": limit, "limitPerBacker": limitPerBacker, "localReceiptLocation": localReceiptLocation.flatMap { (value: LocalReceiptLocation) -> ResultMap in value.resultMap }, "name": name, "postCampaignPledgingEnabled": postCampaignPledgingEnabled, "project": project.flatMap { (value: Project) -> ResultMap in value.resultMap }, "remainingQuantity": remainingQuantity, "shippingPreference": shippingPreference, "shippingSummary": shippingSummary, "shippingRules": shippingRules.flatMap { (value: [ShippingRule?]) -> [ResultMap?] in value.map { (value: ShippingRule?) -> ResultMap? in value.flatMap { (value: ShippingRule) -> ResultMap in value.resultMap } } }, "startsAt": startsAt])
}

public var __typename: String {
Expand Down Expand Up @@ -14782,6 +14784,16 @@ public enum GraphAPI {
}
}

/// Is this reward available for post-campaign pledges?
public var postCampaignPledgingEnabled: Bool {
get {
return resultMap["postCampaignPledgingEnabled"]! as! Bool
}
set {
resultMap.updateValue(newValue, forKey: "postCampaignPledgingEnabled")
}
}

/// The project
public var project: Project? {
get {
Expand Down
1 change: 1 addition & 0 deletions KsApi/fragments/RewardFragment.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fragment RewardFragment on Reward {
...LocationFragment
}
name
postCampaignPledgingEnabled
project {
id
}
Expand Down

0 comments on commit 9dd3062

Please sign in to comment.