allow globbing, and extract queries from .go files
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
query InputObjectQuery($query: UserQueryInput) {
|
||||
user(query: $query) {
|
||||
id
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type InputObjectQueryResponse struct {
|
||||
User InputObjectQueryUser `json:"user"`
|
||||
}
|
||||
|
||||
type InputObjectQueryUser struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
type UserQueryInput struct {
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
Id string `json:"id"`
|
||||
Role UserQueryInputRole `json:"role"`
|
||||
Names []string `json:"names"`
|
||||
}
|
||||
|
||||
type UserQueryInputRole string
|
||||
|
||||
const (
|
||||
UserQueryInputRoleStudent UserQueryInputRole = "STUDENT"
|
||||
UserQueryInputRoleTeacher UserQueryInputRole = "TEACHER"
|
||||
)
|
||||
|
||||
func InputObjectQuery(
|
||||
client graphql.Client,
|
||||
query UserQueryInput,
|
||||
) (*InputObjectQueryResponse, error) {
|
||||
variables := map[string]interface{}{
|
||||
"query": query,
|
||||
}
|
||||
|
||||
var retval InputObjectQueryResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"InputObjectQuery",
|
||||
`
|
||||
query InputObjectQuery ($query: UserQueryInput) {
|
||||
user(query: $query) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
variables,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
query InterfaceNoFragmentsQuery {
|
||||
root {
|
||||
id
|
||||
name
|
||||
children {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type InterfaceNoFragmentsQueryResponse struct {
|
||||
Root InterfaceNoFragmentsQueryRootTopic `json:"root"`
|
||||
}
|
||||
|
||||
type InterfaceNoFragmentsQueryRootTopic struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Children []InterfaceNoFragmentsQueryRootTopicChildrenContent `json:"-"`
|
||||
}
|
||||
|
||||
func (v *InterfaceNoFragmentsQueryRootTopic) UnmarshalJSON(b []byte) error {
|
||||
var firstPass struct {
|
||||
*InterfaceNoFragmentsQueryRootTopic
|
||||
Children json.RawMessage `json:"children"`
|
||||
}
|
||||
firstPass.InterfaceNoFragmentsQueryRootTopic = v
|
||||
|
||||
err := json.Unmarshal(b, &firstPass)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var tn struct {
|
||||
TypeName string `json:"__typename"`
|
||||
}
|
||||
err = json.Unmarshal(firstPass.Children, &tn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch tn.TypeName {
|
||||
|
||||
case "Article":
|
||||
|
||||
v.Children = InterfaceNoFragmentsQueryRootTopicChildrenArticle{}
|
||||
err = json.Unmarshal(
|
||||
firstPass.Children, &v.Children)
|
||||
|
||||
case "Video":
|
||||
|
||||
v.Children = InterfaceNoFragmentsQueryRootTopicChildrenVideo{}
|
||||
err = json.Unmarshal(
|
||||
firstPass.Children, &v.Children)
|
||||
|
||||
case "Topic":
|
||||
|
||||
v.Children = InterfaceNoFragmentsQueryRootTopicChildrenTopic{}
|
||||
err = json.Unmarshal(
|
||||
firstPass.Children, &v.Children)
|
||||
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type InterfaceNoFragmentsQueryRootTopicChildrenArticle struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (v InterfaceNoFragmentsQueryRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
|
||||
}
|
||||
|
||||
type InterfaceNoFragmentsQueryRootTopicChildrenContent interface {
|
||||
implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent()
|
||||
}
|
||||
|
||||
type InterfaceNoFragmentsQueryRootTopicChildrenTopic struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (v InterfaceNoFragmentsQueryRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
|
||||
}
|
||||
|
||||
type InterfaceNoFragmentsQueryRootTopicChildrenVideo struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (v InterfaceNoFragmentsQueryRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
|
||||
}
|
||||
|
||||
func InterfaceNoFragmentsQuery(
|
||||
client graphql.Client,
|
||||
) (*InterfaceNoFragmentsQueryResponse, error) {
|
||||
var retval InterfaceNoFragmentsQueryResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"InterfaceNoFragmentsQuery",
|
||||
`
|
||||
query InterfaceNoFragmentsQuery {
|
||||
root {
|
||||
id
|
||||
name
|
||||
children {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
query ListInputQuery($names: [String]) {
|
||||
user(query: {names: $names}) {
|
||||
id
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type ListInputQueryResponse struct {
|
||||
User ListInputQueryUser `json:"user"`
|
||||
}
|
||||
|
||||
type ListInputQueryUser struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
func ListInputQuery(
|
||||
client graphql.Client,
|
||||
names []string,
|
||||
) (*ListInputQueryResponse, error) {
|
||||
variables := map[string]interface{}{
|
||||
"names": names,
|
||||
}
|
||||
|
||||
var retval ListInputQueryResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"ListInputQuery",
|
||||
`
|
||||
query ListInputQuery ($names: [String]) {
|
||||
user(query: {names:$names}) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
variables,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
query QueryWithAlias { User: user { ID: id } }
|
||||
@@ -0,0 +1,35 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithAliasResponse struct {
|
||||
User QueryWithAliasUser
|
||||
}
|
||||
|
||||
type QueryWithAliasUser struct {
|
||||
ID string
|
||||
}
|
||||
|
||||
func QueryWithAlias(
|
||||
client graphql.Client,
|
||||
) (*QueryWithAliasResponse, error) {
|
||||
var retval QueryWithAliasResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"QueryWithAlias",
|
||||
`
|
||||
query QueryWithAlias {
|
||||
User: user {
|
||||
ID: id
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
query QueryWithDoubleAlias {
|
||||
user {
|
||||
ID: id
|
||||
AlsoID: id
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithDoubleAliasResponse struct {
|
||||
User QueryWithDoubleAliasUser `json:"user"`
|
||||
}
|
||||
|
||||
type QueryWithDoubleAliasUser struct {
|
||||
ID string
|
||||
AlsoID string
|
||||
}
|
||||
|
||||
func QueryWithDoubleAlias(
|
||||
client graphql.Client,
|
||||
) (*QueryWithDoubleAliasResponse, error) {
|
||||
var retval QueryWithDoubleAliasResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"QueryWithDoubleAlias",
|
||||
`
|
||||
query QueryWithDoubleAlias {
|
||||
user {
|
||||
ID: id
|
||||
AlsoID: id
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
query QueryWithEnums {
|
||||
user {
|
||||
roles
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithEnumsResponse struct {
|
||||
User QueryWithEnumsUser `json:"user"`
|
||||
}
|
||||
|
||||
type QueryWithEnumsUser struct {
|
||||
Roles []QueryWithEnumsUserRolesRole `json:"roles"`
|
||||
}
|
||||
|
||||
type QueryWithEnumsUserRolesRole string
|
||||
|
||||
const (
|
||||
QueryWithEnumsUserRolesRoleStudent QueryWithEnumsUserRolesRole = "STUDENT"
|
||||
QueryWithEnumsUserRolesRoleTeacher QueryWithEnumsUserRolesRole = "TEACHER"
|
||||
)
|
||||
|
||||
func QueryWithEnums(
|
||||
client graphql.Client,
|
||||
) (*QueryWithEnumsResponse, error) {
|
||||
var retval QueryWithEnumsResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"QueryWithEnums",
|
||||
`
|
||||
query QueryWithEnums {
|
||||
user {
|
||||
roles
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
query QueryWithSlices {
|
||||
user {
|
||||
emails
|
||||
emailsOrNull
|
||||
emailsWithNulls
|
||||
emailsWithNullsOrNull
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithSlicesResponse struct {
|
||||
User QueryWithSlicesUser `json:"user"`
|
||||
}
|
||||
|
||||
type QueryWithSlicesUser struct {
|
||||
Emails []string `json:"emails"`
|
||||
EmailsOrNull []string `json:"emailsOrNull"`
|
||||
EmailsWithNulls []string `json:"emailsWithNulls"`
|
||||
EmailsWithNullsOrNull []string `json:"emailsWithNullsOrNull"`
|
||||
}
|
||||
|
||||
func QueryWithSlices(
|
||||
client graphql.Client,
|
||||
) (*QueryWithSlicesResponse, error) {
|
||||
var retval QueryWithSlicesResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"QueryWithSlices",
|
||||
`
|
||||
query QueryWithSlices {
|
||||
user {
|
||||
emails
|
||||
emailsOrNull
|
||||
emailsWithNulls
|
||||
emailsWithNullsOrNull
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
query QueryWithStructs {
|
||||
user {
|
||||
authMethods {
|
||||
provider
|
||||
email
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type QueryWithStructsResponse struct {
|
||||
User QueryWithStructsUser `json:"user"`
|
||||
}
|
||||
|
||||
type QueryWithStructsUser struct {
|
||||
AuthMethods []QueryWithStructsUserAuthMethodsAuthMethod `json:"authMethods"`
|
||||
}
|
||||
|
||||
type QueryWithStructsUserAuthMethodsAuthMethod struct {
|
||||
Provider string `json:"provider"`
|
||||
Email string `json:"email"`
|
||||
}
|
||||
|
||||
func QueryWithStructs(
|
||||
client graphql.Client,
|
||||
) (*QueryWithStructsResponse, error) {
|
||||
var retval QueryWithStructsResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"QueryWithStructs",
|
||||
`
|
||||
query QueryWithStructs {
|
||||
user {
|
||||
authMethods {
|
||||
provider
|
||||
email
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
query SimpleInputQuery($name: String!) {
|
||||
user(query: {name: $name}) {
|
||||
id
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type SimpleInputQueryResponse struct {
|
||||
User SimpleInputQueryUser `json:"user"`
|
||||
}
|
||||
|
||||
type SimpleInputQueryUser struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
func SimpleInputQuery(
|
||||
client graphql.Client,
|
||||
name string,
|
||||
) (*SimpleInputQueryResponse, error) {
|
||||
variables := map[string]interface{}{
|
||||
"name": name,
|
||||
}
|
||||
|
||||
var retval SimpleInputQueryResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"SimpleInputQuery",
|
||||
`
|
||||
query SimpleInputQuery ($name: String!) {
|
||||
user(query: {name:$name}) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
variables,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
query SimpleQuery { user { id } }
|
||||
@@ -0,0 +1,35 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type SimpleQueryResponse struct {
|
||||
User SimpleQueryUser `json:"user"`
|
||||
}
|
||||
|
||||
type SimpleQueryUser struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
func SimpleQuery(
|
||||
client graphql.Client,
|
||||
) (*SimpleQueryResponse, error) {
|
||||
var retval SimpleQueryResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"SimpleQuery",
|
||||
`
|
||||
query SimpleQuery {
|
||||
user {
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
query TypeNameQuery {
|
||||
user {
|
||||
__typename
|
||||
id
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type TypeNameQueryResponse struct {
|
||||
User TypeNameQueryUser `json:"user"`
|
||||
}
|
||||
|
||||
type TypeNameQueryUser struct {
|
||||
Typename string `json:"__typename"`
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
func TypeNameQuery(
|
||||
client graphql.Client,
|
||||
) (*TypeNameQueryResponse, error) {
|
||||
var retval TypeNameQueryResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"TypeNameQuery",
|
||||
`
|
||||
query TypeNameQuery {
|
||||
user {
|
||||
__typename
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
query UnionNoFragmentsQuery {
|
||||
randomLeaf {
|
||||
__typename
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type UnionNoFragmentsQueryRandomLeafArticle struct {
|
||||
Typename string `json:"__typename"`
|
||||
}
|
||||
|
||||
func (v UnionNoFragmentsQueryRandomLeafArticle) implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent() {
|
||||
}
|
||||
|
||||
type UnionNoFragmentsQueryRandomLeafLeafContent interface {
|
||||
implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent()
|
||||
}
|
||||
|
||||
type UnionNoFragmentsQueryRandomLeafVideo struct {
|
||||
Typename string `json:"__typename"`
|
||||
}
|
||||
|
||||
func (v UnionNoFragmentsQueryRandomLeafVideo) implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent() {
|
||||
}
|
||||
|
||||
type UnionNoFragmentsQueryResponse struct {
|
||||
RandomLeaf UnionNoFragmentsQueryRandomLeafLeafContent `json:"-"`
|
||||
}
|
||||
|
||||
func (v *UnionNoFragmentsQueryResponse) UnmarshalJSON(b []byte) error {
|
||||
var firstPass struct {
|
||||
*UnionNoFragmentsQueryResponse
|
||||
RandomLeaf json.RawMessage `json:"randomLeaf"`
|
||||
}
|
||||
firstPass.UnionNoFragmentsQueryResponse = v
|
||||
|
||||
err := json.Unmarshal(b, &firstPass)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var tn struct {
|
||||
TypeName string `json:"__typename"`
|
||||
}
|
||||
err = json.Unmarshal(firstPass.RandomLeaf, &tn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch tn.TypeName {
|
||||
|
||||
case "Article":
|
||||
|
||||
v.RandomLeaf = UnionNoFragmentsQueryRandomLeafArticle{}
|
||||
err = json.Unmarshal(
|
||||
firstPass.RandomLeaf, &v.RandomLeaf)
|
||||
|
||||
case "Video":
|
||||
|
||||
v.RandomLeaf = UnionNoFragmentsQueryRandomLeafVideo{}
|
||||
err = json.Unmarshal(
|
||||
firstPass.RandomLeaf, &v.RandomLeaf)
|
||||
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func UnionNoFragmentsQuery(
|
||||
client graphql.Client,
|
||||
) (*UnionNoFragmentsQueryResponse, error) {
|
||||
var retval UnionNoFragmentsQueryResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"UnionNoFragmentsQuery",
|
||||
`
|
||||
query UnionNoFragmentsQuery {
|
||||
randomLeaf {
|
||||
__typename
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
query UsesEnumTwiceQuery {
|
||||
Me: user { roles }
|
||||
OtherUser: user { roles }
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type UsesEnumTwiceQueryMeUser struct {
|
||||
Roles []UsesEnumTwiceQueryMeUserRolesRole `json:"roles"`
|
||||
}
|
||||
|
||||
type UsesEnumTwiceQueryMeUserRolesRole string
|
||||
|
||||
const (
|
||||
UsesEnumTwiceQueryMeUserRolesRoleStudent UsesEnumTwiceQueryMeUserRolesRole = "STUDENT"
|
||||
UsesEnumTwiceQueryMeUserRolesRoleTeacher UsesEnumTwiceQueryMeUserRolesRole = "TEACHER"
|
||||
)
|
||||
|
||||
type UsesEnumTwiceQueryOtherUser struct {
|
||||
Roles []UsesEnumTwiceQueryOtherUserRolesRole `json:"roles"`
|
||||
}
|
||||
|
||||
type UsesEnumTwiceQueryOtherUserRolesRole string
|
||||
|
||||
const (
|
||||
UsesEnumTwiceQueryOtherUserRolesRoleStudent UsesEnumTwiceQueryOtherUserRolesRole = "STUDENT"
|
||||
UsesEnumTwiceQueryOtherUserRolesRoleTeacher UsesEnumTwiceQueryOtherUserRolesRole = "TEACHER"
|
||||
)
|
||||
|
||||
type UsesEnumTwiceQueryResponse struct {
|
||||
Me UsesEnumTwiceQueryMeUser
|
||||
OtherUser UsesEnumTwiceQueryOtherUser
|
||||
}
|
||||
|
||||
func UsesEnumTwiceQuery(
|
||||
client graphql.Client,
|
||||
) (*UsesEnumTwiceQueryResponse, error) {
|
||||
var retval UsesEnumTwiceQueryResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"UsesEnumTwiceQuery",
|
||||
`
|
||||
query UsesEnumTwiceQuery {
|
||||
Me: user {
|
||||
roles
|
||||
}
|
||||
OtherUser: user {
|
||||
roles
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
nil,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
enum Role {
|
||||
STUDENT
|
||||
TEACHER
|
||||
}
|
||||
|
||||
input UserQueryInput {
|
||||
email: String
|
||||
name: String
|
||||
id: ID
|
||||
role: Role
|
||||
names: [String]
|
||||
}
|
||||
|
||||
type AuthMethod {
|
||||
provider: String
|
||||
email: String
|
||||
}
|
||||
|
||||
type User {
|
||||
id: ID!
|
||||
roles: [Role!]
|
||||
name: String
|
||||
emails: [String!]!
|
||||
emailsOrNull: [String!]
|
||||
emailsWithNulls: [String]!
|
||||
emailsWithNullsOrNull: [String]
|
||||
authMethods: [AuthMethod!]!
|
||||
}
|
||||
|
||||
interface Content {
|
||||
id: ID!
|
||||
name: String!
|
||||
parent: Topic
|
||||
}
|
||||
|
||||
union LeafContent = Article | Video
|
||||
|
||||
type Article implements Content {
|
||||
id: ID!
|
||||
name: String!
|
||||
parent: Topic!
|
||||
text: String!
|
||||
}
|
||||
|
||||
type Video implements Content {
|
||||
id: ID!
|
||||
name: String!
|
||||
parent: Topic!
|
||||
duration: Int!
|
||||
}
|
||||
|
||||
type Topic implements Content {
|
||||
id: ID!
|
||||
name: String!
|
||||
parent: Topic
|
||||
children: [Content!]!
|
||||
}
|
||||
|
||||
type Query {
|
||||
user(query: UserQueryInput): User
|
||||
root: Topic!
|
||||
randomLeaf: LeafContent!
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
query unexported($query: UserQueryInput) {
|
||||
user(query: $query) {
|
||||
id
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type unexportedResponse struct {
|
||||
User unexportedUser `json:"user"`
|
||||
}
|
||||
|
||||
type unexportedUser struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
type userQueryInput struct {
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
Id string `json:"id"`
|
||||
Role userQueryInputRole `json:"role"`
|
||||
Names []string `json:"names"`
|
||||
}
|
||||
|
||||
type userQueryInputRole string
|
||||
|
||||
const (
|
||||
userQueryInputRoleStudent userQueryInputRole = "STUDENT"
|
||||
userQueryInputRoleTeacher userQueryInputRole = "TEACHER"
|
||||
)
|
||||
|
||||
func unexported(
|
||||
client graphql.Client,
|
||||
query userQueryInput,
|
||||
) (*unexportedResponse, error) {
|
||||
variables := map[string]interface{}{
|
||||
"query": query,
|
||||
}
|
||||
|
||||
var retval unexportedResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"unexported",
|
||||
`
|
||||
query unexported ($query: UserQueryInput) {
|
||||
user(query: $query) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
variables,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
Reference in New Issue
Block a user