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