github.com/Desuuuu/genqlient@v0.5.3/generate/testdata/snapshots/TestGenerate-ComplexInlineFragments.graphql-ComplexInlineFragments.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 // ComplexInlineFragmentsConflictingStuffArticle includes the requested fields of the GraphQL type Article. 14 type ComplexInlineFragmentsConflictingStuffArticle struct { 15 Typename string `json:"__typename"` 16 Thumbnail ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail `json:"thumbnail"` 17 } 18 19 // GetTypename returns ComplexInlineFragmentsConflictingStuffArticle.Typename, and is useful for accessing the field via an interface. 20 func (v *ComplexInlineFragmentsConflictingStuffArticle) GetTypename() string { return v.Typename } 21 22 // GetThumbnail returns ComplexInlineFragmentsConflictingStuffArticle.Thumbnail, and is useful for accessing the field via an interface. 23 func (v *ComplexInlineFragmentsConflictingStuffArticle) GetThumbnail() ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail { 24 return v.Thumbnail 25 } 26 27 // ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail includes the requested fields of the GraphQL type StuffThumbnail. 28 type ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail struct { 29 Id testutil.ID `json:"id"` 30 ThumbnailUrl string `json:"thumbnailUrl"` 31 } 32 33 // GetId returns ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail.Id, and is useful for accessing the field via an interface. 34 func (v *ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail) GetId() testutil.ID { 35 return v.Id 36 } 37 38 // GetThumbnailUrl returns ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail.ThumbnailUrl, and is useful for accessing the field via an interface. 39 func (v *ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail) GetThumbnailUrl() string { 40 return v.ThumbnailUrl 41 } 42 43 // ComplexInlineFragmentsConflictingStuffContent includes the requested fields of the GraphQL interface Content. 44 // 45 // ComplexInlineFragmentsConflictingStuffContent is implemented by the following types: 46 // ComplexInlineFragmentsConflictingStuffArticle 47 // ComplexInlineFragmentsConflictingStuffVideo 48 // ComplexInlineFragmentsConflictingStuffTopic 49 // The GraphQL type's documentation follows. 50 // 51 // Content is implemented by various types like Article, Video, and Topic. 52 type ComplexInlineFragmentsConflictingStuffContent interface { 53 implementsGraphQLInterfaceComplexInlineFragmentsConflictingStuffContent() 54 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 55 GetTypename() string 56 GetContentArticle() (*ComplexInlineFragmentsConflictingStuffArticle, bool) 57 GetContentVideo() (*ComplexInlineFragmentsConflictingStuffVideo, bool) 58 GetContentTopic() (*ComplexInlineFragmentsConflictingStuffTopic, bool) 59 } 60 61 func (v *ComplexInlineFragmentsConflictingStuffArticle) implementsGraphQLInterfaceComplexInlineFragmentsConflictingStuffContent() { 62 } 63 func (v *ComplexInlineFragmentsConflictingStuffArticle) GetContentArticle() (*ComplexInlineFragmentsConflictingStuffArticle, bool) { 64 return v, true 65 } 66 func (v *ComplexInlineFragmentsConflictingStuffArticle) GetContentVideo() (*ComplexInlineFragmentsConflictingStuffVideo, bool) { 67 return nil, false 68 } 69 func (v *ComplexInlineFragmentsConflictingStuffArticle) GetContentTopic() (*ComplexInlineFragmentsConflictingStuffTopic, bool) { 70 return nil, false 71 } 72 func (v *ComplexInlineFragmentsConflictingStuffVideo) implementsGraphQLInterfaceComplexInlineFragmentsConflictingStuffContent() { 73 } 74 func (v *ComplexInlineFragmentsConflictingStuffVideo) GetContentArticle() (*ComplexInlineFragmentsConflictingStuffArticle, bool) { 75 return nil, false 76 } 77 func (v *ComplexInlineFragmentsConflictingStuffVideo) GetContentVideo() (*ComplexInlineFragmentsConflictingStuffVideo, bool) { 78 return v, true 79 } 80 func (v *ComplexInlineFragmentsConflictingStuffVideo) GetContentTopic() (*ComplexInlineFragmentsConflictingStuffTopic, bool) { 81 return nil, false 82 } 83 func (v *ComplexInlineFragmentsConflictingStuffTopic) implementsGraphQLInterfaceComplexInlineFragmentsConflictingStuffContent() { 84 } 85 func (v *ComplexInlineFragmentsConflictingStuffTopic) GetContentArticle() (*ComplexInlineFragmentsConflictingStuffArticle, bool) { 86 return nil, false 87 } 88 func (v *ComplexInlineFragmentsConflictingStuffTopic) GetContentVideo() (*ComplexInlineFragmentsConflictingStuffVideo, bool) { 89 return nil, false 90 } 91 func (v *ComplexInlineFragmentsConflictingStuffTopic) GetContentTopic() (*ComplexInlineFragmentsConflictingStuffTopic, bool) { 92 return v, true 93 } 94 95 func __unmarshalComplexInlineFragmentsConflictingStuffContent(b []byte, v *ComplexInlineFragmentsConflictingStuffContent) error { 96 if string(b) == "null" { 97 return nil 98 } 99 100 var tn struct { 101 TypeName string `json:"__typename"` 102 } 103 err := json.Unmarshal(b, &tn) 104 if err != nil { 105 return err 106 } 107 108 switch tn.TypeName { 109 case "Article": 110 *v = new(ComplexInlineFragmentsConflictingStuffArticle) 111 return json.Unmarshal(b, *v) 112 case "Video": 113 *v = new(ComplexInlineFragmentsConflictingStuffVideo) 114 return json.Unmarshal(b, *v) 115 case "Topic": 116 *v = new(ComplexInlineFragmentsConflictingStuffTopic) 117 return json.Unmarshal(b, *v) 118 case "": 119 return fmt.Errorf( 120 "response was missing Content.__typename") 121 default: 122 return fmt.Errorf( 123 `unexpected concrete type for ComplexInlineFragmentsConflictingStuffContent: "%v"`, tn.TypeName) 124 } 125 } 126 127 func __marshalComplexInlineFragmentsConflictingStuffContent(v *ComplexInlineFragmentsConflictingStuffContent) ([]byte, error) { 128 129 var typename string 130 switch v := (*v).(type) { 131 case *ComplexInlineFragmentsConflictingStuffArticle: 132 typename = "Article" 133 134 result := struct { 135 TypeName string `json:"__typename"` 136 *ComplexInlineFragmentsConflictingStuffArticle 137 }{typename, v} 138 return json.Marshal(result) 139 case *ComplexInlineFragmentsConflictingStuffVideo: 140 typename = "Video" 141 142 result := struct { 143 TypeName string `json:"__typename"` 144 *ComplexInlineFragmentsConflictingStuffVideo 145 }{typename, v} 146 return json.Marshal(result) 147 case *ComplexInlineFragmentsConflictingStuffTopic: 148 typename = "Topic" 149 150 result := struct { 151 TypeName string `json:"__typename"` 152 *ComplexInlineFragmentsConflictingStuffTopic 153 }{typename, v} 154 return json.Marshal(result) 155 case nil: 156 return []byte("null"), nil 157 default: 158 return nil, fmt.Errorf( 159 `unexpected concrete type for ComplexInlineFragmentsConflictingStuffContent: "%T"`, v) 160 } 161 } 162 163 // ComplexInlineFragmentsConflictingStuffTopic includes the requested fields of the GraphQL type Topic. 164 type ComplexInlineFragmentsConflictingStuffTopic struct { 165 Typename string `json:"__typename"` 166 } 167 168 // GetTypename returns ComplexInlineFragmentsConflictingStuffTopic.Typename, and is useful for accessing the field via an interface. 169 func (v *ComplexInlineFragmentsConflictingStuffTopic) GetTypename() string { return v.Typename } 170 171 // ComplexInlineFragmentsConflictingStuffVideo includes the requested fields of the GraphQL type Video. 172 type ComplexInlineFragmentsConflictingStuffVideo struct { 173 Typename string `json:"__typename"` 174 Thumbnail ComplexInlineFragmentsConflictingStuffVideoThumbnail `json:"thumbnail"` 175 } 176 177 // GetTypename returns ComplexInlineFragmentsConflictingStuffVideo.Typename, and is useful for accessing the field via an interface. 178 func (v *ComplexInlineFragmentsConflictingStuffVideo) GetTypename() string { return v.Typename } 179 180 // GetThumbnail returns ComplexInlineFragmentsConflictingStuffVideo.Thumbnail, and is useful for accessing the field via an interface. 181 func (v *ComplexInlineFragmentsConflictingStuffVideo) GetThumbnail() ComplexInlineFragmentsConflictingStuffVideoThumbnail { 182 return v.Thumbnail 183 } 184 185 // ComplexInlineFragmentsConflictingStuffVideoThumbnail includes the requested fields of the GraphQL type Thumbnail. 186 type ComplexInlineFragmentsConflictingStuffVideoThumbnail struct { 187 Id testutil.ID `json:"id"` 188 TimestampSec int `json:"timestampSec"` 189 } 190 191 // GetId returns ComplexInlineFragmentsConflictingStuffVideoThumbnail.Id, and is useful for accessing the field via an interface. 192 func (v *ComplexInlineFragmentsConflictingStuffVideoThumbnail) GetId() testutil.ID { return v.Id } 193 194 // GetTimestampSec returns ComplexInlineFragmentsConflictingStuffVideoThumbnail.TimestampSec, and is useful for accessing the field via an interface. 195 func (v *ComplexInlineFragmentsConflictingStuffVideoThumbnail) GetTimestampSec() int { 196 return v.TimestampSec 197 } 198 199 // ComplexInlineFragmentsNestedStuffArticle includes the requested fields of the GraphQL type Article. 200 type ComplexInlineFragmentsNestedStuffArticle struct { 201 Typename string `json:"__typename"` 202 } 203 204 // GetTypename returns ComplexInlineFragmentsNestedStuffArticle.Typename, and is useful for accessing the field via an interface. 205 func (v *ComplexInlineFragmentsNestedStuffArticle) GetTypename() string { return v.Typename } 206 207 // ComplexInlineFragmentsNestedStuffContent includes the requested fields of the GraphQL interface Content. 208 // 209 // ComplexInlineFragmentsNestedStuffContent is implemented by the following types: 210 // ComplexInlineFragmentsNestedStuffArticle 211 // ComplexInlineFragmentsNestedStuffVideo 212 // ComplexInlineFragmentsNestedStuffTopic 213 // The GraphQL type's documentation follows. 214 // 215 // Content is implemented by various types like Article, Video, and Topic. 216 type ComplexInlineFragmentsNestedStuffContent interface { 217 implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffContent() 218 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 219 GetTypename() string 220 GetContentArticle() (*ComplexInlineFragmentsNestedStuffArticle, bool) 221 GetContentVideo() (*ComplexInlineFragmentsNestedStuffVideo, bool) 222 GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopic, bool) 223 } 224 225 func (v *ComplexInlineFragmentsNestedStuffArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffContent() { 226 } 227 func (v *ComplexInlineFragmentsNestedStuffArticle) GetContentArticle() (*ComplexInlineFragmentsNestedStuffArticle, bool) { 228 return v, true 229 } 230 func (v *ComplexInlineFragmentsNestedStuffArticle) GetContentVideo() (*ComplexInlineFragmentsNestedStuffVideo, bool) { 231 return nil, false 232 } 233 func (v *ComplexInlineFragmentsNestedStuffArticle) GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopic, bool) { 234 return nil, false 235 } 236 func (v *ComplexInlineFragmentsNestedStuffVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffContent() { 237 } 238 func (v *ComplexInlineFragmentsNestedStuffVideo) GetContentArticle() (*ComplexInlineFragmentsNestedStuffArticle, bool) { 239 return nil, false 240 } 241 func (v *ComplexInlineFragmentsNestedStuffVideo) GetContentVideo() (*ComplexInlineFragmentsNestedStuffVideo, bool) { 242 return v, true 243 } 244 func (v *ComplexInlineFragmentsNestedStuffVideo) GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopic, bool) { 245 return nil, false 246 } 247 func (v *ComplexInlineFragmentsNestedStuffTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffContent() { 248 } 249 func (v *ComplexInlineFragmentsNestedStuffTopic) GetContentArticle() (*ComplexInlineFragmentsNestedStuffArticle, bool) { 250 return nil, false 251 } 252 func (v *ComplexInlineFragmentsNestedStuffTopic) GetContentVideo() (*ComplexInlineFragmentsNestedStuffVideo, bool) { 253 return nil, false 254 } 255 func (v *ComplexInlineFragmentsNestedStuffTopic) GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopic, bool) { 256 return v, true 257 } 258 259 func __unmarshalComplexInlineFragmentsNestedStuffContent(b []byte, v *ComplexInlineFragmentsNestedStuffContent) error { 260 if string(b) == "null" { 261 return nil 262 } 263 264 var tn struct { 265 TypeName string `json:"__typename"` 266 } 267 err := json.Unmarshal(b, &tn) 268 if err != nil { 269 return err 270 } 271 272 switch tn.TypeName { 273 case "Article": 274 *v = new(ComplexInlineFragmentsNestedStuffArticle) 275 return json.Unmarshal(b, *v) 276 case "Video": 277 *v = new(ComplexInlineFragmentsNestedStuffVideo) 278 return json.Unmarshal(b, *v) 279 case "Topic": 280 *v = new(ComplexInlineFragmentsNestedStuffTopic) 281 return json.Unmarshal(b, *v) 282 case "": 283 return fmt.Errorf( 284 "response was missing Content.__typename") 285 default: 286 return fmt.Errorf( 287 `unexpected concrete type for ComplexInlineFragmentsNestedStuffContent: "%v"`, tn.TypeName) 288 } 289 } 290 291 func __marshalComplexInlineFragmentsNestedStuffContent(v *ComplexInlineFragmentsNestedStuffContent) ([]byte, error) { 292 293 var typename string 294 switch v := (*v).(type) { 295 case *ComplexInlineFragmentsNestedStuffArticle: 296 typename = "Article" 297 298 result := struct { 299 TypeName string `json:"__typename"` 300 *ComplexInlineFragmentsNestedStuffArticle 301 }{typename, v} 302 return json.Marshal(result) 303 case *ComplexInlineFragmentsNestedStuffVideo: 304 typename = "Video" 305 306 result := struct { 307 TypeName string `json:"__typename"` 308 *ComplexInlineFragmentsNestedStuffVideo 309 }{typename, v} 310 return json.Marshal(result) 311 case *ComplexInlineFragmentsNestedStuffTopic: 312 typename = "Topic" 313 314 premarshaled, err := v.__premarshalJSON() 315 if err != nil { 316 return nil, err 317 } 318 result := struct { 319 TypeName string `json:"__typename"` 320 *__premarshalComplexInlineFragmentsNestedStuffTopic 321 }{typename, premarshaled} 322 return json.Marshal(result) 323 case nil: 324 return []byte("null"), nil 325 default: 326 return nil, fmt.Errorf( 327 `unexpected concrete type for ComplexInlineFragmentsNestedStuffContent: "%T"`, v) 328 } 329 } 330 331 // ComplexInlineFragmentsNestedStuffTopic includes the requested fields of the GraphQL type Topic. 332 type ComplexInlineFragmentsNestedStuffTopic struct { 333 Typename string `json:"__typename"` 334 Children []ComplexInlineFragmentsNestedStuffTopicChildrenContent `json:"-"` 335 } 336 337 // GetTypename returns ComplexInlineFragmentsNestedStuffTopic.Typename, and is useful for accessing the field via an interface. 338 func (v *ComplexInlineFragmentsNestedStuffTopic) GetTypename() string { return v.Typename } 339 340 // GetChildren returns ComplexInlineFragmentsNestedStuffTopic.Children, and is useful for accessing the field via an interface. 341 func (v *ComplexInlineFragmentsNestedStuffTopic) GetChildren() []ComplexInlineFragmentsNestedStuffTopicChildrenContent { 342 return v.Children 343 } 344 345 func (v *ComplexInlineFragmentsNestedStuffTopic) UnmarshalJSON(b []byte) error { 346 347 if string(b) == "null" { 348 return nil 349 } 350 351 var firstPass struct { 352 *ComplexInlineFragmentsNestedStuffTopic 353 Children []json.RawMessage `json:"children"` 354 graphql.NoUnmarshalJSON 355 } 356 firstPass.ComplexInlineFragmentsNestedStuffTopic = v 357 358 err := json.Unmarshal(b, &firstPass) 359 if err != nil { 360 return err 361 } 362 363 { 364 dst := &v.Children 365 src := firstPass.Children 366 *dst = make( 367 []ComplexInlineFragmentsNestedStuffTopicChildrenContent, 368 len(src)) 369 for i, src := range src { 370 dst := &(*dst)[i] 371 if len(src) != 0 && string(src) != "null" { 372 err = __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenContent( 373 src, dst) 374 if err != nil { 375 return fmt.Errorf( 376 "Unable to unmarshal ComplexInlineFragmentsNestedStuffTopic.Children: %w", err) 377 } 378 } 379 } 380 } 381 return nil 382 } 383 384 type __premarshalComplexInlineFragmentsNestedStuffTopic struct { 385 Typename string `json:"__typename"` 386 387 Children []json.RawMessage `json:"children"` 388 } 389 390 func (v *ComplexInlineFragmentsNestedStuffTopic) MarshalJSON() ([]byte, error) { 391 premarshaled, err := v.__premarshalJSON() 392 if err != nil { 393 return nil, err 394 } 395 return json.Marshal(premarshaled) 396 } 397 398 func (v *ComplexInlineFragmentsNestedStuffTopic) __premarshalJSON() (*__premarshalComplexInlineFragmentsNestedStuffTopic, error) { 399 var retval __premarshalComplexInlineFragmentsNestedStuffTopic 400 401 retval.Typename = v.Typename 402 { 403 404 dst := &retval.Children 405 src := v.Children 406 *dst = make( 407 []json.RawMessage, 408 len(src)) 409 for i, src := range src { 410 dst := &(*dst)[i] 411 var err error 412 *dst, err = __marshalComplexInlineFragmentsNestedStuffTopicChildrenContent( 413 &src) 414 if err != nil { 415 return nil, fmt.Errorf( 416 "Unable to marshal ComplexInlineFragmentsNestedStuffTopic.Children: %w", err) 417 } 418 } 419 } 420 return &retval, nil 421 } 422 423 // ComplexInlineFragmentsNestedStuffTopicChildrenArticle includes the requested fields of the GraphQL type Article. 424 type ComplexInlineFragmentsNestedStuffTopicChildrenArticle struct { 425 Typename string `json:"__typename"` 426 // ID is the identifier of the content. 427 Id testutil.ID `json:"id"` 428 Text string `json:"text"` 429 Parent ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic `json:"parent"` 430 } 431 432 // GetTypename returns ComplexInlineFragmentsNestedStuffTopicChildrenArticle.Typename, and is useful for accessing the field via an interface. 433 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) GetTypename() string { 434 return v.Typename 435 } 436 437 // GetId returns ComplexInlineFragmentsNestedStuffTopicChildrenArticle.Id, and is useful for accessing the field via an interface. 438 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) GetId() testutil.ID { return v.Id } 439 440 // GetText returns ComplexInlineFragmentsNestedStuffTopicChildrenArticle.Text, and is useful for accessing the field via an interface. 441 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) GetText() string { return v.Text } 442 443 // GetParent returns ComplexInlineFragmentsNestedStuffTopicChildrenArticle.Parent, and is useful for accessing the field via an interface. 444 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) GetParent() ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic { 445 return v.Parent 446 } 447 448 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic includes the requested fields of the GraphQL type Topic. 449 type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic struct { 450 Children []ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent `json:"-"` 451 } 452 453 // GetChildren returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic.Children, and is useful for accessing the field via an interface. 454 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic) GetChildren() []ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent { 455 return v.Children 456 } 457 458 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic) UnmarshalJSON(b []byte) error { 459 460 if string(b) == "null" { 461 return nil 462 } 463 464 var firstPass struct { 465 *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic 466 Children []json.RawMessage `json:"children"` 467 graphql.NoUnmarshalJSON 468 } 469 firstPass.ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic = v 470 471 err := json.Unmarshal(b, &firstPass) 472 if err != nil { 473 return err 474 } 475 476 { 477 dst := &v.Children 478 src := firstPass.Children 479 *dst = make( 480 []ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent, 481 len(src)) 482 for i, src := range src { 483 dst := &(*dst)[i] 484 if len(src) != 0 && string(src) != "null" { 485 err = __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent( 486 src, dst) 487 if err != nil { 488 return fmt.Errorf( 489 "Unable to unmarshal ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic.Children: %w", err) 490 } 491 } 492 } 493 } 494 return nil 495 } 496 497 type __premarshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic struct { 498 Children []json.RawMessage `json:"children"` 499 } 500 501 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic) MarshalJSON() ([]byte, error) { 502 premarshaled, err := v.__premarshalJSON() 503 if err != nil { 504 return nil, err 505 } 506 return json.Marshal(premarshaled) 507 } 508 509 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic) __premarshalJSON() (*__premarshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic, error) { 510 var retval __premarshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic 511 512 { 513 514 dst := &retval.Children 515 src := v.Children 516 *dst = make( 517 []json.RawMessage, 518 len(src)) 519 for i, src := range src { 520 dst := &(*dst)[i] 521 var err error 522 *dst, err = __marshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent( 523 &src) 524 if err != nil { 525 return nil, fmt.Errorf( 526 "Unable to marshal ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic.Children: %w", err) 527 } 528 } 529 } 530 return &retval, nil 531 } 532 533 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle includes the requested fields of the GraphQL type Article. 534 type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle struct { 535 Typename string `json:"__typename"` 536 // ID is the identifier of the content. 537 Id testutil.ID `json:"id"` 538 Name string `json:"name"` 539 } 540 541 // GetTypename returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle.Typename, and is useful for accessing the field via an interface. 542 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) GetTypename() string { 543 return v.Typename 544 } 545 546 // GetId returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle.Id, and is useful for accessing the field via an interface. 547 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) GetId() testutil.ID { 548 return v.Id 549 } 550 551 // GetName returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle.Name, and is useful for accessing the field via an interface. 552 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) GetName() string { 553 return v.Name 554 } 555 556 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent includes the requested fields of the GraphQL interface Content. 557 // 558 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent is implemented by the following types: 559 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle 560 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo 561 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic 562 // The GraphQL type's documentation follows. 563 // 564 // Content is implemented by various types like Article, Video, and Topic. 565 type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent interface { 566 implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() 567 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 568 GetTypename() string 569 // GetId returns the interface-field "id" from its implementation. 570 // The GraphQL interface field's documentation follows. 571 // 572 // ID is the identifier of the content. 573 GetId() testutil.ID 574 // GetName returns the interface-field "name" from its implementation. 575 GetName() string 576 GetContentArticle() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle, bool) 577 GetContentVideo() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo, bool) 578 GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic, bool) 579 } 580 581 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() { 582 } 583 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) GetContentArticle() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle, bool) { 584 return v, true 585 } 586 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) GetContentVideo() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo, bool) { 587 return nil, false 588 } 589 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic, bool) { 590 return nil, false 591 } 592 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() { 593 } 594 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) GetContentArticle() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle, bool) { 595 return nil, false 596 } 597 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) GetContentVideo() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo, bool) { 598 return v, true 599 } 600 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic, bool) { 601 return nil, false 602 } 603 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() { 604 } 605 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) GetContentArticle() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle, bool) { 606 return nil, false 607 } 608 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) GetContentVideo() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo, bool) { 609 return nil, false 610 } 611 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic, bool) { 612 return v, true 613 } 614 615 func __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent(b []byte, v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent) error { 616 if string(b) == "null" { 617 return nil 618 } 619 620 var tn struct { 621 TypeName string `json:"__typename"` 622 } 623 err := json.Unmarshal(b, &tn) 624 if err != nil { 625 return err 626 } 627 628 switch tn.TypeName { 629 case "Article": 630 *v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) 631 return json.Unmarshal(b, *v) 632 case "Video": 633 *v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) 634 return json.Unmarshal(b, *v) 635 case "Topic": 636 *v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) 637 return json.Unmarshal(b, *v) 638 case "": 639 return fmt.Errorf( 640 "response was missing Content.__typename") 641 default: 642 return fmt.Errorf( 643 `unexpected concrete type for ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent: "%v"`, tn.TypeName) 644 } 645 } 646 647 func __marshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent(v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent) ([]byte, error) { 648 649 var typename string 650 switch v := (*v).(type) { 651 case *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle: 652 typename = "Article" 653 654 result := struct { 655 TypeName string `json:"__typename"` 656 *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle 657 }{typename, v} 658 return json.Marshal(result) 659 case *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo: 660 typename = "Video" 661 662 result := struct { 663 TypeName string `json:"__typename"` 664 *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo 665 }{typename, v} 666 return json.Marshal(result) 667 case *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic: 668 typename = "Topic" 669 670 result := struct { 671 TypeName string `json:"__typename"` 672 *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic 673 }{typename, v} 674 return json.Marshal(result) 675 case nil: 676 return []byte("null"), nil 677 default: 678 return nil, fmt.Errorf( 679 `unexpected concrete type for ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent: "%T"`, v) 680 } 681 } 682 683 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic. 684 type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic struct { 685 Typename string `json:"__typename"` 686 // ID is the identifier of the content. 687 Id testutil.ID `json:"id"` 688 Name string `json:"name"` 689 } 690 691 // GetTypename returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic.Typename, and is useful for accessing the field via an interface. 692 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) GetTypename() string { 693 return v.Typename 694 } 695 696 // GetId returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic.Id, and is useful for accessing the field via an interface. 697 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) GetId() testutil.ID { 698 return v.Id 699 } 700 701 // GetName returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic.Name, and is useful for accessing the field via an interface. 702 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) GetName() string { 703 return v.Name 704 } 705 706 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo includes the requested fields of the GraphQL type Video. 707 type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo struct { 708 Typename string `json:"__typename"` 709 // ID is the identifier of the content. 710 Id testutil.ID `json:"id"` 711 Name string `json:"name"` 712 } 713 714 // GetTypename returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo.Typename, and is useful for accessing the field via an interface. 715 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) GetTypename() string { 716 return v.Typename 717 } 718 719 // GetId returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo.Id, and is useful for accessing the field via an interface. 720 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) GetId() testutil.ID { 721 return v.Id 722 } 723 724 // GetName returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo.Name, and is useful for accessing the field via an interface. 725 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) GetName() string { 726 return v.Name 727 } 728 729 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic includes the requested fields of the GraphQL type Topic. 730 type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic struct { 731 Name string `json:"name"` 732 Parent ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic `json:"parent"` 733 } 734 735 // GetName returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic.Name, and is useful for accessing the field via an interface. 736 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic) GetName() string { 737 return v.Name 738 } 739 740 // GetParent returns ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic.Parent, and is useful for accessing the field via an interface. 741 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic) GetParent() ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic { 742 return v.Parent 743 } 744 745 // ComplexInlineFragmentsNestedStuffTopicChildrenContent includes the requested fields of the GraphQL interface Content. 746 // 747 // ComplexInlineFragmentsNestedStuffTopicChildrenContent is implemented by the following types: 748 // ComplexInlineFragmentsNestedStuffTopicChildrenArticle 749 // ComplexInlineFragmentsNestedStuffTopicChildrenVideo 750 // ComplexInlineFragmentsNestedStuffTopicChildrenTopic 751 // The GraphQL type's documentation follows. 752 // 753 // Content is implemented by various types like Article, Video, and Topic. 754 type ComplexInlineFragmentsNestedStuffTopicChildrenContent interface { 755 implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() 756 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 757 GetTypename() string 758 // GetId returns the interface-field "id" from its implementation. 759 // The GraphQL interface field's documentation follows. 760 // 761 // ID is the identifier of the content. 762 GetId() testutil.ID 763 GetContentArticle() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticle, bool) 764 GetContentVideo() (*ComplexInlineFragmentsNestedStuffTopicChildrenVideo, bool) 765 GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopicChildrenTopic, bool) 766 } 767 768 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() { 769 } 770 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) GetContentArticle() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticle, bool) { 771 return v, true 772 } 773 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) GetContentVideo() (*ComplexInlineFragmentsNestedStuffTopicChildrenVideo, bool) { 774 return nil, false 775 } 776 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopicChildrenTopic, bool) { 777 return nil, false 778 } 779 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() { 780 } 781 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) GetContentArticle() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticle, bool) { 782 return nil, false 783 } 784 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) GetContentVideo() (*ComplexInlineFragmentsNestedStuffTopicChildrenVideo, bool) { 785 return v, true 786 } 787 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopicChildrenTopic, bool) { 788 return nil, false 789 } 790 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() { 791 } 792 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) GetContentArticle() (*ComplexInlineFragmentsNestedStuffTopicChildrenArticle, bool) { 793 return nil, false 794 } 795 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) GetContentVideo() (*ComplexInlineFragmentsNestedStuffTopicChildrenVideo, bool) { 796 return nil, false 797 } 798 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) GetContentTopic() (*ComplexInlineFragmentsNestedStuffTopicChildrenTopic, bool) { 799 return v, true 800 } 801 802 func __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenContent(b []byte, v *ComplexInlineFragmentsNestedStuffTopicChildrenContent) error { 803 if string(b) == "null" { 804 return nil 805 } 806 807 var tn struct { 808 TypeName string `json:"__typename"` 809 } 810 err := json.Unmarshal(b, &tn) 811 if err != nil { 812 return err 813 } 814 815 switch tn.TypeName { 816 case "Article": 817 *v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticle) 818 return json.Unmarshal(b, *v) 819 case "Video": 820 *v = new(ComplexInlineFragmentsNestedStuffTopicChildrenVideo) 821 return json.Unmarshal(b, *v) 822 case "Topic": 823 *v = new(ComplexInlineFragmentsNestedStuffTopicChildrenTopic) 824 return json.Unmarshal(b, *v) 825 case "": 826 return fmt.Errorf( 827 "response was missing Content.__typename") 828 default: 829 return fmt.Errorf( 830 `unexpected concrete type for ComplexInlineFragmentsNestedStuffTopicChildrenContent: "%v"`, tn.TypeName) 831 } 832 } 833 834 func __marshalComplexInlineFragmentsNestedStuffTopicChildrenContent(v *ComplexInlineFragmentsNestedStuffTopicChildrenContent) ([]byte, error) { 835 836 var typename string 837 switch v := (*v).(type) { 838 case *ComplexInlineFragmentsNestedStuffTopicChildrenArticle: 839 typename = "Article" 840 841 result := struct { 842 TypeName string `json:"__typename"` 843 *ComplexInlineFragmentsNestedStuffTopicChildrenArticle 844 }{typename, v} 845 return json.Marshal(result) 846 case *ComplexInlineFragmentsNestedStuffTopicChildrenVideo: 847 typename = "Video" 848 849 result := struct { 850 TypeName string `json:"__typename"` 851 *ComplexInlineFragmentsNestedStuffTopicChildrenVideo 852 }{typename, v} 853 return json.Marshal(result) 854 case *ComplexInlineFragmentsNestedStuffTopicChildrenTopic: 855 typename = "Topic" 856 857 result := struct { 858 TypeName string `json:"__typename"` 859 *ComplexInlineFragmentsNestedStuffTopicChildrenTopic 860 }{typename, v} 861 return json.Marshal(result) 862 case nil: 863 return []byte("null"), nil 864 default: 865 return nil, fmt.Errorf( 866 `unexpected concrete type for ComplexInlineFragmentsNestedStuffTopicChildrenContent: "%T"`, v) 867 } 868 } 869 870 // ComplexInlineFragmentsNestedStuffTopicChildrenTopic includes the requested fields of the GraphQL type Topic. 871 type ComplexInlineFragmentsNestedStuffTopicChildrenTopic struct { 872 Typename string `json:"__typename"` 873 // ID is the identifier of the content. 874 Id testutil.ID `json:"id"` 875 } 876 877 // GetTypename returns ComplexInlineFragmentsNestedStuffTopicChildrenTopic.Typename, and is useful for accessing the field via an interface. 878 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) GetTypename() string { return v.Typename } 879 880 // GetId returns ComplexInlineFragmentsNestedStuffTopicChildrenTopic.Id, and is useful for accessing the field via an interface. 881 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) GetId() testutil.ID { return v.Id } 882 883 // ComplexInlineFragmentsNestedStuffTopicChildrenVideo includes the requested fields of the GraphQL type Video. 884 type ComplexInlineFragmentsNestedStuffTopicChildrenVideo struct { 885 Typename string `json:"__typename"` 886 // ID is the identifier of the content. 887 Id testutil.ID `json:"id"` 888 } 889 890 // GetTypename returns ComplexInlineFragmentsNestedStuffTopicChildrenVideo.Typename, and is useful for accessing the field via an interface. 891 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) GetTypename() string { return v.Typename } 892 893 // GetId returns ComplexInlineFragmentsNestedStuffTopicChildrenVideo.Id, and is useful for accessing the field via an interface. 894 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) GetId() testutil.ID { return v.Id } 895 896 // ComplexInlineFragmentsNestedStuffVideo includes the requested fields of the GraphQL type Video. 897 type ComplexInlineFragmentsNestedStuffVideo struct { 898 Typename string `json:"__typename"` 899 } 900 901 // GetTypename returns ComplexInlineFragmentsNestedStuffVideo.Typename, and is useful for accessing the field via an interface. 902 func (v *ComplexInlineFragmentsNestedStuffVideo) GetTypename() string { return v.Typename } 903 904 // ComplexInlineFragmentsRandomItemArticle includes the requested fields of the GraphQL type Article. 905 type ComplexInlineFragmentsRandomItemArticle struct { 906 Typename string `json:"__typename"` 907 // ID is the identifier of the content. 908 Id testutil.ID `json:"id"` 909 Text string `json:"text"` 910 Name string `json:"name"` 911 } 912 913 // GetTypename returns ComplexInlineFragmentsRandomItemArticle.Typename, and is useful for accessing the field via an interface. 914 func (v *ComplexInlineFragmentsRandomItemArticle) GetTypename() string { return v.Typename } 915 916 // GetId returns ComplexInlineFragmentsRandomItemArticle.Id, and is useful for accessing the field via an interface. 917 func (v *ComplexInlineFragmentsRandomItemArticle) GetId() testutil.ID { return v.Id } 918 919 // GetText returns ComplexInlineFragmentsRandomItemArticle.Text, and is useful for accessing the field via an interface. 920 func (v *ComplexInlineFragmentsRandomItemArticle) GetText() string { return v.Text } 921 922 // GetName returns ComplexInlineFragmentsRandomItemArticle.Name, and is useful for accessing the field via an interface. 923 func (v *ComplexInlineFragmentsRandomItemArticle) GetName() string { return v.Name } 924 925 // ComplexInlineFragmentsRandomItemContent includes the requested fields of the GraphQL interface Content. 926 // 927 // ComplexInlineFragmentsRandomItemContent is implemented by the following types: 928 // ComplexInlineFragmentsRandomItemArticle 929 // ComplexInlineFragmentsRandomItemVideo 930 // ComplexInlineFragmentsRandomItemTopic 931 // The GraphQL type's documentation follows. 932 // 933 // Content is implemented by various types like Article, Video, and Topic. 934 type ComplexInlineFragmentsRandomItemContent interface { 935 implementsGraphQLInterfaceComplexInlineFragmentsRandomItemContent() 936 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 937 GetTypename() string 938 // GetId returns the interface-field "id" from its implementation. 939 // The GraphQL interface field's documentation follows. 940 // 941 // ID is the identifier of the content. 942 GetId() testutil.ID 943 // GetName returns the interface-field "name" from its implementation. 944 GetName() string 945 GetContentArticle() (*ComplexInlineFragmentsRandomItemArticle, bool) 946 GetContentVideo() (*ComplexInlineFragmentsRandomItemVideo, bool) 947 GetContentTopic() (*ComplexInlineFragmentsRandomItemTopic, bool) 948 } 949 950 func (v *ComplexInlineFragmentsRandomItemArticle) implementsGraphQLInterfaceComplexInlineFragmentsRandomItemContent() { 951 } 952 func (v *ComplexInlineFragmentsRandomItemArticle) GetContentArticle() (*ComplexInlineFragmentsRandomItemArticle, bool) { 953 return v, true 954 } 955 func (v *ComplexInlineFragmentsRandomItemArticle) GetContentVideo() (*ComplexInlineFragmentsRandomItemVideo, bool) { 956 return nil, false 957 } 958 func (v *ComplexInlineFragmentsRandomItemArticle) GetContentTopic() (*ComplexInlineFragmentsRandomItemTopic, bool) { 959 return nil, false 960 } 961 func (v *ComplexInlineFragmentsRandomItemVideo) implementsGraphQLInterfaceComplexInlineFragmentsRandomItemContent() { 962 } 963 func (v *ComplexInlineFragmentsRandomItemVideo) GetContentArticle() (*ComplexInlineFragmentsRandomItemArticle, bool) { 964 return nil, false 965 } 966 func (v *ComplexInlineFragmentsRandomItemVideo) GetContentVideo() (*ComplexInlineFragmentsRandomItemVideo, bool) { 967 return v, true 968 } 969 func (v *ComplexInlineFragmentsRandomItemVideo) GetContentTopic() (*ComplexInlineFragmentsRandomItemTopic, bool) { 970 return nil, false 971 } 972 func (v *ComplexInlineFragmentsRandomItemTopic) implementsGraphQLInterfaceComplexInlineFragmentsRandomItemContent() { 973 } 974 func (v *ComplexInlineFragmentsRandomItemTopic) GetContentArticle() (*ComplexInlineFragmentsRandomItemArticle, bool) { 975 return nil, false 976 } 977 func (v *ComplexInlineFragmentsRandomItemTopic) GetContentVideo() (*ComplexInlineFragmentsRandomItemVideo, bool) { 978 return nil, false 979 } 980 func (v *ComplexInlineFragmentsRandomItemTopic) GetContentTopic() (*ComplexInlineFragmentsRandomItemTopic, bool) { 981 return v, true 982 } 983 984 func __unmarshalComplexInlineFragmentsRandomItemContent(b []byte, v *ComplexInlineFragmentsRandomItemContent) error { 985 if string(b) == "null" { 986 return nil 987 } 988 989 var tn struct { 990 TypeName string `json:"__typename"` 991 } 992 err := json.Unmarshal(b, &tn) 993 if err != nil { 994 return err 995 } 996 997 switch tn.TypeName { 998 case "Article": 999 *v = new(ComplexInlineFragmentsRandomItemArticle) 1000 return json.Unmarshal(b, *v) 1001 case "Video": 1002 *v = new(ComplexInlineFragmentsRandomItemVideo) 1003 return json.Unmarshal(b, *v) 1004 case "Topic": 1005 *v = new(ComplexInlineFragmentsRandomItemTopic) 1006 return json.Unmarshal(b, *v) 1007 case "": 1008 return fmt.Errorf( 1009 "response was missing Content.__typename") 1010 default: 1011 return fmt.Errorf( 1012 `unexpected concrete type for ComplexInlineFragmentsRandomItemContent: "%v"`, tn.TypeName) 1013 } 1014 } 1015 1016 func __marshalComplexInlineFragmentsRandomItemContent(v *ComplexInlineFragmentsRandomItemContent) ([]byte, error) { 1017 1018 var typename string 1019 switch v := (*v).(type) { 1020 case *ComplexInlineFragmentsRandomItemArticle: 1021 typename = "Article" 1022 1023 result := struct { 1024 TypeName string `json:"__typename"` 1025 *ComplexInlineFragmentsRandomItemArticle 1026 }{typename, v} 1027 return json.Marshal(result) 1028 case *ComplexInlineFragmentsRandomItemVideo: 1029 typename = "Video" 1030 1031 result := struct { 1032 TypeName string `json:"__typename"` 1033 *ComplexInlineFragmentsRandomItemVideo 1034 }{typename, v} 1035 return json.Marshal(result) 1036 case *ComplexInlineFragmentsRandomItemTopic: 1037 typename = "Topic" 1038 1039 result := struct { 1040 TypeName string `json:"__typename"` 1041 *ComplexInlineFragmentsRandomItemTopic 1042 }{typename, v} 1043 return json.Marshal(result) 1044 case nil: 1045 return []byte("null"), nil 1046 default: 1047 return nil, fmt.Errorf( 1048 `unexpected concrete type for ComplexInlineFragmentsRandomItemContent: "%T"`, v) 1049 } 1050 } 1051 1052 // ComplexInlineFragmentsRandomItemTopic includes the requested fields of the GraphQL type Topic. 1053 type ComplexInlineFragmentsRandomItemTopic struct { 1054 Typename string `json:"__typename"` 1055 // ID is the identifier of the content. 1056 Id testutil.ID `json:"id"` 1057 Name string `json:"name"` 1058 } 1059 1060 // GetTypename returns ComplexInlineFragmentsRandomItemTopic.Typename, and is useful for accessing the field via an interface. 1061 func (v *ComplexInlineFragmentsRandomItemTopic) GetTypename() string { return v.Typename } 1062 1063 // GetId returns ComplexInlineFragmentsRandomItemTopic.Id, and is useful for accessing the field via an interface. 1064 func (v *ComplexInlineFragmentsRandomItemTopic) GetId() testutil.ID { return v.Id } 1065 1066 // GetName returns ComplexInlineFragmentsRandomItemTopic.Name, and is useful for accessing the field via an interface. 1067 func (v *ComplexInlineFragmentsRandomItemTopic) GetName() string { return v.Name } 1068 1069 // ComplexInlineFragmentsRandomItemVideo includes the requested fields of the GraphQL type Video. 1070 type ComplexInlineFragmentsRandomItemVideo struct { 1071 Typename string `json:"__typename"` 1072 // ID is the identifier of the content. 1073 Id testutil.ID `json:"id"` 1074 Name string `json:"name"` 1075 Duration int `json:"duration"` 1076 } 1077 1078 // GetTypename returns ComplexInlineFragmentsRandomItemVideo.Typename, and is useful for accessing the field via an interface. 1079 func (v *ComplexInlineFragmentsRandomItemVideo) GetTypename() string { return v.Typename } 1080 1081 // GetId returns ComplexInlineFragmentsRandomItemVideo.Id, and is useful for accessing the field via an interface. 1082 func (v *ComplexInlineFragmentsRandomItemVideo) GetId() testutil.ID { return v.Id } 1083 1084 // GetName returns ComplexInlineFragmentsRandomItemVideo.Name, and is useful for accessing the field via an interface. 1085 func (v *ComplexInlineFragmentsRandomItemVideo) GetName() string { return v.Name } 1086 1087 // GetDuration returns ComplexInlineFragmentsRandomItemVideo.Duration, and is useful for accessing the field via an interface. 1088 func (v *ComplexInlineFragmentsRandomItemVideo) GetDuration() int { return v.Duration } 1089 1090 // ComplexInlineFragmentsRepeatedStuffArticle includes the requested fields of the GraphQL type Article. 1091 type ComplexInlineFragmentsRepeatedStuffArticle struct { 1092 Typename string `json:"__typename"` 1093 // ID is the identifier of the content. 1094 Id testutil.ID `json:"id"` 1095 Url string `json:"url"` 1096 // ID is the identifier of the content. 1097 OtherId testutil.ID `json:"otherId"` 1098 Name string `json:"name"` 1099 Text string `json:"text"` 1100 OtherName string `json:"otherName"` 1101 } 1102 1103 // GetTypename returns ComplexInlineFragmentsRepeatedStuffArticle.Typename, and is useful for accessing the field via an interface. 1104 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetTypename() string { return v.Typename } 1105 1106 // GetId returns ComplexInlineFragmentsRepeatedStuffArticle.Id, and is useful for accessing the field via an interface. 1107 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetId() testutil.ID { return v.Id } 1108 1109 // GetUrl returns ComplexInlineFragmentsRepeatedStuffArticle.Url, and is useful for accessing the field via an interface. 1110 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetUrl() string { return v.Url } 1111 1112 // GetOtherId returns ComplexInlineFragmentsRepeatedStuffArticle.OtherId, and is useful for accessing the field via an interface. 1113 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetOtherId() testutil.ID { return v.OtherId } 1114 1115 // GetName returns ComplexInlineFragmentsRepeatedStuffArticle.Name, and is useful for accessing the field via an interface. 1116 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetName() string { return v.Name } 1117 1118 // GetText returns ComplexInlineFragmentsRepeatedStuffArticle.Text, and is useful for accessing the field via an interface. 1119 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetText() string { return v.Text } 1120 1121 // GetOtherName returns ComplexInlineFragmentsRepeatedStuffArticle.OtherName, and is useful for accessing the field via an interface. 1122 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetOtherName() string { return v.OtherName } 1123 1124 // ComplexInlineFragmentsRepeatedStuffContent includes the requested fields of the GraphQL interface Content. 1125 // 1126 // ComplexInlineFragmentsRepeatedStuffContent is implemented by the following types: 1127 // ComplexInlineFragmentsRepeatedStuffArticle 1128 // ComplexInlineFragmentsRepeatedStuffVideo 1129 // ComplexInlineFragmentsRepeatedStuffTopic 1130 // The GraphQL type's documentation follows. 1131 // 1132 // Content is implemented by various types like Article, Video, and Topic. 1133 type ComplexInlineFragmentsRepeatedStuffContent interface { 1134 implementsGraphQLInterfaceComplexInlineFragmentsRepeatedStuffContent() 1135 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 1136 GetTypename() string 1137 // GetId returns the interface-field "id" from its implementation. 1138 // The GraphQL interface field's documentation follows. 1139 // 1140 // ID is the identifier of the content. 1141 GetId() testutil.ID 1142 // GetUrl returns the interface-field "url" from its implementation. 1143 GetUrl() string 1144 // GetOtherId returns the interface-field "id" from its implementation. 1145 // The GraphQL interface field's documentation follows. 1146 // 1147 // ID is the identifier of the content. 1148 GetOtherId() testutil.ID 1149 // GetName returns the interface-field "name" from its implementation. 1150 GetName() string 1151 // GetOtherName returns the interface-field "name" from its implementation. 1152 GetOtherName() string 1153 GetContentArticle() (*ComplexInlineFragmentsRepeatedStuffArticle, bool) 1154 GetContentVideo() (*ComplexInlineFragmentsRepeatedStuffVideo, bool) 1155 GetContentTopic() (*ComplexInlineFragmentsRepeatedStuffTopic, bool) 1156 } 1157 1158 func (v *ComplexInlineFragmentsRepeatedStuffArticle) implementsGraphQLInterfaceComplexInlineFragmentsRepeatedStuffContent() { 1159 } 1160 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetContentArticle() (*ComplexInlineFragmentsRepeatedStuffArticle, bool) { 1161 return v, true 1162 } 1163 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetContentVideo() (*ComplexInlineFragmentsRepeatedStuffVideo, bool) { 1164 return nil, false 1165 } 1166 func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetContentTopic() (*ComplexInlineFragmentsRepeatedStuffTopic, bool) { 1167 return nil, false 1168 } 1169 func (v *ComplexInlineFragmentsRepeatedStuffVideo) implementsGraphQLInterfaceComplexInlineFragmentsRepeatedStuffContent() { 1170 } 1171 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetContentArticle() (*ComplexInlineFragmentsRepeatedStuffArticle, bool) { 1172 return nil, false 1173 } 1174 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetContentVideo() (*ComplexInlineFragmentsRepeatedStuffVideo, bool) { 1175 return v, true 1176 } 1177 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetContentTopic() (*ComplexInlineFragmentsRepeatedStuffTopic, bool) { 1178 return nil, false 1179 } 1180 func (v *ComplexInlineFragmentsRepeatedStuffTopic) implementsGraphQLInterfaceComplexInlineFragmentsRepeatedStuffContent() { 1181 } 1182 func (v *ComplexInlineFragmentsRepeatedStuffTopic) GetContentArticle() (*ComplexInlineFragmentsRepeatedStuffArticle, bool) { 1183 return nil, false 1184 } 1185 func (v *ComplexInlineFragmentsRepeatedStuffTopic) GetContentVideo() (*ComplexInlineFragmentsRepeatedStuffVideo, bool) { 1186 return nil, false 1187 } 1188 func (v *ComplexInlineFragmentsRepeatedStuffTopic) GetContentTopic() (*ComplexInlineFragmentsRepeatedStuffTopic, bool) { 1189 return v, true 1190 } 1191 1192 func __unmarshalComplexInlineFragmentsRepeatedStuffContent(b []byte, v *ComplexInlineFragmentsRepeatedStuffContent) error { 1193 if string(b) == "null" { 1194 return nil 1195 } 1196 1197 var tn struct { 1198 TypeName string `json:"__typename"` 1199 } 1200 err := json.Unmarshal(b, &tn) 1201 if err != nil { 1202 return err 1203 } 1204 1205 switch tn.TypeName { 1206 case "Article": 1207 *v = new(ComplexInlineFragmentsRepeatedStuffArticle) 1208 return json.Unmarshal(b, *v) 1209 case "Video": 1210 *v = new(ComplexInlineFragmentsRepeatedStuffVideo) 1211 return json.Unmarshal(b, *v) 1212 case "Topic": 1213 *v = new(ComplexInlineFragmentsRepeatedStuffTopic) 1214 return json.Unmarshal(b, *v) 1215 case "": 1216 return fmt.Errorf( 1217 "response was missing Content.__typename") 1218 default: 1219 return fmt.Errorf( 1220 `unexpected concrete type for ComplexInlineFragmentsRepeatedStuffContent: "%v"`, tn.TypeName) 1221 } 1222 } 1223 1224 func __marshalComplexInlineFragmentsRepeatedStuffContent(v *ComplexInlineFragmentsRepeatedStuffContent) ([]byte, error) { 1225 1226 var typename string 1227 switch v := (*v).(type) { 1228 case *ComplexInlineFragmentsRepeatedStuffArticle: 1229 typename = "Article" 1230 1231 result := struct { 1232 TypeName string `json:"__typename"` 1233 *ComplexInlineFragmentsRepeatedStuffArticle 1234 }{typename, v} 1235 return json.Marshal(result) 1236 case *ComplexInlineFragmentsRepeatedStuffVideo: 1237 typename = "Video" 1238 1239 result := struct { 1240 TypeName string `json:"__typename"` 1241 *ComplexInlineFragmentsRepeatedStuffVideo 1242 }{typename, v} 1243 return json.Marshal(result) 1244 case *ComplexInlineFragmentsRepeatedStuffTopic: 1245 typename = "Topic" 1246 1247 result := struct { 1248 TypeName string `json:"__typename"` 1249 *ComplexInlineFragmentsRepeatedStuffTopic 1250 }{typename, v} 1251 return json.Marshal(result) 1252 case nil: 1253 return []byte("null"), nil 1254 default: 1255 return nil, fmt.Errorf( 1256 `unexpected concrete type for ComplexInlineFragmentsRepeatedStuffContent: "%T"`, v) 1257 } 1258 } 1259 1260 // ComplexInlineFragmentsRepeatedStuffTopic includes the requested fields of the GraphQL type Topic. 1261 type ComplexInlineFragmentsRepeatedStuffTopic struct { 1262 Typename string `json:"__typename"` 1263 // ID is the identifier of the content. 1264 Id testutil.ID `json:"id"` 1265 Url string `json:"url"` 1266 // ID is the identifier of the content. 1267 OtherId testutil.ID `json:"otherId"` 1268 Name string `json:"name"` 1269 OtherName string `json:"otherName"` 1270 } 1271 1272 // GetTypename returns ComplexInlineFragmentsRepeatedStuffTopic.Typename, and is useful for accessing the field via an interface. 1273 func (v *ComplexInlineFragmentsRepeatedStuffTopic) GetTypename() string { return v.Typename } 1274 1275 // GetId returns ComplexInlineFragmentsRepeatedStuffTopic.Id, and is useful for accessing the field via an interface. 1276 func (v *ComplexInlineFragmentsRepeatedStuffTopic) GetId() testutil.ID { return v.Id } 1277 1278 // GetUrl returns ComplexInlineFragmentsRepeatedStuffTopic.Url, and is useful for accessing the field via an interface. 1279 func (v *ComplexInlineFragmentsRepeatedStuffTopic) GetUrl() string { return v.Url } 1280 1281 // GetOtherId returns ComplexInlineFragmentsRepeatedStuffTopic.OtherId, and is useful for accessing the field via an interface. 1282 func (v *ComplexInlineFragmentsRepeatedStuffTopic) GetOtherId() testutil.ID { return v.OtherId } 1283 1284 // GetName returns ComplexInlineFragmentsRepeatedStuffTopic.Name, and is useful for accessing the field via an interface. 1285 func (v *ComplexInlineFragmentsRepeatedStuffTopic) GetName() string { return v.Name } 1286 1287 // GetOtherName returns ComplexInlineFragmentsRepeatedStuffTopic.OtherName, and is useful for accessing the field via an interface. 1288 func (v *ComplexInlineFragmentsRepeatedStuffTopic) GetOtherName() string { return v.OtherName } 1289 1290 // ComplexInlineFragmentsRepeatedStuffVideo includes the requested fields of the GraphQL type Video. 1291 type ComplexInlineFragmentsRepeatedStuffVideo struct { 1292 Typename string `json:"__typename"` 1293 // ID is the identifier of the content. 1294 Id testutil.ID `json:"id"` 1295 Url string `json:"url"` 1296 // ID is the identifier of the content. 1297 OtherId testutil.ID `json:"otherId"` 1298 Name string `json:"name"` 1299 OtherName string `json:"otherName"` 1300 Duration int `json:"duration"` 1301 } 1302 1303 // GetTypename returns ComplexInlineFragmentsRepeatedStuffVideo.Typename, and is useful for accessing the field via an interface. 1304 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetTypename() string { return v.Typename } 1305 1306 // GetId returns ComplexInlineFragmentsRepeatedStuffVideo.Id, and is useful for accessing the field via an interface. 1307 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetId() testutil.ID { return v.Id } 1308 1309 // GetUrl returns ComplexInlineFragmentsRepeatedStuffVideo.Url, and is useful for accessing the field via an interface. 1310 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetUrl() string { return v.Url } 1311 1312 // GetOtherId returns ComplexInlineFragmentsRepeatedStuffVideo.OtherId, and is useful for accessing the field via an interface. 1313 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetOtherId() testutil.ID { return v.OtherId } 1314 1315 // GetName returns ComplexInlineFragmentsRepeatedStuffVideo.Name, and is useful for accessing the field via an interface. 1316 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetName() string { return v.Name } 1317 1318 // GetOtherName returns ComplexInlineFragmentsRepeatedStuffVideo.OtherName, and is useful for accessing the field via an interface. 1319 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetOtherName() string { return v.OtherName } 1320 1321 // GetDuration returns ComplexInlineFragmentsRepeatedStuffVideo.Duration, and is useful for accessing the field via an interface. 1322 func (v *ComplexInlineFragmentsRepeatedStuffVideo) GetDuration() int { return v.Duration } 1323 1324 // ComplexInlineFragmentsResponse is returned by ComplexInlineFragments on success. 1325 type ComplexInlineFragmentsResponse struct { 1326 Root ComplexInlineFragmentsRootTopic `json:"root"` 1327 RandomItem ComplexInlineFragmentsRandomItemContent `json:"-"` 1328 RepeatedStuff ComplexInlineFragmentsRepeatedStuffContent `json:"-"` 1329 ConflictingStuff ComplexInlineFragmentsConflictingStuffContent `json:"-"` 1330 NestedStuff ComplexInlineFragmentsNestedStuffContent `json:"-"` 1331 } 1332 1333 // GetRoot returns ComplexInlineFragmentsResponse.Root, and is useful for accessing the field via an interface. 1334 func (v *ComplexInlineFragmentsResponse) GetRoot() ComplexInlineFragmentsRootTopic { return v.Root } 1335 1336 // GetRandomItem returns ComplexInlineFragmentsResponse.RandomItem, and is useful for accessing the field via an interface. 1337 func (v *ComplexInlineFragmentsResponse) GetRandomItem() ComplexInlineFragmentsRandomItemContent { 1338 return v.RandomItem 1339 } 1340 1341 // GetRepeatedStuff returns ComplexInlineFragmentsResponse.RepeatedStuff, and is useful for accessing the field via an interface. 1342 func (v *ComplexInlineFragmentsResponse) GetRepeatedStuff() ComplexInlineFragmentsRepeatedStuffContent { 1343 return v.RepeatedStuff 1344 } 1345 1346 // GetConflictingStuff returns ComplexInlineFragmentsResponse.ConflictingStuff, and is useful for accessing the field via an interface. 1347 func (v *ComplexInlineFragmentsResponse) GetConflictingStuff() ComplexInlineFragmentsConflictingStuffContent { 1348 return v.ConflictingStuff 1349 } 1350 1351 // GetNestedStuff returns ComplexInlineFragmentsResponse.NestedStuff, and is useful for accessing the field via an interface. 1352 func (v *ComplexInlineFragmentsResponse) GetNestedStuff() ComplexInlineFragmentsNestedStuffContent { 1353 return v.NestedStuff 1354 } 1355 1356 func (v *ComplexInlineFragmentsResponse) UnmarshalJSON(b []byte) error { 1357 1358 if string(b) == "null" { 1359 return nil 1360 } 1361 1362 var firstPass struct { 1363 *ComplexInlineFragmentsResponse 1364 RandomItem json.RawMessage `json:"randomItem"` 1365 RepeatedStuff json.RawMessage `json:"repeatedStuff"` 1366 ConflictingStuff json.RawMessage `json:"conflictingStuff"` 1367 NestedStuff json.RawMessage `json:"nestedStuff"` 1368 graphql.NoUnmarshalJSON 1369 } 1370 firstPass.ComplexInlineFragmentsResponse = v 1371 1372 err := json.Unmarshal(b, &firstPass) 1373 if err != nil { 1374 return err 1375 } 1376 1377 { 1378 dst := &v.RandomItem 1379 src := firstPass.RandomItem 1380 if len(src) != 0 && string(src) != "null" { 1381 err = __unmarshalComplexInlineFragmentsRandomItemContent( 1382 src, dst) 1383 if err != nil { 1384 return fmt.Errorf( 1385 "Unable to unmarshal ComplexInlineFragmentsResponse.RandomItem: %w", err) 1386 } 1387 } 1388 } 1389 1390 { 1391 dst := &v.RepeatedStuff 1392 src := firstPass.RepeatedStuff 1393 if len(src) != 0 && string(src) != "null" { 1394 err = __unmarshalComplexInlineFragmentsRepeatedStuffContent( 1395 src, dst) 1396 if err != nil { 1397 return fmt.Errorf( 1398 "Unable to unmarshal ComplexInlineFragmentsResponse.RepeatedStuff: %w", err) 1399 } 1400 } 1401 } 1402 1403 { 1404 dst := &v.ConflictingStuff 1405 src := firstPass.ConflictingStuff 1406 if len(src) != 0 && string(src) != "null" { 1407 err = __unmarshalComplexInlineFragmentsConflictingStuffContent( 1408 src, dst) 1409 if err != nil { 1410 return fmt.Errorf( 1411 "Unable to unmarshal ComplexInlineFragmentsResponse.ConflictingStuff: %w", err) 1412 } 1413 } 1414 } 1415 1416 { 1417 dst := &v.NestedStuff 1418 src := firstPass.NestedStuff 1419 if len(src) != 0 && string(src) != "null" { 1420 err = __unmarshalComplexInlineFragmentsNestedStuffContent( 1421 src, dst) 1422 if err != nil { 1423 return fmt.Errorf( 1424 "Unable to unmarshal ComplexInlineFragmentsResponse.NestedStuff: %w", err) 1425 } 1426 } 1427 } 1428 return nil 1429 } 1430 1431 type __premarshalComplexInlineFragmentsResponse struct { 1432 Root ComplexInlineFragmentsRootTopic `json:"root"` 1433 1434 RandomItem json.RawMessage `json:"randomItem"` 1435 1436 RepeatedStuff json.RawMessage `json:"repeatedStuff"` 1437 1438 ConflictingStuff json.RawMessage `json:"conflictingStuff"` 1439 1440 NestedStuff json.RawMessage `json:"nestedStuff"` 1441 } 1442 1443 func (v *ComplexInlineFragmentsResponse) MarshalJSON() ([]byte, error) { 1444 premarshaled, err := v.__premarshalJSON() 1445 if err != nil { 1446 return nil, err 1447 } 1448 return json.Marshal(premarshaled) 1449 } 1450 1451 func (v *ComplexInlineFragmentsResponse) __premarshalJSON() (*__premarshalComplexInlineFragmentsResponse, error) { 1452 var retval __premarshalComplexInlineFragmentsResponse 1453 1454 retval.Root = v.Root 1455 { 1456 1457 dst := &retval.RandomItem 1458 src := v.RandomItem 1459 var err error 1460 *dst, err = __marshalComplexInlineFragmentsRandomItemContent( 1461 &src) 1462 if err != nil { 1463 return nil, fmt.Errorf( 1464 "Unable to marshal ComplexInlineFragmentsResponse.RandomItem: %w", err) 1465 } 1466 } 1467 { 1468 1469 dst := &retval.RepeatedStuff 1470 src := v.RepeatedStuff 1471 var err error 1472 *dst, err = __marshalComplexInlineFragmentsRepeatedStuffContent( 1473 &src) 1474 if err != nil { 1475 return nil, fmt.Errorf( 1476 "Unable to marshal ComplexInlineFragmentsResponse.RepeatedStuff: %w", err) 1477 } 1478 } 1479 { 1480 1481 dst := &retval.ConflictingStuff 1482 src := v.ConflictingStuff 1483 var err error 1484 *dst, err = __marshalComplexInlineFragmentsConflictingStuffContent( 1485 &src) 1486 if err != nil { 1487 return nil, fmt.Errorf( 1488 "Unable to marshal ComplexInlineFragmentsResponse.ConflictingStuff: %w", err) 1489 } 1490 } 1491 { 1492 1493 dst := &retval.NestedStuff 1494 src := v.NestedStuff 1495 var err error 1496 *dst, err = __marshalComplexInlineFragmentsNestedStuffContent( 1497 &src) 1498 if err != nil { 1499 return nil, fmt.Errorf( 1500 "Unable to marshal ComplexInlineFragmentsResponse.NestedStuff: %w", err) 1501 } 1502 } 1503 return &retval, nil 1504 } 1505 1506 // ComplexInlineFragmentsRootTopic includes the requested fields of the GraphQL type Topic. 1507 type ComplexInlineFragmentsRootTopic struct { 1508 // ID is documented in the Content interface. 1509 Id testutil.ID `json:"id"` 1510 SchoolGrade string `json:"schoolGrade"` 1511 Name string `json:"name"` 1512 } 1513 1514 // GetId returns ComplexInlineFragmentsRootTopic.Id, and is useful for accessing the field via an interface. 1515 func (v *ComplexInlineFragmentsRootTopic) GetId() testutil.ID { return v.Id } 1516 1517 // GetSchoolGrade returns ComplexInlineFragmentsRootTopic.SchoolGrade, and is useful for accessing the field via an interface. 1518 func (v *ComplexInlineFragmentsRootTopic) GetSchoolGrade() string { return v.SchoolGrade } 1519 1520 // GetName returns ComplexInlineFragmentsRootTopic.Name, and is useful for accessing the field via an interface. 1521 func (v *ComplexInlineFragmentsRootTopic) GetName() string { return v.Name } 1522 1523 // We test all the spread cases from docs/DESIGN.md, see there for more context 1524 // on each, as well as various other nonsense. But for abstract-in-abstract 1525 // spreads, we can't test cases (4b) and (4c), where I implements J or vice 1526 // versa, because gqlparser doesn't support interfaces that implement other 1527 // interfaces yet. 1528 func ComplexInlineFragments( 1529 client graphql.Client, 1530 ) (*ComplexInlineFragmentsResponse, error) { 1531 req := &graphql.Request{ 1532 OpName: "ComplexInlineFragments", 1533 Query: ` 1534 query ComplexInlineFragments { 1535 root { 1536 id 1537 ... on Topic { 1538 schoolGrade 1539 } 1540 ... on Content { 1541 name 1542 } 1543 } 1544 randomItem { 1545 __typename 1546 id 1547 ... on Article { 1548 text 1549 } 1550 ... on Content { 1551 name 1552 } 1553 ... on HasDuration { 1554 duration 1555 } 1556 } 1557 repeatedStuff: randomItem { 1558 __typename 1559 id 1560 id 1561 url 1562 otherId: id 1563 ... on Article { 1564 name 1565 text 1566 otherName: name 1567 } 1568 ... on Content { 1569 id 1570 name 1571 otherName: name 1572 } 1573 ... on HasDuration { 1574 duration 1575 } 1576 } 1577 conflictingStuff: randomItem { 1578 __typename 1579 ... on Article { 1580 thumbnail { 1581 id 1582 thumbnailUrl 1583 } 1584 } 1585 ... on Video { 1586 thumbnail { 1587 id 1588 timestampSec 1589 } 1590 } 1591 } 1592 nestedStuff: randomItem { 1593 __typename 1594 ... on Topic { 1595 children { 1596 __typename 1597 id 1598 ... on Article { 1599 text 1600 parent { 1601 ... on Content { 1602 name 1603 parent { 1604 ... on Topic { 1605 children { 1606 __typename 1607 id 1608 name 1609 } 1610 } 1611 } 1612 } 1613 } 1614 } 1615 } 1616 } 1617 } 1618 } 1619 `, 1620 } 1621 var err error 1622 1623 var data ComplexInlineFragmentsResponse 1624 resp := &graphql.Response{Data: &data} 1625 1626 err = client.MakeRequest( 1627 nil, 1628 req, 1629 resp, 1630 ) 1631 1632 return &data, err 1633 } 1634