39a980ab4e
Current implementation always uses POST as the transport mechanism. Adding GET support enables usage of GET queries for caching simply via URL. Some notes: - I left the existing API for creating a new client as is, but the implementation could be much cleaner by introducing some sort of configuration struct when creating a new client - The construction of the query parameters follows the logic from Apollo's client implementation, which can be found here https://github.com/apollographql/apollo-client/blob/8beb4820edc6352996e08f7f73bde3573f1eb666/src/link/http/rewriteURIForGET.ts - Updated integration tests to use both sets of clients. Updating the tests to use a test suite would be cleaner
57 lines
923 B
GraphQL
57 lines
923 B
GraphQL
scalar Date
|
|
|
|
type Query {
|
|
me: User
|
|
user(id: ID): User
|
|
being(id: ID!): Being
|
|
beings(ids: [ID!]!): [Being]!
|
|
lotteryWinner(number: Int!): Lucky
|
|
usersBornOn(date: Date!): [User!]!
|
|
usersBornOnDates(dates: [Date!]!): [User!]!
|
|
userSearch(birthdate: Date, id: ID): [User]
|
|
fail: Boolean
|
|
}
|
|
|
|
type Mutation {
|
|
createUser(input: NewUser!): User!
|
|
}
|
|
|
|
type User implements Being & Lucky {
|
|
id: ID!
|
|
name: String!
|
|
luckyNumber: Int
|
|
hair: Hair
|
|
birthdate: Date
|
|
friends: [User!]!
|
|
}
|
|
|
|
input NewUser {
|
|
name: String!
|
|
}
|
|
|
|
type Hair { color: String } # silly name to confuse the name-generator
|
|
|
|
type Animal implements Being {
|
|
id: ID!
|
|
name: String!
|
|
species: Species!
|
|
owner: Being
|
|
hair: BeingsHair
|
|
}
|
|
|
|
type BeingsHair { hasHair: Boolean! } # silly name to confuse the name-generator
|
|
|
|
enum Species {
|
|
DOG
|
|
COELACANTH
|
|
}
|
|
|
|
interface Being {
|
|
id: ID!
|
|
name: String!
|
|
}
|
|
|
|
interface Lucky {
|
|
luckyNumber: Int
|
|
}
|