diff --git a/Kickstarter.xcodeproj/project.pbxproj b/Kickstarter.xcodeproj/project.pbxproj index be16406f87..cd3f0f5293 100644 --- a/Kickstarter.xcodeproj/project.pbxproj +++ b/Kickstarter.xcodeproj/project.pbxproj @@ -493,6 +493,11 @@ 6078106F2A04191C0050D4F7 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 6078106E2A04191C0050D4F7 /* FirebaseAnalytics */; }; 608E7A5328ABDBAE00289E92 /* SetYourPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 608E7A5128ABD5E700289E92 /* SetYourPasswordViewController.swift */; }; 608E7A5628ABE6CD00289E92 /* SetYourPasswordViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 608E7A5428ABE27400289E92 /* SetYourPasswordViewModel.swift */; }; + 6093098D2A6054CB004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6093098C2A6054CB004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift */; }; + 6093098F2A6054D8004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6093098E2A6054D8004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift */; }; + 609309912A60555F004297AF /* TriggerThirdPartyEventInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 609309902A60555F004297AF /* TriggerThirdPartyEventInput.swift */; }; + 609309932A605563004297AF /* TriggerThirdPartyEventInputTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 609309922A605563004297AF /* TriggerThirdPartyEventInputTests.swift */; }; + 609309952A6055A5004297AF /* TriggerThirdPartyEvent.graphql in Resources */ = {isa = PBXBuildFile; fileRef = 609309942A6055A5004297AF /* TriggerThirdPartyEvent.graphql */; }; 60DA50EB28B689A4002E2DF1 /* SetYourPasswordViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60DA50E928B68990002E2DF1 /* SetYourPasswordViewModelTests.swift */; }; 60DA50F128B6953A002E2DF1 /* SetYourPasswordViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60DA50EF28B69534002E2DF1 /* SetYourPasswordViewControllerTests.swift */; }; 60DA50FE28C38DDB002E2DF1 /* AlamofireImage in Frameworks */ = {isa = PBXBuildFile; productRef = 60DA50FD28C38DDB002E2DF1 /* AlamofireImage */; }; @@ -2070,6 +2075,11 @@ 606F2169299E8C9F00BA5CDF /* TriggerCapiEventInputTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TriggerCapiEventInputTests.swift; sourceTree = ""; }; 608E7A5128ABD5E700289E92 /* SetYourPasswordViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetYourPasswordViewController.swift; sourceTree = ""; }; 608E7A5428ABE27400289E92 /* SetYourPasswordViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetYourPasswordViewModel.swift; sourceTree = ""; }; + 6093098C2A6054CB004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift"; sourceTree = ""; }; + 6093098E2A6054D8004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift"; sourceTree = ""; }; + 609309902A60555F004297AF /* TriggerThirdPartyEventInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TriggerThirdPartyEventInput.swift; sourceTree = ""; }; + 609309922A605563004297AF /* TriggerThirdPartyEventInputTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TriggerThirdPartyEventInputTests.swift; sourceTree = ""; }; + 609309942A6055A5004297AF /* TriggerThirdPartyEvent.graphql */ = {isa = PBXFileReference; lastKnownFileType = text; path = TriggerThirdPartyEvent.graphql; sourceTree = ""; }; 60DA50E928B68990002E2DF1 /* SetYourPasswordViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetYourPasswordViewModelTests.swift; sourceTree = ""; }; 60DA50EF28B69534002E2DF1 /* SetYourPasswordViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetYourPasswordViewControllerTests.swift; sourceTree = ""; }; 60DF50962A434E6B002C771F /* DashboardDeprecationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardDeprecationView.swift; sourceTree = ""; }; @@ -5807,6 +5817,7 @@ 062868E526B999EF00EC5052 /* DeletePaymentSource.graphql */, 47D7D09526C2EA5200D2BAB5 /* SignInWithApple.graphql */, 606F2165299D456D00BA5CDF /* TriggerCapiEvent.graphql */, + 609309942A6055A5004297AF /* TriggerThirdPartyEvent.graphql */, 8AC3E0F4269F48A400168BF8 /* UpdateBacking.graphql */, 06643F3926A5FF1C002C5997 /* UpdateUserAccount.graphql */, 06C38CB826A9D13400591CED /* UpdateUserProfile.graphql */, @@ -6027,6 +6038,8 @@ 47D7D09B26C2FA5F00D2BAB5 /* GraphAPI.SignInWithAppleInput+SignInWithAppleInputTests.swift */, 606F215D299D414800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInput.swift */, 606F215A299D3EF800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInputTests.swift */, + 6093098C2A6054CB004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift */, + 6093098E2A6054D8004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift */, 8AC3E10C269F4D4000168BF8 /* GraphAPI.UpdateBackingInput+UpdateBackingInput.swift */, 8AC3E111269F4DAF00168BF8 /* GraphAPI.UpdateBackingInput+UpdateBackingInputTests.swift */, 06643F3B26A61338002C5997 /* GraphAPI.UpdateUserAccountInput+UpdateUserAccountInput.swift */, @@ -7119,6 +7132,8 @@ 77C0818D245CBA1B004ABE88 /* SignInWithAppleInputTests.swift */, 606F2167299D45F900BA5CDF /* TriggerCapiEventInput.swift */, 606F2169299E8C9F00BA5CDF /* TriggerCapiEventInputTests.swift */, + 609309902A60555F004297AF /* TriggerThirdPartyEventInput.swift */, + 609309922A605563004297AF /* TriggerThirdPartyEventInputTests.swift */, 4753C76E264DAFD300BB10B6 /* PostCommentInput.swift */, 4753C78E264EE1B100BB10B6 /* PostCommentInputTests.swift */, ); @@ -7558,6 +7573,7 @@ 06DAAE5626AA3CCB00194E58 /* LocationFragment.graphql in Resources */, 06DAAE5326AA3CC300194E58 /* RewardFragment.graphql in Resources */, 47A662F126AF1FCC001CE7B1 /* WatchProject.graphql in Resources */, + 609309952A6055A5004297AF /* TriggerThirdPartyEvent.graphql in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -8849,6 +8865,7 @@ 20EB9313266030CB004FA1C8 /* PostCommentEnvelope.swift in Sources */, D01588BD1EEB2ED7006E7684 /* ProjectStatsEnvelope.RewardDistributionLenses.swift in Sources */, D01588611EEB2ED7006E7684 /* Config.swift in Sources */, + 609309932A605563004297AF /* TriggerThirdPartyEventInputTests.swift in Sources */, D64DDCE123564D3700DE0EA9 /* PaymentSourceTemplates.swift in Sources */, D002CAE5218CF951009783F2 /* WatchProjectResponseEnvelope.swift in Sources */, D0158A1C1EEB30A2006E7684 /* ProjectNotificationTemplates.swift in Sources */, @@ -8871,6 +8888,7 @@ 8AC3E0962698CF0600168BF8 /* ShippingRule+ShippingRuleFragment.swift in Sources */, 06FE2D7726CDB01E00A4C0F4 /* MockGraphQLClient.swift in Sources */, D6C9A2541F758C7900981E64 /* GraphCategoryLenses.swift in Sources */, + 6093098F2A6054D8004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift in Sources */, D015883B1EEB2ED7006E7684 /* MimeType.swift in Sources */, D01589931EEB2ED7006E7684 /* User.swift in Sources */, D0158A271EEB30A2006E7684 /* ShippingRuleTemplates.swift in Sources */, @@ -8883,10 +8901,12 @@ 8AF34C742342CBC2000B211D /* UpdateBackingInput.swift in Sources */, 4778EE2126A200BE0059EA69 /* UserEnvelope+GraphUserEnvelope.swift in Sources */, 8ADCCCAE264C98A50079D308 /* Comment.swift in Sources */, + 609309912A60555F004297AF /* TriggerThirdPartyEventInput.swift in Sources */, D0158A2E1EEB30A2006E7684 /* User.AvatarTemplates.swift in Sources */, D01588771EEB2ED7006E7684 /* FriendStatsEnvelope.swift in Sources */, D015891D1EEB2ED7006E7684 /* ShippingRule.swift in Sources */, D67B6CD6221F468100B63A6B /* Location+Encode.swift in Sources */, + 6093098D2A6054CB004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift in Sources */, 8AC3E105269F4D1C00168BF8 /* GraphAPI.ApplePay+ApplePayParams.swift in Sources */, D01588331EEB2ED7006E7684 /* Decodable.swift in Sources */, 06232D3E2795EC2C00A81755 /* Element+Helpers.swift in Sources */, diff --git a/KsApi/GraphAPI.swift b/KsApi/GraphAPI.swift index a8e60ee14d..1c64ac40b0 100644 --- a/KsApi/GraphAPI.swift +++ b/KsApi/GraphAPI.swift @@ -754,6 +754,179 @@ public enum GraphAPI { } } + /// Autogenerated input type of TriggerThirdPartyEvent + public struct TriggerThirdPartyEventInput: GraphQLMapConvertible { + public var graphQLMap: GraphQLMap + + /// - Parameters: + /// - deviceId + /// - eventName + /// - firebaseScreen + /// - firebasePreviousScreen + /// - items + /// - projectId + /// - pledgeAmount + /// - shipping + /// - transactionId + /// - userId + /// - appData + /// - clientMutationId: A unique identifier for the client performing the mutation. + public init(deviceId: String, eventName: String, firebaseScreen: Swift.Optional = nil, firebasePreviousScreen: Swift.Optional = nil, items: Swift.Optional<[ThirdPartyEventItemInput]?> = nil, projectId: GraphQLID, pledgeAmount: Swift.Optional = nil, shipping: Swift.Optional = nil, transactionId: Swift.Optional = nil, userId: Swift.Optional = nil, appData: Swift.Optional = nil, clientMutationId: Swift.Optional = nil) { + graphQLMap = ["deviceId": deviceId, "eventName": eventName, "firebaseScreen": firebaseScreen, "firebasePreviousScreen": firebasePreviousScreen, "items": items, "projectId": projectId, "pledgeAmount": pledgeAmount, "shipping": shipping, "transactionId": transactionId, "userId": userId, "appData": appData, "clientMutationId": clientMutationId] + } + + public var deviceId: String { + get { + return graphQLMap["deviceId"] as! String + } + set { + graphQLMap.updateValue(newValue, forKey: "deviceId") + } + } + + public var eventName: String { + get { + return graphQLMap["eventName"] as! String + } + set { + graphQLMap.updateValue(newValue, forKey: "eventName") + } + } + + public var firebaseScreen: Swift.Optional { + get { + return graphQLMap["firebaseScreen"] as? Swift.Optional ?? Swift.Optional.none + } + set { + graphQLMap.updateValue(newValue, forKey: "firebaseScreen") + } + } + + public var firebasePreviousScreen: Swift.Optional { + get { + return graphQLMap["firebasePreviousScreen"] as? Swift.Optional ?? Swift.Optional.none + } + set { + graphQLMap.updateValue(newValue, forKey: "firebasePreviousScreen") + } + } + + public var items: Swift.Optional<[ThirdPartyEventItemInput]?> { + get { + return graphQLMap["items"] as? Swift.Optional<[ThirdPartyEventItemInput]?> ?? Swift.Optional<[ThirdPartyEventItemInput]?>.none + } + set { + graphQLMap.updateValue(newValue, forKey: "items") + } + } + + public var projectId: GraphQLID { + get { + return graphQLMap["projectId"] as! GraphQLID + } + set { + graphQLMap.updateValue(newValue, forKey: "projectId") + } + } + + public var pledgeAmount: Swift.Optional { + get { + return graphQLMap["pledgeAmount"] as? Swift.Optional ?? Swift.Optional.none + } + set { + graphQLMap.updateValue(newValue, forKey: "pledgeAmount") + } + } + + public var shipping: Swift.Optional { + get { + return graphQLMap["shipping"] as? Swift.Optional ?? Swift.Optional.none + } + set { + graphQLMap.updateValue(newValue, forKey: "shipping") + } + } + + public var transactionId: Swift.Optional { + get { + return graphQLMap["transactionId"] as? Swift.Optional ?? Swift.Optional.none + } + set { + graphQLMap.updateValue(newValue, forKey: "transactionId") + } + } + + public var userId: Swift.Optional { + get { + return graphQLMap["userId"] as? Swift.Optional ?? Swift.Optional.none + } + set { + graphQLMap.updateValue(newValue, forKey: "userId") + } + } + + public var appData: Swift.Optional { + get { + return graphQLMap["appData"] as? Swift.Optional ?? Swift.Optional.none + } + set { + graphQLMap.updateValue(newValue, forKey: "appData") + } + } + + /// A unique identifier for the client performing the mutation. + public var clientMutationId: Swift.Optional { + get { + return graphQLMap["clientMutationId"] as? Swift.Optional ?? Swift.Optional.none + } + set { + graphQLMap.updateValue(newValue, forKey: "clientMutationId") + } + } + } + + public struct ThirdPartyEventItemInput: GraphQLMapConvertible { + public var graphQLMap: GraphQLMap + + /// - Parameters: + /// - itemId: The ID of the item. + /// - itemName: The name of the item. + /// - price: The monetary price of the item, in units of the specified currency parameter. + public init(itemId: String, itemName: String, price: Swift.Optional = nil) { + graphQLMap = ["itemId": itemId, "itemName": itemName, "price": price] + } + + /// The ID of the item. + public var itemId: String { + get { + return graphQLMap["itemId"] as! String + } + set { + graphQLMap.updateValue(newValue, forKey: "itemId") + } + } + + /// The name of the item. + public var itemName: String { + get { + return graphQLMap["itemName"] as! String + } + set { + graphQLMap.updateValue(newValue, forKey: "itemName") + } + } + + /// The monetary price of the item, in units of the specified currency parameter. + public var price: Swift.Optional { + get { + return graphQLMap["price"] as? Swift.Optional ?? Swift.Optional.none + } + set { + graphQLMap.updateValue(newValue, forKey: "price") + } + } + } + /// Autogenerated input type of UnwatchProject public struct UnwatchProjectInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap @@ -4460,6 +4633,100 @@ public enum GraphAPI { } } + public final class TriggerThirdPartyEventMutation: GraphQLMutation { + /// The raw GraphQL definition of this operation. + public let operationDefinition: String = + """ + mutation triggerThirdPartyEvent($input: TriggerThirdPartyEventInput!) { + triggerThirdPartyEvent(input: $input) { + __typename + success + } + } + """ + + public let operationName: String = "triggerThirdPartyEvent" + + public var input: TriggerThirdPartyEventInput + + public init(input: TriggerThirdPartyEventInput) { + self.input = input + } + + public var variables: GraphQLMap? { + return ["input": input] + } + + public struct Data: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Mutation"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("triggerThirdPartyEvent", arguments: ["input": GraphQLVariable("input")], type: .object(TriggerThirdPartyEvent.selections)), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(triggerThirdPartyEvent: TriggerThirdPartyEvent? = nil) { + self.init(unsafeResultMap: ["__typename": "Mutation", "triggerThirdPartyEvent": triggerThirdPartyEvent.flatMap { (value: TriggerThirdPartyEvent) -> ResultMap in value.resultMap }]) + } + + /// Triggers third party event + public var triggerThirdPartyEvent: TriggerThirdPartyEvent? { + get { + return (resultMap["triggerThirdPartyEvent"] as? ResultMap).flatMap { TriggerThirdPartyEvent(unsafeResultMap: $0) } + } + set { + resultMap.updateValue(newValue?.resultMap, forKey: "triggerThirdPartyEvent") + } + } + + public struct TriggerThirdPartyEvent: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["TriggerThirdPartyEventPayload"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("success", type: .nonNull(.scalar(Bool.self))), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(success: Bool) { + self.init(unsafeResultMap: ["__typename": "TriggerThirdPartyEventPayload", "success": success]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + public var success: Bool { + get { + return resultMap["success"]! as! Bool + } + set { + resultMap.updateValue(newValue, forKey: "success") + } + } + } + } + } + public final class UnwatchProjectMutation: GraphQLMutation { /// The raw GraphQL definition of this operation. public let operationDefinition: String = diff --git a/KsApi/MockService.swift b/KsApi/MockService.swift index c822665f24..165af40f7e 100644 --- a/KsApi/MockService.swift +++ b/KsApi/MockService.swift @@ -40,6 +40,8 @@ fileprivate let triggerCapiEventResult: Result? + fileprivate let triggerThirdPartyEventResult: Result? + fileprivate let facebookConnectResponse: User? fileprivate let facebookConnectError: ErrorEnvelope? @@ -223,6 +225,7 @@ changePaymentMethodResult: Result? = nil, deletePaymentMethodResult: Result? = nil, triggerCapiEventResult: Result? = nil, + triggerThirdPartyEventResult: Result? = nil, clearUserUnseenActivityResult: Result? = nil, facebookConnectResponse: User? = nil, facebookConnectError: ErrorEnvelope? = nil, @@ -344,6 +347,8 @@ self.triggerCapiEventResult = triggerCapiEventResult + self.triggerThirdPartyEventResult = triggerThirdPartyEventResult + self.facebookConnectResponse = facebookConnectResponse self.facebookConnectError = facebookConnectError @@ -1605,6 +1610,18 @@ return client.performWithResult(mutation: mutation, result: self.triggerCapiEventResult) } + internal func triggerThirdPartyEventInput(input: TriggerThirdPartyEventInput) -> ReactiveSwift + .SignalProducer { + guard let client = self.apolloClient else { + return .empty + } + + let mutation = GraphAPI + .TriggerThirdPartyEventMutation(input: GraphAPI.TriggerThirdPartyEventInput.from(input)) + + return client.performWithResult(mutation: mutation, result: self.triggerThirdPartyEventResult) + } + internal func publish(draft _: UpdateDraft) -> SignalProducer { if let error = publishUpdateError { return SignalProducer(error: error) diff --git a/KsApi/Service.swift b/KsApi/Service.swift index cece6c1eb2..78f5f2b9bb 100644 --- a/KsApi/Service.swift +++ b/KsApi/Service.swift @@ -116,6 +116,16 @@ public struct Service: ServiceType { } } + public func triggerThirdPartyEventInput(input: TriggerThirdPartyEventInput) + -> SignalProducer { + return GraphQL.shared.client + .perform(mutation: GraphAPI + .TriggerThirdPartyEventMutation(input: GraphAPI.TriggerThirdPartyEventInput.from(input))) + .flatMap { _ in + SignalProducer(value: EmptyResponseEnvelope()) + } + } + public func cancelBacking(input: CancelBackingInput) -> SignalProducer { return GraphQL.shared.client diff --git a/KsApi/ServiceType.swift b/KsApi/ServiceType.swift index 5644f88525..4645473461 100644 --- a/KsApi/ServiceType.swift +++ b/KsApi/ServiceType.swift @@ -51,6 +51,10 @@ public protocol ServiceType { func triggerCapiEventInput(input: TriggerCapiEventInput) -> SignalProducer + /// Sends facebook ad data and/or google analytics data relevant to the user + func triggerThirdPartyEventInput(input: TriggerThirdPartyEventInput) + -> SignalProducer + /// Cancels a backing func cancelBacking(input: CancelBackingInput) -> SignalProducer diff --git a/KsApi/graphql-schema.json b/KsApi/graphql-schema.json index b3b6fae53b..969ccb29f7 100644 --- a/KsApi/graphql-schema.json +++ b/KsApi/graphql-schema.json @@ -4609,6 +4609,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "fulfillmentTool", + "description": "The project's selected fulfillment tool", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectFulfillmentTool", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "fundingRatio", "description": "The ratio of funding progress.", @@ -7290,6 +7302,30 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "fulfillmentToolOptions", + "description": "List of fulfillment tools available to creator based on hrc status", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "FulfillmentPlatformEnum", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "hasImage", "description": "If the user has uploaded an avatar.", @@ -11943,12 +11979,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "fulfillment_report_onboarding_2023", - "description": null, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "updated_referrer_codes_2023", "description": null, @@ -12021,6 +12051,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "prelaunch_faqs_2023", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "fork_ui_2023", "description": null, @@ -12219,6 +12255,35 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "ENUM", + "name": "FulfillmentPlatformEnum", + "description": "Top level fulfillment platform types, e.g. kickstarter, pledgemanager, or other", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "kickstarter", + "description": "kickstarter", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pledgemanager", + "description": "pledgemanager", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "other", + "description": "other", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, { "kind": "SCALAR", "name": "Float", @@ -17744,6 +17809,65 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "ProjectFulfillmentTool", + "description": "A project's selected fulfillment tool", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "platform", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "platformType", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "FulfillmentPlatformEnum", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "SCALAR", "name": "Ratio", @@ -20494,6 +20618,11 @@ "name": "RichTextHeader3", "ofType": null }, + { + "kind": "OBJECT", + "name": "RichTextHeader4", + "ofType": null + }, { "kind": "OBJECT", "name": "RichTextList", @@ -20634,6 +20763,33 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "RichTextHeader4", + "description": "A Header 4.

", + "fields": [ + { + "name": "html", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "RichTextList", @@ -30425,6 +30581,33 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "createOrUpdateProjectFulfillmentTool", + "description": "Sets a project's chosen fulfillment platform / tool", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "CreateProjectFulfillmentToolInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "CreateProjectFulfillmentToolPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "createPaymentSource", "description": "Create a payment source", @@ -35614,6 +35797,104 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "INPUT_OBJECT", + "name": "CreateProjectFulfillmentToolInput", + "description": "Autogenerated input type of CreateProjectFulfillmentTool", + "fields": null, + "inputFields": [ + { + "name": "projectId", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "platformType", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "FulfillmentPlatformEnum", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "platform", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "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": "CreateProjectFulfillmentToolPayload", + "description": "Autogenerated return type of CreateProjectFulfillmentTool", + "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": "fulfillmentTool", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectFulfillmentTool", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "CreatePaymentSourceInput", @@ -43661,6 +43942,16 @@ }, "defaultValue": null }, + { + "name": "storyRteVersion", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, { "name": "goal", "description": null, diff --git a/KsApi/models/graphql/adapters/GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift b/KsApi/models/graphql/adapters/GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift new file mode 100644 index 0000000000..6aa9e1f94c --- /dev/null +++ b/KsApi/models/graphql/adapters/GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift @@ -0,0 +1,15 @@ +extension GraphAPI.TriggerThirdPartyEventInput { + static func from(_ input: TriggerThirdPartyEventInput) -> GraphAPI.TriggerThirdPartyEventInput { + return GraphAPI.TriggerThirdPartyEventInput( + deviceId: input.deviceId, + eventName: input.eventName, + projectId: input.projectId, + pledgeAmount: input.pledgeAmount, + shipping: input.shipping, + transactionId: input.transactionId, + userId: input.userId, + appData: input.appData, + clientMutationId: input.clientMutationId + ) + } +} diff --git a/KsApi/models/graphql/adapters/GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift b/KsApi/models/graphql/adapters/GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift new file mode 100644 index 0000000000..73882afe35 --- /dev/null +++ b/KsApi/models/graphql/adapters/GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift @@ -0,0 +1,35 @@ +@testable import KsApi +import XCTest + +class GraphAPI_TriggerThirdPartyEventInput_TriggerThirdPartyEventInputTests: XCTestCase { + func testTriggerThirdEventPartyInputCreation_WithValidData_Success() { + let input = + TriggerThirdPartyEventInput( + deviceId: "deviceId", + eventName: "eventName", + projectId: "projectId", + pledgeAmount: 1.0, + shipping: 2.0, + transactionId: "transactionId", + userId: "userId", + appData: GraphAPI.AppDataInput( + advertiserTrackingEnabled: true, + applicationTrackingEnabled: true, + extinfo: ["appData"] + ), + clientMutationId: "" + ) + + let graphInput = GraphAPI.TriggerThirdPartyEventInput.from(input) + + XCTAssertEqual(graphInput.deviceId, input.deviceId) + XCTAssertEqual(graphInput.eventName, input.eventName) + XCTAssertEqual(graphInput.projectId, input.projectId) + XCTAssertEqual(graphInput.pledgeAmount, input.pledgeAmount) + XCTAssertEqual(graphInput.shipping, input.shipping) + XCTAssertEqual(graphInput.transactionId, input.transactionId) + XCTAssertEqual(graphInput.userId, input.userId) + XCTAssertNotNil(graphInput.appData) + XCTAssertEqual(graphInput.clientMutationId, input.clientMutationId) + } +} diff --git a/KsApi/mutations/TriggerThirdPartyEvent.graphql b/KsApi/mutations/TriggerThirdPartyEvent.graphql new file mode 100644 index 0000000000..920c1e27e2 --- /dev/null +++ b/KsApi/mutations/TriggerThirdPartyEvent.graphql @@ -0,0 +1,5 @@ +mutation triggerThirdPartyEvent($input: TriggerThirdPartyEventInput!) { + triggerThirdPartyEvent(input: $input) { + success + } +} diff --git a/KsApi/mutations/inputs/TriggerThirdPartyEventInput.swift b/KsApi/mutations/inputs/TriggerThirdPartyEventInput.swift new file mode 100644 index 0000000000..ddbc9a6f96 --- /dev/null +++ b/KsApi/mutations/inputs/TriggerThirdPartyEventInput.swift @@ -0,0 +1,49 @@ +import Foundation + +public struct TriggerThirdPartyEventInput: GraphMutationInput { + let deviceId: String + let eventName: String + let projectId: String + let pledgeAmount: Double? + let shipping: Double? + let transactionId: String? + let userId: String? + let appData: GraphAPI.AppDataInput? + let clientMutationId: String + + public init( + deviceId: String, + eventName: String, + projectId: String, + pledgeAmount: Double?, + shipping: Double?, + transactionId: String?, + userId: String?, + appData: GraphAPI.AppDataInput?, + clientMutationId: String + ) { + self.deviceId = deviceId + self.eventName = eventName + self.projectId = projectId + self.pledgeAmount = pledgeAmount + self.shipping = shipping + self.transactionId = transactionId + self.userId = userId + self.appData = appData + self.clientMutationId = clientMutationId + } + + public func toInputDictionary() -> [String: Any] { + return [ + "deviceId": self.deviceId, + "eventName": self.eventName, + "projectId": self.projectId, + "pledgeAmount": self.pledgeAmount, + "shipping": self.shipping, + "transactionId": self.transactionId, + "userId": self.userId, + "appData": self.appData, + "clientMutationId": self.clientMutationId + ] + } +} diff --git a/KsApi/mutations/inputs/TriggerThirdPartyEventInputTests.swift b/KsApi/mutations/inputs/TriggerThirdPartyEventInputTests.swift new file mode 100644 index 0000000000..3730c8fb2f --- /dev/null +++ b/KsApi/mutations/inputs/TriggerThirdPartyEventInputTests.swift @@ -0,0 +1,35 @@ +@testable import KsApi +import XCTest + +final class TriggerThirdPartyEventInputTests: XCTestCase { + func testTriggerThirdPartyEventInputTestsDictionary_WithValue_Success() { + let triggerThirdPartyEventInput = + TriggerThirdPartyEventInput( + deviceId: "deviceId", + eventName: "eventName", + projectId: "projectId", + pledgeAmount: 1.0, + shipping: 2.0, + transactionId: "transactionId", + userId: "userId", + appData: GraphAPI.AppDataInput( + advertiserTrackingEnabled: true, + applicationTrackingEnabled: true, + extinfo: ["appData"] + ), + clientMutationId: "" + ) + + let input = triggerThirdPartyEventInput.toInputDictionary() + + XCTAssertEqual(input["deviceId"] as? String, "deviceId") + XCTAssertEqual(input["eventName"] as? String, "eventName") + XCTAssertEqual(input["projectId"] as? String, "projectId") + XCTAssertEqual(input["pledgeAmount"] as? Double, 1.0) + XCTAssertEqual(input["shipping"] as? Double, 2.0) + XCTAssertEqual(input["transactionId"] as? String, "transactionId") + XCTAssertEqual(input["userId"] as? String, "userId") + XCTAssertNotNil(input["appData"]) + XCTAssertEqual(input["clientMutationId"] as? String, "") + } +}