github.com/Desuuuu/genqlient@v0.5.3/generate/testdata/snapshots/TestGenerate-InterfaceListField.graphql-InterfaceListField.graphql.go (about)

     1  // Code generated by github.com/Desuuuu/genqlient, DO NOT EDIT.
     2  
     3  package test
     4  
     5  import (
     6  	"encoding/json"
     7  	"fmt"
     8  
     9  	"github.com/Desuuuu/genqlient/graphql"
    10  	"github.com/Desuuuu/genqlient/internal/testutil"
    11  )
    12  
    13  // InterfaceListFieldResponse is returned by InterfaceListField on success.
    14  type InterfaceListFieldResponse struct {
    15  	Root        InterfaceListFieldRootTopic         `json:"root"`
    16  	WithPointer *InterfaceListFieldWithPointerTopic `json:"withPointer"`
    17  }
    18  
    19  // GetRoot returns InterfaceListFieldResponse.Root, and is useful for accessing the field via an interface.
    20  func (v *InterfaceListFieldResponse) GetRoot() InterfaceListFieldRootTopic { return v.Root }
    21  
    22  // GetWithPointer returns InterfaceListFieldResponse.WithPointer, and is useful for accessing the field via an interface.
    23  func (v *InterfaceListFieldResponse) GetWithPointer() *InterfaceListFieldWithPointerTopic {
    24  	return v.WithPointer
    25  }
    26  
    27  // InterfaceListFieldRootTopic includes the requested fields of the GraphQL type Topic.
    28  type InterfaceListFieldRootTopic struct {
    29  	// ID is documented in the Content interface.
    30  	Id       testutil.ID                                  `json:"id"`
    31  	Name     string                                       `json:"name"`
    32  	Children []InterfaceListFieldRootTopicChildrenContent `json:"-"`
    33  }
    34  
    35  // GetId returns InterfaceListFieldRootTopic.Id, and is useful for accessing the field via an interface.
    36  func (v *InterfaceListFieldRootTopic) GetId() testutil.ID { return v.Id }
    37  
    38  // GetName returns InterfaceListFieldRootTopic.Name, and is useful for accessing the field via an interface.
    39  func (v *InterfaceListFieldRootTopic) GetName() string { return v.Name }
    40  
    41  // GetChildren returns InterfaceListFieldRootTopic.Children, and is useful for accessing the field via an interface.
    42  func (v *InterfaceListFieldRootTopic) GetChildren() []InterfaceListFieldRootTopicChildrenContent {
    43  	return v.Children
    44  }
    45  
    46  func (v *InterfaceListFieldRootTopic) UnmarshalJSON(b []byte) error {
    47  
    48  	if string(b) == "null" {
    49  		return nil
    50  	}
    51  
    52  	var firstPass struct {
    53  		*InterfaceListFieldRootTopic
    54  		Children []json.RawMessage `json:"children"`
    55  		graphql.NoUnmarshalJSON
    56  	}
    57  	firstPass.InterfaceListFieldRootTopic = v
    58  
    59  	err := json.Unmarshal(b, &firstPass)
    60  	if err != nil {
    61  		return err
    62  	}
    63  
    64  	{
    65  		dst := &v.Children
    66  		src := firstPass.Children
    67  		*dst = make(
    68  			[]InterfaceListFieldRootTopicChildrenContent,
    69  			len(src))
    70  		for i, src := range src {
    71  			dst := &(*dst)[i]
    72  			if len(src) != 0 && string(src) != "null" {
    73  				err = __unmarshalInterfaceListFieldRootTopicChildrenContent(
    74  					src, dst)
    75  				if err != nil {
    76  					return fmt.Errorf(
    77  						"Unable to unmarshal InterfaceListFieldRootTopic.Children: %w", err)
    78  				}
    79  			}
    80  		}
    81  	}
    82  	return nil
    83  }
    84  
    85  type __premarshalInterfaceListFieldRootTopic struct {
    86  	Id testutil.ID `json:"id"`
    87  
    88  	Name string `json:"name"`
    89  
    90  	Children []json.RawMessage `json:"children"`
    91  }
    92  
    93  func (v *InterfaceListFieldRootTopic) MarshalJSON() ([]byte, error) {
    94  	premarshaled, err := v.__premarshalJSON()
    95  	if err != nil {
    96  		return nil, err
    97  	}
    98  	return json.Marshal(premarshaled)
    99  }
   100  
   101  func (v *InterfaceListFieldRootTopic) __premarshalJSON() (*__premarshalInterfaceListFieldRootTopic, error) {
   102  	var retval __premarshalInterfaceListFieldRootTopic
   103  
   104  	retval.Id = v.Id
   105  	retval.Name = v.Name
   106  	{
   107  
   108  		dst := &retval.Children
   109  		src := v.Children
   110  		*dst = make(
   111  			[]json.RawMessage,
   112  			len(src))
   113  		for i, src := range src {
   114  			dst := &(*dst)[i]
   115  			var err error
   116  			*dst, err = __marshalInterfaceListFieldRootTopicChildrenContent(
   117  				&src)
   118  			if err != nil {
   119  				return nil, fmt.Errorf(
   120  					"Unable to marshal InterfaceListFieldRootTopic.Children: %w", err)
   121  			}
   122  		}
   123  	}
   124  	return &retval, nil
   125  }
   126  
   127  // InterfaceListFieldRootTopicChildrenArticle includes the requested fields of the GraphQL type Article.
   128  type InterfaceListFieldRootTopicChildrenArticle struct {
   129  	Typename string `json:"__typename"`
   130  	// ID is the identifier of the content.
   131  	Id   testutil.ID `json:"id"`
   132  	Name string      `json:"name"`
   133  }
   134  
   135  // GetTypename returns InterfaceListFieldRootTopicChildrenArticle.Typename, and is useful for accessing the field via an interface.
   136  func (v *InterfaceListFieldRootTopicChildrenArticle) GetTypename() string { return v.Typename }
   137  
   138  // GetId returns InterfaceListFieldRootTopicChildrenArticle.Id, and is useful for accessing the field via an interface.
   139  func (v *InterfaceListFieldRootTopicChildrenArticle) GetId() testutil.ID { return v.Id }
   140  
   141  // GetName returns InterfaceListFieldRootTopicChildrenArticle.Name, and is useful for accessing the field via an interface.
   142  func (v *InterfaceListFieldRootTopicChildrenArticle) GetName() string { return v.Name }
   143  
   144  // InterfaceListFieldRootTopicChildrenContent includes the requested fields of the GraphQL interface Content.
   145  //
   146  // InterfaceListFieldRootTopicChildrenContent is implemented by the following types:
   147  // InterfaceListFieldRootTopicChildrenArticle
   148  // InterfaceListFieldRootTopicChildrenVideo
   149  // InterfaceListFieldRootTopicChildrenTopic
   150  // The GraphQL type's documentation follows.
   151  //
   152  // Content is implemented by various types like Article, Video, and Topic.
   153  type InterfaceListFieldRootTopicChildrenContent interface {
   154  	implementsGraphQLInterfaceInterfaceListFieldRootTopicChildrenContent()
   155  	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
   156  	GetTypename() string
   157  	// GetId returns the interface-field "id" from its implementation.
   158  	// The GraphQL interface field's documentation follows.
   159  	//
   160  	// ID is the identifier of the content.
   161  	GetId() testutil.ID
   162  	// GetName returns the interface-field "name" from its implementation.
   163  	GetName() string
   164  	GetContentArticle() (*InterfaceListFieldRootTopicChildrenArticle, bool)
   165  	GetContentVideo() (*InterfaceListFieldRootTopicChildrenVideo, bool)
   166  	GetContentTopic() (*InterfaceListFieldRootTopicChildrenTopic, bool)
   167  }
   168  
   169  func (v *InterfaceListFieldRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceListFieldRootTopicChildrenContent() {
   170  }
   171  func (v *InterfaceListFieldRootTopicChildrenArticle) GetContentArticle() (*InterfaceListFieldRootTopicChildrenArticle, bool) {
   172  	return v, true
   173  }
   174  func (v *InterfaceListFieldRootTopicChildrenArticle) GetContentVideo() (*InterfaceListFieldRootTopicChildrenVideo, bool) {
   175  	return nil, false
   176  }
   177  func (v *InterfaceListFieldRootTopicChildrenArticle) GetContentTopic() (*InterfaceListFieldRootTopicChildrenTopic, bool) {
   178  	return nil, false
   179  }
   180  func (v *InterfaceListFieldRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceListFieldRootTopicChildrenContent() {
   181  }
   182  func (v *InterfaceListFieldRootTopicChildrenVideo) GetContentArticle() (*InterfaceListFieldRootTopicChildrenArticle, bool) {
   183  	return nil, false
   184  }
   185  func (v *InterfaceListFieldRootTopicChildrenVideo) GetContentVideo() (*InterfaceListFieldRootTopicChildrenVideo, bool) {
   186  	return v, true
   187  }
   188  func (v *InterfaceListFieldRootTopicChildrenVideo) GetContentTopic() (*InterfaceListFieldRootTopicChildrenTopic, bool) {
   189  	return nil, false
   190  }
   191  func (v *InterfaceListFieldRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceListFieldRootTopicChildrenContent() {
   192  }
   193  func (v *InterfaceListFieldRootTopicChildrenTopic) GetContentArticle() (*InterfaceListFieldRootTopicChildrenArticle, bool) {
   194  	return nil, false
   195  }
   196  func (v *InterfaceListFieldRootTopicChildrenTopic) GetContentVideo() (*InterfaceListFieldRootTopicChildrenVideo, bool) {
   197  	return nil, false
   198  }
   199  func (v *InterfaceListFieldRootTopicChildrenTopic) GetContentTopic() (*InterfaceListFieldRootTopicChildrenTopic, bool) {
   200  	return v, true
   201  }
   202  
   203  func __unmarshalInterfaceListFieldRootTopicChildrenContent(b []byte, v *InterfaceListFieldRootTopicChildrenContent) error {
   204  	if string(b) == "null" {
   205  		return nil
   206  	}
   207  
   208  	var tn struct {
   209  		TypeName string `json:"__typename"`
   210  	}
   211  	err := json.Unmarshal(b, &tn)
   212  	if err != nil {
   213  		return err
   214  	}
   215  
   216  	switch tn.TypeName {
   217  	case "Article":
   218  		*v = new(InterfaceListFieldRootTopicChildrenArticle)
   219  		return json.Unmarshal(b, *v)
   220  	case "Video":
   221  		*v = new(InterfaceListFieldRootTopicChildrenVideo)
   222  		return json.Unmarshal(b, *v)
   223  	case "Topic":
   224  		*v = new(InterfaceListFieldRootTopicChildrenTopic)
   225  		return json.Unmarshal(b, *v)
   226  	case "":
   227  		return fmt.Errorf(
   228  			"response was missing Content.__typename")
   229  	default:
   230  		return fmt.Errorf(
   231  			`unexpected concrete type for InterfaceListFieldRootTopicChildrenContent: "%v"`, tn.TypeName)
   232  	}
   233  }
   234  
   235  func __marshalInterfaceListFieldRootTopicChildrenContent(v *InterfaceListFieldRootTopicChildrenContent) ([]byte, error) {
   236  
   237  	var typename string
   238  	switch v := (*v).(type) {
   239  	case *InterfaceListFieldRootTopicChildrenArticle:
   240  		typename = "Article"
   241  
   242  		result := struct {
   243  			TypeName string `json:"__typename"`
   244  			*InterfaceListFieldRootTopicChildrenArticle
   245  		}{typename, v}
   246  		return json.Marshal(result)
   247  	case *InterfaceListFieldRootTopicChildrenVideo:
   248  		typename = "Video"
   249  
   250  		result := struct {
   251  			TypeName string `json:"__typename"`
   252  			*InterfaceListFieldRootTopicChildrenVideo
   253  		}{typename, v}
   254  		return json.Marshal(result)
   255  	case *InterfaceListFieldRootTopicChildrenTopic:
   256  		typename = "Topic"
   257  
   258  		result := struct {
   259  			TypeName string `json:"__typename"`
   260  			*InterfaceListFieldRootTopicChildrenTopic
   261  		}{typename, v}
   262  		return json.Marshal(result)
   263  	case nil:
   264  		return []byte("null"), nil
   265  	default:
   266  		return nil, fmt.Errorf(
   267  			`unexpected concrete type for InterfaceListFieldRootTopicChildrenContent: "%T"`, v)
   268  	}
   269  }
   270  
   271  // InterfaceListFieldRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
   272  type InterfaceListFieldRootTopicChildrenTopic struct {
   273  	Typename string `json:"__typename"`
   274  	// ID is the identifier of the content.
   275  	Id   testutil.ID `json:"id"`
   276  	Name string      `json:"name"`
   277  }
   278  
   279  // GetTypename returns InterfaceListFieldRootTopicChildrenTopic.Typename, and is useful for accessing the field via an interface.
   280  func (v *InterfaceListFieldRootTopicChildrenTopic) GetTypename() string { return v.Typename }
   281  
   282  // GetId returns InterfaceListFieldRootTopicChildrenTopic.Id, and is useful for accessing the field via an interface.
   283  func (v *InterfaceListFieldRootTopicChildrenTopic) GetId() testutil.ID { return v.Id }
   284  
   285  // GetName returns InterfaceListFieldRootTopicChildrenTopic.Name, and is useful for accessing the field via an interface.
   286  func (v *InterfaceListFieldRootTopicChildrenTopic) GetName() string { return v.Name }
   287  
   288  // InterfaceListFieldRootTopicChildrenVideo includes the requested fields of the GraphQL type Video.
   289  type InterfaceListFieldRootTopicChildrenVideo struct {
   290  	Typename string `json:"__typename"`
   291  	// ID is the identifier of the content.
   292  	Id   testutil.ID `json:"id"`
   293  	Name string      `json:"name"`
   294  }
   295  
   296  // GetTypename returns InterfaceListFieldRootTopicChildrenVideo.Typename, and is useful for accessing the field via an interface.
   297  func (v *InterfaceListFieldRootTopicChildrenVideo) GetTypename() string { return v.Typename }
   298  
   299  // GetId returns InterfaceListFieldRootTopicChildrenVideo.Id, and is useful for accessing the field via an interface.
   300  func (v *InterfaceListFieldRootTopicChildrenVideo) GetId() testutil.ID { return v.Id }
   301  
   302  // GetName returns InterfaceListFieldRootTopicChildrenVideo.Name, and is useful for accessing the field via an interface.
   303  func (v *InterfaceListFieldRootTopicChildrenVideo) GetName() string { return v.Name }
   304  
   305  // InterfaceListFieldWithPointerTopic includes the requested fields of the GraphQL type Topic.
   306  type InterfaceListFieldWithPointerTopic struct {
   307  	// ID is documented in the Content interface.
   308  	Id       testutil.ID                                         `json:"id"`
   309  	Name     string                                              `json:"name"`
   310  	Children []InterfaceListFieldWithPointerTopicChildrenContent `json:"-"`
   311  }
   312  
   313  // GetId returns InterfaceListFieldWithPointerTopic.Id, and is useful for accessing the field via an interface.
   314  func (v *InterfaceListFieldWithPointerTopic) GetId() testutil.ID { return v.Id }
   315  
   316  // GetName returns InterfaceListFieldWithPointerTopic.Name, and is useful for accessing the field via an interface.
   317  func (v *InterfaceListFieldWithPointerTopic) GetName() string { return v.Name }
   318  
   319  // GetChildren returns InterfaceListFieldWithPointerTopic.Children, and is useful for accessing the field via an interface.
   320  func (v *InterfaceListFieldWithPointerTopic) GetChildren() []InterfaceListFieldWithPointerTopicChildrenContent {
   321  	return v.Children
   322  }
   323  
   324  func (v *InterfaceListFieldWithPointerTopic) UnmarshalJSON(b []byte) error {
   325  
   326  	if string(b) == "null" {
   327  		return nil
   328  	}
   329  
   330  	var firstPass struct {
   331  		*InterfaceListFieldWithPointerTopic
   332  		Children []json.RawMessage `json:"children"`
   333  		graphql.NoUnmarshalJSON
   334  	}
   335  	firstPass.InterfaceListFieldWithPointerTopic = v
   336  
   337  	err := json.Unmarshal(b, &firstPass)
   338  	if err != nil {
   339  		return err
   340  	}
   341  
   342  	{
   343  		dst := &v.Children
   344  		src := firstPass.Children
   345  		*dst = make(
   346  			[]InterfaceListFieldWithPointerTopicChildrenContent,
   347  			len(src))
   348  		for i, src := range src {
   349  			dst := &(*dst)[i]
   350  			if len(src) != 0 && string(src) != "null" {
   351  				err = __unmarshalInterfaceListFieldWithPointerTopicChildrenContent(
   352  					src, dst)
   353  				if err != nil {
   354  					return fmt.Errorf(
   355  						"Unable to unmarshal InterfaceListFieldWithPointerTopic.Children: %w", err)
   356  				}
   357  			}
   358  		}
   359  	}
   360  	return nil
   361  }
   362  
   363  type __premarshalInterfaceListFieldWithPointerTopic struct {
   364  	Id testutil.ID `json:"id"`
   365  
   366  	Name string `json:"name"`
   367  
   368  	Children []json.RawMessage `json:"children"`
   369  }
   370  
   371  func (v *InterfaceListFieldWithPointerTopic) MarshalJSON() ([]byte, error) {
   372  	premarshaled, err := v.__premarshalJSON()
   373  	if err != nil {
   374  		return nil, err
   375  	}
   376  	return json.Marshal(premarshaled)
   377  }
   378  
   379  func (v *InterfaceListFieldWithPointerTopic) __premarshalJSON() (*__premarshalInterfaceListFieldWithPointerTopic, error) {
   380  	var retval __premarshalInterfaceListFieldWithPointerTopic
   381  
   382  	retval.Id = v.Id
   383  	retval.Name = v.Name
   384  	{
   385  
   386  		dst := &retval.Children
   387  		src := v.Children
   388  		*dst = make(
   389  			[]json.RawMessage,
   390  			len(src))
   391  		for i, src := range src {
   392  			dst := &(*dst)[i]
   393  			var err error
   394  			*dst, err = __marshalInterfaceListFieldWithPointerTopicChildrenContent(
   395  				&src)
   396  			if err != nil {
   397  				return nil, fmt.Errorf(
   398  					"Unable to marshal InterfaceListFieldWithPointerTopic.Children: %w", err)
   399  			}
   400  		}
   401  	}
   402  	return &retval, nil
   403  }
   404  
   405  // InterfaceListFieldWithPointerTopicChildrenArticle includes the requested fields of the GraphQL type Article.
   406  type InterfaceListFieldWithPointerTopicChildrenArticle struct {
   407  	Typename string `json:"__typename"`
   408  	// ID is the identifier of the content.
   409  	Id   testutil.ID `json:"id"`
   410  	Name string      `json:"name"`
   411  }
   412  
   413  // GetTypename returns InterfaceListFieldWithPointerTopicChildrenArticle.Typename, and is useful for accessing the field via an interface.
   414  func (v *InterfaceListFieldWithPointerTopicChildrenArticle) GetTypename() string { return v.Typename }
   415  
   416  // GetId returns InterfaceListFieldWithPointerTopicChildrenArticle.Id, and is useful for accessing the field via an interface.
   417  func (v *InterfaceListFieldWithPointerTopicChildrenArticle) GetId() testutil.ID { return v.Id }
   418  
   419  // GetName returns InterfaceListFieldWithPointerTopicChildrenArticle.Name, and is useful for accessing the field via an interface.
   420  func (v *InterfaceListFieldWithPointerTopicChildrenArticle) GetName() string { return v.Name }
   421  
   422  // InterfaceListFieldWithPointerTopicChildrenContent includes the requested fields of the GraphQL interface Content.
   423  //
   424  // InterfaceListFieldWithPointerTopicChildrenContent is implemented by the following types:
   425  // InterfaceListFieldWithPointerTopicChildrenArticle
   426  // InterfaceListFieldWithPointerTopicChildrenVideo
   427  // InterfaceListFieldWithPointerTopicChildrenTopic
   428  // The GraphQL type's documentation follows.
   429  //
   430  // Content is implemented by various types like Article, Video, and Topic.
   431  type InterfaceListFieldWithPointerTopicChildrenContent interface {
   432  	implementsGraphQLInterfaceInterfaceListFieldWithPointerTopicChildrenContent()
   433  	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
   434  	GetTypename() string
   435  	// GetId returns the interface-field "id" from its implementation.
   436  	// The GraphQL interface field's documentation follows.
   437  	//
   438  	// ID is the identifier of the content.
   439  	GetId() testutil.ID
   440  	// GetName returns the interface-field "name" from its implementation.
   441  	GetName() string
   442  	GetContentArticle() (*InterfaceListFieldWithPointerTopicChildrenArticle, bool)
   443  	GetContentVideo() (*InterfaceListFieldWithPointerTopicChildrenVideo, bool)
   444  	GetContentTopic() (*InterfaceListFieldWithPointerTopicChildrenTopic, bool)
   445  }
   446  
   447  func (v *InterfaceListFieldWithPointerTopicChildrenArticle) implementsGraphQLInterfaceInterfaceListFieldWithPointerTopicChildrenContent() {
   448  }
   449  func (v *InterfaceListFieldWithPointerTopicChildrenArticle) GetContentArticle() (*InterfaceListFieldWithPointerTopicChildrenArticle, bool) {
   450  	return v, true
   451  }
   452  func (v *InterfaceListFieldWithPointerTopicChildrenArticle) GetContentVideo() (*InterfaceListFieldWithPointerTopicChildrenVideo, bool) {
   453  	return nil, false
   454  }
   455  func (v *InterfaceListFieldWithPointerTopicChildrenArticle) GetContentTopic() (*InterfaceListFieldWithPointerTopicChildrenTopic, bool) {
   456  	return nil, false
   457  }
   458  func (v *InterfaceListFieldWithPointerTopicChildrenVideo) implementsGraphQLInterfaceInterfaceListFieldWithPointerTopicChildrenContent() {
   459  }
   460  func (v *InterfaceListFieldWithPointerTopicChildrenVideo) GetContentArticle() (*InterfaceListFieldWithPointerTopicChildrenArticle, bool) {
   461  	return nil, false
   462  }
   463  func (v *InterfaceListFieldWithPointerTopicChildrenVideo) GetContentVideo() (*InterfaceListFieldWithPointerTopicChildrenVideo, bool) {
   464  	return v, true
   465  }
   466  func (v *InterfaceListFieldWithPointerTopicChildrenVideo) GetContentTopic() (*InterfaceListFieldWithPointerTopicChildrenTopic, bool) {
   467  	return nil, false
   468  }
   469  func (v *InterfaceListFieldWithPointerTopicChildrenTopic) implementsGraphQLInterfaceInterfaceListFieldWithPointerTopicChildrenContent() {
   470  }
   471  func (v *InterfaceListFieldWithPointerTopicChildrenTopic) GetContentArticle() (*InterfaceListFieldWithPointerTopicChildrenArticle, bool) {
   472  	return nil, false
   473  }
   474  func (v *InterfaceListFieldWithPointerTopicChildrenTopic) GetContentVideo() (*InterfaceListFieldWithPointerTopicChildrenVideo, bool) {
   475  	return nil, false
   476  }
   477  func (v *InterfaceListFieldWithPointerTopicChildrenTopic) GetContentTopic() (*InterfaceListFieldWithPointerTopicChildrenTopic, bool) {
   478  	return v, true
   479  }
   480  
   481  func __unmarshalInterfaceListFieldWithPointerTopicChildrenContent(b []byte, v *InterfaceListFieldWithPointerTopicChildrenContent) error {
   482  	if string(b) == "null" {
   483  		return nil
   484  	}
   485  
   486  	var tn struct {
   487  		TypeName string `json:"__typename"`
   488  	}
   489  	err := json.Unmarshal(b, &tn)
   490  	if err != nil {
   491  		return err
   492  	}
   493  
   494  	switch tn.TypeName {
   495  	case "Article":
   496  		*v = new(InterfaceListFieldWithPointerTopicChildrenArticle)
   497  		return json.Unmarshal(b, *v)
   498  	case "Video":
   499  		*v = new(InterfaceListFieldWithPointerTopicChildrenVideo)
   500  		return json.Unmarshal(b, *v)
   501  	case "Topic":
   502  		*v = new(InterfaceListFieldWithPointerTopicChildrenTopic)
   503  		return json.Unmarshal(b, *v)
   504  	case "":
   505  		return fmt.Errorf(
   506  			"response was missing Content.__typename")
   507  	default:
   508  		return fmt.Errorf(
   509  			`unexpected concrete type for InterfaceListFieldWithPointerTopicChildrenContent: "%v"`, tn.TypeName)
   510  	}
   511  }
   512  
   513  func __marshalInterfaceListFieldWithPointerTopicChildrenContent(v *InterfaceListFieldWithPointerTopicChildrenContent) ([]byte, error) {
   514  
   515  	var typename string
   516  	switch v := (*v).(type) {
   517  	case *InterfaceListFieldWithPointerTopicChildrenArticle:
   518  		typename = "Article"
   519  
   520  		result := struct {
   521  			TypeName string `json:"__typename"`
   522  			*InterfaceListFieldWithPointerTopicChildrenArticle
   523  		}{typename, v}
   524  		return json.Marshal(result)
   525  	case *InterfaceListFieldWithPointerTopicChildrenVideo:
   526  		typename = "Video"
   527  
   528  		result := struct {
   529  			TypeName string `json:"__typename"`
   530  			*InterfaceListFieldWithPointerTopicChildrenVideo
   531  		}{typename, v}
   532  		return json.Marshal(result)
   533  	case *InterfaceListFieldWithPointerTopicChildrenTopic:
   534  		typename = "Topic"
   535  
   536  		result := struct {
   537  			TypeName string `json:"__typename"`
   538  			*InterfaceListFieldWithPointerTopicChildrenTopic
   539  		}{typename, v}
   540  		return json.Marshal(result)
   541  	case nil:
   542  		return []byte("null"), nil
   543  	default:
   544  		return nil, fmt.Errorf(
   545  			`unexpected concrete type for InterfaceListFieldWithPointerTopicChildrenContent: "%T"`, v)
   546  	}
   547  }
   548  
   549  // InterfaceListFieldWithPointerTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
   550  type InterfaceListFieldWithPointerTopicChildrenTopic struct {
   551  	Typename string `json:"__typename"`
   552  	// ID is the identifier of the content.
   553  	Id   testutil.ID `json:"id"`
   554  	Name string      `json:"name"`
   555  }
   556  
   557  // GetTypename returns InterfaceListFieldWithPointerTopicChildrenTopic.Typename, and is useful for accessing the field via an interface.
   558  func (v *InterfaceListFieldWithPointerTopicChildrenTopic) GetTypename() string { return v.Typename }
   559  
   560  // GetId returns InterfaceListFieldWithPointerTopicChildrenTopic.Id, and is useful for accessing the field via an interface.
   561  func (v *InterfaceListFieldWithPointerTopicChildrenTopic) GetId() testutil.ID { return v.Id }
   562  
   563  // GetName returns InterfaceListFieldWithPointerTopicChildrenTopic.Name, and is useful for accessing the field via an interface.
   564  func (v *InterfaceListFieldWithPointerTopicChildrenTopic) GetName() string { return v.Name }
   565  
   566  // InterfaceListFieldWithPointerTopicChildrenVideo includes the requested fields of the GraphQL type Video.
   567  type InterfaceListFieldWithPointerTopicChildrenVideo struct {
   568  	Typename string `json:"__typename"`
   569  	// ID is the identifier of the content.
   570  	Id   testutil.ID `json:"id"`
   571  	Name string      `json:"name"`
   572  }
   573  
   574  // GetTypename returns InterfaceListFieldWithPointerTopicChildrenVideo.Typename, and is useful for accessing the field via an interface.
   575  func (v *InterfaceListFieldWithPointerTopicChildrenVideo) GetTypename() string { return v.Typename }
   576  
   577  // GetId returns InterfaceListFieldWithPointerTopicChildrenVideo.Id, and is useful for accessing the field via an interface.
   578  func (v *InterfaceListFieldWithPointerTopicChildrenVideo) GetId() testutil.ID { return v.Id }
   579  
   580  // GetName returns InterfaceListFieldWithPointerTopicChildrenVideo.Name, and is useful for accessing the field via an interface.
   581  func (v *InterfaceListFieldWithPointerTopicChildrenVideo) GetName() string { return v.Name }
   582  
   583  func InterfaceListField(
   584  	client graphql.Client,
   585  ) (*InterfaceListFieldResponse, error) {
   586  	req := &graphql.Request{
   587  		OpName: "InterfaceListField",
   588  		Query: `
   589  query InterfaceListField {
   590  	root {
   591  		id
   592  		name
   593  		children {
   594  			__typename
   595  			id
   596  			name
   597  		}
   598  	}
   599  	withPointer: root {
   600  		id
   601  		name
   602  		children {
   603  			__typename
   604  			id
   605  			name
   606  		}
   607  	}
   608  }
   609  `,
   610  	}
   611  	var err error
   612  
   613  	var data InterfaceListFieldResponse
   614  	resp := &graphql.Response{Data: &data}
   615  
   616  	err = client.MakeRequest(
   617  		nil,
   618  		req,
   619  		resp,
   620  	)
   621  
   622  	return &data, err
   623  }
   624