-
Notifications
You must be signed in to change notification settings - Fork 731
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add (broken) generated AnimalKingdom files
- Loading branch information
1 parent
d3b0e44
commit 3b48ade
Showing
19 changed files
with
303 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
Sources/AnimalKingdomAPI/graphql/API/AllAnimalsQuery.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<SkinCovering>?.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<SkinCovering>? { 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"] } | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public final class Animal: Interface { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public class Bird {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public class Cat {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public enum ClassroomPet {} |
16 changes: 16 additions & 0 deletions
16
Sources/AnimalKingdomAPI/graphql/API/ClassroomPetDetails.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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), | ||
] } | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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), | ||
] } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public class Height {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public class Human {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public final class Pet: Interface { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public class PetRock {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
public enum RelativeSize: String, EnumType { | ||
case LARGE | ||
case AVERAGE | ||
case SMALL | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public enum SkinCovering: String, EnumType { | ||
case FUR | ||
case HAIR | ||
case FEATHERS | ||
case SCALES | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public final class WarmBlooded: Interface { } |
Oops, something went wrong.