package test // Code generated by github.com/Khan/genqlient, DO NOT EDIT. import ( "encoding/json" "github.com/Khan/genqlient/graphql" "github.com/me/mypkg" ) // InterfaceNestingResponse is returned by InterfaceNesting on success. type InterfaceNestingResponse struct { Root InterfaceNestingRootTopic `json:"root"` } type InterfaceNestingRootTopic struct { // ID is documented in the Content interface. Id mypkg.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenContent `json:"-"` } func (v *InterfaceNestingRootTopic) UnmarshalJSON(b []byte) error { var firstPass struct { *InterfaceNestingRootTopic Children json.RawMessage `json:"children"` } firstPass.InterfaceNestingRootTopic = 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 = InterfaceNestingRootTopicChildrenArticle{} err = json.Unmarshal( firstPass.Children, &v.Children) case "Video": v.Children = InterfaceNestingRootTopicChildrenVideo{} err = json.Unmarshal( firstPass.Children, &v.Children) case "Topic": v.Children = InterfaceNestingRootTopicChildrenTopic{} err = json.Unmarshal( firstPass.Children, &v.Children) } if err != nil { return err } return nil } type InterfaceNestingRootTopicChildrenArticle struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` Parent InterfaceNestingRootTopicChildrenArticleParentTopic `json:"parent"` } func (v InterfaceNestingRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() { } type InterfaceNestingRootTopicChildrenArticleParentTopic struct { // ID is documented in the Content interface. Id mypkg.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent `json:"-"` } func (v *InterfaceNestingRootTopicChildrenArticleParentTopic) UnmarshalJSON(b []byte) error { var firstPass struct { *InterfaceNestingRootTopicChildrenArticleParentTopic Children json.RawMessage `json:"children"` } firstPass.InterfaceNestingRootTopicChildrenArticleParentTopic = 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 = InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle{} err = json.Unmarshal( firstPass.Children, &v.Children) case "Video": v.Children = InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo{} err = json.Unmarshal( firstPass.Children, &v.Children) case "Topic": v.Children = InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic{} err = json.Unmarshal( firstPass.Children, &v.Children) } if err != nil { return err } return nil } type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() { } // Content is implemented by various types like Article, Video, and Topic. type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent interface { implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() } type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() { } type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() { } // Content is implemented by various types like Article, Video, and Topic. type InterfaceNestingRootTopicChildrenContent interface { implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() } type InterfaceNestingRootTopicChildrenTopic struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` Parent InterfaceNestingRootTopicChildrenTopicParentTopic `json:"parent"` } func (v InterfaceNestingRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() { } type InterfaceNestingRootTopicChildrenTopicParentTopic struct { // ID is documented in the Content interface. Id mypkg.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent `json:"-"` } func (v *InterfaceNestingRootTopicChildrenTopicParentTopic) UnmarshalJSON(b []byte) error { var firstPass struct { *InterfaceNestingRootTopicChildrenTopicParentTopic Children json.RawMessage `json:"children"` } firstPass.InterfaceNestingRootTopicChildrenTopicParentTopic = 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 = InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle{} err = json.Unmarshal( firstPass.Children, &v.Children) case "Video": v.Children = InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo{} err = json.Unmarshal( firstPass.Children, &v.Children) case "Topic": v.Children = InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic{} err = json.Unmarshal( firstPass.Children, &v.Children) } if err != nil { return err } return nil } type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() { } // Content is implemented by various types like Article, Video, and Topic. type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent interface { implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() } type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() { } type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() { } type InterfaceNestingRootTopicChildrenVideo struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` Parent InterfaceNestingRootTopicChildrenVideoParentTopic `json:"parent"` } func (v InterfaceNestingRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() { } type InterfaceNestingRootTopicChildrenVideoParentTopic struct { // ID is documented in the Content interface. Id mypkg.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent `json:"-"` } func (v *InterfaceNestingRootTopicChildrenVideoParentTopic) UnmarshalJSON(b []byte) error { var firstPass struct { *InterfaceNestingRootTopicChildrenVideoParentTopic Children json.RawMessage `json:"children"` } firstPass.InterfaceNestingRootTopicChildrenVideoParentTopic = 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 = InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle{} err = json.Unmarshal( firstPass.Children, &v.Children) case "Video": v.Children = InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo{} err = json.Unmarshal( firstPass.Children, &v.Children) case "Topic": v.Children = InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic{} err = json.Unmarshal( firstPass.Children, &v.Children) } if err != nil { return err } return nil } type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() { } // Content is implemented by various types like Article, Video, and Topic. type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent interface { implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() } type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() { } type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo struct { // ID is the identifier of the content. Id mypkg.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() { } func InterfaceNesting( client graphql.Client, ) (*InterfaceNestingResponse, error) { var retval InterfaceNestingResponse err := client.MakeRequest( nil, "InterfaceNesting", ` query InterfaceNesting { root { id children { id parent { id children { id } } } } } `, &retval, nil, ) return &retval, err }