Files
salman-rbandGitHub 39a980ab4e Add support for client that uses GET as transport mechanism (#186)
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
2022-04-13 16:16:27 -07:00

93 lines
1.5 KiB
Go

// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package server
import (
"fmt"
"io"
"strconv"
)
type Being interface {
IsBeing()
}
type Lucky interface {
IsLucky()
}
type Animal struct {
ID string `json:"id"`
Name string `json:"name"`
Species Species `json:"species"`
Owner Being `json:"owner"`
Hair *BeingsHair `json:"hair"`
}
func (Animal) IsBeing() {}
type BeingsHair struct {
HasHair bool `json:"hasHair"`
}
type Hair struct {
Color *string `json:"color"`
}
type NewUser struct {
Name string `json:"name"`
}
type User struct {
ID string `json:"id"`
Name string `json:"name"`
LuckyNumber *int `json:"luckyNumber"`
Hair *Hair `json:"hair"`
Birthdate *string `json:"birthdate"`
Friends []*User `json:"friends"`
}
func (User) IsBeing() {}
func (User) IsLucky() {}
type Species string
const (
SpeciesDog Species = "DOG"
SpeciesCoelacanth Species = "COELACANTH"
)
var AllSpecies = []Species{
SpeciesDog,
SpeciesCoelacanth,
}
func (e Species) IsValid() bool {
switch e {
case SpeciesDog, SpeciesCoelacanth:
return true
}
return false
}
func (e Species) String() string {
return string(e)
}
func (e *Species) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Species(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Species", str)
}
return nil
}
func (e Species) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}