package test // Code generated by github.com/Khan/genqlient, DO NOT EDIT. import ( "encoding/json" "fmt" "github.com/Khan/genqlient/graphql" "github.com/Khan/genqlient/internal/testutil" ) // InterfaceNoFragmentsQueryResponse is returned by InterfaceNoFragmentsQuery on success. type InterfaceNoFragmentsQueryResponse struct { Root InterfaceNoFragmentsQueryRootTopic `json:"root"` } // InterfaceNoFragmentsQueryRootTopic includes the requested fields of the GraphQL type Topic. type InterfaceNoFragmentsQueryRootTopic struct { // ID is documented in the Content interface. Id testutil.ID `json:"id"` Name string `json:"name"` Children []InterfaceNoFragmentsQueryRootTopicChildrenContent `json:"children"` } // InterfaceNoFragmentsQueryRootTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNoFragmentsQueryRootTopicChildrenArticle struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` Name string `json:"name"` } // InterfaceNoFragmentsQueryRootTopicChildrenContent includes the requested fields of the GraphQL type Content. // The GraphQL type's documentation follows. // // Content is implemented by various types like Article, Video, and Topic. type InterfaceNoFragmentsQueryRootTopicChildrenContent interface { implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() } func (v *InterfaceNoFragmentsQueryRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() { } func (v *InterfaceNoFragmentsQueryRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() { } func (v *InterfaceNoFragmentsQueryRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() { } func __unmarshalInterfaceNoFragmentsQueryRootTopicChildrenContent(v *InterfaceNoFragmentsQueryRootTopicChildrenContent, m json.RawMessage) error { if string(m) == "null" { return nil } var tn struct { TypeName string `json:"__typename"` } err := json.Unmarshal(m, &tn) if err != nil { return err } switch tn.TypeName { case "Article": *v = new(InterfaceNoFragmentsQueryRootTopicChildrenArticle) return json.Unmarshal(m, *v) case "Video": *v = new(InterfaceNoFragmentsQueryRootTopicChildrenVideo) return json.Unmarshal(m, *v) case "Topic": *v = new(InterfaceNoFragmentsQueryRootTopicChildrenTopic) return json.Unmarshal(m, *v) default: return fmt.Errorf( `Unexpected concrete type for InterfaceNoFragmentsQueryRootTopicChildrenContent: "%v"`, tn.TypeName) } } // InterfaceNoFragmentsQueryRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNoFragmentsQueryRootTopicChildrenTopic struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` Name string `json:"name"` } // InterfaceNoFragmentsQueryRootTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNoFragmentsQueryRootTopicChildrenVideo struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` Name string `json:"name"` } func InterfaceNoFragmentsQuery( client graphql.Client, ) (*InterfaceNoFragmentsQueryResponse, error) { var retval InterfaceNoFragmentsQueryResponse err := client.MakeRequest( nil, "InterfaceNoFragmentsQuery", ` query InterfaceNoFragmentsQuery { root { id name children { __typename id name } } } `, &retval, nil, ) return &retval, err }