From 3b48ade7e0cac63127ca46ecaa39df506578bdb7 Mon Sep 17 00:00:00 2001 From: Anthony Miller Date: Thu, 27 Jan 2022 14:54:59 -0800 Subject: [PATCH] Add (broken) generated AnimalKingdom files --- Apollo.xcodeproj/project.pbxproj | 93 ++++++++++++++++--- .../graphql/API/AllAnimalsQuery.swift | 63 +++++++++++++ .../AnimalKingdomAPI/graphql/API/Animal.swift | 1 + .../AnimalKingdomAPI/graphql/API/Bird.swift | 1 + .../AnimalKingdomAPI/graphql/API/Cat.swift | 1 + .../graphql/API/ClassroomPet.swift | 1 + .../graphql/API/ClassroomPetDetails.swift | 16 ++++ .../graphql/API/ClassroomPets.swift | 22 +++++ .../AnimalKingdomAPI/graphql/API/Height.swift | 1 + .../graphql/API/HeightInMeters.swift | 24 +++++ .../AnimalKingdomAPI/graphql/API/Human.swift | 1 + .../AnimalKingdomAPI/graphql/API/Pet.swift | 1 + .../graphql/API/PetDetails.swift | 28 ++++++ .../graphql/API/PetRock.swift | 1 + .../graphql/API/RelativeSize.swift | 5 + .../AnimalKingdomAPI/graphql/API/Schema.swift | 22 +++++ .../graphql/API/SkinCovering.swift | 6 ++ .../graphql/API/WarmBlooded.swift | 1 + .../graphql/API/WarmBloodedDetails.swift | 28 ++++++ 19 files changed, 303 insertions(+), 13 deletions(-) create mode 100644 Sources/AnimalKingdomAPI/graphql/API/AllAnimalsQuery.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/Animal.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/Bird.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/Cat.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/ClassroomPet.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/ClassroomPetDetails.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/ClassroomPets.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/Height.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/HeightInMeters.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/Human.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/Pet.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/PetDetails.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/PetRock.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/RelativeSize.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/Schema.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/SkinCovering.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/WarmBlooded.swift create mode 100644 Sources/AnimalKingdomAPI/graphql/API/WarmBloodedDetails.swift diff --git a/Apollo.xcodeproj/project.pbxproj b/Apollo.xcodeproj/project.pbxproj index 90b0c19cf4..ffa39d149f 100644 --- a/Apollo.xcodeproj/project.pbxproj +++ b/Apollo.xcodeproj/project.pbxproj @@ -266,6 +266,24 @@ DEAFB781270647D400BE02F3 /* MockCompilationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEAFB780270647D400BE02F3 /* MockCompilationResult.swift */; }; DEAFB78327064F6900BE02F3 /* MockGraphQLType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEAFB78227064F6900BE02F3 /* MockGraphQLType.swift */; }; DEAFB787270652D100BE02F3 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = DEAFB786270652D100BE02F3 /* OrderedCollections */; }; + DEC11F3327A359C800E07121 /* ClassroomPets.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2127A359C800E07121 /* ClassroomPets.swift */; }; + DEC11F3427A359C800E07121 /* PetDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2227A359C800E07121 /* PetDetails.swift */; }; + DEC11F3527A359C800E07121 /* HeightInMeters.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2327A359C800E07121 /* HeightInMeters.swift */; }; + DEC11F3627A359C800E07121 /* Bird.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2427A359C800E07121 /* Bird.swift */; }; + DEC11F3727A359C800E07121 /* ClassroomPetDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2527A359C800E07121 /* ClassroomPetDetails.swift */; }; + DEC11F3827A359C800E07121 /* Human.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2627A359C800E07121 /* Human.swift */; }; + DEC11F3927A359C800E07121 /* AllAnimalsQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2727A359C800E07121 /* AllAnimalsQuery.swift */; }; + DEC11F3A27A359C800E07121 /* WarmBloodedDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2827A359C800E07121 /* WarmBloodedDetails.swift */; }; + DEC11F3B27A359C800E07121 /* Cat.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2927A359C800E07121 /* Cat.swift */; }; + DEC11F3C27A359C800E07121 /* Animal.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2A27A359C800E07121 /* Animal.swift */; }; + DEC11F3D27A359C800E07121 /* Pet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2B27A359C800E07121 /* Pet.swift */; }; + DEC11F3E27A359C800E07121 /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2C27A359C800E07121 /* Schema.swift */; }; + DEC11F3F27A359C800E07121 /* ClassroomPet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2D27A359C800E07121 /* ClassroomPet.swift */; }; + DEC11F4027A359C800E07121 /* Height.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2E27A359C800E07121 /* Height.swift */; }; + DEC11F4127A359C800E07121 /* WarmBlooded.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F2F27A359C800E07121 /* WarmBlooded.swift */; }; + DEC11F4227A359C800E07121 /* SkinCovering.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F3027A359C800E07121 /* SkinCovering.swift */; }; + DEC11F4327A359C800E07121 /* RelativeSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F3127A359C800E07121 /* RelativeSize.swift */; }; + DEC11F4427A359C800E07121 /* PetRock.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC11F3227A359C800E07121 /* PetRock.swift */; }; DECD46D0262F64D000924527 /* StarWarsApolloSchemaDownloaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DECD46CF262F64D000924527 /* StarWarsApolloSchemaDownloaderTests.swift */; }; DECD46FB262F659500924527 /* ApolloCodegenLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7B6F47233C26D100F32205 /* ApolloCodegenLib.framework */; }; DECD4736262F668500924527 /* UploadAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B2DFBB624E1FA0D00ED3AE6 /* UploadAPI.framework */; }; @@ -471,13 +489,6 @@ remoteGlobalIDString = DE058606266978A100265760; remoteInfo = ApolloModels; }; - DE223C25271F337E004A0148 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE3C7A00260A6B9800D2F4FF; - remoteInfo = AnimalKingdomAPI; - }; DE3C7A96260A6C1000D2F4FF /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; @@ -953,6 +964,24 @@ DEAFB77A2706444B00BE02F3 /* IRRootEntityFieldBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IRRootEntityFieldBuilderTests.swift; sourceTree = ""; }; DEAFB780270647D400BE02F3 /* MockCompilationResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockCompilationResult.swift; sourceTree = ""; }; DEAFB78227064F6900BE02F3 /* MockGraphQLType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockGraphQLType.swift; sourceTree = ""; }; + DEC11F2127A359C800E07121 /* ClassroomPets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassroomPets.swift; sourceTree = ""; }; + DEC11F2227A359C800E07121 /* PetDetails.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetDetails.swift; sourceTree = ""; }; + DEC11F2327A359C800E07121 /* HeightInMeters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeightInMeters.swift; sourceTree = ""; }; + DEC11F2427A359C800E07121 /* Bird.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bird.swift; sourceTree = ""; }; + DEC11F2527A359C800E07121 /* ClassroomPetDetails.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassroomPetDetails.swift; sourceTree = ""; }; + DEC11F2627A359C800E07121 /* Human.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Human.swift; sourceTree = ""; }; + DEC11F2727A359C800E07121 /* AllAnimalsQuery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AllAnimalsQuery.swift; sourceTree = ""; }; + DEC11F2827A359C800E07121 /* WarmBloodedDetails.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WarmBloodedDetails.swift; sourceTree = ""; }; + DEC11F2927A359C800E07121 /* Cat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cat.swift; sourceTree = ""; }; + DEC11F2A27A359C800E07121 /* Animal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animal.swift; sourceTree = ""; }; + DEC11F2B27A359C800E07121 /* Pet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pet.swift; sourceTree = ""; }; + DEC11F2C27A359C800E07121 /* Schema.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Schema.swift; sourceTree = ""; }; + DEC11F2D27A359C800E07121 /* ClassroomPet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassroomPet.swift; sourceTree = ""; }; + DEC11F2E27A359C800E07121 /* Height.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Height.swift; sourceTree = ""; }; + DEC11F2F27A359C800E07121 /* WarmBlooded.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WarmBlooded.swift; sourceTree = ""; }; + DEC11F3027A359C800E07121 /* SkinCovering.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SkinCovering.swift; sourceTree = ""; }; + DEC11F3127A359C800E07121 /* RelativeSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RelativeSize.swift; sourceTree = ""; }; + DEC11F3227A359C800E07121 /* PetRock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetRock.swift; sourceTree = ""; }; DECD46CF262F64D000924527 /* StarWarsApolloSchemaDownloaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StarWarsApolloSchemaDownloaderTests.swift; sourceTree = ""; }; DECD490B262F81BF00924527 /* ApolloCodegenTestSupport.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApolloCodegenTestSupport.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DECD490D262F81BF00924527 /* ApolloCodegenTestSupport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApolloCodegenTestSupport.h; sourceTree = ""; }; @@ -1978,6 +2007,7 @@ DE3C7AB7260A6D3E00D2F4FF /* graphql */ = { isa = PBXGroup; children = ( + DEC11F2027A359C800E07121 /* API */, DE2FCF2E26E8092B0057EA67 /* AllAnimals.graphql */, DE2FCF2D26E8092B0057EA67 /* Schema.graphqls */, DE2FCF2F26E8092B0057EA67 /* ClassroomPets.graphql */, @@ -2097,6 +2127,31 @@ path = IR; sourceTree = ""; }; + DEC11F2027A359C800E07121 /* API */ = { + isa = PBXGroup; + children = ( + DEC11F2127A359C800E07121 /* ClassroomPets.swift */, + DEC11F2227A359C800E07121 /* PetDetails.swift */, + DEC11F2327A359C800E07121 /* HeightInMeters.swift */, + DEC11F2427A359C800E07121 /* Bird.swift */, + DEC11F2527A359C800E07121 /* ClassroomPetDetails.swift */, + DEC11F2627A359C800E07121 /* Human.swift */, + DEC11F2727A359C800E07121 /* AllAnimalsQuery.swift */, + DEC11F2827A359C800E07121 /* WarmBloodedDetails.swift */, + DEC11F2927A359C800E07121 /* Cat.swift */, + DEC11F2A27A359C800E07121 /* Animal.swift */, + DEC11F2B27A359C800E07121 /* Pet.swift */, + DEC11F2C27A359C800E07121 /* Schema.swift */, + DEC11F2D27A359C800E07121 /* ClassroomPet.swift */, + DEC11F2E27A359C800E07121 /* Height.swift */, + DEC11F2F27A359C800E07121 /* WarmBlooded.swift */, + DEC11F3027A359C800E07121 /* SkinCovering.swift */, + DEC11F3127A359C800E07121 /* RelativeSize.swift */, + DEC11F3227A359C800E07121 /* PetRock.swift */, + ); + path = API; + sourceTree = ""; + }; DECD490C262F81BF00924527 /* ApolloCodegenTestSupport */ = { isa = PBXGroup; children = ( @@ -2371,7 +2426,6 @@ buildRules = ( ); dependencies = ( - DE223C26271F337E004A0148 /* PBXTargetDependency */, E6E4209426A7DF5800B82624 /* PBXTargetDependency */, 9B683549246348CB00337AE6 /* PBXTargetDependency */, ); @@ -3267,7 +3321,25 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + DEC11F3C27A359C800E07121 /* Animal.swift in Sources */, DE223C24271F335D004A0148 /* Resources.swift in Sources */, + DEC11F3827A359C800E07121 /* Human.swift in Sources */, + DEC11F4227A359C800E07121 /* SkinCovering.swift in Sources */, + DEC11F3F27A359C800E07121 /* ClassroomPet.swift in Sources */, + DEC11F3B27A359C800E07121 /* Cat.swift in Sources */, + DEC11F3627A359C800E07121 /* Bird.swift in Sources */, + DEC11F3727A359C800E07121 /* ClassroomPetDetails.swift in Sources */, + DEC11F4327A359C800E07121 /* RelativeSize.swift in Sources */, + DEC11F3927A359C800E07121 /* AllAnimalsQuery.swift in Sources */, + DEC11F3E27A359C800E07121 /* Schema.swift in Sources */, + DEC11F3427A359C800E07121 /* PetDetails.swift in Sources */, + DEC11F4427A359C800E07121 /* PetRock.swift in Sources */, + DEC11F3327A359C800E07121 /* ClassroomPets.swift in Sources */, + DEC11F4027A359C800E07121 /* Height.swift in Sources */, + DEC11F4127A359C800E07121 /* WarmBlooded.swift in Sources */, + DEC11F3D27A359C800E07121 /* Pet.swift in Sources */, + DEC11F3A27A359C800E07121 /* WarmBloodedDetails.swift in Sources */, + DEC11F3527A359C800E07121 /* HeightInMeters.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3405,11 +3477,6 @@ target = DE058606266978A100265760 /* ApolloAPI */; targetProxy = DE05862726697B1D00265760 /* PBXContainerItemProxy */; }; - DE223C26271F337E004A0148 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE3C7A00260A6B9800D2F4FF /* AnimalKingdomAPI */; - targetProxy = DE223C25271F337E004A0148 /* PBXContainerItemProxy */; - }; DE3C7A97260A6C1000D2F4FF /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 9B68353D2463481A00337AE6 /* ApolloUtils */; diff --git a/Sources/AnimalKingdomAPI/graphql/API/AllAnimalsQuery.swift b/Sources/AnimalKingdomAPI/graphql/API/AllAnimalsQuery.swift new file mode 100644 index 0000000000..3815591d59 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/AllAnimalsQuery.swift @@ -0,0 +1,63 @@ +public struct Data: API.SelectionSet { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Object(API.Query.self) } + public static var selections: [Selection] { [ + .field("allAnimals", [Animal].self), + ] } + + public var allAnimals: [AllAnimal] { data["allAnimals"] } + + public struct AllAnimal: API.SelectionSet { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Interface(API.Animal.self) } + public static var selections: [Selection] { [ + .field("height", Height.self), + .field("species", String.self), + .field("skinCovering", GraphQLEnum?.self), + .field("predators", [Animal].self), + .typeCase(AsWarmBlooded.self), + .typeCase(AsPet.self), + .typeCase(AsCat.self), + .typeCase(AsClassroomPet.self), + .fragment(HeightInMeters.self), + ] } + + public var height: Height { data["height"] } + public var species: String { data["species"] } + public var skinCovering: GraphQLEnum? { data["skinCovering"] } + public var predators: [Predator] { data["predators"] } + + public struct Height: API.SelectionSet { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Object(API.Height.self) } + public static var selections: [Selection] { [ + .field("feet", Int.self), + .field("inches", Int.self), + ] } + + public var feet: Int { data["feet"] } + public var inches: Int { data["inches"] } + public var meters: Int { data["meters"] } + + } + public struct Predator: API.SelectionSet { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Interface(API.Animal.self) } + public static var selections: [Selection] { [ + .field("species", String.self), + .typeCase(AsWarmBlooded.self), + ] } + + public var species: String { data["species"] } + + } + } +} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/Animal.swift b/Sources/AnimalKingdomAPI/graphql/API/Animal.swift new file mode 100644 index 0000000000..811af956c4 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/Animal.swift @@ -0,0 +1 @@ +public final class Animal: Interface { } \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/Bird.swift b/Sources/AnimalKingdomAPI/graphql/API/Bird.swift new file mode 100644 index 0000000000..d4be6410db --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/Bird.swift @@ -0,0 +1 @@ +public class Bird {} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/Cat.swift b/Sources/AnimalKingdomAPI/graphql/API/Cat.swift new file mode 100644 index 0000000000..7275ee816a --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/Cat.swift @@ -0,0 +1 @@ +public class Cat {} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/ClassroomPet.swift b/Sources/AnimalKingdomAPI/graphql/API/ClassroomPet.swift new file mode 100644 index 0000000000..54e4998f8a --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/ClassroomPet.swift @@ -0,0 +1 @@ +public enum ClassroomPet {} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/ClassroomPetDetails.swift b/Sources/AnimalKingdomAPI/graphql/API/ClassroomPetDetails.swift new file mode 100644 index 0000000000..58341f1b4d --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/ClassroomPetDetails.swift @@ -0,0 +1,16 @@ +public struct ClassroomPetDetails: API.SelectionSet, Fragment { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Union(API.ClassroomPet.self) } + public static var selections: [Selection] { [ + .typeCase(AsAnimal.self), + .typeCase(AsPet.self), + .typeCase(AsWarmBlooded.self), + .typeCase(AsCat.self), + .typeCase(AsBird.self), + .typeCase(AsPetRock.self), + ] } + + +} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/ClassroomPets.swift b/Sources/AnimalKingdomAPI/graphql/API/ClassroomPets.swift new file mode 100644 index 0000000000..4fe06b76c7 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/ClassroomPets.swift @@ -0,0 +1,22 @@ +public struct Data: API.SelectionSet { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Object(API.Query.self) } + public static var selections: [Selection] { [ + .field("classroomPets", [ClassroomPet].self), + ] } + + public var classroomPets: [ClassroomPet] { data["classroomPets"] } + + public struct ClassroomPet: API.SelectionSet { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Union(API.ClassroomPet.self) } + public static var selections: [Selection] { [ + .fragment(ClassroomPetDetails.self), + ] } + + } +} diff --git a/Sources/AnimalKingdomAPI/graphql/API/Height.swift b/Sources/AnimalKingdomAPI/graphql/API/Height.swift new file mode 100644 index 0000000000..aeda968569 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/Height.swift @@ -0,0 +1 @@ +public class Height {} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/HeightInMeters.swift b/Sources/AnimalKingdomAPI/graphql/API/HeightInMeters.swift new file mode 100644 index 0000000000..9831ba9325 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/HeightInMeters.swift @@ -0,0 +1,24 @@ +public struct HeightInMeters: API.SelectionSet, Fragment { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Interface(API.Animal.self) } + public static var selections: [Selection] { [ + .field("height", Height.self), + ] } + + public var height: Height { data["height"] } + + public struct Height: API.SelectionSet { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Object(API.Height.self) } + public static var selections: [Selection] { [ + .field("meters", Int.self), + ] } + + public var meters: Int { data["meters"] } + + } +} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/Human.swift b/Sources/AnimalKingdomAPI/graphql/API/Human.swift new file mode 100644 index 0000000000..96b204f455 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/Human.swift @@ -0,0 +1 @@ +public class Human {} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/Pet.swift b/Sources/AnimalKingdomAPI/graphql/API/Pet.swift new file mode 100644 index 0000000000..05d9752b69 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/Pet.swift @@ -0,0 +1 @@ +public final class Pet: Interface { } \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/PetDetails.swift b/Sources/AnimalKingdomAPI/graphql/API/PetDetails.swift new file mode 100644 index 0000000000..8a531d1f6b --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/PetDetails.swift @@ -0,0 +1,28 @@ +public struct PetDetails: API.SelectionSet, Fragment { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Interface(API.Pet.self) } + public static var selections: [Selection] { [ + .field("humanName", String?.self), + .field("favoriteToy", String.self), + .field("owner", Human?.self), + ] } + + public var humanName: String? { data["humanName"] } + public var favoriteToy: String { data["favoriteToy"] } + public var owner: Owner? { data["owner"] } + + public struct Owner: API.SelectionSet { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Object(API.Human.self) } + public static var selections: [Selection] { [ + .field("firstName", String.self), + ] } + + public var firstName: String { data["firstName"] } + + } +} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/PetRock.swift b/Sources/AnimalKingdomAPI/graphql/API/PetRock.swift new file mode 100644 index 0000000000..2de93df447 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/PetRock.swift @@ -0,0 +1 @@ +public class PetRock {} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/RelativeSize.swift b/Sources/AnimalKingdomAPI/graphql/API/RelativeSize.swift new file mode 100644 index 0000000000..d5f148617d --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/RelativeSize.swift @@ -0,0 +1,5 @@ +public enum RelativeSize: String, EnumType { + case LARGE + case AVERAGE + case SMALL +} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/Schema.swift b/Sources/AnimalKingdomAPI/graphql/API/Schema.swift new file mode 100644 index 0000000000..d8dd42a3ba --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/Schema.swift @@ -0,0 +1,22 @@ +import ApolloAPI + +public typealias ID = String + +public protocol SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet +where Schema == API.Schema {} + +public protocol TypeCase: ApolloAPI.SelectionSet & ApolloAPI.TypeCase +where Schema == API.Schema {} + +public enum Schema: SchemaConfiguration { + public static func objectType(forTypename __typename: String) -> Object.Type? { + switch __typename { + case "Height": return API.Height.self + case "Human": return API.Human.self + case "Cat": return API.Cat.self + case "Bird": return API.Bird.self + case "PetRock": return API.PetRock.self + default: return nil + } + } +} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/SkinCovering.swift b/Sources/AnimalKingdomAPI/graphql/API/SkinCovering.swift new file mode 100644 index 0000000000..5abfba8744 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/SkinCovering.swift @@ -0,0 +1,6 @@ +public enum SkinCovering: String, EnumType { + case FUR + case HAIR + case FEATHERS + case SCALES +} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/WarmBlooded.swift b/Sources/AnimalKingdomAPI/graphql/API/WarmBlooded.swift new file mode 100644 index 0000000000..7422691dfe --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/WarmBlooded.swift @@ -0,0 +1 @@ +public final class WarmBlooded: Interface { } \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/graphql/API/WarmBloodedDetails.swift b/Sources/AnimalKingdomAPI/graphql/API/WarmBloodedDetails.swift new file mode 100644 index 0000000000..2ffcdb2361 --- /dev/null +++ b/Sources/AnimalKingdomAPI/graphql/API/WarmBloodedDetails.swift @@ -0,0 +1,28 @@ +public struct WarmBloodedDetails: API.SelectionSet, Fragment { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Interface(API.WarmBlooded.self) } + public static var selections: [Selection] { [ + .field("bodyTemperature", Int.self), + .field("height", Height.self), + ] } + + public var bodyTemperature: Int { data["bodyTemperature"] } + public var height: Height { data["height"] } + + public struct Height: API.SelectionSet { + public let data: ResponseDict + public init(data: ResponseDict) { self.data = data } + + public static var __parentType: ParentType { .Object(API.Height.self) } + public static var selections: [Selection] { [ + .field("meters", Int.self), + .field("yards", Int.self), + ] } + + public var meters: Int { data["meters"] } + public var yards: Int { data["yards"] } + + } +} \ No newline at end of file