|
| 1 | +export interface CarInput { |
| 2 | + /** A car's id */ |
| 3 | + readonly id: number | null; |
| 4 | + /** A car's name */ |
| 5 | + readonly name: string | null; |
| 6 | +} |
| 7 | + |
| 8 | +/** Long type */ |
| 9 | +export type Long = number; |
| 10 | + |
| 11 | +// ==================================================== |
| 12 | +// Documents |
| 13 | +// ==================================================== |
| 14 | + |
| 15 | +export type DeleteCarVariables = { |
| 16 | + readonly id: number; |
| 17 | +}; |
| 18 | + |
| 19 | +export type DeleteCarMutation = { |
| 20 | + readonly __typename?: 'Mutation'; |
| 21 | + |
| 22 | + readonly deleteCar: boolean | null; |
| 23 | +}; |
| 24 | + |
| 25 | +export type GetCarVariables = { |
| 26 | + readonly id: number; |
| 27 | +}; |
| 28 | + |
| 29 | +export type GetCarQuery = { |
| 30 | + readonly __typename?: 'Query'; |
| 31 | + |
| 32 | + readonly car: GetCarCar | null; |
| 33 | +}; |
| 34 | + |
| 35 | +export type GetCarCar = { |
| 36 | + readonly __typename?: 'Car'; |
| 37 | + |
| 38 | + readonly id: number | null; |
| 39 | + |
| 40 | + readonly name: string | null; |
| 41 | + |
| 42 | + readonly giphyUrl: string | null; |
| 43 | +}; |
| 44 | + |
| 45 | +export type ListCarsVariables = {}; |
| 46 | + |
| 47 | +export type ListCarsQuery = { |
| 48 | + readonly __typename?: 'Query'; |
| 49 | + |
| 50 | + readonly cars: ReadonlyArray<ListCarsCars> | null; |
| 51 | +}; |
| 52 | + |
| 53 | +export type ListCarsCars = { |
| 54 | + readonly __typename?: 'Car'; |
| 55 | + |
| 56 | + readonly id: number | null; |
| 57 | + |
| 58 | + readonly name: string | null; |
| 59 | + |
| 60 | + readonly giphyUrl: string | null; |
| 61 | +}; |
| 62 | + |
| 63 | +export type SaveCarVariables = { |
| 64 | + readonly car: CarInput; |
| 65 | +}; |
| 66 | + |
| 67 | +export type SaveCarMutation = { |
| 68 | + readonly __typename?: 'Mutation'; |
| 69 | + |
| 70 | + readonly saveCar: SaveCarSaveCar | null; |
| 71 | +}; |
| 72 | + |
| 73 | +export type SaveCarSaveCar = { |
| 74 | + readonly __typename?: 'Car'; |
| 75 | + |
| 76 | + readonly id: number | null; |
| 77 | + |
| 78 | + readonly name: string | null; |
| 79 | + |
| 80 | + readonly giphyUrl: string | null; |
| 81 | +}; |
| 82 | + |
| 83 | +// ==================================================== |
| 84 | +// Scalars |
| 85 | +// ==================================================== |
| 86 | + |
| 87 | +// ==================================================== |
| 88 | +// Types |
| 89 | +// ==================================================== |
| 90 | + |
| 91 | +/** Query root type */ |
| 92 | +export interface Query { |
| 93 | + readonly cars: ReadonlyArray<Car> | null; |
| 94 | + |
| 95 | + readonly car: Car | null; |
| 96 | +} |
| 97 | + |
| 98 | +export interface Car { |
| 99 | + readonly giphyUrl: string | null; |
| 100 | + |
| 101 | + readonly id: number | null; |
| 102 | + |
| 103 | + readonly isCool: boolean; |
| 104 | + |
| 105 | + readonly name: string | null; |
| 106 | +} |
| 107 | + |
| 108 | +/** Mutation root type */ |
| 109 | +export interface Mutation { |
| 110 | + readonly deleteCar: boolean | null; |
| 111 | + |
| 112 | + readonly saveCar: Car | null; |
| 113 | +} |
| 114 | + |
| 115 | +// ==================================================== |
| 116 | +// Arguments |
| 117 | +// ==================================================== |
| 118 | + |
| 119 | +export interface CarQueryArgs { |
| 120 | + id: number | null; |
| 121 | +} |
| 122 | +export interface DeleteCarMutationArgs { |
| 123 | + id: number | null; |
| 124 | +} |
| 125 | +export interface SaveCarMutationArgs { |
| 126 | + car: CarInput | null; |
| 127 | +} |
| 128 | + |
| 129 | +// ==================================================== |
| 130 | +// START: Apollo Angular template |
| 131 | +// ==================================================== |
| 132 | + |
| 133 | +import { Injectable } from '@angular/core'; |
| 134 | +import * as Apollo from 'apollo-angular'; |
| 135 | + |
| 136 | +import gql from 'graphql-tag'; |
| 137 | + |
| 138 | +// ==================================================== |
| 139 | +// Apollo Services |
| 140 | +// ==================================================== |
| 141 | + |
| 142 | +@Injectable({ |
| 143 | + providedIn: 'root' |
| 144 | +}) |
| 145 | +export class DeleteCarGQL extends Apollo.Mutation< |
| 146 | + DeleteCarMutation, |
| 147 | + DeleteCarVariables |
| 148 | +> { |
| 149 | + document: any = gql` |
| 150 | + mutation DeleteCar($id: Long!) { |
| 151 | + deleteCar(id: $id) |
| 152 | + } |
| 153 | + `; |
| 154 | +} |
| 155 | +@Injectable({ |
| 156 | + providedIn: 'root' |
| 157 | +}) |
| 158 | +export class GetCarGQL extends Apollo.Query<GetCarQuery, GetCarVariables> { |
| 159 | + document: any = gql` |
| 160 | + query GetCar($id: Long!) { |
| 161 | + car(id: $id) { |
| 162 | + id |
| 163 | + name |
| 164 | + giphyUrl |
| 165 | + } |
| 166 | + } |
| 167 | + `; |
| 168 | +} |
| 169 | +@Injectable({ |
| 170 | + providedIn: 'root' |
| 171 | +}) |
| 172 | +export class ListCarsGQL extends Apollo.Query< |
| 173 | + ListCarsQuery, |
| 174 | + ListCarsVariables |
| 175 | +> { |
| 176 | + document: any = gql` |
| 177 | + query ListCars { |
| 178 | + cars { |
| 179 | + id |
| 180 | + name |
| 181 | + giphyUrl |
| 182 | + } |
| 183 | + } |
| 184 | + `; |
| 185 | +} |
| 186 | +@Injectable({ |
| 187 | + providedIn: 'root' |
| 188 | +}) |
| 189 | +export class SaveCarGQL extends Apollo.Mutation< |
| 190 | + SaveCarMutation, |
| 191 | + SaveCarVariables |
| 192 | +> { |
| 193 | + document: any = gql` |
| 194 | + mutation SaveCar($car: CarInput!) { |
| 195 | + saveCar(car: $car) { |
| 196 | + id |
| 197 | + name |
| 198 | + giphyUrl |
| 199 | + } |
| 200 | + } |
| 201 | + `; |
| 202 | +} |
| 203 | + |
| 204 | +// ==================================================== |
| 205 | +// END: Apollo Angular template |
| 206 | +// ==================================================== |
0 commit comments