From 5a7b1a9dc494d43a8da692e7449a005ad517e05c Mon Sep 17 00:00:00 2001 From: Ethan Gill Date: Wed, 11 Nov 2020 13:46:12 -0500 Subject: [PATCH 1/7] Update legacy CLI to 2.31.0 --- scripts/run-bundled-codegen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run-bundled-codegen.sh b/scripts/run-bundled-codegen.sh index ea42e67c33..77399c2ba2 100755 --- a/scripts/run-bundled-codegen.sh +++ b/scripts/run-bundled-codegen.sh @@ -11,7 +11,7 @@ SCRIPT_DIR="$(dirname "$0")" # Get the SHASUM of the tarball ZIP_FILE="${SCRIPT_DIR}/apollo.tar.gz" -ZIP_FILE_DOWNLOAD_URL="https://install.apollographql.com/legacy-cli/darwin/2.30.2" +ZIP_FILE_DOWNLOAD_URL="https://install.apollographql.com/legacy-cli/darwin/2.31.0" SHASUM_FILE="${SCRIPT_DIR}/apollo/.shasum" APOLLO_DIR="${SCRIPT_DIR}"/apollo IS_RETRY="false" From 2517f05fb092c2195aba39290ffb86c61405fcb0 Mon Sep 17 00:00:00 2001 From: Ethan Gill Date: Fri, 13 Nov 2020 11:43:42 -0500 Subject: [PATCH 2/7] Fixed SHASUM for 2.31.0 --- scripts/run-bundled-codegen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run-bundled-codegen.sh b/scripts/run-bundled-codegen.sh index 77399c2ba2..b74cba7591 100755 --- a/scripts/run-bundled-codegen.sh +++ b/scripts/run-bundled-codegen.sh @@ -52,13 +52,13 @@ remove_existing_apollo() { extract_cli() { tar xzf "${SCRIPT_DIR}"/apollo.tar.gz -C "${SCRIPT_DIR}" - + echo "${SHASUM}" | tee "${SHASUM_FILE}" } validate_codegen_and_extract_if_needed() { # Make sure the SHASUM matches the release for this version - EXPECTED_SHASUM="d8ff4cd914708479317354721dee8b156acebddb79abbdcda4348a341ab6e53d" + EXPECTED_SHASUM="f62891cbe78d159664d06e087ee2d26bf6fdb9f31ce08b9030b8adc9fb80dc7e" update_shasum if [[ ${SHASUM} = ${EXPECTED_SHASUM}* ]]; then From 78a85a0d57cda391dc9b78beb5909db7424e2787 Mon Sep 17 00:00:00 2001 From: Ethan Gill Date: Fri, 13 Nov 2020 11:49:50 -0500 Subject: [PATCH 3/7] Update API.swift for StarWarsAPI, UploadAPI, GitHubAPI --- Sources/GitHubAPI/API.swift | 43 +- Sources/StarWarsAPI/API.swift | 1236 +++------------------------------ Sources/UploadAPI/API.swift | 6 - 3 files changed, 118 insertions(+), 1167 deletions(-) diff --git a/Sources/GitHubAPI/API.swift b/Sources/GitHubAPI/API.swift index e8762fbf6c..55a2aa624a 100644 --- a/Sources/GitHubAPI/API.swift +++ b/Sources/GitHubAPI/API.swift @@ -7,12 +7,38 @@ import Foundation public final class RepositoryQuery: GraphQLQuery { /// The raw GraphQL definition of this operation. public let operationDefinition: String = - "query Repository { repository(owner: \"apollographql\", name: \"apollo-ios\") { __typename issueOrPullRequest(number: 13) { __typename ... on Issue { body ... on UniformResourceLocatable { url } author { __typename avatarUrl } } ... on Reactable { viewerCanReact ... on Comment { author { __typename login } } } } } }" + """ + query Repository { + repository(owner: "apollographql", name: "apollo-ios") { + __typename + issueOrPullRequest(number: 13) { + __typename + ... on Issue { + body + ... on UniformResourceLocatable { + url + } + author { + __typename + avatarUrl + } + } + ... on Reactable { + viewerCanReact + ... on Comment { + author { + __typename + login + } + } + } + } + } + } + """ public let operationName: String = "Repository" - public let operationIdentifier: String? = "63e25c339275a65f43b847e692e42caed8c06e25fbfb3dc8db6d4897b180c9ef" - public init() { } @@ -359,12 +385,17 @@ public final class RepositoryQuery: GraphQLQuery { public final class RepoUrlQuery: GraphQLQuery { /// The raw GraphQL definition of this operation. public let operationDefinition: String = - "query RepoURL { repository(owner: \"apollographql\", name: \"apollo-ios\") { __typename url } }" + """ + query RepoURL { + repository(owner: "apollographql", name: "apollo-ios") { + __typename + url + } + } + """ public let operationName: String = "RepoURL" - public let operationIdentifier: String? = "b55f22bcbfaea0d861089b3fbe06299675a21d11ba7138ace39ecbde606a3dc1" - public init() { } diff --git a/Sources/StarWarsAPI/API.swift b/Sources/StarWarsAPI/API.swift index de77758cb7..1f59f0c3a4 100644 --- a/Sources/StarWarsAPI/API.swift +++ b/Sources/StarWarsAPI/API.swift @@ -151,8 +151,6 @@ public final class CreateReviewForEpisodeMutation: GraphQLMutation { public let operationName: String = "CreateReviewForEpisode" - public let operationIdentifier: String? = "9bbf5b4074d0635fb19d17c621b7b04ebfb1920d468a94266819e149841e7d5d" - public var episode: Episode public var review: ReviewInput @@ -261,8 +259,6 @@ public final class CreateAwesomeReviewMutation: GraphQLMutation { public let operationName: String = "CreateAwesomeReview" - public let operationIdentifier: String? = "4a1250de93ebcb5cad5870acf15001112bf27bb963e8709555b5ff67a1405374" - public init() { } @@ -365,8 +361,6 @@ public final class HeroAndFriendsNamesQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNames" - public let operationIdentifier: String? = "fe3f21394eb861aa515c4d582e645469045793c9cbbeca4b5d4ce4d7dd617556" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -526,8 +520,6 @@ public final class HeroAndFriendsNamesWithIDsQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNamesWithIDs" - public let operationIdentifier: String? = "8e4ca76c63660898cfd5a3845e3709027750b5f0151c7f9be65759b869c5486d" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -708,8 +700,6 @@ public final class HeroAndFriendsIDsQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsIDs" - public let operationIdentifier: String? = "117d0f6831d8f4abe5b61ed1dbb8071b0825e19649916c0fe0906a6f578bb088" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -879,8 +869,6 @@ public final class HeroAndFriendsNamesWithIdForParentOnlyQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNamesWithIDForParentOnly" - public let operationIdentifier: String? = "f091468a629f3b757c03a1b7710c6ede8b5c8f10df7ba3238f2bbcd71c56f90f" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -1046,8 +1034,6 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNamesWithFragment" - public let operationIdentifier: String? = "1d3ad903dad146ff9d7aa09813fc01becd017489bfc1af8ffd178498730a5a26" - public var queryDocument: String { return operationDefinition.appending("\n" + FriendsNames.fragmentDefinition) } public var episode: Episode? @@ -1095,8 +1081,7 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("friends", type: .list(.object(Friend.selections))), + GraphQLFragmentSpread(FriendsNames.self), ] } @@ -1106,14 +1091,6 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { self.resultMap = unsafeResultMap } - public static func makeHuman(name: String, friends: [Friend?]? = nil) -> Hero { - return Hero(unsafeResultMap: ["__typename": "Human", "name": name, "friends": friends.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }]) - } - - public static func makeDroid(name: String, friends: [Friend?]? = nil) -> Hero { - return Hero(unsafeResultMap: ["__typename": "Droid", "name": name, "friends": friends.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }]) - } - public var __typename: String { get { return resultMap["__typename"]! as! String @@ -1133,16 +1110,6 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { } } - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { - get { - return (resultMap["friends"] as? [ResultMap?]).flatMap { (value: [ResultMap?]) -> [Friend?] in value.map { (value: ResultMap?) -> Friend? in value.flatMap { (value: ResultMap) -> Friend in Friend(unsafeResultMap: value) } } } - } - set { - resultMap.updateValue(newValue.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }, forKey: "friends") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -1168,50 +1135,6 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { } } } - - public struct Friend: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Human", "Droid"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public static func makeHuman(name: String) -> Friend { - return Friend(unsafeResultMap: ["__typename": "Human", "name": name]) - } - - public static func makeDroid(name: String) -> Friend { - return Friend(unsafeResultMap: ["__typename": "Droid", "name": name]) - } - - public var __typename: String { - get { - return resultMap["__typename"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "__typename") - } - } - - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - } } } } @@ -1239,8 +1162,6 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNamesWithFragmentTwice" - public let operationIdentifier: String? = "e02ef22e116ad1ca35f0298ed3badb60eeb986203f0088575a5f137768c322fc" - public var queryDocument: String { return operationDefinition.appending("\n" + CharacterName.fragmentDefinition) } public var episode: Episode? @@ -1335,8 +1256,7 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLFragmentSpread(CharacterName.self), ] } @@ -1363,16 +1283,6 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { } } - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -1457,8 +1367,7 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLFragmentSpread(CharacterName.self), GraphQLField("__typename", type: .nonNull(.scalar(String.self))), ] } @@ -1486,16 +1395,6 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { } } - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -1541,8 +1440,6 @@ public final class HeroAppearsInQuery: GraphQLQuery { public let operationName: String = "HeroAppearsIn" - public let operationIdentifier: String? = "22d772c0fc813281705e8f0a55fc70e71eeff6e98f3f9ef96cf67fb896914522" - public init() { } @@ -1634,8 +1531,6 @@ public final class HeroAppearsInWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroAppearsInWithFragment" - public let operationIdentifier: String? = "1756158bd7736d58db45a48d74a724fa1b6fdac735376df8afac8318ba5431fb" - public var queryDocument: String { return operationDefinition.appending("\n" + CharacterAppearsIn.fragmentDefinition) } public var episode: Episode? @@ -1682,8 +1577,7 @@ public final class HeroAppearsInWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("appearsIn", type: .nonNull(.list(.scalar(Episode.self)))), + GraphQLFragmentSpread(CharacterAppearsIn.self), ] } @@ -1710,16 +1604,6 @@ public final class HeroAppearsInWithFragmentQuery: GraphQLQuery { } } - /// The movies this character appears in - public var appearsIn: [Episode?] { - get { - return resultMap["appearsIn"]! as! [Episode?] - } - set { - resultMap.updateValue(newValue, forKey: "appearsIn") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -1763,8 +1647,6 @@ public final class HeroNameConditionalExclusionQuery: GraphQLQuery { public let operationName: String = "HeroNameConditionalExclusion" - public let operationIdentifier: String? = "3dd42259adf2d0598e89e0279bee2c128a7913f02b1da6aa43f3b5def6a8a1f8" - public var skipName: Bool public init(skipName: Bool) { @@ -1865,8 +1747,6 @@ public final class HeroNameConditionalInclusionQuery: GraphQLQuery { public let operationName: String = "HeroNameConditionalInclusion" - public let operationIdentifier: String? = "338081aea3acc83d04af0741ecf0da1ec2ee8e6468a88383476b681015905ef8" - public var includeName: Bool public init(includeName: Bool) { @@ -1967,8 +1847,6 @@ public final class HeroNameConditionalBothQuery: GraphQLQuery { public let operationName: String = "HeroNameConditionalBoth" - public let operationIdentifier: String? = "66f4dc124b6374b1912b22a2a208e34a4b1997349402a372b95bcfafc7884064" - public var skipName: Bool public var includeName: Bool @@ -2074,8 +1952,6 @@ public final class HeroNameConditionalBothSeparateQuery: GraphQLQuery { public let operationName: String = "HeroNameConditionalBothSeparate" - public let operationIdentifier: String? = "d0f9e9205cdc09320035662f528a177654d3275b0bf94cf0e259a65fde33e7e5" - public var skipName: Bool public var includeName: Bool @@ -2184,8 +2060,6 @@ public final class HeroDetailsInlineConditionalInclusionQuery: GraphQLQuery { public let operationName: String = "HeroDetailsInlineConditionalInclusion" - public let operationIdentifier: String? = "fcd9d7acb4e7c97e3ae5ad3cbf4e83556626149de589f0c2fce2f8ede31b0d90" - public var includeDetails: Bool public init(includeDetails: Bool) { @@ -2297,8 +2171,6 @@ public final class HeroDetailsFragmentConditionalInclusionQuery: GraphQLQuery { public let operationName: String = "HeroDetailsFragmentConditionalInclusion" - public let operationIdentifier: String? = "b31aec7d977249e185922e4cc90318fd2c7197631470904bf937b0626de54b4f" - public var queryDocument: String { return operationDefinition.appending("\n" + HeroDetails.fragmentDefinition) } public var includeDetails: Bool @@ -2344,16 +2216,10 @@ public final class HeroDetailsFragmentConditionalInclusionQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ - GraphQLTypeCase( - variants: ["Human": AsHuman.selections, "Droid": AsDroid.selections], - default: [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - ]), - ] - ) + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ + GraphQLFragmentSpread(HeroDetails.self), + ]), ] } @@ -2380,16 +2246,6 @@ public final class HeroDetailsFragmentConditionalInclusionQuery: GraphQLQuery { } } - /// The name of the character - public var name: String? { - get { - return resultMap["name"] as? String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -2415,265 +2271,69 @@ public final class HeroDetailsFragmentConditionalInclusionQuery: GraphQLQuery { } } } + } + } +} - public var asHuman: AsHuman? { - get { - if !AsHuman.possibleTypes.contains(__typename) { return nil } - return AsHuman(unsafeResultMap: resultMap) - } - set { - guard let newValue = newValue else { return } - resultMap = newValue.resultMap +public final class HeroNameTypeSpecificConditionalInclusionQuery: GraphQLQuery { + /// The raw GraphQL definition of this operation. + public let operationDefinition: String = + """ + query HeroNameTypeSpecificConditionalInclusion($episode: Episode, $includeName: Boolean!) { + hero(episode: $episode) { + __typename + name @include(if: $includeName) + ... on Droid { + name } } + } + """ - public struct AsHuman: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Human"] + public let operationName: String = "HeroNameTypeSpecificConditionalInclusion" - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - ]), - GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("height", type: .scalar(Double.self)), - ]), - ] - } + public var episode: Episode? + public var includeName: Bool - public private(set) var resultMap: ResultMap + public init(episode: Episode? = nil, includeName: Bool) { + self.episode = episode + self.includeName = includeName + } - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } + public var variables: GraphQLMap? { + return ["episode": episode, "includeName": includeName] + } - public init(name: String? = nil, height: Double? = nil) { - self.init(unsafeResultMap: ["__typename": "Human", "name": name, "height": height]) - } + public struct Data: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Query"] - public var __typename: String { - get { - return resultMap["__typename"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "__typename") - } - } + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("hero", arguments: ["episode": GraphQLVariable("episode")], type: .object(Hero.selections)), + ] + } - /// What this human calls themselves - public var name: String? { - get { - return resultMap["name"] as? String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } + public private(set) var resultMap: ResultMap - /// Height in the preferred unit, default is meters - public var height: Double? { - get { - return resultMap["height"] as? Double - } - set { - resultMap.updateValue(newValue, forKey: "height") - } - } + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } - public var fragments: Fragments { - get { - return Fragments(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } + public init(hero: Hero? = nil) { + self.init(unsafeResultMap: ["__typename": "Query", "hero": hero.flatMap { (value: Hero) -> ResultMap in value.resultMap }]) + } - public struct Fragments { - public private(set) var resultMap: ResultMap + public var hero: Hero? { + get { + return (resultMap["hero"] as? ResultMap).flatMap { Hero(unsafeResultMap: $0) } + } + set { + resultMap.updateValue(newValue?.resultMap, forKey: "hero") + } + } - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public var heroDetails: HeroDetails { - get { - return HeroDetails(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - } - } - - public var asDroid: AsDroid? { - get { - if !AsDroid.possibleTypes.contains(__typename) { return nil } - return AsDroid(unsafeResultMap: resultMap) - } - set { - guard let newValue = newValue else { return } - resultMap = newValue.resultMap - } - } - - public struct AsDroid: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Droid"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - ]), - GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("primaryFunction", type: .scalar(String.self)), - ]), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public init(name: String? = nil, primaryFunction: String? = nil) { - self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "primaryFunction": primaryFunction]) - } - - public var __typename: String { - get { - return resultMap["__typename"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "__typename") - } - } - - /// What others call this droid - public var name: String? { - get { - return resultMap["name"] as? String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// This droid's primary function - public var primaryFunction: String? { - get { - return resultMap["primaryFunction"] as? String - } - set { - resultMap.updateValue(newValue, forKey: "primaryFunction") - } - } - - public var fragments: Fragments { - get { - return Fragments(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - - public struct Fragments { - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public var heroDetails: HeroDetails { - get { - return HeroDetails(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - } - } - } - } -} - -public final class HeroNameTypeSpecificConditionalInclusionQuery: GraphQLQuery { - /// The raw GraphQL definition of this operation. - public let operationDefinition: String = - """ - query HeroNameTypeSpecificConditionalInclusion($episode: Episode, $includeName: Boolean!) { - hero(episode: $episode) { - __typename - name @include(if: $includeName) - ... on Droid { - name - } - } - } - """ - - public let operationName: String = "HeroNameTypeSpecificConditionalInclusion" - - public let operationIdentifier: String? = "4d465fbc6e3731d011025048502f16278307d73300ea9329a709d7e2b6815e40" - - public var episode: Episode? - public var includeName: Bool - - public init(episode: Episode? = nil, includeName: Bool) { - self.episode = episode - self.includeName = includeName - } - - public var variables: GraphQLMap? { - return ["episode": episode, "includeName": includeName] - } - - public struct Data: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Query"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("hero", arguments: ["episode": GraphQLVariable("episode")], type: .object(Hero.selections)), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public init(hero: Hero? = nil) { - self.init(unsafeResultMap: ["__typename": "Query", "hero": hero.flatMap { (value: Hero) -> ResultMap in value.resultMap }]) - } - - public var hero: Hero? { - get { - return (resultMap["hero"] as? ResultMap).flatMap { Hero(unsafeResultMap: $0) } - } - set { - resultMap.updateValue(newValue?.resultMap, forKey: "hero") - } - } - - public struct Hero: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Human", "Droid"] + public struct Hero: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Human", "Droid"] public static var selections: [GraphQLSelection] { return [ @@ -2799,8 +2459,6 @@ public final class HeroFriendsDetailsConditionalInclusionQuery: GraphQLQuery { public let operationName: String = "HeroFriendsDetailsConditionalInclusion" - public let operationIdentifier: String? = "9bdfeee789c1d22123402a9c3e3edefeb66799b3436289751be8f47905e3babd" - public var includeFriendsDetails: Bool public init(includeFriendsDetails: Bool) { @@ -3022,8 +2680,6 @@ public final class HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery: public let operationName: String = "HeroFriendsDetailsUnconditionalAndConditionalInclusion" - public let operationIdentifier: String? = "501fcb710e5ffeeab2c65b7935fbded394ffea92e7b5dd904d05d5deab6f39c6" - public var includeFriendsDetails: Bool public init(includeFriendsDetails: Bool) { @@ -3254,8 +2910,6 @@ public final class HeroDetailsQuery: GraphQLQuery { public let operationName: String = "HeroDetails" - public let operationIdentifier: String? = "2b67111fd3a1c6b2ac7d1ef7764e5cefa41d3f4218e1d60cb67c22feafbd43ec" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -3483,8 +3137,6 @@ public final class HeroDetailsWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroDetailsWithFragment" - public let operationIdentifier: String? = "d20fa2f460058b8eec3d227f2f6088a708cf35dfa2b5ebf1414e34f9674ecfce" - public var queryDocument: String { return operationDefinition.appending("\n" + HeroDetails.fragmentDefinition) } public var episode: Episode? @@ -3530,14 +3182,8 @@ public final class HeroDetailsWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ - GraphQLTypeCase( - variants: ["Human": AsHuman.selections, "Droid": AsDroid.selections], - default: [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - ] - ) + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLFragmentSpread(HeroDetails.self), ] } @@ -3564,16 +3210,6 @@ public final class HeroDetailsWithFragmentQuery: GraphQLQuery { } } - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -3590,194 +3226,12 @@ public final class HeroDetailsWithFragmentQuery: GraphQLQuery { self.resultMap = unsafeResultMap } - public var heroDetails: HeroDetails { - get { - return HeroDetails(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - } - - public var asHuman: AsHuman? { - get { - if !AsHuman.possibleTypes.contains(__typename) { return nil } - return AsHuman(unsafeResultMap: resultMap) - } - set { - guard let newValue = newValue else { return } - resultMap = newValue.resultMap - } - } - - public struct AsHuman: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Human"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("height", type: .scalar(Double.self)), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public init(name: String, height: Double? = nil) { - self.init(unsafeResultMap: ["__typename": "Human", "name": name, "height": height]) - } - - public var __typename: String { - get { - return resultMap["__typename"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "__typename") - } - } - - /// What this human calls themselves - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// Height in the preferred unit, default is meters - public var height: Double? { - get { - return resultMap["height"] as? Double - } - set { - resultMap.updateValue(newValue, forKey: "height") - } - } - - public var fragments: Fragments { - get { - return Fragments(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - - public struct Fragments { - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public var heroDetails: HeroDetails { - get { - return HeroDetails(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - } - } - - public var asDroid: AsDroid? { - get { - if !AsDroid.possibleTypes.contains(__typename) { return nil } - return AsDroid(unsafeResultMap: resultMap) - } - set { - guard let newValue = newValue else { return } - resultMap = newValue.resultMap - } - } - - public struct AsDroid: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Droid"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("primaryFunction", type: .scalar(String.self)), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public init(name: String, primaryFunction: String? = nil) { - self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "primaryFunction": primaryFunction]) - } - - public var __typename: String { - get { - return resultMap["__typename"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "__typename") - } - } - - /// What others call this droid - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// This droid's primary function - public var primaryFunction: String? { - get { - return resultMap["primaryFunction"] as? String - } - set { - resultMap.updateValue(newValue, forKey: "primaryFunction") - } - } - - public var fragments: Fragments { - get { - return Fragments(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - - public struct Fragments { - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap + public var heroDetails: HeroDetails { + get { + return HeroDetails(unsafeResultMap: resultMap) } - - public var heroDetails: HeroDetails { - get { - return HeroDetails(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } + set { + resultMap += newValue.resultMap } } } @@ -3799,8 +3253,6 @@ public final class DroidDetailsWithFragmentQuery: GraphQLQuery { public let operationName: String = "DroidDetailsWithFragment" - public let operationIdentifier: String? = "7277e97563e911ac8f5c91d401028d218aae41f38df014d7fa0b037bb2a2e739" - public var queryDocument: String { return operationDefinition.appending("\n" + DroidDetails.fragmentDefinition) } public var episode: Episode? @@ -3846,12 +3298,8 @@ public final class DroidDetailsWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ - GraphQLTypeCase( - variants: ["Droid": AsDroid.selections], - default: [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - ] - ) + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLFragmentSpread(DroidDetails.self), ] } @@ -3905,95 +3353,6 @@ public final class DroidDetailsWithFragmentQuery: GraphQLQuery { } } } - - public var asDroid: AsDroid? { - get { - if !AsDroid.possibleTypes.contains(__typename) { return nil } - return AsDroid(unsafeResultMap: resultMap) - } - set { - guard let newValue = newValue else { return } - resultMap = newValue.resultMap - } - } - - public struct AsDroid: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Droid"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("primaryFunction", type: .scalar(String.self)), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public init(name: String, primaryFunction: String? = nil) { - self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "primaryFunction": primaryFunction]) - } - - public var __typename: String { - get { - return resultMap["__typename"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "__typename") - } - } - - /// What others call this droid - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// This droid's primary function - public var primaryFunction: String? { - get { - return resultMap["primaryFunction"] as? String - } - set { - resultMap.updateValue(newValue, forKey: "primaryFunction") - } - } - - public var fragments: Fragments { - get { - return Fragments(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - - public struct Fragments { - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public var droidDetails: DroidDetails { - get { - return DroidDetails(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - } - } } } } @@ -4019,8 +3378,6 @@ public final class HeroFriendsOfFriendsNamesQuery: GraphQLQuery { public let operationName: String = "HeroFriendsOfFriendsNames" - public let operationIdentifier: String? = "37cd5626048e7243716ffda9e56503939dd189772124a1c21b0e0b87e69aae01" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -4218,8 +3575,6 @@ public final class HeroNameQuery: GraphQLQuery { public let operationName: String = "HeroName" - public let operationIdentifier: String? = "f6e76545cd03aa21368d9969cb39447f6e836a16717823281803778e7805d671" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -4319,8 +3674,6 @@ public final class HeroNameWithIdQuery: GraphQLQuery { public let operationName: String = "HeroNameWithID" - public let operationIdentifier: String? = "83c03f612c46fca72f6cb902df267c57bffc9209bc44dd87d2524fb2b34f6f18" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -4430,8 +3783,6 @@ public final class HeroNameWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroNameWithFragment" - public let operationIdentifier: String? = "b952f0054915a32ec524ac0dde0244bcda246649debe149f9e32e303e21c8266" - public var queryDocument: String { return operationDefinition.appending("\n" + CharacterName.fragmentDefinition) } public var episode: Episode? @@ -4478,8 +3829,7 @@ public final class HeroNameWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLFragmentSpread(CharacterName.self), ] } @@ -4506,16 +3856,6 @@ public final class HeroNameWithFragmentQuery: GraphQLQuery { } } - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -4560,8 +3900,6 @@ public final class HeroNameWithFragmentAndIdQuery: GraphQLQuery { public let operationName: String = "HeroNameWithFragmentAndID" - public let operationIdentifier: String? = "a87a0694c09d1ed245e9a80f245d96a5f57b20a4aa936ee9ab09b2a43620db02" - public var queryDocument: String { return operationDefinition.appending("\n" + CharacterName.fragmentDefinition) } public var episode: Episode? @@ -4609,8 +3947,7 @@ public final class HeroNameWithFragmentAndIdQuery: GraphQLQuery { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLFragmentSpread(CharacterName.self), ] } @@ -4647,16 +3984,6 @@ public final class HeroNameWithFragmentAndIdQuery: GraphQLQuery { } } - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -4700,8 +4027,6 @@ public final class HeroNameAndAppearsInWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroNameAndAppearsInWithFragment" - public let operationIdentifier: String? = "0664fed3eb4f9fbdb44e8691d9e8fd11f2b3c097ba11327592054f602bd3ba1a" - public var queryDocument: String { return operationDefinition.appending("\n" + CharacterNameAndAppearsIn.fragmentDefinition) } public var episode: Episode? @@ -4748,9 +4073,7 @@ public final class HeroNameAndAppearsInWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("appearsIn", type: .nonNull(.list(.scalar(Episode.self)))), + GraphQLFragmentSpread(CharacterNameAndAppearsIn.self), ] } @@ -4777,26 +4100,6 @@ public final class HeroNameAndAppearsInWithFragmentQuery: GraphQLQuery { } } - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// The movies this character appears in - public var appearsIn: [Episode?] { - get { - return resultMap["appearsIn"]! as! [Episode?] - } - set { - resultMap.updateValue(newValue, forKey: "appearsIn") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -4858,8 +4161,6 @@ public final class HeroParentTypeDependentFieldQuery: GraphQLQuery { public let operationName: String = "HeroParentTypeDependentField" - public let operationIdentifier: String? = "561e22ac4da5209f254779b70e01557fb2fc57916b9914088429ec809e166cad" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -5314,8 +4615,6 @@ public final class HeroTypeDependentAliasedFieldQuery: GraphQLQuery { public let operationName: String = "HeroTypeDependentAliasedField" - public let operationIdentifier: String? = "b5838c22bac1c5626023dac4412ca9b86bebfe16608991fb632a37c44e12811e" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -5514,8 +4813,6 @@ public final class SameHeroTwiceQuery: GraphQLQuery { public let operationName: String = "SameHeroTwice" - public let operationIdentifier: String? = "2a8ad85a703add7d64622aaf6be76b58a1134caf28e4ff6b34dd00ba89541364" - public init() { } @@ -5672,8 +4969,6 @@ public final class SearchQuery: GraphQLQuery { public let operationName: String = "Search" - public let operationIdentifier: String? = "73536da2eec4d83e6e1003e674cb2299d9da2798f7bd310e57339a6bcd713b77" - public var term: String? public init(term: String? = nil) { @@ -5957,8 +5252,6 @@ public final class StarshipQuery: GraphQLQuery { public let operationName: String = "Starship" - public let operationIdentifier: String? = "a3734516185da9919e3e66d74fe92b60d65292a1943dc54913f7332637dfdd2a" - public init() { } @@ -6058,8 +5351,6 @@ public final class StarshipCoordinatesQuery: GraphQLQuery { public let operationName: String = "StarshipCoordinates" - public let operationIdentifier: String? = "8dd77d4bc7494c184606da092a665a7c2ca3c2a3f14d3b23fa5e469e207b3406" - public var coordinates: [[Double]]? public init(coordinates: [[Double]]?) { @@ -6177,8 +5468,6 @@ public final class ReviewAddedSubscription: GraphQLSubscription { public let operationName: String = "ReviewAdded" - public let operationIdentifier: String? = "38644c5e7cf4fd506b91d2e7010cabf84e63dfcd33cf1deb443b4b32b55e2cbe" - public var episode: Episode? public init(episode: Episode? = nil) { @@ -6269,120 +5558,12 @@ public final class ReviewAddedSubscription: GraphQLSubscription { } /// Comment about the movie - public var commentary: String? { - get { - return resultMap["commentary"] as? String - } - set { - resultMap.updateValue(newValue, forKey: "commentary") - } - } - } - } -} - -public final class HumanQuery: GraphQLQuery { - /// The raw GraphQL definition of this operation. - public let operationDefinition: String = - """ - query Human($id: ID!) { - human(id: $id) { - __typename - name - mass - } - } - """ - - public let operationName: String = "Human" - - public let operationIdentifier: String? = "b37eb69b82fd52358321e49453769750983be1c286744dbf415735d7bcf12f1e" - - public var id: GraphQLID - - public init(id: GraphQLID) { - self.id = id - } - - public var variables: GraphQLMap? { - return ["id": id] - } - - public struct Data: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Query"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("human", arguments: ["id": GraphQLVariable("id")], type: .object(Human.selections)), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public init(human: Human? = nil) { - self.init(unsafeResultMap: ["__typename": "Query", "human": human.flatMap { (value: Human) -> ResultMap in value.resultMap }]) - } - - public var human: Human? { - get { - return (resultMap["human"] as? ResultMap).flatMap { Human(unsafeResultMap: $0) } - } - set { - resultMap.updateValue(newValue?.resultMap, forKey: "human") - } - } - - public struct Human: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Human"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("mass", type: .scalar(Double.self)), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public init(name: String, mass: Double? = nil) { - self.init(unsafeResultMap: ["__typename": "Human", "name": name, "mass": mass]) - } - - public var __typename: String { - get { - return resultMap["__typename"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "__typename") - } - } - - /// What this human calls themselves - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// Mass in kilograms, or null if unknown - public var mass: Double? { + public var commentary: String? { get { - return resultMap["mass"] as? Double + return resultMap["commentary"] as? String } set { - resultMap.updateValue(newValue, forKey: "mass") + resultMap.updateValue(newValue, forKey: "commentary") } } } @@ -6407,8 +5588,6 @@ public final class TwoHeroesQuery: GraphQLQuery { public let operationName: String = "TwoHeroes" - public let operationIdentifier: String? = "b868fa9c48f19b8151c08c09f46831e3b9cd09f5c617d328647de785244b52bb" - public init() { } @@ -6556,10 +5735,8 @@ public struct DroidNameAndPrimaryFunction: GraphQLFragment { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("primaryFunction", type: .scalar(String.self)), + GraphQLFragmentSpread(CharacterName.self), + GraphQLFragmentSpread(DroidPrimaryFunction.self), ] } @@ -6582,26 +5759,6 @@ public struct DroidNameAndPrimaryFunction: GraphQLFragment { } } - /// What others call this droid - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// This droid's primary function - public var primaryFunction: String? { - get { - return resultMap["primaryFunction"] as? String - } - set { - resultMap.updateValue(newValue, forKey: "primaryFunction") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -6653,14 +5810,9 @@ public struct CharacterNameAndDroidPrimaryFunction: GraphQLFragment { public static var selections: [GraphQLSelection] { return [ - GraphQLTypeCase( - variants: ["Droid": AsDroid.selections], - default: [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - ] - ) + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLFragmentSpread(CharacterName.self), + GraphQLFragmentSpread(DroidPrimaryFunction.self), ] } @@ -6687,16 +5839,6 @@ public struct CharacterNameAndDroidPrimaryFunction: GraphQLFragment { } } - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -6733,105 +5875,6 @@ public struct CharacterNameAndDroidPrimaryFunction: GraphQLFragment { } } } - - public var asDroid: AsDroid? { - get { - if !AsDroid.possibleTypes.contains(__typename) { return nil } - return AsDroid(unsafeResultMap: resultMap) - } - set { - guard let newValue = newValue else { return } - resultMap = newValue.resultMap - } - } - - public struct AsDroid: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Droid"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("primaryFunction", type: .scalar(String.self)), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public init(name: String, primaryFunction: String? = nil) { - self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "primaryFunction": primaryFunction]) - } - - public var __typename: String { - get { - return resultMap["__typename"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "__typename") - } - } - - /// What others call this droid - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// This droid's primary function - public var primaryFunction: String? { - get { - return resultMap["primaryFunction"] as? String - } - set { - resultMap.updateValue(newValue, forKey: "primaryFunction") - } - } - - public var fragments: Fragments { - get { - return Fragments(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - - public struct Fragments { - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public var characterName: CharacterName { - get { - return CharacterName(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - - public var droidPrimaryFunction: DroidPrimaryFunction { - get { - return DroidPrimaryFunction(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } - } - } } public struct CharacterNameAndDroidAppearsIn: GraphQLFragment { @@ -7119,10 +6162,7 @@ public struct CharacterNameAndAppearsInWithNestedFragments: GraphQLFragment { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("appearsIn", type: .nonNull(.list(.scalar(Episode.self)))), + GraphQLFragmentSpread(CharacterNameWithNestedAppearsInFragment.self), ] } @@ -7149,26 +6189,6 @@ public struct CharacterNameAndAppearsInWithNestedFragments: GraphQLFragment { } } - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// The movies this character appears in - public var appearsIn: [Episode?] { - get { - return resultMap["appearsIn"]! as! [Episode?] - } - set { - resultMap.updateValue(newValue, forKey: "appearsIn") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -7193,15 +6213,6 @@ public struct CharacterNameAndAppearsInWithNestedFragments: GraphQLFragment { resultMap += newValue.resultMap } } - - public var characterAppearsIn: CharacterAppearsIn { - get { - return CharacterAppearsIn(unsafeResultMap: resultMap) - } - set { - resultMap += newValue.resultMap - } - } } } @@ -7222,8 +6233,7 @@ public struct CharacterNameWithNestedAppearsInFragment: GraphQLFragment { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("appearsIn", type: .nonNull(.list(.scalar(Episode.self)))), + GraphQLFragmentSpread(CharacterAppearsIn.self), ] } @@ -7260,16 +6270,6 @@ public struct CharacterNameWithNestedAppearsInFragment: GraphQLFragment { } } - /// The movies this character appears in - public var appearsIn: [Episode?] { - get { - return resultMap["appearsIn"]! as! [Episode?] - } - set { - resultMap.updateValue(newValue, forKey: "appearsIn") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -7339,10 +6339,6 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { return CharacterNameWithInlineFragment(unsafeResultMap: ["__typename": "Human", "friends": friends.flatMap { (value: [AsHuman.Friend?]) -> [ResultMap?] in value.map { (value: AsHuman.Friend?) -> ResultMap? in value.flatMap { (value: AsHuman.Friend) -> ResultMap in value.resultMap } } }]) } - public static func makeDroid(name: String, friends: [AsDroid.Friend?]? = nil) -> CharacterNameWithInlineFragment { - return CharacterNameWithInlineFragment(unsafeResultMap: ["__typename": "Droid", "name": name, "friends": friends.flatMap { (value: [AsDroid.Friend?]) -> [ResultMap?] in value.map { (value: AsDroid.Friend?) -> ResultMap? in value.flatMap { (value: AsDroid.Friend) -> ResultMap in value.resultMap } } }]) - } - public var __typename: String { get { return resultMap["__typename"]! as! String @@ -7464,10 +6460,8 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("friends", type: .list(.object(Friend.selections))), + GraphQLFragmentSpread(CharacterName.self), + GraphQLFragmentSpread(FriendsNames.self), ] } @@ -7477,10 +6471,6 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { self.resultMap = unsafeResultMap } - public init(name: String, friends: [Friend?]? = nil) { - self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "friends": friends.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }]) - } - public var __typename: String { get { return resultMap["__typename"]! as! String @@ -7490,26 +6480,6 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { } } - /// What others call this droid - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - - /// This droid's friends, or an empty list if they have none - public var friends: [Friend?]? { - get { - return (resultMap["friends"] as? [ResultMap?]).flatMap { (value: [ResultMap?]) -> [Friend?] in value.map { (value: ResultMap?) -> Friend? in value.flatMap { (value: ResultMap) -> Friend in Friend(unsafeResultMap: value) } } } - } - set { - resultMap.updateValue(newValue.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }, forKey: "friends") - } - } - public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -7544,50 +6514,6 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { } } } - - public struct Friend: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Human", "Droid"] - - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("name", type: .nonNull(.scalar(String.self))), - ] - } - - public private(set) var resultMap: ResultMap - - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } - - public static func makeHuman(name: String) -> Friend { - return Friend(unsafeResultMap: ["__typename": "Human", "name": name]) - } - - public static func makeDroid(name: String) -> Friend { - return Friend(unsafeResultMap: ["__typename": "Droid", "name": name]) - } - - public var __typename: String { - get { - return resultMap["__typename"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "__typename") - } - } - - /// The name of the character - public var name: String { - get { - return resultMap["name"]! as! String - } - set { - resultMap.updateValue(newValue, forKey: "name") - } - } - } } } diff --git a/Sources/UploadAPI/API.swift b/Sources/UploadAPI/API.swift index 2a056f80c1..a2f9395959 100644 --- a/Sources/UploadAPI/API.swift +++ b/Sources/UploadAPI/API.swift @@ -21,8 +21,6 @@ public final class UploadMultipleFilesToTheSameParameterMutation: GraphQLMutatio public let operationName: String = "UploadMultipleFilesToTheSameParameter" - public let operationIdentifier: String? = "88858c283bb72f18c0049dc85b140e72a4046f469fa16a8bf4bcf01c11d8a2b7" - public var files: [String] public init(files: [String]) { @@ -149,8 +147,6 @@ public final class UploadMultipleFilesToDifferentParametersMutation: GraphQLMuta public let operationName: String = "UploadMultipleFilesToDifferentParameters" - public let operationIdentifier: String? = "1ec89997a185c50bacc5f62ad41f27f3070f4a950d72e4a1510a4c64160812d5" - public var singleFile: String public var multipleFiles: [String] @@ -279,8 +275,6 @@ public final class UploadOneFileMutation: GraphQLMutation { public let operationName: String = "UploadOneFile" - public let operationIdentifier: String? = "c5d5919f77d9ba16a9689b6b0ad4b781cb05dc1dc4812623bf80f7c044c09533" - public var file: String public init(file: String) { From 4df457adf14f53453a0ec282b10098bfe4c10206 Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Mon, 16 Nov 2020 17:02:48 -0600 Subject: [PATCH 4/7] oh hai xcode 12.2 --- Apollo.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/Apollo Playground.xcscheme | 2 +- Apollo.xcodeproj/xcshareddata/xcschemes/Apollo.xcscheme | 2 +- .../xcshareddata/xcschemes/ApolloCodegenLib.xcscheme | 2 +- Apollo.xcodeproj/xcshareddata/xcschemes/ApolloCore.xcscheme | 2 +- Apollo.xcodeproj/xcshareddata/xcschemes/ApolloSQLite.xcscheme | 2 +- .../xcshareddata/xcschemes/ApolloWebSocket.xcscheme | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Apollo.xcodeproj/project.pbxproj b/Apollo.xcodeproj/project.pbxproj index 5fc0c4b4eb..e690381c22 100644 --- a/Apollo.xcodeproj/project.pbxproj +++ b/Apollo.xcodeproj/project.pbxproj @@ -2012,7 +2012,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1130; - LastUpgradeCheck = 1210; + LastUpgradeCheck = 1220; ORGANIZATIONNAME = "Apollo GraphQL"; TargetAttributes = { 9B2DFBB524E1FA0D00ED3AE6 = { diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo Playground.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo Playground.xcscheme index 204cd57513..cca7c984de 100644 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo Playground.xcscheme +++ b/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo Playground.xcscheme @@ -1,6 +1,6 @@ Date: Mon, 16 Nov 2020 17:03:21 -0600 Subject: [PATCH 5/7] update download string and shasum for swift interface to CLI --- Sources/ApolloCodegenLib/CLIDownloader.swift | 2 +- Sources/ApolloCodegenLib/CLIExtractor.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/ApolloCodegenLib/CLIDownloader.swift b/Sources/ApolloCodegenLib/CLIDownloader.swift index fcd8f17d61..d01f7b0287 100644 --- a/Sources/ApolloCodegenLib/CLIDownloader.swift +++ b/Sources/ApolloCodegenLib/CLIDownloader.swift @@ -30,7 +30,7 @@ struct CLIDownloader { } /// The URL string for getting the current version of the CLI - static let downloadURLString = "https://install.apollographql.com/legacy-cli/darwin/2.30.2" + static let downloadURLString = "https://install.apollographql.com/legacy-cli/darwin/2.31.0" /// Downloads the appropriate Apollo CLI in a zip file. /// diff --git a/Sources/ApolloCodegenLib/CLIExtractor.swift b/Sources/ApolloCodegenLib/CLIExtractor.swift index e57fb1fd83..abaf9f5690 100644 --- a/Sources/ApolloCodegenLib/CLIExtractor.swift +++ b/Sources/ApolloCodegenLib/CLIExtractor.swift @@ -25,7 +25,7 @@ struct CLIExtractor { } } - static let expectedSHASUM = "d8ff4cd914708479317354721dee8b156acebddb79abbdcda4348a341ab6e53d" + static let expectedSHASUM = "f62891cbe78d159664d06e087ee2d26bf6fdb9f31ce08b9030b8adc9fb80dc7e" /// Checks to see if the CLI has already been extracted and is the correct version, and extracts or re-extracts as necessary /// From 864a77be4be6ca67feb12c10cb5da94354164c95 Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Mon, 16 Nov 2020 17:04:13 -0600 Subject: [PATCH 6/7] regen star wars and github APIs based on the scripts in the targets --- Sources/GitHubAPI/API.swift | 43 +- Sources/StarWarsAPI/API.swift | 1232 ++++++++++++++++++++++++++++++--- 2 files changed, 1159 insertions(+), 116 deletions(-) diff --git a/Sources/GitHubAPI/API.swift b/Sources/GitHubAPI/API.swift index 55a2aa624a..e8762fbf6c 100644 --- a/Sources/GitHubAPI/API.swift +++ b/Sources/GitHubAPI/API.swift @@ -7,38 +7,12 @@ import Foundation public final class RepositoryQuery: GraphQLQuery { /// The raw GraphQL definition of this operation. public let operationDefinition: String = - """ - query Repository { - repository(owner: "apollographql", name: "apollo-ios") { - __typename - issueOrPullRequest(number: 13) { - __typename - ... on Issue { - body - ... on UniformResourceLocatable { - url - } - author { - __typename - avatarUrl - } - } - ... on Reactable { - viewerCanReact - ... on Comment { - author { - __typename - login - } - } - } - } - } - } - """ + "query Repository { repository(owner: \"apollographql\", name: \"apollo-ios\") { __typename issueOrPullRequest(number: 13) { __typename ... on Issue { body ... on UniformResourceLocatable { url } author { __typename avatarUrl } } ... on Reactable { viewerCanReact ... on Comment { author { __typename login } } } } } }" public let operationName: String = "Repository" + public let operationIdentifier: String? = "63e25c339275a65f43b847e692e42caed8c06e25fbfb3dc8db6d4897b180c9ef" + public init() { } @@ -385,17 +359,12 @@ public final class RepositoryQuery: GraphQLQuery { public final class RepoUrlQuery: GraphQLQuery { /// The raw GraphQL definition of this operation. public let operationDefinition: String = - """ - query RepoURL { - repository(owner: "apollographql", name: "apollo-ios") { - __typename - url - } - } - """ + "query RepoURL { repository(owner: \"apollographql\", name: \"apollo-ios\") { __typename url } }" public let operationName: String = "RepoURL" + public let operationIdentifier: String? = "b55f22bcbfaea0d861089b3fbe06299675a21d11ba7138ace39ecbde606a3dc1" + public init() { } diff --git a/Sources/StarWarsAPI/API.swift b/Sources/StarWarsAPI/API.swift index 1f59f0c3a4..de77758cb7 100644 --- a/Sources/StarWarsAPI/API.swift +++ b/Sources/StarWarsAPI/API.swift @@ -151,6 +151,8 @@ public final class CreateReviewForEpisodeMutation: GraphQLMutation { public let operationName: String = "CreateReviewForEpisode" + public let operationIdentifier: String? = "9bbf5b4074d0635fb19d17c621b7b04ebfb1920d468a94266819e149841e7d5d" + public var episode: Episode public var review: ReviewInput @@ -259,6 +261,8 @@ public final class CreateAwesomeReviewMutation: GraphQLMutation { public let operationName: String = "CreateAwesomeReview" + public let operationIdentifier: String? = "4a1250de93ebcb5cad5870acf15001112bf27bb963e8709555b5ff67a1405374" + public init() { } @@ -361,6 +365,8 @@ public final class HeroAndFriendsNamesQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNames" + public let operationIdentifier: String? = "fe3f21394eb861aa515c4d582e645469045793c9cbbeca4b5d4ce4d7dd617556" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -520,6 +526,8 @@ public final class HeroAndFriendsNamesWithIDsQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNamesWithIDs" + public let operationIdentifier: String? = "8e4ca76c63660898cfd5a3845e3709027750b5f0151c7f9be65759b869c5486d" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -700,6 +708,8 @@ public final class HeroAndFriendsIDsQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsIDs" + public let operationIdentifier: String? = "117d0f6831d8f4abe5b61ed1dbb8071b0825e19649916c0fe0906a6f578bb088" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -869,6 +879,8 @@ public final class HeroAndFriendsNamesWithIdForParentOnlyQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNamesWithIDForParentOnly" + public let operationIdentifier: String? = "f091468a629f3b757c03a1b7710c6ede8b5c8f10df7ba3238f2bbcd71c56f90f" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -1034,6 +1046,8 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNamesWithFragment" + public let operationIdentifier: String? = "1d3ad903dad146ff9d7aa09813fc01becd017489bfc1af8ffd178498730a5a26" + public var queryDocument: String { return operationDefinition.appending("\n" + FriendsNames.fragmentDefinition) } public var episode: Episode? @@ -1081,7 +1095,8 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(FriendsNames.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("friends", type: .list(.object(Friend.selections))), ] } @@ -1091,6 +1106,14 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { self.resultMap = unsafeResultMap } + public static func makeHuman(name: String, friends: [Friend?]? = nil) -> Hero { + return Hero(unsafeResultMap: ["__typename": "Human", "name": name, "friends": friends.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }]) + } + + public static func makeDroid(name: String, friends: [Friend?]? = nil) -> Hero { + return Hero(unsafeResultMap: ["__typename": "Droid", "name": name, "friends": friends.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }]) + } + public var __typename: String { get { return resultMap["__typename"]! as! String @@ -1110,6 +1133,16 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { } } + /// The friends of the character, or an empty list if they have none + public var friends: [Friend?]? { + get { + return (resultMap["friends"] as? [ResultMap?]).flatMap { (value: [ResultMap?]) -> [Friend?] in value.map { (value: ResultMap?) -> Friend? in value.flatMap { (value: ResultMap) -> Friend in Friend(unsafeResultMap: value) } } } + } + set { + resultMap.updateValue(newValue.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }, forKey: "friends") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -1135,6 +1168,50 @@ public final class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { } } } + + public struct Friend: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Human", "Droid"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public static func makeHuman(name: String) -> Friend { + return Friend(unsafeResultMap: ["__typename": "Human", "name": name]) + } + + public static func makeDroid(name: String) -> Friend { + return Friend(unsafeResultMap: ["__typename": "Droid", "name": name]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + } } } } @@ -1162,6 +1239,8 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { public let operationName: String = "HeroAndFriendsNamesWithFragmentTwice" + public let operationIdentifier: String? = "e02ef22e116ad1ca35f0298ed3badb60eeb986203f0088575a5f137768c322fc" + public var queryDocument: String { return operationDefinition.appending("\n" + CharacterName.fragmentDefinition) } public var episode: Episode? @@ -1256,7 +1335,8 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterName.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), ] } @@ -1283,6 +1363,16 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { } } + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -1367,7 +1457,8 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterName.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), GraphQLField("__typename", type: .nonNull(.scalar(String.self))), ] } @@ -1395,6 +1486,16 @@ public final class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { } } + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -1440,6 +1541,8 @@ public final class HeroAppearsInQuery: GraphQLQuery { public let operationName: String = "HeroAppearsIn" + public let operationIdentifier: String? = "22d772c0fc813281705e8f0a55fc70e71eeff6e98f3f9ef96cf67fb896914522" + public init() { } @@ -1531,6 +1634,8 @@ public final class HeroAppearsInWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroAppearsInWithFragment" + public let operationIdentifier: String? = "1756158bd7736d58db45a48d74a724fa1b6fdac735376df8afac8318ba5431fb" + public var queryDocument: String { return operationDefinition.appending("\n" + CharacterAppearsIn.fragmentDefinition) } public var episode: Episode? @@ -1577,7 +1682,8 @@ public final class HeroAppearsInWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterAppearsIn.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("appearsIn", type: .nonNull(.list(.scalar(Episode.self)))), ] } @@ -1604,6 +1710,16 @@ public final class HeroAppearsInWithFragmentQuery: GraphQLQuery { } } + /// The movies this character appears in + public var appearsIn: [Episode?] { + get { + return resultMap["appearsIn"]! as! [Episode?] + } + set { + resultMap.updateValue(newValue, forKey: "appearsIn") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -1647,6 +1763,8 @@ public final class HeroNameConditionalExclusionQuery: GraphQLQuery { public let operationName: String = "HeroNameConditionalExclusion" + public let operationIdentifier: String? = "3dd42259adf2d0598e89e0279bee2c128a7913f02b1da6aa43f3b5def6a8a1f8" + public var skipName: Bool public init(skipName: Bool) { @@ -1747,6 +1865,8 @@ public final class HeroNameConditionalInclusionQuery: GraphQLQuery { public let operationName: String = "HeroNameConditionalInclusion" + public let operationIdentifier: String? = "338081aea3acc83d04af0741ecf0da1ec2ee8e6468a88383476b681015905ef8" + public var includeName: Bool public init(includeName: Bool) { @@ -1847,6 +1967,8 @@ public final class HeroNameConditionalBothQuery: GraphQLQuery { public let operationName: String = "HeroNameConditionalBoth" + public let operationIdentifier: String? = "66f4dc124b6374b1912b22a2a208e34a4b1997349402a372b95bcfafc7884064" + public var skipName: Bool public var includeName: Bool @@ -1952,6 +2074,8 @@ public final class HeroNameConditionalBothSeparateQuery: GraphQLQuery { public let operationName: String = "HeroNameConditionalBothSeparate" + public let operationIdentifier: String? = "d0f9e9205cdc09320035662f528a177654d3275b0bf94cf0e259a65fde33e7e5" + public var skipName: Bool public var includeName: Bool @@ -2060,6 +2184,8 @@ public final class HeroDetailsInlineConditionalInclusionQuery: GraphQLQuery { public let operationName: String = "HeroDetailsInlineConditionalInclusion" + public let operationIdentifier: String? = "fcd9d7acb4e7c97e3ae5ad3cbf4e83556626149de589f0c2fce2f8ede31b0d90" + public var includeDetails: Bool public init(includeDetails: Bool) { @@ -2171,6 +2297,8 @@ public final class HeroDetailsFragmentConditionalInclusionQuery: GraphQLQuery { public let operationName: String = "HeroDetailsFragmentConditionalInclusion" + public let operationIdentifier: String? = "b31aec7d977249e185922e4cc90318fd2c7197631470904bf937b0626de54b4f" + public var queryDocument: String { return operationDefinition.appending("\n" + HeroDetails.fragmentDefinition) } public var includeDetails: Bool @@ -2216,10 +2344,16 @@ public final class HeroDetailsFragmentConditionalInclusionQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ - GraphQLFragmentSpread(HeroDetails.self), - ]), + GraphQLTypeCase( + variants: ["Human": AsHuman.selections, "Droid": AsDroid.selections], + default: [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + ]), + ] + ) ] } @@ -2246,6 +2380,16 @@ public final class HeroDetailsFragmentConditionalInclusionQuery: GraphQLQuery { } } + /// The name of the character + public var name: String? { + get { + return resultMap["name"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -2271,73 +2415,269 @@ public final class HeroDetailsFragmentConditionalInclusionQuery: GraphQLQuery { } } } - } - } -} -public final class HeroNameTypeSpecificConditionalInclusionQuery: GraphQLQuery { - /// The raw GraphQL definition of this operation. - public let operationDefinition: String = - """ - query HeroNameTypeSpecificConditionalInclusion($episode: Episode, $includeName: Boolean!) { - hero(episode: $episode) { - __typename - name @include(if: $includeName) - ... on Droid { - name + public var asHuman: AsHuman? { + get { + if !AsHuman.possibleTypes.contains(__typename) { return nil } + return AsHuman(unsafeResultMap: resultMap) + } + set { + guard let newValue = newValue else { return } + resultMap = newValue.resultMap } } - } - """ - public let operationName: String = "HeroNameTypeSpecificConditionalInclusion" + public struct AsHuman: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Human"] - public var episode: Episode? - public var includeName: Bool + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + ]), + GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("height", type: .scalar(Double.self)), + ]), + ] + } - public init(episode: Episode? = nil, includeName: Bool) { - self.episode = episode - self.includeName = includeName - } + public private(set) var resultMap: ResultMap - public var variables: GraphQLMap? { - return ["episode": episode, "includeName": includeName] - } + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } - public struct Data: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Query"] + public init(name: String? = nil, height: Double? = nil) { + self.init(unsafeResultMap: ["__typename": "Human", "name": name, "height": height]) + } - public static var selections: [GraphQLSelection] { - return [ - GraphQLField("hero", arguments: ["episode": GraphQLVariable("episode")], type: .object(Hero.selections)), - ] - } + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } - public private(set) var resultMap: ResultMap + /// What this human calls themselves + public var name: String? { + get { + return resultMap["name"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } - public init(unsafeResultMap: ResultMap) { - self.resultMap = unsafeResultMap - } + /// Height in the preferred unit, default is meters + public var height: Double? { + get { + return resultMap["height"] as? Double + } + set { + resultMap.updateValue(newValue, forKey: "height") + } + } - public init(hero: Hero? = nil) { - self.init(unsafeResultMap: ["__typename": "Query", "hero": hero.flatMap { (value: Hero) -> ResultMap in value.resultMap }]) - } + public var fragments: Fragments { + get { + return Fragments(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } - public var hero: Hero? { - get { - return (resultMap["hero"] as? ResultMap).flatMap { Hero(unsafeResultMap: $0) } - } - set { - resultMap.updateValue(newValue?.resultMap, forKey: "hero") - } - } + public struct Fragments { + public private(set) var resultMap: ResultMap - public struct Hero: GraphQLSelectionSet { - public static let possibleTypes: [String] = ["Human", "Droid"] + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } - public static var selections: [GraphQLSelection] { - return [ - GraphQLTypeCase( + public var heroDetails: HeroDetails { + get { + return HeroDetails(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + } + } + + public var asDroid: AsDroid? { + get { + if !AsDroid.possibleTypes.contains(__typename) { return nil } + return AsDroid(unsafeResultMap: resultMap) + } + set { + guard let newValue = newValue else { return } + resultMap = newValue.resultMap + } + } + + public struct AsDroid: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Droid"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + ]), + GraphQLBooleanCondition(variableName: "includeDetails", inverted: false, selections: [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("primaryFunction", type: .scalar(String.self)), + ]), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(name: String? = nil, primaryFunction: String? = nil) { + self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "primaryFunction": primaryFunction]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + /// What others call this droid + public var name: String? { + get { + return resultMap["name"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// This droid's primary function + public var primaryFunction: String? { + get { + return resultMap["primaryFunction"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "primaryFunction") + } + } + + public var fragments: Fragments { + get { + return Fragments(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + + public struct Fragments { + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public var heroDetails: HeroDetails { + get { + return HeroDetails(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + } + } + } + } +} + +public final class HeroNameTypeSpecificConditionalInclusionQuery: GraphQLQuery { + /// The raw GraphQL definition of this operation. + public let operationDefinition: String = + """ + query HeroNameTypeSpecificConditionalInclusion($episode: Episode, $includeName: Boolean!) { + hero(episode: $episode) { + __typename + name @include(if: $includeName) + ... on Droid { + name + } + } + } + """ + + public let operationName: String = "HeroNameTypeSpecificConditionalInclusion" + + public let operationIdentifier: String? = "4d465fbc6e3731d011025048502f16278307d73300ea9329a709d7e2b6815e40" + + public var episode: Episode? + public var includeName: Bool + + public init(episode: Episode? = nil, includeName: Bool) { + self.episode = episode + self.includeName = includeName + } + + public var variables: GraphQLMap? { + return ["episode": episode, "includeName": includeName] + } + + public struct Data: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Query"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("hero", arguments: ["episode": GraphQLVariable("episode")], type: .object(Hero.selections)), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(hero: Hero? = nil) { + self.init(unsafeResultMap: ["__typename": "Query", "hero": hero.flatMap { (value: Hero) -> ResultMap in value.resultMap }]) + } + + public var hero: Hero? { + get { + return (resultMap["hero"] as? ResultMap).flatMap { Hero(unsafeResultMap: $0) } + } + set { + resultMap.updateValue(newValue?.resultMap, forKey: "hero") + } + } + + public struct Hero: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Human", "Droid"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLTypeCase( variants: ["Droid": AsDroid.selections], default: [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), @@ -2459,6 +2799,8 @@ public final class HeroFriendsDetailsConditionalInclusionQuery: GraphQLQuery { public let operationName: String = "HeroFriendsDetailsConditionalInclusion" + public let operationIdentifier: String? = "9bdfeee789c1d22123402a9c3e3edefeb66799b3436289751be8f47905e3babd" + public var includeFriendsDetails: Bool public init(includeFriendsDetails: Bool) { @@ -2680,6 +3022,8 @@ public final class HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery: public let operationName: String = "HeroFriendsDetailsUnconditionalAndConditionalInclusion" + public let operationIdentifier: String? = "501fcb710e5ffeeab2c65b7935fbded394ffea92e7b5dd904d05d5deab6f39c6" + public var includeFriendsDetails: Bool public init(includeFriendsDetails: Bool) { @@ -2910,6 +3254,8 @@ public final class HeroDetailsQuery: GraphQLQuery { public let operationName: String = "HeroDetails" + public let operationIdentifier: String? = "2b67111fd3a1c6b2ac7d1ef7764e5cefa41d3f4218e1d60cb67c22feafbd43ec" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -3137,6 +3483,8 @@ public final class HeroDetailsWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroDetailsWithFragment" + public let operationIdentifier: String? = "d20fa2f460058b8eec3d227f2f6088a708cf35dfa2b5ebf1414e34f9674ecfce" + public var queryDocument: String { return operationDefinition.appending("\n" + HeroDetails.fragmentDefinition) } public var episode: Episode? @@ -3182,8 +3530,14 @@ public final class HeroDetailsWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(HeroDetails.self), + GraphQLTypeCase( + variants: ["Human": AsHuman.selections, "Droid": AsDroid.selections], + default: [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + ] + ) ] } @@ -3210,6 +3564,16 @@ public final class HeroDetailsWithFragmentQuery: GraphQLQuery { } } + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -3228,12 +3592,194 @@ public final class HeroDetailsWithFragmentQuery: GraphQLQuery { public var heroDetails: HeroDetails { get { - return HeroDetails(unsafeResultMap: resultMap) + return HeroDetails(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + } + + public var asHuman: AsHuman? { + get { + if !AsHuman.possibleTypes.contains(__typename) { return nil } + return AsHuman(unsafeResultMap: resultMap) + } + set { + guard let newValue = newValue else { return } + resultMap = newValue.resultMap + } + } + + public struct AsHuman: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Human"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("height", type: .scalar(Double.self)), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(name: String, height: Double? = nil) { + self.init(unsafeResultMap: ["__typename": "Human", "name": name, "height": height]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + /// What this human calls themselves + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// Height in the preferred unit, default is meters + public var height: Double? { + get { + return resultMap["height"] as? Double + } + set { + resultMap.updateValue(newValue, forKey: "height") + } + } + + public var fragments: Fragments { + get { + return Fragments(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + + public struct Fragments { + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public var heroDetails: HeroDetails { + get { + return HeroDetails(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + } + } + + public var asDroid: AsDroid? { + get { + if !AsDroid.possibleTypes.contains(__typename) { return nil } + return AsDroid(unsafeResultMap: resultMap) + } + set { + guard let newValue = newValue else { return } + resultMap = newValue.resultMap + } + } + + public struct AsDroid: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Droid"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("primaryFunction", type: .scalar(String.self)), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(name: String, primaryFunction: String? = nil) { + self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "primaryFunction": primaryFunction]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + /// What others call this droid + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// This droid's primary function + public var primaryFunction: String? { + get { + return resultMap["primaryFunction"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "primaryFunction") + } + } + + public var fragments: Fragments { + get { + return Fragments(unsafeResultMap: resultMap) } set { resultMap += newValue.resultMap } } + + public struct Fragments { + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public var heroDetails: HeroDetails { + get { + return HeroDetails(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + } } } } @@ -3253,6 +3799,8 @@ public final class DroidDetailsWithFragmentQuery: GraphQLQuery { public let operationName: String = "DroidDetailsWithFragment" + public let operationIdentifier: String? = "7277e97563e911ac8f5c91d401028d218aae41f38df014d7fa0b037bb2a2e739" + public var queryDocument: String { return operationDefinition.appending("\n" + DroidDetails.fragmentDefinition) } public var episode: Episode? @@ -3298,8 +3846,12 @@ public final class DroidDetailsWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(DroidDetails.self), + GraphQLTypeCase( + variants: ["Droid": AsDroid.selections], + default: [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + ] + ) ] } @@ -3353,6 +3905,95 @@ public final class DroidDetailsWithFragmentQuery: GraphQLQuery { } } } + + public var asDroid: AsDroid? { + get { + if !AsDroid.possibleTypes.contains(__typename) { return nil } + return AsDroid(unsafeResultMap: resultMap) + } + set { + guard let newValue = newValue else { return } + resultMap = newValue.resultMap + } + } + + public struct AsDroid: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Droid"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("primaryFunction", type: .scalar(String.self)), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(name: String, primaryFunction: String? = nil) { + self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "primaryFunction": primaryFunction]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + /// What others call this droid + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// This droid's primary function + public var primaryFunction: String? { + get { + return resultMap["primaryFunction"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "primaryFunction") + } + } + + public var fragments: Fragments { + get { + return Fragments(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + + public struct Fragments { + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public var droidDetails: DroidDetails { + get { + return DroidDetails(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + } + } } } } @@ -3378,6 +4019,8 @@ public final class HeroFriendsOfFriendsNamesQuery: GraphQLQuery { public let operationName: String = "HeroFriendsOfFriendsNames" + public let operationIdentifier: String? = "37cd5626048e7243716ffda9e56503939dd189772124a1c21b0e0b87e69aae01" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -3575,6 +4218,8 @@ public final class HeroNameQuery: GraphQLQuery { public let operationName: String = "HeroName" + public let operationIdentifier: String? = "f6e76545cd03aa21368d9969cb39447f6e836a16717823281803778e7805d671" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -3674,6 +4319,8 @@ public final class HeroNameWithIdQuery: GraphQLQuery { public let operationName: String = "HeroNameWithID" + public let operationIdentifier: String? = "83c03f612c46fca72f6cb902df267c57bffc9209bc44dd87d2524fb2b34f6f18" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -3783,6 +4430,8 @@ public final class HeroNameWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroNameWithFragment" + public let operationIdentifier: String? = "b952f0054915a32ec524ac0dde0244bcda246649debe149f9e32e303e21c8266" + public var queryDocument: String { return operationDefinition.appending("\n" + CharacterName.fragmentDefinition) } public var episode: Episode? @@ -3829,7 +4478,8 @@ public final class HeroNameWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterName.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), ] } @@ -3856,6 +4506,16 @@ public final class HeroNameWithFragmentQuery: GraphQLQuery { } } + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -3900,6 +4560,8 @@ public final class HeroNameWithFragmentAndIdQuery: GraphQLQuery { public let operationName: String = "HeroNameWithFragmentAndID" + public let operationIdentifier: String? = "a87a0694c09d1ed245e9a80f245d96a5f57b20a4aa936ee9ab09b2a43620db02" + public var queryDocument: String { return operationDefinition.appending("\n" + CharacterName.fragmentDefinition) } public var episode: Episode? @@ -3947,7 +4609,8 @@ public final class HeroNameWithFragmentAndIdQuery: GraphQLQuery { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLFragmentSpread(CharacterName.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), ] } @@ -3984,6 +4647,16 @@ public final class HeroNameWithFragmentAndIdQuery: GraphQLQuery { } } + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -4027,6 +4700,8 @@ public final class HeroNameAndAppearsInWithFragmentQuery: GraphQLQuery { public let operationName: String = "HeroNameAndAppearsInWithFragment" + public let operationIdentifier: String? = "0664fed3eb4f9fbdb44e8691d9e8fd11f2b3c097ba11327592054f602bd3ba1a" + public var queryDocument: String { return operationDefinition.appending("\n" + CharacterNameAndAppearsIn.fragmentDefinition) } public var episode: Episode? @@ -4073,7 +4748,9 @@ public final class HeroNameAndAppearsInWithFragmentQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterNameAndAppearsIn.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("appearsIn", type: .nonNull(.list(.scalar(Episode.self)))), ] } @@ -4100,6 +4777,26 @@ public final class HeroNameAndAppearsInWithFragmentQuery: GraphQLQuery { } } + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// The movies this character appears in + public var appearsIn: [Episode?] { + get { + return resultMap["appearsIn"]! as! [Episode?] + } + set { + resultMap.updateValue(newValue, forKey: "appearsIn") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -4161,6 +4858,8 @@ public final class HeroParentTypeDependentFieldQuery: GraphQLQuery { public let operationName: String = "HeroParentTypeDependentField" + public let operationIdentifier: String? = "561e22ac4da5209f254779b70e01557fb2fc57916b9914088429ec809e166cad" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -4615,6 +5314,8 @@ public final class HeroTypeDependentAliasedFieldQuery: GraphQLQuery { public let operationName: String = "HeroTypeDependentAliasedField" + public let operationIdentifier: String? = "b5838c22bac1c5626023dac4412ca9b86bebfe16608991fb632a37c44e12811e" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -4813,6 +5514,8 @@ public final class SameHeroTwiceQuery: GraphQLQuery { public let operationName: String = "SameHeroTwice" + public let operationIdentifier: String? = "2a8ad85a703add7d64622aaf6be76b58a1134caf28e4ff6b34dd00ba89541364" + public init() { } @@ -4969,6 +5672,8 @@ public final class SearchQuery: GraphQLQuery { public let operationName: String = "Search" + public let operationIdentifier: String? = "73536da2eec4d83e6e1003e674cb2299d9da2798f7bd310e57339a6bcd713b77" + public var term: String? public init(term: String? = nil) { @@ -5252,6 +5957,8 @@ public final class StarshipQuery: GraphQLQuery { public let operationName: String = "Starship" + public let operationIdentifier: String? = "a3734516185da9919e3e66d74fe92b60d65292a1943dc54913f7332637dfdd2a" + public init() { } @@ -5351,6 +6058,8 @@ public final class StarshipCoordinatesQuery: GraphQLQuery { public let operationName: String = "StarshipCoordinates" + public let operationIdentifier: String? = "8dd77d4bc7494c184606da092a665a7c2ca3c2a3f14d3b23fa5e469e207b3406" + public var coordinates: [[Double]]? public init(coordinates: [[Double]]?) { @@ -5468,6 +6177,8 @@ public final class ReviewAddedSubscription: GraphQLSubscription { public let operationName: String = "ReviewAdded" + public let operationIdentifier: String? = "38644c5e7cf4fd506b91d2e7010cabf84e63dfcd33cf1deb443b4b32b55e2cbe" + public var episode: Episode? public init(episode: Episode? = nil) { @@ -5560,10 +6271,118 @@ public final class ReviewAddedSubscription: GraphQLSubscription { /// Comment about the movie public var commentary: String? { get { - return resultMap["commentary"] as? String + return resultMap["commentary"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "commentary") + } + } + } + } +} + +public final class HumanQuery: GraphQLQuery { + /// The raw GraphQL definition of this operation. + public let operationDefinition: String = + """ + query Human($id: ID!) { + human(id: $id) { + __typename + name + mass + } + } + """ + + public let operationName: String = "Human" + + public let operationIdentifier: String? = "b37eb69b82fd52358321e49453769750983be1c286744dbf415735d7bcf12f1e" + + public var id: GraphQLID + + public init(id: GraphQLID) { + self.id = id + } + + public var variables: GraphQLMap? { + return ["id": id] + } + + public struct Data: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Query"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("human", arguments: ["id": GraphQLVariable("id")], type: .object(Human.selections)), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(human: Human? = nil) { + self.init(unsafeResultMap: ["__typename": "Query", "human": human.flatMap { (value: Human) -> ResultMap in value.resultMap }]) + } + + public var human: Human? { + get { + return (resultMap["human"] as? ResultMap).flatMap { Human(unsafeResultMap: $0) } + } + set { + resultMap.updateValue(newValue?.resultMap, forKey: "human") + } + } + + public struct Human: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Human"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("mass", type: .scalar(Double.self)), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(name: String, mass: Double? = nil) { + self.init(unsafeResultMap: ["__typename": "Human", "name": name, "mass": mass]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + /// What this human calls themselves + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// Mass in kilograms, or null if unknown + public var mass: Double? { + get { + return resultMap["mass"] as? Double } set { - resultMap.updateValue(newValue, forKey: "commentary") + resultMap.updateValue(newValue, forKey: "mass") } } } @@ -5588,6 +6407,8 @@ public final class TwoHeroesQuery: GraphQLQuery { public let operationName: String = "TwoHeroes" + public let operationIdentifier: String? = "b868fa9c48f19b8151c08c09f46831e3b9cd09f5c617d328647de785244b52bb" + public init() { } @@ -5735,8 +6556,10 @@ public struct DroidNameAndPrimaryFunction: GraphQLFragment { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterName.self), - GraphQLFragmentSpread(DroidPrimaryFunction.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("primaryFunction", type: .scalar(String.self)), ] } @@ -5759,6 +6582,26 @@ public struct DroidNameAndPrimaryFunction: GraphQLFragment { } } + /// What others call this droid + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// This droid's primary function + public var primaryFunction: String? { + get { + return resultMap["primaryFunction"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "primaryFunction") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -5810,9 +6653,14 @@ public struct CharacterNameAndDroidPrimaryFunction: GraphQLFragment { public static var selections: [GraphQLSelection] { return [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterName.self), - GraphQLFragmentSpread(DroidPrimaryFunction.self), + GraphQLTypeCase( + variants: ["Droid": AsDroid.selections], + default: [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + ] + ) ] } @@ -5839,6 +6687,16 @@ public struct CharacterNameAndDroidPrimaryFunction: GraphQLFragment { } } + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -5875,6 +6733,105 @@ public struct CharacterNameAndDroidPrimaryFunction: GraphQLFragment { } } } + + public var asDroid: AsDroid? { + get { + if !AsDroid.possibleTypes.contains(__typename) { return nil } + return AsDroid(unsafeResultMap: resultMap) + } + set { + guard let newValue = newValue else { return } + resultMap = newValue.resultMap + } + } + + public struct AsDroid: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Droid"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("primaryFunction", type: .scalar(String.self)), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public init(name: String, primaryFunction: String? = nil) { + self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "primaryFunction": primaryFunction]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + /// What others call this droid + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// This droid's primary function + public var primaryFunction: String? { + get { + return resultMap["primaryFunction"] as? String + } + set { + resultMap.updateValue(newValue, forKey: "primaryFunction") + } + } + + public var fragments: Fragments { + get { + return Fragments(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + + public struct Fragments { + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public var characterName: CharacterName { + get { + return CharacterName(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + + public var droidPrimaryFunction: DroidPrimaryFunction { + get { + return DroidPrimaryFunction(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } + } + } } public struct CharacterNameAndDroidAppearsIn: GraphQLFragment { @@ -6162,7 +7119,10 @@ public struct CharacterNameAndAppearsInWithNestedFragments: GraphQLFragment { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterNameWithNestedAppearsInFragment.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("appearsIn", type: .nonNull(.list(.scalar(Episode.self)))), ] } @@ -6189,6 +7149,26 @@ public struct CharacterNameAndAppearsInWithNestedFragments: GraphQLFragment { } } + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// The movies this character appears in + public var appearsIn: [Episode?] { + get { + return resultMap["appearsIn"]! as! [Episode?] + } + set { + resultMap.updateValue(newValue, forKey: "appearsIn") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -6213,6 +7193,15 @@ public struct CharacterNameAndAppearsInWithNestedFragments: GraphQLFragment { resultMap += newValue.resultMap } } + + public var characterAppearsIn: CharacterAppearsIn { + get { + return CharacterAppearsIn(unsafeResultMap: resultMap) + } + set { + resultMap += newValue.resultMap + } + } } } @@ -6233,7 +7222,8 @@ public struct CharacterNameWithNestedAppearsInFragment: GraphQLFragment { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterAppearsIn.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("appearsIn", type: .nonNull(.list(.scalar(Episode.self)))), ] } @@ -6270,6 +7260,16 @@ public struct CharacterNameWithNestedAppearsInFragment: GraphQLFragment { } } + /// The movies this character appears in + public var appearsIn: [Episode?] { + get { + return resultMap["appearsIn"]! as! [Episode?] + } + set { + resultMap.updateValue(newValue, forKey: "appearsIn") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -6339,6 +7339,10 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { return CharacterNameWithInlineFragment(unsafeResultMap: ["__typename": "Human", "friends": friends.flatMap { (value: [AsHuman.Friend?]) -> [ResultMap?] in value.map { (value: AsHuman.Friend?) -> ResultMap? in value.flatMap { (value: AsHuman.Friend) -> ResultMap in value.resultMap } } }]) } + public static func makeDroid(name: String, friends: [AsDroid.Friend?]? = nil) -> CharacterNameWithInlineFragment { + return CharacterNameWithInlineFragment(unsafeResultMap: ["__typename": "Droid", "name": name, "friends": friends.flatMap { (value: [AsDroid.Friend?]) -> [ResultMap?] in value.map { (value: AsDroid.Friend?) -> ResultMap? in value.flatMap { (value: AsDroid.Friend) -> ResultMap in value.resultMap } } }]) + } + public var __typename: String { get { return resultMap["__typename"]! as! String @@ -6460,8 +7464,10 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { public static var selections: [GraphQLSelection] { return [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLFragmentSpread(CharacterName.self), - GraphQLFragmentSpread(FriendsNames.self), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("friends", type: .list(.object(Friend.selections))), ] } @@ -6471,6 +7477,10 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { self.resultMap = unsafeResultMap } + public init(name: String, friends: [Friend?]? = nil) { + self.init(unsafeResultMap: ["__typename": "Droid", "name": name, "friends": friends.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }]) + } + public var __typename: String { get { return resultMap["__typename"]! as! String @@ -6480,6 +7490,26 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { } } + /// What others call this droid + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + + /// This droid's friends, or an empty list if they have none + public var friends: [Friend?]? { + get { + return (resultMap["friends"] as? [ResultMap?]).flatMap { (value: [ResultMap?]) -> [Friend?] in value.map { (value: ResultMap?) -> Friend? in value.flatMap { (value: ResultMap) -> Friend in Friend(unsafeResultMap: value) } } } + } + set { + resultMap.updateValue(newValue.flatMap { (value: [Friend?]) -> [ResultMap?] in value.map { (value: Friend?) -> ResultMap? in value.flatMap { (value: Friend) -> ResultMap in value.resultMap } } }, forKey: "friends") + } + } + public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) @@ -6514,6 +7544,50 @@ public struct CharacterNameWithInlineFragment: GraphQLFragment { } } } + + public struct Friend: GraphQLSelectionSet { + public static let possibleTypes: [String] = ["Human", "Droid"] + + public static var selections: [GraphQLSelection] { + return [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("name", type: .nonNull(.scalar(String.self))), + ] + } + + public private(set) var resultMap: ResultMap + + public init(unsafeResultMap: ResultMap) { + self.resultMap = unsafeResultMap + } + + public static func makeHuman(name: String) -> Friend { + return Friend(unsafeResultMap: ["__typename": "Human", "name": name]) + } + + public static func makeDroid(name: String) -> Friend { + return Friend(unsafeResultMap: ["__typename": "Droid", "name": name]) + } + + public var __typename: String { + get { + return resultMap["__typename"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "__typename") + } + } + + /// The name of the character + public var name: String { + get { + return resultMap["name"]! as! String + } + set { + resultMap.updateValue(newValue, forKey: "name") + } + } + } } } From 16dd2c756c683076485f1d65004d3a69f7c087ff Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Mon, 16 Nov 2020 17:07:12 -0600 Subject: [PATCH 7/7] regen upload with settings from swift scripts --- Sources/UploadAPI/API.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/UploadAPI/API.swift b/Sources/UploadAPI/API.swift index a2f9395959..2a056f80c1 100644 --- a/Sources/UploadAPI/API.swift +++ b/Sources/UploadAPI/API.swift @@ -21,6 +21,8 @@ public final class UploadMultipleFilesToTheSameParameterMutation: GraphQLMutatio public let operationName: String = "UploadMultipleFilesToTheSameParameter" + public let operationIdentifier: String? = "88858c283bb72f18c0049dc85b140e72a4046f469fa16a8bf4bcf01c11d8a2b7" + public var files: [String] public init(files: [String]) { @@ -147,6 +149,8 @@ public final class UploadMultipleFilesToDifferentParametersMutation: GraphQLMuta public let operationName: String = "UploadMultipleFilesToDifferentParameters" + public let operationIdentifier: String? = "1ec89997a185c50bacc5f62ad41f27f3070f4a950d72e4a1510a4c64160812d5" + public var singleFile: String public var multipleFiles: [String] @@ -275,6 +279,8 @@ public final class UploadOneFileMutation: GraphQLMutation { public let operationName: String = "UploadOneFile" + public let operationIdentifier: String? = "c5d5919f77d9ba16a9689b6b0ad4b781cb05dc1dc4812623bf80f7c044c09533" + public var file: String public init(file: String) {