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" ) // InterfaceNestingResponse is returned by InterfaceNesting on success. type InterfaceNestingResponse struct { Root InterfaceNestingRootTopic `json:"root"` } // InterfaceNestingRootTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopic struct { // ID is documented in the Content interface. Id testutil.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenContent `json:"-"` } func (v *InterfaceNestingRootTopic) UnmarshalJSON(b []byte) error { type InterfaceNestingRootTopicWrapper InterfaceNestingRootTopic var firstPass struct { *InterfaceNestingRootTopicWrapper Children []json.RawMessage `json:"children"` } firstPass.InterfaceNestingRootTopicWrapper = (*InterfaceNestingRootTopicWrapper)(v) err := json.Unmarshal(b, &firstPass) if err != nil { return err } { target := &v.Children raw := firstPass.Children *target = make( []InterfaceNestingRootTopicChildrenContent, len(raw)) for i, raw := range raw { target := &(*target)[i] err = __unmarshalInterfaceNestingRootTopicChildrenContent( target, raw) if err != nil { return err } } } return nil } // InterfaceNestingRootTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNestingRootTopicChildrenArticle struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` Parent InterfaceNestingRootTopicChildrenArticleParentTopic `json:"parent"` } // InterfaceNestingRootTopicChildrenArticleParentTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenArticleParentTopic struct { // ID is documented in the Content interface. Id testutil.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent `json:"-"` } func (v *InterfaceNestingRootTopicChildrenArticleParentTopic) UnmarshalJSON(b []byte) error { type InterfaceNestingRootTopicChildrenArticleParentTopicWrapper InterfaceNestingRootTopicChildrenArticleParentTopic var firstPass struct { *InterfaceNestingRootTopicChildrenArticleParentTopicWrapper Children []json.RawMessage `json:"children"` } firstPass.InterfaceNestingRootTopicChildrenArticleParentTopicWrapper = (*InterfaceNestingRootTopicChildrenArticleParentTopicWrapper)(v) err := json.Unmarshal(b, &firstPass) if err != nil { return err } { target := &v.Children raw := firstPass.Children *target = make( []InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent, len(raw)) for i, raw := range raw { target := &(*target)[i] err = __unmarshalInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent( target, raw) if err != nil { return err } } } return nil } // InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` } // InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent 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 InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent interface { implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() } func (v *InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() { } func (v *InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() { } func (v *InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() { } func __unmarshalInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent(v *InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent, 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(InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle) return json.Unmarshal(m, *v) case "Video": *v = new(InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo) return json.Unmarshal(m, *v) case "Topic": *v = new(InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic) return json.Unmarshal(m, *v) default: return fmt.Errorf( `Unexpected concrete type for InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent: "%v"`, tn.TypeName) } } // InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` } // InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` } // InterfaceNestingRootTopicChildrenContent 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 InterfaceNestingRootTopicChildrenContent interface { implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() } func (v *InterfaceNestingRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() { } func (v *InterfaceNestingRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() { } func (v *InterfaceNestingRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() { } func __unmarshalInterfaceNestingRootTopicChildrenContent(v *InterfaceNestingRootTopicChildrenContent, 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(InterfaceNestingRootTopicChildrenArticle) return json.Unmarshal(m, *v) case "Video": *v = new(InterfaceNestingRootTopicChildrenVideo) return json.Unmarshal(m, *v) case "Topic": *v = new(InterfaceNestingRootTopicChildrenTopic) return json.Unmarshal(m, *v) default: return fmt.Errorf( `Unexpected concrete type for InterfaceNestingRootTopicChildrenContent: "%v"`, tn.TypeName) } } // InterfaceNestingRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenTopic struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` Parent InterfaceNestingRootTopicChildrenTopicParentTopic `json:"parent"` } // InterfaceNestingRootTopicChildrenTopicParentTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenTopicParentTopic struct { // ID is documented in the Content interface. Id testutil.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent `json:"-"` } func (v *InterfaceNestingRootTopicChildrenTopicParentTopic) UnmarshalJSON(b []byte) error { type InterfaceNestingRootTopicChildrenTopicParentTopicWrapper InterfaceNestingRootTopicChildrenTopicParentTopic var firstPass struct { *InterfaceNestingRootTopicChildrenTopicParentTopicWrapper Children []json.RawMessage `json:"children"` } firstPass.InterfaceNestingRootTopicChildrenTopicParentTopicWrapper = (*InterfaceNestingRootTopicChildrenTopicParentTopicWrapper)(v) err := json.Unmarshal(b, &firstPass) if err != nil { return err } { target := &v.Children raw := firstPass.Children *target = make( []InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent, len(raw)) for i, raw := range raw { target := &(*target)[i] err = __unmarshalInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent( target, raw) if err != nil { return err } } } return nil } // InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` } // InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent 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 InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent interface { implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() } func (v *InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() { } func (v *InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() { } func (v *InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() { } func __unmarshalInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent(v *InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent, 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(InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle) return json.Unmarshal(m, *v) case "Video": *v = new(InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo) return json.Unmarshal(m, *v) case "Topic": *v = new(InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic) return json.Unmarshal(m, *v) default: return fmt.Errorf( `Unexpected concrete type for InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent: "%v"`, tn.TypeName) } } // InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` } // InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` } // InterfaceNestingRootTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNestingRootTopicChildrenVideo struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` Parent InterfaceNestingRootTopicChildrenVideoParentTopic `json:"parent"` } // InterfaceNestingRootTopicChildrenVideoParentTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenVideoParentTopic struct { // ID is documented in the Content interface. Id testutil.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent `json:"-"` } func (v *InterfaceNestingRootTopicChildrenVideoParentTopic) UnmarshalJSON(b []byte) error { type InterfaceNestingRootTopicChildrenVideoParentTopicWrapper InterfaceNestingRootTopicChildrenVideoParentTopic var firstPass struct { *InterfaceNestingRootTopicChildrenVideoParentTopicWrapper Children []json.RawMessage `json:"children"` } firstPass.InterfaceNestingRootTopicChildrenVideoParentTopicWrapper = (*InterfaceNestingRootTopicChildrenVideoParentTopicWrapper)(v) err := json.Unmarshal(b, &firstPass) if err != nil { return err } { target := &v.Children raw := firstPass.Children *target = make( []InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent, len(raw)) for i, raw := range raw { target := &(*target)[i] err = __unmarshalInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent( target, raw) if err != nil { return err } } } return nil } // InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` } // InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent 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 InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent interface { implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() } func (v *InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() { } func (v *InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() { } func (v *InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() { } func __unmarshalInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent(v *InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent, 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(InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle) return json.Unmarshal(m, *v) case "Video": *v = new(InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo) return json.Unmarshal(m, *v) case "Topic": *v = new(InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic) return json.Unmarshal(m, *v) default: return fmt.Errorf( `Unexpected concrete type for InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent: "%v"`, tn.TypeName) } } // InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` } // InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo struct { Typename string `json:"__typename"` // ID is the identifier of the content. Id testutil.ID `json:"id"` } func InterfaceNesting( client graphql.Client, ) (*InterfaceNestingResponse, error) { var retval InterfaceNestingResponse err := client.MakeRequest( nil, "InterfaceNesting", ` query InterfaceNesting { root { id children { __typename id parent { id children { __typename id } } } } } `, &retval, nil, ) return &retval, err }