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