total rewrite to interface handling; not complete but it compiles

This commit is contained in:
Ben Kraft
2020-07-16 13:28:43 -07:00
parent af4a765a32
commit cf7136ca65
33 changed files with 712 additions and 173 deletions
+37 -8
View File
@@ -1,8 +1,37 @@
type Response struct {
User *struct {
AuthMethods []struct {
Provider *string `json:"provider"`
Email *string `json:"email"`
} `json:"authMethods"`
} `json:"user"`
}
package test
// Code generated by github.com/Khan/genql, DO NOT EDIT.
import (
"context"
"github.com/Khan/genql/graphql"
)
type AuthMethod struct {
Provider *string `json:"provider"`
Email *string `json:"email"`
}
type QueryWithStructsResponse struct {
User *User `json:"user"`
}
type User struct {
AuthMethods []AuthMethod `json:"authMethods"`
}
func QueryWithStructs(client *graphql.Client) (*QueryWithStructsResponse, error) {
var retval QueryWithStructsResponse
err := client.MakeRequest(context.Background(), `
query QueryWithStructs {
user {
authMethods {
provider
email
}
}
}
`, &retval, nil)
return &retval, err
}