From 68712833b95a46b9ca2097698f8120f96b48bc61 Mon Sep 17 00:00:00 2001 From: Steve Streza Date: Wed, 14 Aug 2024 15:48:19 -0700 Subject: [PATCH] Update GraphQL schema to use flags for PPO items --- KsApi/GraphAPI.swift | 81 +++- KsApi/fragments/PPOCardFragment.graphql | 6 +- KsApi/graphql-schema.json | 562 +++++++++++++++++------- 3 files changed, 477 insertions(+), 172 deletions(-) diff --git a/KsApi/GraphAPI.swift b/KsApi/GraphAPI.swift index 2f387acb17..7d7677532e 100644 --- a/KsApi/GraphAPI.swift +++ b/KsApi/GraphAPI.swift @@ -14947,7 +14947,12 @@ public enum GraphAPI { ...PPOBackingFragment } tierType - tags + flags { + __typename + icon + message + type + } } """ @@ -14958,7 +14963,7 @@ public enum GraphAPI { GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("backing", type: .object(Backing.selections)), GraphQLField("tierType", type: .scalar(String.self)), - GraphQLField("tags", type: .list(.nonNull(.scalar(String.self)))), + GraphQLField("flags", type: .list(.nonNull(.object(Flag.selections)))), ] } @@ -14968,8 +14973,8 @@ public enum GraphAPI { self.resultMap = unsafeResultMap } - public init(backing: Backing? = nil, tierType: String? = nil, tags: [String]? = nil) { - self.init(unsafeResultMap: ["__typename": "PledgeProjectOverviewItem", "backing": backing.flatMap { (value: Backing) -> ResultMap in value.resultMap }, "tierType": tierType, "tags": tags]) + public init(backing: Backing? = nil, tierType: String? = nil, flags: [Flag]? = nil) { + self.init(unsafeResultMap: ["__typename": "PledgeProjectOverviewItem", "backing": backing.flatMap { (value: Backing) -> ResultMap in value.resultMap }, "tierType": tierType, "flags": flags.flatMap { (value: [Flag]) -> [ResultMap] in value.map { (value: Flag) -> ResultMap in value.resultMap } }]) } public var __typename: String { @@ -15002,12 +15007,12 @@ public enum GraphAPI { } /// tags - public var tags: [String]? { + public var flags: [Flag]? { get { - return resultMap["tags"] as? [String] + return (resultMap["flags"] as? [ResultMap]).flatMap { (value: [ResultMap]) -> [Flag] in value.map { (value: ResultMap) -> Flag in Flag(unsafeResultMap: value) } } } set { - resultMap.updateValue(newValue, forKey: "tags") + resultMap.updateValue(newValue.flatMap { (value: [Flag]) -> [ResultMap] in value.map { (value: Flag) -> ResultMap in value.resultMap } }, forKey: "flags") } } @@ -15062,6 +15067,68 @@ public enum GraphAPI { } } } + + public struct Flag: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["PledgedProjectsOverviewPledgeFlags"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("icon", type: .scalar(String.self)), + GraphQLField("message", type: .scalar(String.self)), + GraphQLField("type", type: .scalar(String.self)), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(icon: String? = nil, message: String? = nil, type: String? = nil) { + self.init(unsafeResultMap: ["__typename": "PledgedProjectsOverviewPledgeFlags", "icon": icon, "message": message, "type": type]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + /// Flag icon type, e.g. time, alert, etc. + public var icon: String? { + get { + return resultMap["icon"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "icon") + } + } + + /// Translated flag message + public var message: String? { + get { + return resultMap["message"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "message") + } + } + + /// Flag type, e.g. warning, alert, etc. + public var type: String? { + get { + return resultMap["type"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "type") + } + } + } } public struct PpoProjectFragment: GraphQLFragment { diff --git a/KsApi/fragments/PPOCardFragment.graphql b/KsApi/fragments/PPOCardFragment.graphql index 6b972fbbf4..2ddd11ed7a 100644 --- a/KsApi/fragments/PPOCardFragment.graphql +++ b/KsApi/fragments/PPOCardFragment.graphql @@ -3,5 +3,9 @@ fragment PPOCardFragment on PledgeProjectOverviewItem { ...PPOBackingFragment } tierType - tags + flags { + icon + message + type + } } diff --git a/KsApi/graphql-schema.json b/KsApi/graphql-schema.json index eec5da0c74..7693fbff09 100644 --- a/KsApi/graphql-schema.json +++ b/KsApi/graphql-schema.json @@ -3288,6 +3288,22 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "shippingRatesValid", + "description": "Whether the shipping rates are filled out and not missing fields", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ShippingRateValidation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "shippingRules", "description": "Shipping rules defined by the creator for this reward", @@ -4341,6 +4357,22 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "taxConfigCompletionStatus", + "description": "Whether the item is completely configured for tax purposes", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PrereqCompletionStatus", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -5725,22 +5757,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "hasItemQuestionsOrOptions", - "description": "Whether or not the project has at least one item-level question or option", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "hasPostCampaignConfig", "description": "Does this project have any post-campaign config?", @@ -5805,22 +5821,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "hasSurveyQuestionsOrSelections", - "description": "Whether or not the project has at least one item-level question, item-level option selection, or project-level question", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "id", "description": null, @@ -13641,6 +13641,12 @@ "description": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "creator_nav_refresh", + "description": null, + "isDeprecated": false, + "deprecationReason": null } ], "possibleTypes": null @@ -18161,6 +18167,38 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "hasBackerQuestionsOrItemOptions", + "description": "Whether the survey has at least one question or option", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasItemQuestionsOrOptions", + "description": "Whether the survey has at least one item-level question or option", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "id", "description": null, @@ -26694,18 +26732,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "item", - "description": "The associated item", - "args": [], - "type": { - "kind": "OBJECT", - "name": "RewardItem", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "marketValue", "description": "Value of item pre any bundling discounts", @@ -26736,6 +26762,35 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "ENUM", + "name": "PrereqCompletionStatus", + "description": "Completion status of objects necessary for pledge redemption", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "not_started", + "description": "Prereq has not been started", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "incomplete", + "description": "Prereq has been started but is not complete", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "complete", + "description": "Prereq is complete", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, { "kind": "ENUM", "name": "RewardType", @@ -26890,6 +26945,35 @@ } ] }, + { + "kind": "ENUM", + "name": "ShippingRateValidation", + "description": "Validation State of shipping rates for a reward", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "not_started", + "description": "Shipping rates have not been defined", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "incomplete", + "description": "Some shipping rates are invalid or are missing data", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "complete", + "description": "All shipping rates are valid", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, { "kind": "OBJECT", "name": "ShippingRule", @@ -27398,8 +27482,32 @@ "description": "A cart associated with a backing", "fields": [ { - "name": "answers", - "description": "The answers to project-level survey questions", + "name": "backingRewardAnswers", + "description": "Answers associated with a cart's backing rewards", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Answer", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "baseRewardAnswers", + "description": "The answers to reward-level questions", "args": [], "type": { "kind": "NON_NULL", @@ -27473,6 +27581,30 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "projectAnswers", + "description": "The answers to project-level questions", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Answer", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "shouldCollectAddress", "description": "Whether or not this cart needs an address to be finalized", @@ -32769,7 +32901,7 @@ "deprecationReason": null }, { - "name": "tags", + "name": "flags", "description": "tags", "args": [], "type": { @@ -32779,8 +32911,8 @@ "kind": "NON_NULL", "name": null, "ofType": { - "kind": "SCALAR", - "name": "String", + "kind": "OBJECT", + "name": "PledgedProjectsOverviewPledgeFlags", "ofType": null } } @@ -32806,6 +32938,53 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "PledgedProjectsOverviewPledgeFlags", + "description": "Flags for pledge in projects overview dashboard", + "fields": [ + { + "name": "icon", + "description": "Flag icon type, e.g. time, alert, etc.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "Translated flag message", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "Flag type, e.g. warning, alert, etc.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "ENUM", "name": "GoalBuckets", @@ -36001,33 +36180,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "removeTaxCategory", - "description": "Removes tax category from item tax config.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "RemoveTaxCategoryInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "RemoveTaxCategoryPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "reportSpam", "description": null, @@ -36352,6 +36504,33 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "setTaxCategory", + "description": "Sets tax category for an item", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "SetTaxCategoryInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "SetTaxCategoryPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "signInWithApple", "description": "Signs in or sign up a user via the Sign in With Apple service", @@ -46980,94 +47159,6 @@ "enumValues": null, "possibleTypes": null }, - { - "kind": "INPUT_OBJECT", - "name": "RemoveTaxCategoryInput", - "description": "Autogenerated input type of RemoveTaxCategory", - "fields": null, - "inputFields": [ - { - "name": "taxCategoryId", - "description": "The tax cateogry id", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "itemId", - "description": "The item id", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RemoveTaxCategoryPayload", - "description": "Autogenerated return type of RemoveTaxCategory", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "success", - "description": "Succeeds if tax category is deleted.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, { "kind": "INPUT_OBJECT", "name": "ReportSpamInput", @@ -48210,6 +48301,139 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "INPUT_OBJECT", + "name": "SetTaxCategoryInput", + "description": "Autogenerated input type of SetTaxCategory", + "fields": null, + "inputFields": [ + { + "name": "itemId", + "description": "The item id", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "taxCategoryId", + "description": "The tax category id", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "taxCategoryInput", + "description": "Input for creating or updating a tax category", + "type": { + "kind": "INPUT_OBJECT", + "name": "TaxCategoryInput", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "TaxCategoryInput", + "description": "Input to create or update a tax category", + "fields": null, + "inputFields": [ + { + "name": "userLabel", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "taxCode", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SetTaxCategoryPayload", + "description": "Autogenerated return type of SetTaxCategory", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "itemTaxConfig", + "description": "The updated item tax config", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ItemTaxConfig", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "SignInWithAppleInput", @@ -48683,6 +48907,16 @@ } }, "defaultValue": null + }, + { + "name": "answerableId", + "description": null, + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null } ], "interfaces": null,