github.com/nathanstitt/genqlient@v0.3.1-0.20211028004951-a2bda3c41ab8/internal/integration/generated.go (about) 1 package integration 2 3 // Code generated by github.com/Khan/genqlient, DO NOT EDIT. 4 5 import ( 6 "context" 7 "encoding/json" 8 "fmt" 9 "time" 10 11 "github.com/Khan/genqlient/graphql" 12 "github.com/Khan/genqlient/internal/testutil" 13 ) 14 15 // AnimalFields includes the GraphQL fields of Animal requested by the fragment AnimalFields. 16 type AnimalFields struct { 17 Id string `json:"id"` 18 Hair AnimalFieldsHairBeingsHair `json:"hair"` 19 Owner AnimalFieldsOwnerBeing `json:"-"` 20 } 21 22 // GetId returns AnimalFields.Id, and is useful for accessing the field via an interface. 23 func (v *AnimalFields) GetId() string { return v.Id } 24 25 // GetHair returns AnimalFields.Hair, and is useful for accessing the field via an interface. 26 func (v *AnimalFields) GetHair() AnimalFieldsHairBeingsHair { return v.Hair } 27 28 // GetOwner returns AnimalFields.Owner, and is useful for accessing the field via an interface. 29 func (v *AnimalFields) GetOwner() AnimalFieldsOwnerBeing { return v.Owner } 30 31 func (v *AnimalFields) UnmarshalJSON(b []byte) error { 32 33 if string(b) == "null" { 34 return nil 35 } 36 37 var firstPass struct { 38 *AnimalFields 39 Owner json.RawMessage `json:"owner"` 40 graphql.NoUnmarshalJSON 41 } 42 firstPass.AnimalFields = v 43 44 err := json.Unmarshal(b, &firstPass) 45 if err != nil { 46 return err 47 } 48 49 { 50 dst := &v.Owner 51 src := firstPass.Owner 52 if len(src) != 0 && string(src) != "null" { 53 err = __unmarshalAnimalFieldsOwnerBeing( 54 src, dst) 55 if err != nil { 56 return fmt.Errorf( 57 "Unable to unmarshal AnimalFields.Owner: %w", err) 58 } 59 } 60 } 61 return nil 62 } 63 64 type __premarshalAnimalFields struct { 65 Id string `json:"id"` 66 67 Hair AnimalFieldsHairBeingsHair `json:"hair"` 68 69 Owner json.RawMessage `json:"owner"` 70 } 71 72 func (v *AnimalFields) MarshalJSON() ([]byte, error) { 73 premarshaled, err := v.__premarshalJSON() 74 if err != nil { 75 return nil, err 76 } 77 return json.Marshal(premarshaled) 78 } 79 80 func (v *AnimalFields) __premarshalJSON() (*__premarshalAnimalFields, error) { 81 var retval __premarshalAnimalFields 82 83 retval.Id = v.Id 84 retval.Hair = v.Hair 85 { 86 87 dst := &retval.Owner 88 src := v.Owner 89 var err error 90 *dst, err = __marshalAnimalFieldsOwnerBeing( 91 &src) 92 if err != nil { 93 return nil, fmt.Errorf( 94 "Unable to marshal AnimalFields.Owner: %w", err) 95 } 96 } 97 return &retval, nil 98 } 99 100 // AnimalFieldsHairBeingsHair includes the requested fields of the GraphQL type BeingsHair. 101 type AnimalFieldsHairBeingsHair struct { 102 HasHair bool `json:"hasHair"` 103 } 104 105 // GetHasHair returns AnimalFieldsHairBeingsHair.HasHair, and is useful for accessing the field via an interface. 106 func (v *AnimalFieldsHairBeingsHair) GetHasHair() bool { return v.HasHair } 107 108 // AnimalFieldsOwnerAnimal includes the requested fields of the GraphQL type Animal. 109 type AnimalFieldsOwnerAnimal struct { 110 Typename string `json:"__typename"` 111 Id string `json:"id"` 112 } 113 114 // GetTypename returns AnimalFieldsOwnerAnimal.Typename, and is useful for accessing the field via an interface. 115 func (v *AnimalFieldsOwnerAnimal) GetTypename() string { return v.Typename } 116 117 // GetId returns AnimalFieldsOwnerAnimal.Id, and is useful for accessing the field via an interface. 118 func (v *AnimalFieldsOwnerAnimal) GetId() string { return v.Id } 119 120 // AnimalFieldsOwnerBeing includes the requested fields of the GraphQL interface Being. 121 // 122 // AnimalFieldsOwnerBeing is implemented by the following types: 123 // AnimalFieldsOwnerUser 124 // AnimalFieldsOwnerAnimal 125 type AnimalFieldsOwnerBeing interface { 126 implementsGraphQLInterfaceAnimalFieldsOwnerBeing() 127 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 128 GetTypename() string 129 // GetId returns the interface-field "id" from its implementation. 130 GetId() string 131 } 132 133 func (v *AnimalFieldsOwnerUser) implementsGraphQLInterfaceAnimalFieldsOwnerBeing() {} 134 func (v *AnimalFieldsOwnerAnimal) implementsGraphQLInterfaceAnimalFieldsOwnerBeing() {} 135 136 func __unmarshalAnimalFieldsOwnerBeing(b []byte, v *AnimalFieldsOwnerBeing) error { 137 if string(b) == "null" { 138 return nil 139 } 140 141 var tn struct { 142 TypeName string `json:"__typename"` 143 } 144 err := json.Unmarshal(b, &tn) 145 if err != nil { 146 return err 147 } 148 149 switch tn.TypeName { 150 case "User": 151 *v = new(AnimalFieldsOwnerUser) 152 return json.Unmarshal(b, *v) 153 case "Animal": 154 *v = new(AnimalFieldsOwnerAnimal) 155 return json.Unmarshal(b, *v) 156 case "": 157 return fmt.Errorf( 158 "Response was missing Being.__typename") 159 default: 160 return fmt.Errorf( 161 `Unexpected concrete type for AnimalFieldsOwnerBeing: "%v"`, tn.TypeName) 162 } 163 } 164 165 func __marshalAnimalFieldsOwnerBeing(v *AnimalFieldsOwnerBeing) ([]byte, error) { 166 167 var typename string 168 switch v := (*v).(type) { 169 case *AnimalFieldsOwnerUser: 170 typename = "User" 171 172 premarshaled, err := v.__premarshalJSON() 173 if err != nil { 174 return nil, err 175 } 176 result := struct { 177 TypeName string `json:"__typename"` 178 *__premarshalAnimalFieldsOwnerUser 179 }{typename, premarshaled} 180 return json.Marshal(result) 181 case *AnimalFieldsOwnerAnimal: 182 typename = "Animal" 183 184 result := struct { 185 TypeName string `json:"__typename"` 186 *AnimalFieldsOwnerAnimal 187 }{typename, v} 188 return json.Marshal(result) 189 case nil: 190 return []byte("null"), nil 191 default: 192 return nil, fmt.Errorf( 193 `Unexpected concrete type for AnimalFieldsOwnerBeing: "%T"`, v) 194 } 195 } 196 197 // AnimalFieldsOwnerUser includes the requested fields of the GraphQL type User. 198 type AnimalFieldsOwnerUser struct { 199 Typename string `json:"__typename"` 200 Id string `json:"id"` 201 UserFields `json:"-"` 202 LuckyFieldsUser `json:"-"` 203 } 204 205 // GetTypename returns AnimalFieldsOwnerUser.Typename, and is useful for accessing the field via an interface. 206 func (v *AnimalFieldsOwnerUser) GetTypename() string { return v.Typename } 207 208 // GetId returns AnimalFieldsOwnerUser.Id, and is useful for accessing the field via an interface. 209 func (v *AnimalFieldsOwnerUser) GetId() string { return v.Id } 210 211 // GetLuckyNumber returns AnimalFieldsOwnerUser.LuckyNumber, and is useful for accessing the field via an interface. 212 func (v *AnimalFieldsOwnerUser) GetLuckyNumber() int { return v.LuckyFieldsUser.LuckyNumber } 213 214 // GetHair returns AnimalFieldsOwnerUser.Hair, and is useful for accessing the field via an interface. 215 func (v *AnimalFieldsOwnerUser) GetHair() MoreUserFieldsHair { return v.UserFields.MoreUserFields.Hair } 216 217 func (v *AnimalFieldsOwnerUser) UnmarshalJSON(b []byte) error { 218 219 if string(b) == "null" { 220 return nil 221 } 222 223 var firstPass struct { 224 *AnimalFieldsOwnerUser 225 graphql.NoUnmarshalJSON 226 } 227 firstPass.AnimalFieldsOwnerUser = v 228 229 err := json.Unmarshal(b, &firstPass) 230 if err != nil { 231 return err 232 } 233 234 err = json.Unmarshal( 235 b, &v.UserFields) 236 if err != nil { 237 return err 238 } 239 err = json.Unmarshal( 240 b, &v.LuckyFieldsUser) 241 if err != nil { 242 return err 243 } 244 return nil 245 } 246 247 type __premarshalAnimalFieldsOwnerUser struct { 248 Typename string `json:"__typename"` 249 250 Id string `json:"id"` 251 252 LuckyNumber int `json:"luckyNumber"` 253 254 Hair MoreUserFieldsHair `json:"hair"` 255 } 256 257 func (v *AnimalFieldsOwnerUser) MarshalJSON() ([]byte, error) { 258 premarshaled, err := v.__premarshalJSON() 259 if err != nil { 260 return nil, err 261 } 262 return json.Marshal(premarshaled) 263 } 264 265 func (v *AnimalFieldsOwnerUser) __premarshalJSON() (*__premarshalAnimalFieldsOwnerUser, error) { 266 var retval __premarshalAnimalFieldsOwnerUser 267 268 retval.Typename = v.Typename 269 retval.Id = v.Id 270 retval.LuckyNumber = v.LuckyFieldsUser.LuckyNumber 271 retval.Hair = v.UserFields.MoreUserFields.Hair 272 return &retval, nil 273 } 274 275 // FriendsFields includes the GraphQL fields of User requested by the fragment FriendsFields. 276 type FriendsFields struct { 277 Id string `json:"id"` 278 Name string `json:"name"` 279 } 280 281 // GetId returns FriendsFields.Id, and is useful for accessing the field via an interface. 282 func (v *FriendsFields) GetId() string { return v.Id } 283 284 // GetName returns FriendsFields.Name, and is useful for accessing the field via an interface. 285 func (v *FriendsFields) GetName() string { return v.Name } 286 287 // InnerBeingFields includes the GraphQL fields of Being requested by the fragment InnerBeingFields. 288 // 289 // InnerBeingFields is implemented by the following types: 290 // InnerBeingFieldsUser 291 // InnerBeingFieldsAnimal 292 type InnerBeingFields interface { 293 implementsGraphQLInterfaceInnerBeingFields() 294 // GetId returns the interface-field "id" from its implementation. 295 GetId() string 296 // GetName returns the interface-field "name" from its implementation. 297 GetName() string 298 } 299 300 func (v *InnerBeingFieldsUser) implementsGraphQLInterfaceInnerBeingFields() {} 301 func (v *InnerBeingFieldsAnimal) implementsGraphQLInterfaceInnerBeingFields() {} 302 303 func __unmarshalInnerBeingFields(b []byte, v *InnerBeingFields) error { 304 if string(b) == "null" { 305 return nil 306 } 307 308 var tn struct { 309 TypeName string `json:"__typename"` 310 } 311 err := json.Unmarshal(b, &tn) 312 if err != nil { 313 return err 314 } 315 316 switch tn.TypeName { 317 case "User": 318 *v = new(InnerBeingFieldsUser) 319 return json.Unmarshal(b, *v) 320 case "Animal": 321 *v = new(InnerBeingFieldsAnimal) 322 return json.Unmarshal(b, *v) 323 case "": 324 return fmt.Errorf( 325 "Response was missing Being.__typename") 326 default: 327 return fmt.Errorf( 328 `Unexpected concrete type for InnerBeingFields: "%v"`, tn.TypeName) 329 } 330 } 331 332 func __marshalInnerBeingFields(v *InnerBeingFields) ([]byte, error) { 333 334 var typename string 335 switch v := (*v).(type) { 336 case *InnerBeingFieldsUser: 337 typename = "User" 338 339 result := struct { 340 TypeName string `json:"__typename"` 341 *InnerBeingFieldsUser 342 }{typename, v} 343 return json.Marshal(result) 344 case *InnerBeingFieldsAnimal: 345 typename = "Animal" 346 347 result := struct { 348 TypeName string `json:"__typename"` 349 *InnerBeingFieldsAnimal 350 }{typename, v} 351 return json.Marshal(result) 352 case nil: 353 return []byte("null"), nil 354 default: 355 return nil, fmt.Errorf( 356 `Unexpected concrete type for InnerBeingFields: "%T"`, v) 357 } 358 } 359 360 // InnerBeingFields includes the GraphQL fields of Animal requested by the fragment InnerBeingFields. 361 type InnerBeingFieldsAnimal struct { 362 Id string `json:"id"` 363 Name string `json:"name"` 364 } 365 366 // GetId returns InnerBeingFieldsAnimal.Id, and is useful for accessing the field via an interface. 367 func (v *InnerBeingFieldsAnimal) GetId() string { return v.Id } 368 369 // GetName returns InnerBeingFieldsAnimal.Name, and is useful for accessing the field via an interface. 370 func (v *InnerBeingFieldsAnimal) GetName() string { return v.Name } 371 372 // InnerBeingFields includes the GraphQL fields of User requested by the fragment InnerBeingFields. 373 type InnerBeingFieldsUser struct { 374 Id string `json:"id"` 375 Name string `json:"name"` 376 Friends []FriendsFields `json:"friends"` 377 } 378 379 // GetId returns InnerBeingFieldsUser.Id, and is useful for accessing the field via an interface. 380 func (v *InnerBeingFieldsUser) GetId() string { return v.Id } 381 382 // GetName returns InnerBeingFieldsUser.Name, and is useful for accessing the field via an interface. 383 func (v *InnerBeingFieldsUser) GetName() string { return v.Name } 384 385 // GetFriends returns InnerBeingFieldsUser.Friends, and is useful for accessing the field via an interface. 386 func (v *InnerBeingFieldsUser) GetFriends() []FriendsFields { return v.Friends } 387 388 // InnerLuckyFields includes the GraphQL fields of Lucky requested by the fragment InnerLuckyFields. 389 // 390 // InnerLuckyFields is implemented by the following types: 391 // InnerLuckyFieldsUser 392 type InnerLuckyFields interface { 393 implementsGraphQLInterfaceInnerLuckyFields() 394 // GetLuckyNumber returns the interface-field "luckyNumber" from its implementation. 395 GetLuckyNumber() int 396 } 397 398 func (v *InnerLuckyFieldsUser) implementsGraphQLInterfaceInnerLuckyFields() {} 399 400 func __unmarshalInnerLuckyFields(b []byte, v *InnerLuckyFields) error { 401 if string(b) == "null" { 402 return nil 403 } 404 405 var tn struct { 406 TypeName string `json:"__typename"` 407 } 408 err := json.Unmarshal(b, &tn) 409 if err != nil { 410 return err 411 } 412 413 switch tn.TypeName { 414 case "User": 415 *v = new(InnerLuckyFieldsUser) 416 return json.Unmarshal(b, *v) 417 case "": 418 return fmt.Errorf( 419 "Response was missing Lucky.__typename") 420 default: 421 return fmt.Errorf( 422 `Unexpected concrete type for InnerLuckyFields: "%v"`, tn.TypeName) 423 } 424 } 425 426 func __marshalInnerLuckyFields(v *InnerLuckyFields) ([]byte, error) { 427 428 var typename string 429 switch v := (*v).(type) { 430 case *InnerLuckyFieldsUser: 431 typename = "User" 432 433 result := struct { 434 TypeName string `json:"__typename"` 435 *InnerLuckyFieldsUser 436 }{typename, v} 437 return json.Marshal(result) 438 case nil: 439 return []byte("null"), nil 440 default: 441 return nil, fmt.Errorf( 442 `Unexpected concrete type for InnerLuckyFields: "%T"`, v) 443 } 444 } 445 446 // InnerLuckyFields includes the GraphQL fields of User requested by the fragment InnerLuckyFields. 447 type InnerLuckyFieldsUser struct { 448 LuckyNumber int `json:"luckyNumber"` 449 } 450 451 // GetLuckyNumber returns InnerLuckyFieldsUser.LuckyNumber, and is useful for accessing the field via an interface. 452 func (v *InnerLuckyFieldsUser) GetLuckyNumber() int { return v.LuckyNumber } 453 454 // LuckyFields includes the GraphQL fields of Lucky requested by the fragment LuckyFields. 455 // 456 // LuckyFields is implemented by the following types: 457 // LuckyFieldsUser 458 type LuckyFields interface { 459 implementsGraphQLInterfaceLuckyFields() 460 // GetLuckyNumber returns the interface-field "luckyNumber" from its implementation. 461 GetLuckyNumber() int 462 } 463 464 func (v *LuckyFieldsUser) implementsGraphQLInterfaceLuckyFields() {} 465 466 func __unmarshalLuckyFields(b []byte, v *LuckyFields) error { 467 if string(b) == "null" { 468 return nil 469 } 470 471 var tn struct { 472 TypeName string `json:"__typename"` 473 } 474 err := json.Unmarshal(b, &tn) 475 if err != nil { 476 return err 477 } 478 479 switch tn.TypeName { 480 case "User": 481 *v = new(LuckyFieldsUser) 482 return json.Unmarshal(b, *v) 483 case "": 484 return fmt.Errorf( 485 "Response was missing Lucky.__typename") 486 default: 487 return fmt.Errorf( 488 `Unexpected concrete type for LuckyFields: "%v"`, tn.TypeName) 489 } 490 } 491 492 func __marshalLuckyFields(v *LuckyFields) ([]byte, error) { 493 494 var typename string 495 switch v := (*v).(type) { 496 case *LuckyFieldsUser: 497 typename = "User" 498 499 premarshaled, err := v.__premarshalJSON() 500 if err != nil { 501 return nil, err 502 } 503 result := struct { 504 TypeName string `json:"__typename"` 505 *__premarshalLuckyFieldsUser 506 }{typename, premarshaled} 507 return json.Marshal(result) 508 case nil: 509 return []byte("null"), nil 510 default: 511 return nil, fmt.Errorf( 512 `Unexpected concrete type for LuckyFields: "%T"`, v) 513 } 514 } 515 516 // LuckyFields includes the GraphQL fields of User requested by the fragment LuckyFields. 517 type LuckyFieldsUser struct { 518 MoreUserFields `json:"-"` 519 LuckyNumber int `json:"luckyNumber"` 520 } 521 522 // GetLuckyNumber returns LuckyFieldsUser.LuckyNumber, and is useful for accessing the field via an interface. 523 func (v *LuckyFieldsUser) GetLuckyNumber() int { return v.LuckyNumber } 524 525 // GetId returns LuckyFieldsUser.Id, and is useful for accessing the field via an interface. 526 func (v *LuckyFieldsUser) GetId() string { return v.MoreUserFields.Id } 527 528 // GetHair returns LuckyFieldsUser.Hair, and is useful for accessing the field via an interface. 529 func (v *LuckyFieldsUser) GetHair() MoreUserFieldsHair { return v.MoreUserFields.Hair } 530 531 func (v *LuckyFieldsUser) UnmarshalJSON(b []byte) error { 532 533 if string(b) == "null" { 534 return nil 535 } 536 537 var firstPass struct { 538 *LuckyFieldsUser 539 graphql.NoUnmarshalJSON 540 } 541 firstPass.LuckyFieldsUser = v 542 543 err := json.Unmarshal(b, &firstPass) 544 if err != nil { 545 return err 546 } 547 548 err = json.Unmarshal( 549 b, &v.MoreUserFields) 550 if err != nil { 551 return err 552 } 553 return nil 554 } 555 556 type __premarshalLuckyFieldsUser struct { 557 LuckyNumber int `json:"luckyNumber"` 558 559 Id string `json:"id"` 560 561 Hair MoreUserFieldsHair `json:"hair"` 562 } 563 564 func (v *LuckyFieldsUser) MarshalJSON() ([]byte, error) { 565 premarshaled, err := v.__premarshalJSON() 566 if err != nil { 567 return nil, err 568 } 569 return json.Marshal(premarshaled) 570 } 571 572 func (v *LuckyFieldsUser) __premarshalJSON() (*__premarshalLuckyFieldsUser, error) { 573 var retval __premarshalLuckyFieldsUser 574 575 retval.LuckyNumber = v.LuckyNumber 576 retval.Id = v.MoreUserFields.Id 577 retval.Hair = v.MoreUserFields.Hair 578 return &retval, nil 579 } 580 581 // MoreUserFields includes the GraphQL fields of User requested by the fragment MoreUserFields. 582 type MoreUserFields struct { 583 Id string `json:"id"` 584 Hair MoreUserFieldsHair `json:"hair"` 585 } 586 587 // GetId returns MoreUserFields.Id, and is useful for accessing the field via an interface. 588 func (v *MoreUserFields) GetId() string { return v.Id } 589 590 // GetHair returns MoreUserFields.Hair, and is useful for accessing the field via an interface. 591 func (v *MoreUserFields) GetHair() MoreUserFieldsHair { return v.Hair } 592 593 // MoreUserFieldsHair includes the requested fields of the GraphQL type Hair. 594 type MoreUserFieldsHair struct { 595 Color string `json:"color"` 596 } 597 598 // GetColor returns MoreUserFieldsHair.Color, and is useful for accessing the field via an interface. 599 func (v *MoreUserFieldsHair) GetColor() string { return v.Color } 600 601 // QueryFragment includes the GraphQL fields of Query requested by the fragment QueryFragment. 602 type QueryFragment struct { 603 Beings []QueryFragmentBeingsBeing `json:"-"` 604 } 605 606 // GetBeings returns QueryFragment.Beings, and is useful for accessing the field via an interface. 607 func (v *QueryFragment) GetBeings() []QueryFragmentBeingsBeing { return v.Beings } 608 609 func (v *QueryFragment) UnmarshalJSON(b []byte) error { 610 611 if string(b) == "null" { 612 return nil 613 } 614 615 var firstPass struct { 616 *QueryFragment 617 Beings []json.RawMessage `json:"beings"` 618 graphql.NoUnmarshalJSON 619 } 620 firstPass.QueryFragment = v 621 622 err := json.Unmarshal(b, &firstPass) 623 if err != nil { 624 return err 625 } 626 627 { 628 dst := &v.Beings 629 src := firstPass.Beings 630 *dst = make( 631 []QueryFragmentBeingsBeing, 632 len(src)) 633 for i, src := range src { 634 dst := &(*dst)[i] 635 if len(src) != 0 && string(src) != "null" { 636 err = __unmarshalQueryFragmentBeingsBeing( 637 src, dst) 638 if err != nil { 639 return fmt.Errorf( 640 "Unable to unmarshal QueryFragment.Beings: %w", err) 641 } 642 } 643 } 644 } 645 return nil 646 } 647 648 type __premarshalQueryFragment struct { 649 Beings []json.RawMessage `json:"beings"` 650 } 651 652 func (v *QueryFragment) MarshalJSON() ([]byte, error) { 653 premarshaled, err := v.__premarshalJSON() 654 if err != nil { 655 return nil, err 656 } 657 return json.Marshal(premarshaled) 658 } 659 660 func (v *QueryFragment) __premarshalJSON() (*__premarshalQueryFragment, error) { 661 var retval __premarshalQueryFragment 662 663 { 664 665 dst := &retval.Beings 666 src := v.Beings 667 *dst = make( 668 []json.RawMessage, 669 len(src)) 670 for i, src := range src { 671 dst := &(*dst)[i] 672 var err error 673 *dst, err = __marshalQueryFragmentBeingsBeing( 674 &src) 675 if err != nil { 676 return nil, fmt.Errorf( 677 "Unable to marshal QueryFragment.Beings: %w", err) 678 } 679 } 680 } 681 return &retval, nil 682 } 683 684 // QueryFragmentBeingsAnimal includes the requested fields of the GraphQL type Animal. 685 type QueryFragmentBeingsAnimal struct { 686 Typename string `json:"__typename"` 687 Id string `json:"id"` 688 Owner InnerBeingFields `json:"-"` 689 } 690 691 // GetTypename returns QueryFragmentBeingsAnimal.Typename, and is useful for accessing the field via an interface. 692 func (v *QueryFragmentBeingsAnimal) GetTypename() string { return v.Typename } 693 694 // GetId returns QueryFragmentBeingsAnimal.Id, and is useful for accessing the field via an interface. 695 func (v *QueryFragmentBeingsAnimal) GetId() string { return v.Id } 696 697 // GetOwner returns QueryFragmentBeingsAnimal.Owner, and is useful for accessing the field via an interface. 698 func (v *QueryFragmentBeingsAnimal) GetOwner() InnerBeingFields { return v.Owner } 699 700 func (v *QueryFragmentBeingsAnimal) UnmarshalJSON(b []byte) error { 701 702 if string(b) == "null" { 703 return nil 704 } 705 706 var firstPass struct { 707 *QueryFragmentBeingsAnimal 708 Owner json.RawMessage `json:"owner"` 709 graphql.NoUnmarshalJSON 710 } 711 firstPass.QueryFragmentBeingsAnimal = v 712 713 err := json.Unmarshal(b, &firstPass) 714 if err != nil { 715 return err 716 } 717 718 { 719 dst := &v.Owner 720 src := firstPass.Owner 721 if len(src) != 0 && string(src) != "null" { 722 err = __unmarshalInnerBeingFields( 723 src, dst) 724 if err != nil { 725 return fmt.Errorf( 726 "Unable to unmarshal QueryFragmentBeingsAnimal.Owner: %w", err) 727 } 728 } 729 } 730 return nil 731 } 732 733 type __premarshalQueryFragmentBeingsAnimal struct { 734 Typename string `json:"__typename"` 735 736 Id string `json:"id"` 737 738 Owner json.RawMessage `json:"owner"` 739 } 740 741 func (v *QueryFragmentBeingsAnimal) MarshalJSON() ([]byte, error) { 742 premarshaled, err := v.__premarshalJSON() 743 if err != nil { 744 return nil, err 745 } 746 return json.Marshal(premarshaled) 747 } 748 749 func (v *QueryFragmentBeingsAnimal) __premarshalJSON() (*__premarshalQueryFragmentBeingsAnimal, error) { 750 var retval __premarshalQueryFragmentBeingsAnimal 751 752 retval.Typename = v.Typename 753 retval.Id = v.Id 754 { 755 756 dst := &retval.Owner 757 src := v.Owner 758 var err error 759 *dst, err = __marshalInnerBeingFields( 760 &src) 761 if err != nil { 762 return nil, fmt.Errorf( 763 "Unable to marshal QueryFragmentBeingsAnimal.Owner: %w", err) 764 } 765 } 766 return &retval, nil 767 } 768 769 // QueryFragmentBeingsBeing includes the requested fields of the GraphQL interface Being. 770 // 771 // QueryFragmentBeingsBeing is implemented by the following types: 772 // QueryFragmentBeingsUser 773 // QueryFragmentBeingsAnimal 774 type QueryFragmentBeingsBeing interface { 775 implementsGraphQLInterfaceQueryFragmentBeingsBeing() 776 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 777 GetTypename() string 778 // GetId returns the interface-field "id" from its implementation. 779 GetId() string 780 } 781 782 func (v *QueryFragmentBeingsUser) implementsGraphQLInterfaceQueryFragmentBeingsBeing() {} 783 func (v *QueryFragmentBeingsAnimal) implementsGraphQLInterfaceQueryFragmentBeingsBeing() {} 784 785 func __unmarshalQueryFragmentBeingsBeing(b []byte, v *QueryFragmentBeingsBeing) error { 786 if string(b) == "null" { 787 return nil 788 } 789 790 var tn struct { 791 TypeName string `json:"__typename"` 792 } 793 err := json.Unmarshal(b, &tn) 794 if err != nil { 795 return err 796 } 797 798 switch tn.TypeName { 799 case "User": 800 *v = new(QueryFragmentBeingsUser) 801 return json.Unmarshal(b, *v) 802 case "Animal": 803 *v = new(QueryFragmentBeingsAnimal) 804 return json.Unmarshal(b, *v) 805 case "": 806 return fmt.Errorf( 807 "Response was missing Being.__typename") 808 default: 809 return fmt.Errorf( 810 `Unexpected concrete type for QueryFragmentBeingsBeing: "%v"`, tn.TypeName) 811 } 812 } 813 814 func __marshalQueryFragmentBeingsBeing(v *QueryFragmentBeingsBeing) ([]byte, error) { 815 816 var typename string 817 switch v := (*v).(type) { 818 case *QueryFragmentBeingsUser: 819 typename = "User" 820 821 premarshaled, err := v.__premarshalJSON() 822 if err != nil { 823 return nil, err 824 } 825 result := struct { 826 TypeName string `json:"__typename"` 827 *__premarshalQueryFragmentBeingsUser 828 }{typename, premarshaled} 829 return json.Marshal(result) 830 case *QueryFragmentBeingsAnimal: 831 typename = "Animal" 832 833 premarshaled, err := v.__premarshalJSON() 834 if err != nil { 835 return nil, err 836 } 837 result := struct { 838 TypeName string `json:"__typename"` 839 *__premarshalQueryFragmentBeingsAnimal 840 }{typename, premarshaled} 841 return json.Marshal(result) 842 case nil: 843 return []byte("null"), nil 844 default: 845 return nil, fmt.Errorf( 846 `Unexpected concrete type for QueryFragmentBeingsBeing: "%T"`, v) 847 } 848 } 849 850 // QueryFragmentBeingsUser includes the requested fields of the GraphQL type User. 851 type QueryFragmentBeingsUser struct { 852 Typename string `json:"__typename"` 853 Id string `json:"id"` 854 InnerLuckyFieldsUser `json:"-"` 855 } 856 857 // GetTypename returns QueryFragmentBeingsUser.Typename, and is useful for accessing the field via an interface. 858 func (v *QueryFragmentBeingsUser) GetTypename() string { return v.Typename } 859 860 // GetId returns QueryFragmentBeingsUser.Id, and is useful for accessing the field via an interface. 861 func (v *QueryFragmentBeingsUser) GetId() string { return v.Id } 862 863 // GetLuckyNumber returns QueryFragmentBeingsUser.LuckyNumber, and is useful for accessing the field via an interface. 864 func (v *QueryFragmentBeingsUser) GetLuckyNumber() int { return v.InnerLuckyFieldsUser.LuckyNumber } 865 866 func (v *QueryFragmentBeingsUser) UnmarshalJSON(b []byte) error { 867 868 if string(b) == "null" { 869 return nil 870 } 871 872 var firstPass struct { 873 *QueryFragmentBeingsUser 874 graphql.NoUnmarshalJSON 875 } 876 firstPass.QueryFragmentBeingsUser = v 877 878 err := json.Unmarshal(b, &firstPass) 879 if err != nil { 880 return err 881 } 882 883 err = json.Unmarshal( 884 b, &v.InnerLuckyFieldsUser) 885 if err != nil { 886 return err 887 } 888 return nil 889 } 890 891 type __premarshalQueryFragmentBeingsUser struct { 892 Typename string `json:"__typename"` 893 894 Id string `json:"id"` 895 896 LuckyNumber int `json:"luckyNumber"` 897 } 898 899 func (v *QueryFragmentBeingsUser) MarshalJSON() ([]byte, error) { 900 premarshaled, err := v.__premarshalJSON() 901 if err != nil { 902 return nil, err 903 } 904 return json.Marshal(premarshaled) 905 } 906 907 func (v *QueryFragmentBeingsUser) __premarshalJSON() (*__premarshalQueryFragmentBeingsUser, error) { 908 var retval __premarshalQueryFragmentBeingsUser 909 910 retval.Typename = v.Typename 911 retval.Id = v.Id 912 retval.LuckyNumber = v.InnerLuckyFieldsUser.LuckyNumber 913 return &retval, nil 914 } 915 916 type Species string 917 918 const ( 919 SpeciesDog Species = "DOG" 920 SpeciesCoelacanth Species = "COELACANTH" 921 ) 922 923 // UserFields includes the GraphQL fields of User requested by the fragment UserFields. 924 type UserFields struct { 925 Id string `json:"id"` 926 LuckyFieldsUser `json:"-"` 927 MoreUserFields `json:"-"` 928 } 929 930 // GetId returns UserFields.Id, and is useful for accessing the field via an interface. 931 func (v *UserFields) GetId() string { return v.Id } 932 933 // GetLuckyNumber returns UserFields.LuckyNumber, and is useful for accessing the field via an interface. 934 func (v *UserFields) GetLuckyNumber() int { return v.LuckyFieldsUser.LuckyNumber } 935 936 // GetHair returns UserFields.Hair, and is useful for accessing the field via an interface. 937 func (v *UserFields) GetHair() MoreUserFieldsHair { return v.MoreUserFields.Hair } 938 939 func (v *UserFields) UnmarshalJSON(b []byte) error { 940 941 if string(b) == "null" { 942 return nil 943 } 944 945 var firstPass struct { 946 *UserFields 947 graphql.NoUnmarshalJSON 948 } 949 firstPass.UserFields = v 950 951 err := json.Unmarshal(b, &firstPass) 952 if err != nil { 953 return err 954 } 955 956 err = json.Unmarshal( 957 b, &v.LuckyFieldsUser) 958 if err != nil { 959 return err 960 } 961 err = json.Unmarshal( 962 b, &v.MoreUserFields) 963 if err != nil { 964 return err 965 } 966 return nil 967 } 968 969 type __premarshalUserFields struct { 970 Id string `json:"id"` 971 972 LuckyNumber int `json:"luckyNumber"` 973 974 Hair MoreUserFieldsHair `json:"hair"` 975 } 976 977 func (v *UserFields) MarshalJSON() ([]byte, error) { 978 premarshaled, err := v.__premarshalJSON() 979 if err != nil { 980 return nil, err 981 } 982 return json.Marshal(premarshaled) 983 } 984 985 func (v *UserFields) __premarshalJSON() (*__premarshalUserFields, error) { 986 var retval __premarshalUserFields 987 988 retval.Id = v.Id 989 retval.LuckyNumber = v.LuckyFieldsUser.LuckyNumber 990 retval.Hair = v.MoreUserFields.Hair 991 return &retval, nil 992 } 993 994 // __queryWithCustomMarshalInput is used internally by genqlient 995 type __queryWithCustomMarshalInput struct { 996 Date time.Time `json:"-"` 997 } 998 999 // GetDate returns __queryWithCustomMarshalInput.Date, and is useful for accessing the field via an interface. 1000 func (v *__queryWithCustomMarshalInput) GetDate() time.Time { return v.Date } 1001 1002 func (v *__queryWithCustomMarshalInput) UnmarshalJSON(b []byte) error { 1003 1004 if string(b) == "null" { 1005 return nil 1006 } 1007 1008 var firstPass struct { 1009 *__queryWithCustomMarshalInput 1010 Date json.RawMessage `json:"date"` 1011 graphql.NoUnmarshalJSON 1012 } 1013 firstPass.__queryWithCustomMarshalInput = v 1014 1015 err := json.Unmarshal(b, &firstPass) 1016 if err != nil { 1017 return err 1018 } 1019 1020 { 1021 dst := &v.Date 1022 src := firstPass.Date 1023 if len(src) != 0 && string(src) != "null" { 1024 err = testutil.UnmarshalDate( 1025 src, dst) 1026 if err != nil { 1027 return fmt.Errorf( 1028 "Unable to unmarshal __queryWithCustomMarshalInput.Date: %w", err) 1029 } 1030 } 1031 } 1032 return nil 1033 } 1034 1035 type __premarshal__queryWithCustomMarshalInput struct { 1036 Date json.RawMessage `json:"date"` 1037 } 1038 1039 func (v *__queryWithCustomMarshalInput) MarshalJSON() ([]byte, error) { 1040 premarshaled, err := v.__premarshalJSON() 1041 if err != nil { 1042 return nil, err 1043 } 1044 return json.Marshal(premarshaled) 1045 } 1046 1047 func (v *__queryWithCustomMarshalInput) __premarshalJSON() (*__premarshal__queryWithCustomMarshalInput, error) { 1048 var retval __premarshal__queryWithCustomMarshalInput 1049 1050 { 1051 1052 dst := &retval.Date 1053 src := v.Date 1054 var err error 1055 *dst, err = testutil.MarshalDate( 1056 &src) 1057 if err != nil { 1058 return nil, fmt.Errorf( 1059 "Unable to marshal __queryWithCustomMarshalInput.Date: %w", err) 1060 } 1061 } 1062 return &retval, nil 1063 } 1064 1065 // __queryWithCustomMarshalOptionalInput is used internally by genqlient 1066 type __queryWithCustomMarshalOptionalInput struct { 1067 Date *time.Time `json:"-"` 1068 Id *string `json:"id"` 1069 } 1070 1071 // GetDate returns __queryWithCustomMarshalOptionalInput.Date, and is useful for accessing the field via an interface. 1072 func (v *__queryWithCustomMarshalOptionalInput) GetDate() *time.Time { return v.Date } 1073 1074 // GetId returns __queryWithCustomMarshalOptionalInput.Id, and is useful for accessing the field via an interface. 1075 func (v *__queryWithCustomMarshalOptionalInput) GetId() *string { return v.Id } 1076 1077 func (v *__queryWithCustomMarshalOptionalInput) UnmarshalJSON(b []byte) error { 1078 1079 if string(b) == "null" { 1080 return nil 1081 } 1082 1083 var firstPass struct { 1084 *__queryWithCustomMarshalOptionalInput 1085 Date json.RawMessage `json:"date"` 1086 graphql.NoUnmarshalJSON 1087 } 1088 firstPass.__queryWithCustomMarshalOptionalInput = v 1089 1090 err := json.Unmarshal(b, &firstPass) 1091 if err != nil { 1092 return err 1093 } 1094 1095 { 1096 dst := &v.Date 1097 src := firstPass.Date 1098 if len(src) != 0 && string(src) != "null" { 1099 *dst = new(time.Time) 1100 err = testutil.UnmarshalDate( 1101 src, *dst) 1102 if err != nil { 1103 return fmt.Errorf( 1104 "Unable to unmarshal __queryWithCustomMarshalOptionalInput.Date: %w", err) 1105 } 1106 } 1107 } 1108 return nil 1109 } 1110 1111 type __premarshal__queryWithCustomMarshalOptionalInput struct { 1112 Date json.RawMessage `json:"date"` 1113 1114 Id *string `json:"id"` 1115 } 1116 1117 func (v *__queryWithCustomMarshalOptionalInput) MarshalJSON() ([]byte, error) { 1118 premarshaled, err := v.__premarshalJSON() 1119 if err != nil { 1120 return nil, err 1121 } 1122 return json.Marshal(premarshaled) 1123 } 1124 1125 func (v *__queryWithCustomMarshalOptionalInput) __premarshalJSON() (*__premarshal__queryWithCustomMarshalOptionalInput, error) { 1126 var retval __premarshal__queryWithCustomMarshalOptionalInput 1127 1128 { 1129 1130 dst := &retval.Date 1131 src := v.Date 1132 if src != nil { 1133 var err error 1134 *dst, err = testutil.MarshalDate( 1135 src) 1136 if err != nil { 1137 return nil, fmt.Errorf( 1138 "Unable to marshal __queryWithCustomMarshalOptionalInput.Date: %w", err) 1139 } 1140 } 1141 } 1142 retval.Id = v.Id 1143 return &retval, nil 1144 } 1145 1146 // __queryWithCustomMarshalSliceInput is used internally by genqlient 1147 type __queryWithCustomMarshalSliceInput struct { 1148 Dates []time.Time `json:"-"` 1149 } 1150 1151 // GetDates returns __queryWithCustomMarshalSliceInput.Dates, and is useful for accessing the field via an interface. 1152 func (v *__queryWithCustomMarshalSliceInput) GetDates() []time.Time { return v.Dates } 1153 1154 func (v *__queryWithCustomMarshalSliceInput) UnmarshalJSON(b []byte) error { 1155 1156 if string(b) == "null" { 1157 return nil 1158 } 1159 1160 var firstPass struct { 1161 *__queryWithCustomMarshalSliceInput 1162 Dates []json.RawMessage `json:"dates"` 1163 graphql.NoUnmarshalJSON 1164 } 1165 firstPass.__queryWithCustomMarshalSliceInput = v 1166 1167 err := json.Unmarshal(b, &firstPass) 1168 if err != nil { 1169 return err 1170 } 1171 1172 { 1173 dst := &v.Dates 1174 src := firstPass.Dates 1175 *dst = make( 1176 []time.Time, 1177 len(src)) 1178 for i, src := range src { 1179 dst := &(*dst)[i] 1180 if len(src) != 0 && string(src) != "null" { 1181 err = testutil.UnmarshalDate( 1182 src, dst) 1183 if err != nil { 1184 return fmt.Errorf( 1185 "Unable to unmarshal __queryWithCustomMarshalSliceInput.Dates: %w", err) 1186 } 1187 } 1188 } 1189 } 1190 return nil 1191 } 1192 1193 type __premarshal__queryWithCustomMarshalSliceInput struct { 1194 Dates []json.RawMessage `json:"dates"` 1195 } 1196 1197 func (v *__queryWithCustomMarshalSliceInput) MarshalJSON() ([]byte, error) { 1198 premarshaled, err := v.__premarshalJSON() 1199 if err != nil { 1200 return nil, err 1201 } 1202 return json.Marshal(premarshaled) 1203 } 1204 1205 func (v *__queryWithCustomMarshalSliceInput) __premarshalJSON() (*__premarshal__queryWithCustomMarshalSliceInput, error) { 1206 var retval __premarshal__queryWithCustomMarshalSliceInput 1207 1208 { 1209 1210 dst := &retval.Dates 1211 src := v.Dates 1212 *dst = make( 1213 []json.RawMessage, 1214 len(src)) 1215 for i, src := range src { 1216 dst := &(*dst)[i] 1217 var err error 1218 *dst, err = testutil.MarshalDate( 1219 &src) 1220 if err != nil { 1221 return nil, fmt.Errorf( 1222 "Unable to marshal __queryWithCustomMarshalSliceInput.Dates: %w", err) 1223 } 1224 } 1225 } 1226 return &retval, nil 1227 } 1228 1229 // __queryWithFlattenInput is used internally by genqlient 1230 type __queryWithFlattenInput struct { 1231 Ids []string `json:"ids"` 1232 } 1233 1234 // GetIds returns __queryWithFlattenInput.Ids, and is useful for accessing the field via an interface. 1235 func (v *__queryWithFlattenInput) GetIds() []string { return v.Ids } 1236 1237 // __queryWithFragmentsInput is used internally by genqlient 1238 type __queryWithFragmentsInput struct { 1239 Ids []string `json:"ids"` 1240 } 1241 1242 // GetIds returns __queryWithFragmentsInput.Ids, and is useful for accessing the field via an interface. 1243 func (v *__queryWithFragmentsInput) GetIds() []string { return v.Ids } 1244 1245 // __queryWithInterfaceListFieldInput is used internally by genqlient 1246 type __queryWithInterfaceListFieldInput struct { 1247 Ids []string `json:"ids"` 1248 } 1249 1250 // GetIds returns __queryWithInterfaceListFieldInput.Ids, and is useful for accessing the field via an interface. 1251 func (v *__queryWithInterfaceListFieldInput) GetIds() []string { return v.Ids } 1252 1253 // __queryWithInterfaceListPointerFieldInput is used internally by genqlient 1254 type __queryWithInterfaceListPointerFieldInput struct { 1255 Ids []string `json:"ids"` 1256 } 1257 1258 // GetIds returns __queryWithInterfaceListPointerFieldInput.Ids, and is useful for accessing the field via an interface. 1259 func (v *__queryWithInterfaceListPointerFieldInput) GetIds() []string { return v.Ids } 1260 1261 // __queryWithInterfaceNoFragmentsInput is used internally by genqlient 1262 type __queryWithInterfaceNoFragmentsInput struct { 1263 Id string `json:"id"` 1264 } 1265 1266 // GetId returns __queryWithInterfaceNoFragmentsInput.Id, and is useful for accessing the field via an interface. 1267 func (v *__queryWithInterfaceNoFragmentsInput) GetId() string { return v.Id } 1268 1269 // __queryWithNamedFragmentsInput is used internally by genqlient 1270 type __queryWithNamedFragmentsInput struct { 1271 Ids []string `json:"ids"` 1272 } 1273 1274 // GetIds returns __queryWithNamedFragmentsInput.Ids, and is useful for accessing the field via an interface. 1275 func (v *__queryWithNamedFragmentsInput) GetIds() []string { return v.Ids } 1276 1277 // __queryWithOmitemptyInput is used internally by genqlient 1278 type __queryWithOmitemptyInput struct { 1279 Id string `json:"id,omitempty"` 1280 } 1281 1282 // GetId returns __queryWithOmitemptyInput.Id, and is useful for accessing the field via an interface. 1283 func (v *__queryWithOmitemptyInput) GetId() string { return v.Id } 1284 1285 // __queryWithVariablesInput is used internally by genqlient 1286 type __queryWithVariablesInput struct { 1287 Id string `json:"id"` 1288 } 1289 1290 // GetId returns __queryWithVariablesInput.Id, and is useful for accessing the field via an interface. 1291 func (v *__queryWithVariablesInput) GetId() string { return v.Id } 1292 1293 // failingQueryMeUser includes the requested fields of the GraphQL type User. 1294 type failingQueryMeUser struct { 1295 Id string `json:"id"` 1296 } 1297 1298 // GetId returns failingQueryMeUser.Id, and is useful for accessing the field via an interface. 1299 func (v *failingQueryMeUser) GetId() string { return v.Id } 1300 1301 // failingQueryResponse is returned by failingQuery on success. 1302 type failingQueryResponse struct { 1303 Fail bool `json:"fail"` 1304 Me failingQueryMeUser `json:"me"` 1305 } 1306 1307 // GetFail returns failingQueryResponse.Fail, and is useful for accessing the field via an interface. 1308 func (v *failingQueryResponse) GetFail() bool { return v.Fail } 1309 1310 // GetMe returns failingQueryResponse.Me, and is useful for accessing the field via an interface. 1311 func (v *failingQueryResponse) GetMe() failingQueryMeUser { return v.Me } 1312 1313 // queryWithCustomMarshalOptionalResponse is returned by queryWithCustomMarshalOptional on success. 1314 type queryWithCustomMarshalOptionalResponse struct { 1315 UserSearch []queryWithCustomMarshalOptionalUserSearchUser `json:"userSearch"` 1316 } 1317 1318 // GetUserSearch returns queryWithCustomMarshalOptionalResponse.UserSearch, and is useful for accessing the field via an interface. 1319 func (v *queryWithCustomMarshalOptionalResponse) GetUserSearch() []queryWithCustomMarshalOptionalUserSearchUser { 1320 return v.UserSearch 1321 } 1322 1323 // queryWithCustomMarshalOptionalUserSearchUser includes the requested fields of the GraphQL type User. 1324 type queryWithCustomMarshalOptionalUserSearchUser struct { 1325 Id string `json:"id"` 1326 Name string `json:"name"` 1327 Birthdate time.Time `json:"-"` 1328 } 1329 1330 // GetId returns queryWithCustomMarshalOptionalUserSearchUser.Id, and is useful for accessing the field via an interface. 1331 func (v *queryWithCustomMarshalOptionalUserSearchUser) GetId() string { return v.Id } 1332 1333 // GetName returns queryWithCustomMarshalOptionalUserSearchUser.Name, and is useful for accessing the field via an interface. 1334 func (v *queryWithCustomMarshalOptionalUserSearchUser) GetName() string { return v.Name } 1335 1336 // GetBirthdate returns queryWithCustomMarshalOptionalUserSearchUser.Birthdate, and is useful for accessing the field via an interface. 1337 func (v *queryWithCustomMarshalOptionalUserSearchUser) GetBirthdate() time.Time { return v.Birthdate } 1338 1339 func (v *queryWithCustomMarshalOptionalUserSearchUser) UnmarshalJSON(b []byte) error { 1340 1341 if string(b) == "null" { 1342 return nil 1343 } 1344 1345 var firstPass struct { 1346 *queryWithCustomMarshalOptionalUserSearchUser 1347 Birthdate json.RawMessage `json:"birthdate"` 1348 graphql.NoUnmarshalJSON 1349 } 1350 firstPass.queryWithCustomMarshalOptionalUserSearchUser = v 1351 1352 err := json.Unmarshal(b, &firstPass) 1353 if err != nil { 1354 return err 1355 } 1356 1357 { 1358 dst := &v.Birthdate 1359 src := firstPass.Birthdate 1360 if len(src) != 0 && string(src) != "null" { 1361 err = testutil.UnmarshalDate( 1362 src, dst) 1363 if err != nil { 1364 return fmt.Errorf( 1365 "Unable to unmarshal queryWithCustomMarshalOptionalUserSearchUser.Birthdate: %w", err) 1366 } 1367 } 1368 } 1369 return nil 1370 } 1371 1372 type __premarshalqueryWithCustomMarshalOptionalUserSearchUser struct { 1373 Id string `json:"id"` 1374 1375 Name string `json:"name"` 1376 1377 Birthdate json.RawMessage `json:"birthdate"` 1378 } 1379 1380 func (v *queryWithCustomMarshalOptionalUserSearchUser) MarshalJSON() ([]byte, error) { 1381 premarshaled, err := v.__premarshalJSON() 1382 if err != nil { 1383 return nil, err 1384 } 1385 return json.Marshal(premarshaled) 1386 } 1387 1388 func (v *queryWithCustomMarshalOptionalUserSearchUser) __premarshalJSON() (*__premarshalqueryWithCustomMarshalOptionalUserSearchUser, error) { 1389 var retval __premarshalqueryWithCustomMarshalOptionalUserSearchUser 1390 1391 retval.Id = v.Id 1392 retval.Name = v.Name 1393 { 1394 1395 dst := &retval.Birthdate 1396 src := v.Birthdate 1397 var err error 1398 *dst, err = testutil.MarshalDate( 1399 &src) 1400 if err != nil { 1401 return nil, fmt.Errorf( 1402 "Unable to marshal queryWithCustomMarshalOptionalUserSearchUser.Birthdate: %w", err) 1403 } 1404 } 1405 return &retval, nil 1406 } 1407 1408 // queryWithCustomMarshalResponse is returned by queryWithCustomMarshal on success. 1409 type queryWithCustomMarshalResponse struct { 1410 UsersBornOn []queryWithCustomMarshalUsersBornOnUser `json:"usersBornOn"` 1411 } 1412 1413 // GetUsersBornOn returns queryWithCustomMarshalResponse.UsersBornOn, and is useful for accessing the field via an interface. 1414 func (v *queryWithCustomMarshalResponse) GetUsersBornOn() []queryWithCustomMarshalUsersBornOnUser { 1415 return v.UsersBornOn 1416 } 1417 1418 // queryWithCustomMarshalSliceResponse is returned by queryWithCustomMarshalSlice on success. 1419 type queryWithCustomMarshalSliceResponse struct { 1420 UsersBornOnDates []queryWithCustomMarshalSliceUsersBornOnDatesUser `json:"usersBornOnDates"` 1421 } 1422 1423 // GetUsersBornOnDates returns queryWithCustomMarshalSliceResponse.UsersBornOnDates, and is useful for accessing the field via an interface. 1424 func (v *queryWithCustomMarshalSliceResponse) GetUsersBornOnDates() []queryWithCustomMarshalSliceUsersBornOnDatesUser { 1425 return v.UsersBornOnDates 1426 } 1427 1428 // queryWithCustomMarshalSliceUsersBornOnDatesUser includes the requested fields of the GraphQL type User. 1429 type queryWithCustomMarshalSliceUsersBornOnDatesUser struct { 1430 Id string `json:"id"` 1431 Name string `json:"name"` 1432 Birthdate time.Time `json:"-"` 1433 } 1434 1435 // GetId returns queryWithCustomMarshalSliceUsersBornOnDatesUser.Id, and is useful for accessing the field via an interface. 1436 func (v *queryWithCustomMarshalSliceUsersBornOnDatesUser) GetId() string { return v.Id } 1437 1438 // GetName returns queryWithCustomMarshalSliceUsersBornOnDatesUser.Name, and is useful for accessing the field via an interface. 1439 func (v *queryWithCustomMarshalSliceUsersBornOnDatesUser) GetName() string { return v.Name } 1440 1441 // GetBirthdate returns queryWithCustomMarshalSliceUsersBornOnDatesUser.Birthdate, and is useful for accessing the field via an interface. 1442 func (v *queryWithCustomMarshalSliceUsersBornOnDatesUser) GetBirthdate() time.Time { 1443 return v.Birthdate 1444 } 1445 1446 func (v *queryWithCustomMarshalSliceUsersBornOnDatesUser) UnmarshalJSON(b []byte) error { 1447 1448 if string(b) == "null" { 1449 return nil 1450 } 1451 1452 var firstPass struct { 1453 *queryWithCustomMarshalSliceUsersBornOnDatesUser 1454 Birthdate json.RawMessage `json:"birthdate"` 1455 graphql.NoUnmarshalJSON 1456 } 1457 firstPass.queryWithCustomMarshalSliceUsersBornOnDatesUser = v 1458 1459 err := json.Unmarshal(b, &firstPass) 1460 if err != nil { 1461 return err 1462 } 1463 1464 { 1465 dst := &v.Birthdate 1466 src := firstPass.Birthdate 1467 if len(src) != 0 && string(src) != "null" { 1468 err = testutil.UnmarshalDate( 1469 src, dst) 1470 if err != nil { 1471 return fmt.Errorf( 1472 "Unable to unmarshal queryWithCustomMarshalSliceUsersBornOnDatesUser.Birthdate: %w", err) 1473 } 1474 } 1475 } 1476 return nil 1477 } 1478 1479 type __premarshalqueryWithCustomMarshalSliceUsersBornOnDatesUser struct { 1480 Id string `json:"id"` 1481 1482 Name string `json:"name"` 1483 1484 Birthdate json.RawMessage `json:"birthdate"` 1485 } 1486 1487 func (v *queryWithCustomMarshalSliceUsersBornOnDatesUser) MarshalJSON() ([]byte, error) { 1488 premarshaled, err := v.__premarshalJSON() 1489 if err != nil { 1490 return nil, err 1491 } 1492 return json.Marshal(premarshaled) 1493 } 1494 1495 func (v *queryWithCustomMarshalSliceUsersBornOnDatesUser) __premarshalJSON() (*__premarshalqueryWithCustomMarshalSliceUsersBornOnDatesUser, error) { 1496 var retval __premarshalqueryWithCustomMarshalSliceUsersBornOnDatesUser 1497 1498 retval.Id = v.Id 1499 retval.Name = v.Name 1500 { 1501 1502 dst := &retval.Birthdate 1503 src := v.Birthdate 1504 var err error 1505 *dst, err = testutil.MarshalDate( 1506 &src) 1507 if err != nil { 1508 return nil, fmt.Errorf( 1509 "Unable to marshal queryWithCustomMarshalSliceUsersBornOnDatesUser.Birthdate: %w", err) 1510 } 1511 } 1512 return &retval, nil 1513 } 1514 1515 // queryWithCustomMarshalUsersBornOnUser includes the requested fields of the GraphQL type User. 1516 type queryWithCustomMarshalUsersBornOnUser struct { 1517 Id string `json:"id"` 1518 Name string `json:"name"` 1519 Birthdate time.Time `json:"-"` 1520 } 1521 1522 // GetId returns queryWithCustomMarshalUsersBornOnUser.Id, and is useful for accessing the field via an interface. 1523 func (v *queryWithCustomMarshalUsersBornOnUser) GetId() string { return v.Id } 1524 1525 // GetName returns queryWithCustomMarshalUsersBornOnUser.Name, and is useful for accessing the field via an interface. 1526 func (v *queryWithCustomMarshalUsersBornOnUser) GetName() string { return v.Name } 1527 1528 // GetBirthdate returns queryWithCustomMarshalUsersBornOnUser.Birthdate, and is useful for accessing the field via an interface. 1529 func (v *queryWithCustomMarshalUsersBornOnUser) GetBirthdate() time.Time { return v.Birthdate } 1530 1531 func (v *queryWithCustomMarshalUsersBornOnUser) UnmarshalJSON(b []byte) error { 1532 1533 if string(b) == "null" { 1534 return nil 1535 } 1536 1537 var firstPass struct { 1538 *queryWithCustomMarshalUsersBornOnUser 1539 Birthdate json.RawMessage `json:"birthdate"` 1540 graphql.NoUnmarshalJSON 1541 } 1542 firstPass.queryWithCustomMarshalUsersBornOnUser = v 1543 1544 err := json.Unmarshal(b, &firstPass) 1545 if err != nil { 1546 return err 1547 } 1548 1549 { 1550 dst := &v.Birthdate 1551 src := firstPass.Birthdate 1552 if len(src) != 0 && string(src) != "null" { 1553 err = testutil.UnmarshalDate( 1554 src, dst) 1555 if err != nil { 1556 return fmt.Errorf( 1557 "Unable to unmarshal queryWithCustomMarshalUsersBornOnUser.Birthdate: %w", err) 1558 } 1559 } 1560 } 1561 return nil 1562 } 1563 1564 type __premarshalqueryWithCustomMarshalUsersBornOnUser struct { 1565 Id string `json:"id"` 1566 1567 Name string `json:"name"` 1568 1569 Birthdate json.RawMessage `json:"birthdate"` 1570 } 1571 1572 func (v *queryWithCustomMarshalUsersBornOnUser) MarshalJSON() ([]byte, error) { 1573 premarshaled, err := v.__premarshalJSON() 1574 if err != nil { 1575 return nil, err 1576 } 1577 return json.Marshal(premarshaled) 1578 } 1579 1580 func (v *queryWithCustomMarshalUsersBornOnUser) __premarshalJSON() (*__premarshalqueryWithCustomMarshalUsersBornOnUser, error) { 1581 var retval __premarshalqueryWithCustomMarshalUsersBornOnUser 1582 1583 retval.Id = v.Id 1584 retval.Name = v.Name 1585 { 1586 1587 dst := &retval.Birthdate 1588 src := v.Birthdate 1589 var err error 1590 *dst, err = testutil.MarshalDate( 1591 &src) 1592 if err != nil { 1593 return nil, fmt.Errorf( 1594 "Unable to marshal queryWithCustomMarshalUsersBornOnUser.Birthdate: %w", err) 1595 } 1596 } 1597 return &retval, nil 1598 } 1599 1600 // queryWithFragmentsBeingsAnimal includes the requested fields of the GraphQL type Animal. 1601 type queryWithFragmentsBeingsAnimal struct { 1602 Typename string `json:"__typename"` 1603 Id string `json:"id"` 1604 Name string `json:"name"` 1605 Hair queryWithFragmentsBeingsAnimalHairBeingsHair `json:"hair"` 1606 Species Species `json:"species"` 1607 Owner queryWithFragmentsBeingsAnimalOwnerBeing `json:"-"` 1608 } 1609 1610 // GetTypename returns queryWithFragmentsBeingsAnimal.Typename, and is useful for accessing the field via an interface. 1611 func (v *queryWithFragmentsBeingsAnimal) GetTypename() string { return v.Typename } 1612 1613 // GetId returns queryWithFragmentsBeingsAnimal.Id, and is useful for accessing the field via an interface. 1614 func (v *queryWithFragmentsBeingsAnimal) GetId() string { return v.Id } 1615 1616 // GetName returns queryWithFragmentsBeingsAnimal.Name, and is useful for accessing the field via an interface. 1617 func (v *queryWithFragmentsBeingsAnimal) GetName() string { return v.Name } 1618 1619 // GetHair returns queryWithFragmentsBeingsAnimal.Hair, and is useful for accessing the field via an interface. 1620 func (v *queryWithFragmentsBeingsAnimal) GetHair() queryWithFragmentsBeingsAnimalHairBeingsHair { 1621 return v.Hair 1622 } 1623 1624 // GetSpecies returns queryWithFragmentsBeingsAnimal.Species, and is useful for accessing the field via an interface. 1625 func (v *queryWithFragmentsBeingsAnimal) GetSpecies() Species { return v.Species } 1626 1627 // GetOwner returns queryWithFragmentsBeingsAnimal.Owner, and is useful for accessing the field via an interface. 1628 func (v *queryWithFragmentsBeingsAnimal) GetOwner() queryWithFragmentsBeingsAnimalOwnerBeing { 1629 return v.Owner 1630 } 1631 1632 func (v *queryWithFragmentsBeingsAnimal) UnmarshalJSON(b []byte) error { 1633 1634 if string(b) == "null" { 1635 return nil 1636 } 1637 1638 var firstPass struct { 1639 *queryWithFragmentsBeingsAnimal 1640 Owner json.RawMessage `json:"owner"` 1641 graphql.NoUnmarshalJSON 1642 } 1643 firstPass.queryWithFragmentsBeingsAnimal = v 1644 1645 err := json.Unmarshal(b, &firstPass) 1646 if err != nil { 1647 return err 1648 } 1649 1650 { 1651 dst := &v.Owner 1652 src := firstPass.Owner 1653 if len(src) != 0 && string(src) != "null" { 1654 err = __unmarshalqueryWithFragmentsBeingsAnimalOwnerBeing( 1655 src, dst) 1656 if err != nil { 1657 return fmt.Errorf( 1658 "Unable to unmarshal queryWithFragmentsBeingsAnimal.Owner: %w", err) 1659 } 1660 } 1661 } 1662 return nil 1663 } 1664 1665 type __premarshalqueryWithFragmentsBeingsAnimal struct { 1666 Typename string `json:"__typename"` 1667 1668 Id string `json:"id"` 1669 1670 Name string `json:"name"` 1671 1672 Hair queryWithFragmentsBeingsAnimalHairBeingsHair `json:"hair"` 1673 1674 Species Species `json:"species"` 1675 1676 Owner json.RawMessage `json:"owner"` 1677 } 1678 1679 func (v *queryWithFragmentsBeingsAnimal) MarshalJSON() ([]byte, error) { 1680 premarshaled, err := v.__premarshalJSON() 1681 if err != nil { 1682 return nil, err 1683 } 1684 return json.Marshal(premarshaled) 1685 } 1686 1687 func (v *queryWithFragmentsBeingsAnimal) __premarshalJSON() (*__premarshalqueryWithFragmentsBeingsAnimal, error) { 1688 var retval __premarshalqueryWithFragmentsBeingsAnimal 1689 1690 retval.Typename = v.Typename 1691 retval.Id = v.Id 1692 retval.Name = v.Name 1693 retval.Hair = v.Hair 1694 retval.Species = v.Species 1695 { 1696 1697 dst := &retval.Owner 1698 src := v.Owner 1699 var err error 1700 *dst, err = __marshalqueryWithFragmentsBeingsAnimalOwnerBeing( 1701 &src) 1702 if err != nil { 1703 return nil, fmt.Errorf( 1704 "Unable to marshal queryWithFragmentsBeingsAnimal.Owner: %w", err) 1705 } 1706 } 1707 return &retval, nil 1708 } 1709 1710 // queryWithFragmentsBeingsAnimalHairBeingsHair includes the requested fields of the GraphQL type BeingsHair. 1711 type queryWithFragmentsBeingsAnimalHairBeingsHair struct { 1712 HasHair bool `json:"hasHair"` 1713 } 1714 1715 // GetHasHair returns queryWithFragmentsBeingsAnimalHairBeingsHair.HasHair, and is useful for accessing the field via an interface. 1716 func (v *queryWithFragmentsBeingsAnimalHairBeingsHair) GetHasHair() bool { return v.HasHair } 1717 1718 // queryWithFragmentsBeingsAnimalOwnerAnimal includes the requested fields of the GraphQL type Animal. 1719 type queryWithFragmentsBeingsAnimalOwnerAnimal struct { 1720 Typename string `json:"__typename"` 1721 Id string `json:"id"` 1722 Name string `json:"name"` 1723 } 1724 1725 // GetTypename returns queryWithFragmentsBeingsAnimalOwnerAnimal.Typename, and is useful for accessing the field via an interface. 1726 func (v *queryWithFragmentsBeingsAnimalOwnerAnimal) GetTypename() string { return v.Typename } 1727 1728 // GetId returns queryWithFragmentsBeingsAnimalOwnerAnimal.Id, and is useful for accessing the field via an interface. 1729 func (v *queryWithFragmentsBeingsAnimalOwnerAnimal) GetId() string { return v.Id } 1730 1731 // GetName returns queryWithFragmentsBeingsAnimalOwnerAnimal.Name, and is useful for accessing the field via an interface. 1732 func (v *queryWithFragmentsBeingsAnimalOwnerAnimal) GetName() string { return v.Name } 1733 1734 // queryWithFragmentsBeingsAnimalOwnerBeing includes the requested fields of the GraphQL interface Being. 1735 // 1736 // queryWithFragmentsBeingsAnimalOwnerBeing is implemented by the following types: 1737 // queryWithFragmentsBeingsAnimalOwnerUser 1738 // queryWithFragmentsBeingsAnimalOwnerAnimal 1739 type queryWithFragmentsBeingsAnimalOwnerBeing interface { 1740 implementsGraphQLInterfacequeryWithFragmentsBeingsAnimalOwnerBeing() 1741 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 1742 GetTypename() string 1743 // GetId returns the interface-field "id" from its implementation. 1744 GetId() string 1745 // GetName returns the interface-field "name" from its implementation. 1746 GetName() string 1747 } 1748 1749 func (v *queryWithFragmentsBeingsAnimalOwnerUser) implementsGraphQLInterfacequeryWithFragmentsBeingsAnimalOwnerBeing() { 1750 } 1751 func (v *queryWithFragmentsBeingsAnimalOwnerAnimal) implementsGraphQLInterfacequeryWithFragmentsBeingsAnimalOwnerBeing() { 1752 } 1753 1754 func __unmarshalqueryWithFragmentsBeingsAnimalOwnerBeing(b []byte, v *queryWithFragmentsBeingsAnimalOwnerBeing) error { 1755 if string(b) == "null" { 1756 return nil 1757 } 1758 1759 var tn struct { 1760 TypeName string `json:"__typename"` 1761 } 1762 err := json.Unmarshal(b, &tn) 1763 if err != nil { 1764 return err 1765 } 1766 1767 switch tn.TypeName { 1768 case "User": 1769 *v = new(queryWithFragmentsBeingsAnimalOwnerUser) 1770 return json.Unmarshal(b, *v) 1771 case "Animal": 1772 *v = new(queryWithFragmentsBeingsAnimalOwnerAnimal) 1773 return json.Unmarshal(b, *v) 1774 case "": 1775 return fmt.Errorf( 1776 "Response was missing Being.__typename") 1777 default: 1778 return fmt.Errorf( 1779 `Unexpected concrete type for queryWithFragmentsBeingsAnimalOwnerBeing: "%v"`, tn.TypeName) 1780 } 1781 } 1782 1783 func __marshalqueryWithFragmentsBeingsAnimalOwnerBeing(v *queryWithFragmentsBeingsAnimalOwnerBeing) ([]byte, error) { 1784 1785 var typename string 1786 switch v := (*v).(type) { 1787 case *queryWithFragmentsBeingsAnimalOwnerUser: 1788 typename = "User" 1789 1790 result := struct { 1791 TypeName string `json:"__typename"` 1792 *queryWithFragmentsBeingsAnimalOwnerUser 1793 }{typename, v} 1794 return json.Marshal(result) 1795 case *queryWithFragmentsBeingsAnimalOwnerAnimal: 1796 typename = "Animal" 1797 1798 result := struct { 1799 TypeName string `json:"__typename"` 1800 *queryWithFragmentsBeingsAnimalOwnerAnimal 1801 }{typename, v} 1802 return json.Marshal(result) 1803 case nil: 1804 return []byte("null"), nil 1805 default: 1806 return nil, fmt.Errorf( 1807 `Unexpected concrete type for queryWithFragmentsBeingsAnimalOwnerBeing: "%T"`, v) 1808 } 1809 } 1810 1811 // queryWithFragmentsBeingsAnimalOwnerUser includes the requested fields of the GraphQL type User. 1812 type queryWithFragmentsBeingsAnimalOwnerUser struct { 1813 Typename string `json:"__typename"` 1814 Id string `json:"id"` 1815 Name string `json:"name"` 1816 LuckyNumber int `json:"luckyNumber"` 1817 } 1818 1819 // GetTypename returns queryWithFragmentsBeingsAnimalOwnerUser.Typename, and is useful for accessing the field via an interface. 1820 func (v *queryWithFragmentsBeingsAnimalOwnerUser) GetTypename() string { return v.Typename } 1821 1822 // GetId returns queryWithFragmentsBeingsAnimalOwnerUser.Id, and is useful for accessing the field via an interface. 1823 func (v *queryWithFragmentsBeingsAnimalOwnerUser) GetId() string { return v.Id } 1824 1825 // GetName returns queryWithFragmentsBeingsAnimalOwnerUser.Name, and is useful for accessing the field via an interface. 1826 func (v *queryWithFragmentsBeingsAnimalOwnerUser) GetName() string { return v.Name } 1827 1828 // GetLuckyNumber returns queryWithFragmentsBeingsAnimalOwnerUser.LuckyNumber, and is useful for accessing the field via an interface. 1829 func (v *queryWithFragmentsBeingsAnimalOwnerUser) GetLuckyNumber() int { return v.LuckyNumber } 1830 1831 // queryWithFragmentsBeingsBeing includes the requested fields of the GraphQL interface Being. 1832 // 1833 // queryWithFragmentsBeingsBeing is implemented by the following types: 1834 // queryWithFragmentsBeingsUser 1835 // queryWithFragmentsBeingsAnimal 1836 type queryWithFragmentsBeingsBeing interface { 1837 implementsGraphQLInterfacequeryWithFragmentsBeingsBeing() 1838 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 1839 GetTypename() string 1840 // GetId returns the interface-field "id" from its implementation. 1841 GetId() string 1842 // GetName returns the interface-field "name" from its implementation. 1843 GetName() string 1844 } 1845 1846 func (v *queryWithFragmentsBeingsUser) implementsGraphQLInterfacequeryWithFragmentsBeingsBeing() {} 1847 func (v *queryWithFragmentsBeingsAnimal) implementsGraphQLInterfacequeryWithFragmentsBeingsBeing() {} 1848 1849 func __unmarshalqueryWithFragmentsBeingsBeing(b []byte, v *queryWithFragmentsBeingsBeing) error { 1850 if string(b) == "null" { 1851 return nil 1852 } 1853 1854 var tn struct { 1855 TypeName string `json:"__typename"` 1856 } 1857 err := json.Unmarshal(b, &tn) 1858 if err != nil { 1859 return err 1860 } 1861 1862 switch tn.TypeName { 1863 case "User": 1864 *v = new(queryWithFragmentsBeingsUser) 1865 return json.Unmarshal(b, *v) 1866 case "Animal": 1867 *v = new(queryWithFragmentsBeingsAnimal) 1868 return json.Unmarshal(b, *v) 1869 case "": 1870 return fmt.Errorf( 1871 "Response was missing Being.__typename") 1872 default: 1873 return fmt.Errorf( 1874 `Unexpected concrete type for queryWithFragmentsBeingsBeing: "%v"`, tn.TypeName) 1875 } 1876 } 1877 1878 func __marshalqueryWithFragmentsBeingsBeing(v *queryWithFragmentsBeingsBeing) ([]byte, error) { 1879 1880 var typename string 1881 switch v := (*v).(type) { 1882 case *queryWithFragmentsBeingsUser: 1883 typename = "User" 1884 1885 result := struct { 1886 TypeName string `json:"__typename"` 1887 *queryWithFragmentsBeingsUser 1888 }{typename, v} 1889 return json.Marshal(result) 1890 case *queryWithFragmentsBeingsAnimal: 1891 typename = "Animal" 1892 1893 premarshaled, err := v.__premarshalJSON() 1894 if err != nil { 1895 return nil, err 1896 } 1897 result := struct { 1898 TypeName string `json:"__typename"` 1899 *__premarshalqueryWithFragmentsBeingsAnimal 1900 }{typename, premarshaled} 1901 return json.Marshal(result) 1902 case nil: 1903 return []byte("null"), nil 1904 default: 1905 return nil, fmt.Errorf( 1906 `Unexpected concrete type for queryWithFragmentsBeingsBeing: "%T"`, v) 1907 } 1908 } 1909 1910 // queryWithFragmentsBeingsUser includes the requested fields of the GraphQL type User. 1911 type queryWithFragmentsBeingsUser struct { 1912 Typename string `json:"__typename"` 1913 Id string `json:"id"` 1914 Name string `json:"name"` 1915 LuckyNumber int `json:"luckyNumber"` 1916 Hair queryWithFragmentsBeingsUserHair `json:"hair"` 1917 } 1918 1919 // GetTypename returns queryWithFragmentsBeingsUser.Typename, and is useful for accessing the field via an interface. 1920 func (v *queryWithFragmentsBeingsUser) GetTypename() string { return v.Typename } 1921 1922 // GetId returns queryWithFragmentsBeingsUser.Id, and is useful for accessing the field via an interface. 1923 func (v *queryWithFragmentsBeingsUser) GetId() string { return v.Id } 1924 1925 // GetName returns queryWithFragmentsBeingsUser.Name, and is useful for accessing the field via an interface. 1926 func (v *queryWithFragmentsBeingsUser) GetName() string { return v.Name } 1927 1928 // GetLuckyNumber returns queryWithFragmentsBeingsUser.LuckyNumber, and is useful for accessing the field via an interface. 1929 func (v *queryWithFragmentsBeingsUser) GetLuckyNumber() int { return v.LuckyNumber } 1930 1931 // GetHair returns queryWithFragmentsBeingsUser.Hair, and is useful for accessing the field via an interface. 1932 func (v *queryWithFragmentsBeingsUser) GetHair() queryWithFragmentsBeingsUserHair { return v.Hair } 1933 1934 // queryWithFragmentsBeingsUserHair includes the requested fields of the GraphQL type Hair. 1935 type queryWithFragmentsBeingsUserHair struct { 1936 Color string `json:"color"` 1937 } 1938 1939 // GetColor returns queryWithFragmentsBeingsUserHair.Color, and is useful for accessing the field via an interface. 1940 func (v *queryWithFragmentsBeingsUserHair) GetColor() string { return v.Color } 1941 1942 // queryWithFragmentsResponse is returned by queryWithFragments on success. 1943 type queryWithFragmentsResponse struct { 1944 Beings []queryWithFragmentsBeingsBeing `json:"-"` 1945 } 1946 1947 // GetBeings returns queryWithFragmentsResponse.Beings, and is useful for accessing the field via an interface. 1948 func (v *queryWithFragmentsResponse) GetBeings() []queryWithFragmentsBeingsBeing { return v.Beings } 1949 1950 func (v *queryWithFragmentsResponse) UnmarshalJSON(b []byte) error { 1951 1952 if string(b) == "null" { 1953 return nil 1954 } 1955 1956 var firstPass struct { 1957 *queryWithFragmentsResponse 1958 Beings []json.RawMessage `json:"beings"` 1959 graphql.NoUnmarshalJSON 1960 } 1961 firstPass.queryWithFragmentsResponse = v 1962 1963 err := json.Unmarshal(b, &firstPass) 1964 if err != nil { 1965 return err 1966 } 1967 1968 { 1969 dst := &v.Beings 1970 src := firstPass.Beings 1971 *dst = make( 1972 []queryWithFragmentsBeingsBeing, 1973 len(src)) 1974 for i, src := range src { 1975 dst := &(*dst)[i] 1976 if len(src) != 0 && string(src) != "null" { 1977 err = __unmarshalqueryWithFragmentsBeingsBeing( 1978 src, dst) 1979 if err != nil { 1980 return fmt.Errorf( 1981 "Unable to unmarshal queryWithFragmentsResponse.Beings: %w", err) 1982 } 1983 } 1984 } 1985 } 1986 return nil 1987 } 1988 1989 type __premarshalqueryWithFragmentsResponse struct { 1990 Beings []json.RawMessage `json:"beings"` 1991 } 1992 1993 func (v *queryWithFragmentsResponse) MarshalJSON() ([]byte, error) { 1994 premarshaled, err := v.__premarshalJSON() 1995 if err != nil { 1996 return nil, err 1997 } 1998 return json.Marshal(premarshaled) 1999 } 2000 2001 func (v *queryWithFragmentsResponse) __premarshalJSON() (*__premarshalqueryWithFragmentsResponse, error) { 2002 var retval __premarshalqueryWithFragmentsResponse 2003 2004 { 2005 2006 dst := &retval.Beings 2007 src := v.Beings 2008 *dst = make( 2009 []json.RawMessage, 2010 len(src)) 2011 for i, src := range src { 2012 dst := &(*dst)[i] 2013 var err error 2014 *dst, err = __marshalqueryWithFragmentsBeingsBeing( 2015 &src) 2016 if err != nil { 2017 return nil, fmt.Errorf( 2018 "Unable to marshal queryWithFragmentsResponse.Beings: %w", err) 2019 } 2020 } 2021 } 2022 return &retval, nil 2023 } 2024 2025 // queryWithInterfaceListFieldBeingsAnimal includes the requested fields of the GraphQL type Animal. 2026 type queryWithInterfaceListFieldBeingsAnimal struct { 2027 Typename string `json:"__typename"` 2028 Id string `json:"id"` 2029 Name string `json:"name"` 2030 } 2031 2032 // GetTypename returns queryWithInterfaceListFieldBeingsAnimal.Typename, and is useful for accessing the field via an interface. 2033 func (v *queryWithInterfaceListFieldBeingsAnimal) GetTypename() string { return v.Typename } 2034 2035 // GetId returns queryWithInterfaceListFieldBeingsAnimal.Id, and is useful for accessing the field via an interface. 2036 func (v *queryWithInterfaceListFieldBeingsAnimal) GetId() string { return v.Id } 2037 2038 // GetName returns queryWithInterfaceListFieldBeingsAnimal.Name, and is useful for accessing the field via an interface. 2039 func (v *queryWithInterfaceListFieldBeingsAnimal) GetName() string { return v.Name } 2040 2041 // queryWithInterfaceListFieldBeingsBeing includes the requested fields of the GraphQL interface Being. 2042 // 2043 // queryWithInterfaceListFieldBeingsBeing is implemented by the following types: 2044 // queryWithInterfaceListFieldBeingsUser 2045 // queryWithInterfaceListFieldBeingsAnimal 2046 type queryWithInterfaceListFieldBeingsBeing interface { 2047 implementsGraphQLInterfacequeryWithInterfaceListFieldBeingsBeing() 2048 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 2049 GetTypename() string 2050 // GetId returns the interface-field "id" from its implementation. 2051 GetId() string 2052 // GetName returns the interface-field "name" from its implementation. 2053 GetName() string 2054 } 2055 2056 func (v *queryWithInterfaceListFieldBeingsUser) implementsGraphQLInterfacequeryWithInterfaceListFieldBeingsBeing() { 2057 } 2058 func (v *queryWithInterfaceListFieldBeingsAnimal) implementsGraphQLInterfacequeryWithInterfaceListFieldBeingsBeing() { 2059 } 2060 2061 func __unmarshalqueryWithInterfaceListFieldBeingsBeing(b []byte, v *queryWithInterfaceListFieldBeingsBeing) error { 2062 if string(b) == "null" { 2063 return nil 2064 } 2065 2066 var tn struct { 2067 TypeName string `json:"__typename"` 2068 } 2069 err := json.Unmarshal(b, &tn) 2070 if err != nil { 2071 return err 2072 } 2073 2074 switch tn.TypeName { 2075 case "User": 2076 *v = new(queryWithInterfaceListFieldBeingsUser) 2077 return json.Unmarshal(b, *v) 2078 case "Animal": 2079 *v = new(queryWithInterfaceListFieldBeingsAnimal) 2080 return json.Unmarshal(b, *v) 2081 case "": 2082 return fmt.Errorf( 2083 "Response was missing Being.__typename") 2084 default: 2085 return fmt.Errorf( 2086 `Unexpected concrete type for queryWithInterfaceListFieldBeingsBeing: "%v"`, tn.TypeName) 2087 } 2088 } 2089 2090 func __marshalqueryWithInterfaceListFieldBeingsBeing(v *queryWithInterfaceListFieldBeingsBeing) ([]byte, error) { 2091 2092 var typename string 2093 switch v := (*v).(type) { 2094 case *queryWithInterfaceListFieldBeingsUser: 2095 typename = "User" 2096 2097 result := struct { 2098 TypeName string `json:"__typename"` 2099 *queryWithInterfaceListFieldBeingsUser 2100 }{typename, v} 2101 return json.Marshal(result) 2102 case *queryWithInterfaceListFieldBeingsAnimal: 2103 typename = "Animal" 2104 2105 result := struct { 2106 TypeName string `json:"__typename"` 2107 *queryWithInterfaceListFieldBeingsAnimal 2108 }{typename, v} 2109 return json.Marshal(result) 2110 case nil: 2111 return []byte("null"), nil 2112 default: 2113 return nil, fmt.Errorf( 2114 `Unexpected concrete type for queryWithInterfaceListFieldBeingsBeing: "%T"`, v) 2115 } 2116 } 2117 2118 // queryWithInterfaceListFieldBeingsUser includes the requested fields of the GraphQL type User. 2119 type queryWithInterfaceListFieldBeingsUser struct { 2120 Typename string `json:"__typename"` 2121 Id string `json:"id"` 2122 Name string `json:"name"` 2123 } 2124 2125 // GetTypename returns queryWithInterfaceListFieldBeingsUser.Typename, and is useful for accessing the field via an interface. 2126 func (v *queryWithInterfaceListFieldBeingsUser) GetTypename() string { return v.Typename } 2127 2128 // GetId returns queryWithInterfaceListFieldBeingsUser.Id, and is useful for accessing the field via an interface. 2129 func (v *queryWithInterfaceListFieldBeingsUser) GetId() string { return v.Id } 2130 2131 // GetName returns queryWithInterfaceListFieldBeingsUser.Name, and is useful for accessing the field via an interface. 2132 func (v *queryWithInterfaceListFieldBeingsUser) GetName() string { return v.Name } 2133 2134 // queryWithInterfaceListFieldResponse is returned by queryWithInterfaceListField on success. 2135 type queryWithInterfaceListFieldResponse struct { 2136 Beings []queryWithInterfaceListFieldBeingsBeing `json:"-"` 2137 } 2138 2139 // GetBeings returns queryWithInterfaceListFieldResponse.Beings, and is useful for accessing the field via an interface. 2140 func (v *queryWithInterfaceListFieldResponse) GetBeings() []queryWithInterfaceListFieldBeingsBeing { 2141 return v.Beings 2142 } 2143 2144 func (v *queryWithInterfaceListFieldResponse) UnmarshalJSON(b []byte) error { 2145 2146 if string(b) == "null" { 2147 return nil 2148 } 2149 2150 var firstPass struct { 2151 *queryWithInterfaceListFieldResponse 2152 Beings []json.RawMessage `json:"beings"` 2153 graphql.NoUnmarshalJSON 2154 } 2155 firstPass.queryWithInterfaceListFieldResponse = v 2156 2157 err := json.Unmarshal(b, &firstPass) 2158 if err != nil { 2159 return err 2160 } 2161 2162 { 2163 dst := &v.Beings 2164 src := firstPass.Beings 2165 *dst = make( 2166 []queryWithInterfaceListFieldBeingsBeing, 2167 len(src)) 2168 for i, src := range src { 2169 dst := &(*dst)[i] 2170 if len(src) != 0 && string(src) != "null" { 2171 err = __unmarshalqueryWithInterfaceListFieldBeingsBeing( 2172 src, dst) 2173 if err != nil { 2174 return fmt.Errorf( 2175 "Unable to unmarshal queryWithInterfaceListFieldResponse.Beings: %w", err) 2176 } 2177 } 2178 } 2179 } 2180 return nil 2181 } 2182 2183 type __premarshalqueryWithInterfaceListFieldResponse struct { 2184 Beings []json.RawMessage `json:"beings"` 2185 } 2186 2187 func (v *queryWithInterfaceListFieldResponse) MarshalJSON() ([]byte, error) { 2188 premarshaled, err := v.__premarshalJSON() 2189 if err != nil { 2190 return nil, err 2191 } 2192 return json.Marshal(premarshaled) 2193 } 2194 2195 func (v *queryWithInterfaceListFieldResponse) __premarshalJSON() (*__premarshalqueryWithInterfaceListFieldResponse, error) { 2196 var retval __premarshalqueryWithInterfaceListFieldResponse 2197 2198 { 2199 2200 dst := &retval.Beings 2201 src := v.Beings 2202 *dst = make( 2203 []json.RawMessage, 2204 len(src)) 2205 for i, src := range src { 2206 dst := &(*dst)[i] 2207 var err error 2208 *dst, err = __marshalqueryWithInterfaceListFieldBeingsBeing( 2209 &src) 2210 if err != nil { 2211 return nil, fmt.Errorf( 2212 "Unable to marshal queryWithInterfaceListFieldResponse.Beings: %w", err) 2213 } 2214 } 2215 } 2216 return &retval, nil 2217 } 2218 2219 // queryWithInterfaceListPointerFieldBeingsAnimal includes the requested fields of the GraphQL type Animal. 2220 type queryWithInterfaceListPointerFieldBeingsAnimal struct { 2221 Typename string `json:"__typename"` 2222 Id string `json:"id"` 2223 Name string `json:"name"` 2224 } 2225 2226 // GetTypename returns queryWithInterfaceListPointerFieldBeingsAnimal.Typename, and is useful for accessing the field via an interface. 2227 func (v *queryWithInterfaceListPointerFieldBeingsAnimal) GetTypename() string { return v.Typename } 2228 2229 // GetId returns queryWithInterfaceListPointerFieldBeingsAnimal.Id, and is useful for accessing the field via an interface. 2230 func (v *queryWithInterfaceListPointerFieldBeingsAnimal) GetId() string { return v.Id } 2231 2232 // GetName returns queryWithInterfaceListPointerFieldBeingsAnimal.Name, and is useful for accessing the field via an interface. 2233 func (v *queryWithInterfaceListPointerFieldBeingsAnimal) GetName() string { return v.Name } 2234 2235 // queryWithInterfaceListPointerFieldBeingsBeing includes the requested fields of the GraphQL interface Being. 2236 // 2237 // queryWithInterfaceListPointerFieldBeingsBeing is implemented by the following types: 2238 // queryWithInterfaceListPointerFieldBeingsUser 2239 // queryWithInterfaceListPointerFieldBeingsAnimal 2240 type queryWithInterfaceListPointerFieldBeingsBeing interface { 2241 implementsGraphQLInterfacequeryWithInterfaceListPointerFieldBeingsBeing() 2242 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 2243 GetTypename() string 2244 // GetId returns the interface-field "id" from its implementation. 2245 GetId() string 2246 // GetName returns the interface-field "name" from its implementation. 2247 GetName() string 2248 } 2249 2250 func (v *queryWithInterfaceListPointerFieldBeingsUser) implementsGraphQLInterfacequeryWithInterfaceListPointerFieldBeingsBeing() { 2251 } 2252 func (v *queryWithInterfaceListPointerFieldBeingsAnimal) implementsGraphQLInterfacequeryWithInterfaceListPointerFieldBeingsBeing() { 2253 } 2254 2255 func __unmarshalqueryWithInterfaceListPointerFieldBeingsBeing(b []byte, v *queryWithInterfaceListPointerFieldBeingsBeing) error { 2256 if string(b) == "null" { 2257 return nil 2258 } 2259 2260 var tn struct { 2261 TypeName string `json:"__typename"` 2262 } 2263 err := json.Unmarshal(b, &tn) 2264 if err != nil { 2265 return err 2266 } 2267 2268 switch tn.TypeName { 2269 case "User": 2270 *v = new(queryWithInterfaceListPointerFieldBeingsUser) 2271 return json.Unmarshal(b, *v) 2272 case "Animal": 2273 *v = new(queryWithInterfaceListPointerFieldBeingsAnimal) 2274 return json.Unmarshal(b, *v) 2275 case "": 2276 return fmt.Errorf( 2277 "Response was missing Being.__typename") 2278 default: 2279 return fmt.Errorf( 2280 `Unexpected concrete type for queryWithInterfaceListPointerFieldBeingsBeing: "%v"`, tn.TypeName) 2281 } 2282 } 2283 2284 func __marshalqueryWithInterfaceListPointerFieldBeingsBeing(v *queryWithInterfaceListPointerFieldBeingsBeing) ([]byte, error) { 2285 2286 var typename string 2287 switch v := (*v).(type) { 2288 case *queryWithInterfaceListPointerFieldBeingsUser: 2289 typename = "User" 2290 2291 result := struct { 2292 TypeName string `json:"__typename"` 2293 *queryWithInterfaceListPointerFieldBeingsUser 2294 }{typename, v} 2295 return json.Marshal(result) 2296 case *queryWithInterfaceListPointerFieldBeingsAnimal: 2297 typename = "Animal" 2298 2299 result := struct { 2300 TypeName string `json:"__typename"` 2301 *queryWithInterfaceListPointerFieldBeingsAnimal 2302 }{typename, v} 2303 return json.Marshal(result) 2304 case nil: 2305 return []byte("null"), nil 2306 default: 2307 return nil, fmt.Errorf( 2308 `Unexpected concrete type for queryWithInterfaceListPointerFieldBeingsBeing: "%T"`, v) 2309 } 2310 } 2311 2312 // queryWithInterfaceListPointerFieldBeingsUser includes the requested fields of the GraphQL type User. 2313 type queryWithInterfaceListPointerFieldBeingsUser struct { 2314 Typename string `json:"__typename"` 2315 Id string `json:"id"` 2316 Name string `json:"name"` 2317 } 2318 2319 // GetTypename returns queryWithInterfaceListPointerFieldBeingsUser.Typename, and is useful for accessing the field via an interface. 2320 func (v *queryWithInterfaceListPointerFieldBeingsUser) GetTypename() string { return v.Typename } 2321 2322 // GetId returns queryWithInterfaceListPointerFieldBeingsUser.Id, and is useful for accessing the field via an interface. 2323 func (v *queryWithInterfaceListPointerFieldBeingsUser) GetId() string { return v.Id } 2324 2325 // GetName returns queryWithInterfaceListPointerFieldBeingsUser.Name, and is useful for accessing the field via an interface. 2326 func (v *queryWithInterfaceListPointerFieldBeingsUser) GetName() string { return v.Name } 2327 2328 // queryWithInterfaceListPointerFieldResponse is returned by queryWithInterfaceListPointerField on success. 2329 type queryWithInterfaceListPointerFieldResponse struct { 2330 Beings []*queryWithInterfaceListPointerFieldBeingsBeing `json:"-"` 2331 } 2332 2333 // GetBeings returns queryWithInterfaceListPointerFieldResponse.Beings, and is useful for accessing the field via an interface. 2334 func (v *queryWithInterfaceListPointerFieldResponse) GetBeings() []*queryWithInterfaceListPointerFieldBeingsBeing { 2335 return v.Beings 2336 } 2337 2338 func (v *queryWithInterfaceListPointerFieldResponse) UnmarshalJSON(b []byte) error { 2339 2340 if string(b) == "null" { 2341 return nil 2342 } 2343 2344 var firstPass struct { 2345 *queryWithInterfaceListPointerFieldResponse 2346 Beings []json.RawMessage `json:"beings"` 2347 graphql.NoUnmarshalJSON 2348 } 2349 firstPass.queryWithInterfaceListPointerFieldResponse = v 2350 2351 err := json.Unmarshal(b, &firstPass) 2352 if err != nil { 2353 return err 2354 } 2355 2356 { 2357 dst := &v.Beings 2358 src := firstPass.Beings 2359 *dst = make( 2360 []*queryWithInterfaceListPointerFieldBeingsBeing, 2361 len(src)) 2362 for i, src := range src { 2363 dst := &(*dst)[i] 2364 if len(src) != 0 && string(src) != "null" { 2365 *dst = new(queryWithInterfaceListPointerFieldBeingsBeing) 2366 err = __unmarshalqueryWithInterfaceListPointerFieldBeingsBeing( 2367 src, *dst) 2368 if err != nil { 2369 return fmt.Errorf( 2370 "Unable to unmarshal queryWithInterfaceListPointerFieldResponse.Beings: %w", err) 2371 } 2372 } 2373 } 2374 } 2375 return nil 2376 } 2377 2378 type __premarshalqueryWithInterfaceListPointerFieldResponse struct { 2379 Beings []json.RawMessage `json:"beings"` 2380 } 2381 2382 func (v *queryWithInterfaceListPointerFieldResponse) MarshalJSON() ([]byte, error) { 2383 premarshaled, err := v.__premarshalJSON() 2384 if err != nil { 2385 return nil, err 2386 } 2387 return json.Marshal(premarshaled) 2388 } 2389 2390 func (v *queryWithInterfaceListPointerFieldResponse) __premarshalJSON() (*__premarshalqueryWithInterfaceListPointerFieldResponse, error) { 2391 var retval __premarshalqueryWithInterfaceListPointerFieldResponse 2392 2393 { 2394 2395 dst := &retval.Beings 2396 src := v.Beings 2397 *dst = make( 2398 []json.RawMessage, 2399 len(src)) 2400 for i, src := range src { 2401 dst := &(*dst)[i] 2402 if src != nil { 2403 var err error 2404 *dst, err = __marshalqueryWithInterfaceListPointerFieldBeingsBeing( 2405 src) 2406 if err != nil { 2407 return nil, fmt.Errorf( 2408 "Unable to marshal queryWithInterfaceListPointerFieldResponse.Beings: %w", err) 2409 } 2410 } 2411 } 2412 } 2413 return &retval, nil 2414 } 2415 2416 // queryWithInterfaceNoFragmentsBeing includes the requested fields of the GraphQL interface Being. 2417 // 2418 // queryWithInterfaceNoFragmentsBeing is implemented by the following types: 2419 // queryWithInterfaceNoFragmentsBeingUser 2420 // queryWithInterfaceNoFragmentsBeingAnimal 2421 type queryWithInterfaceNoFragmentsBeing interface { 2422 implementsGraphQLInterfacequeryWithInterfaceNoFragmentsBeing() 2423 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 2424 GetTypename() string 2425 // GetId returns the interface-field "id" from its implementation. 2426 GetId() string 2427 // GetName returns the interface-field "name" from its implementation. 2428 GetName() string 2429 } 2430 2431 func (v *queryWithInterfaceNoFragmentsBeingUser) implementsGraphQLInterfacequeryWithInterfaceNoFragmentsBeing() { 2432 } 2433 func (v *queryWithInterfaceNoFragmentsBeingAnimal) implementsGraphQLInterfacequeryWithInterfaceNoFragmentsBeing() { 2434 } 2435 2436 func __unmarshalqueryWithInterfaceNoFragmentsBeing(b []byte, v *queryWithInterfaceNoFragmentsBeing) error { 2437 if string(b) == "null" { 2438 return nil 2439 } 2440 2441 var tn struct { 2442 TypeName string `json:"__typename"` 2443 } 2444 err := json.Unmarshal(b, &tn) 2445 if err != nil { 2446 return err 2447 } 2448 2449 switch tn.TypeName { 2450 case "User": 2451 *v = new(queryWithInterfaceNoFragmentsBeingUser) 2452 return json.Unmarshal(b, *v) 2453 case "Animal": 2454 *v = new(queryWithInterfaceNoFragmentsBeingAnimal) 2455 return json.Unmarshal(b, *v) 2456 case "": 2457 return fmt.Errorf( 2458 "Response was missing Being.__typename") 2459 default: 2460 return fmt.Errorf( 2461 `Unexpected concrete type for queryWithInterfaceNoFragmentsBeing: "%v"`, tn.TypeName) 2462 } 2463 } 2464 2465 func __marshalqueryWithInterfaceNoFragmentsBeing(v *queryWithInterfaceNoFragmentsBeing) ([]byte, error) { 2466 2467 var typename string 2468 switch v := (*v).(type) { 2469 case *queryWithInterfaceNoFragmentsBeingUser: 2470 typename = "User" 2471 2472 result := struct { 2473 TypeName string `json:"__typename"` 2474 *queryWithInterfaceNoFragmentsBeingUser 2475 }{typename, v} 2476 return json.Marshal(result) 2477 case *queryWithInterfaceNoFragmentsBeingAnimal: 2478 typename = "Animal" 2479 2480 result := struct { 2481 TypeName string `json:"__typename"` 2482 *queryWithInterfaceNoFragmentsBeingAnimal 2483 }{typename, v} 2484 return json.Marshal(result) 2485 case nil: 2486 return []byte("null"), nil 2487 default: 2488 return nil, fmt.Errorf( 2489 `Unexpected concrete type for queryWithInterfaceNoFragmentsBeing: "%T"`, v) 2490 } 2491 } 2492 2493 // queryWithInterfaceNoFragmentsBeingAnimal includes the requested fields of the GraphQL type Animal. 2494 type queryWithInterfaceNoFragmentsBeingAnimal struct { 2495 Typename string `json:"__typename"` 2496 Id string `json:"id"` 2497 Name string `json:"name"` 2498 } 2499 2500 // GetTypename returns queryWithInterfaceNoFragmentsBeingAnimal.Typename, and is useful for accessing the field via an interface. 2501 func (v *queryWithInterfaceNoFragmentsBeingAnimal) GetTypename() string { return v.Typename } 2502 2503 // GetId returns queryWithInterfaceNoFragmentsBeingAnimal.Id, and is useful for accessing the field via an interface. 2504 func (v *queryWithInterfaceNoFragmentsBeingAnimal) GetId() string { return v.Id } 2505 2506 // GetName returns queryWithInterfaceNoFragmentsBeingAnimal.Name, and is useful for accessing the field via an interface. 2507 func (v *queryWithInterfaceNoFragmentsBeingAnimal) GetName() string { return v.Name } 2508 2509 // queryWithInterfaceNoFragmentsBeingUser includes the requested fields of the GraphQL type User. 2510 type queryWithInterfaceNoFragmentsBeingUser struct { 2511 Typename string `json:"__typename"` 2512 Id string `json:"id"` 2513 Name string `json:"name"` 2514 } 2515 2516 // GetTypename returns queryWithInterfaceNoFragmentsBeingUser.Typename, and is useful for accessing the field via an interface. 2517 func (v *queryWithInterfaceNoFragmentsBeingUser) GetTypename() string { return v.Typename } 2518 2519 // GetId returns queryWithInterfaceNoFragmentsBeingUser.Id, and is useful for accessing the field via an interface. 2520 func (v *queryWithInterfaceNoFragmentsBeingUser) GetId() string { return v.Id } 2521 2522 // GetName returns queryWithInterfaceNoFragmentsBeingUser.Name, and is useful for accessing the field via an interface. 2523 func (v *queryWithInterfaceNoFragmentsBeingUser) GetName() string { return v.Name } 2524 2525 // queryWithInterfaceNoFragmentsMeUser includes the requested fields of the GraphQL type User. 2526 type queryWithInterfaceNoFragmentsMeUser struct { 2527 Id string `json:"id"` 2528 Name string `json:"name"` 2529 } 2530 2531 // GetId returns queryWithInterfaceNoFragmentsMeUser.Id, and is useful for accessing the field via an interface. 2532 func (v *queryWithInterfaceNoFragmentsMeUser) GetId() string { return v.Id } 2533 2534 // GetName returns queryWithInterfaceNoFragmentsMeUser.Name, and is useful for accessing the field via an interface. 2535 func (v *queryWithInterfaceNoFragmentsMeUser) GetName() string { return v.Name } 2536 2537 // queryWithInterfaceNoFragmentsResponse is returned by queryWithInterfaceNoFragments on success. 2538 type queryWithInterfaceNoFragmentsResponse struct { 2539 Being queryWithInterfaceNoFragmentsBeing `json:"-"` 2540 Me queryWithInterfaceNoFragmentsMeUser `json:"me"` 2541 } 2542 2543 // GetBeing returns queryWithInterfaceNoFragmentsResponse.Being, and is useful for accessing the field via an interface. 2544 func (v *queryWithInterfaceNoFragmentsResponse) GetBeing() queryWithInterfaceNoFragmentsBeing { 2545 return v.Being 2546 } 2547 2548 // GetMe returns queryWithInterfaceNoFragmentsResponse.Me, and is useful for accessing the field via an interface. 2549 func (v *queryWithInterfaceNoFragmentsResponse) GetMe() queryWithInterfaceNoFragmentsMeUser { 2550 return v.Me 2551 } 2552 2553 func (v *queryWithInterfaceNoFragmentsResponse) UnmarshalJSON(b []byte) error { 2554 2555 if string(b) == "null" { 2556 return nil 2557 } 2558 2559 var firstPass struct { 2560 *queryWithInterfaceNoFragmentsResponse 2561 Being json.RawMessage `json:"being"` 2562 graphql.NoUnmarshalJSON 2563 } 2564 firstPass.queryWithInterfaceNoFragmentsResponse = v 2565 2566 err := json.Unmarshal(b, &firstPass) 2567 if err != nil { 2568 return err 2569 } 2570 2571 { 2572 dst := &v.Being 2573 src := firstPass.Being 2574 if len(src) != 0 && string(src) != "null" { 2575 err = __unmarshalqueryWithInterfaceNoFragmentsBeing( 2576 src, dst) 2577 if err != nil { 2578 return fmt.Errorf( 2579 "Unable to unmarshal queryWithInterfaceNoFragmentsResponse.Being: %w", err) 2580 } 2581 } 2582 } 2583 return nil 2584 } 2585 2586 type __premarshalqueryWithInterfaceNoFragmentsResponse struct { 2587 Being json.RawMessage `json:"being"` 2588 2589 Me queryWithInterfaceNoFragmentsMeUser `json:"me"` 2590 } 2591 2592 func (v *queryWithInterfaceNoFragmentsResponse) MarshalJSON() ([]byte, error) { 2593 premarshaled, err := v.__premarshalJSON() 2594 if err != nil { 2595 return nil, err 2596 } 2597 return json.Marshal(premarshaled) 2598 } 2599 2600 func (v *queryWithInterfaceNoFragmentsResponse) __premarshalJSON() (*__premarshalqueryWithInterfaceNoFragmentsResponse, error) { 2601 var retval __premarshalqueryWithInterfaceNoFragmentsResponse 2602 2603 { 2604 2605 dst := &retval.Being 2606 src := v.Being 2607 var err error 2608 *dst, err = __marshalqueryWithInterfaceNoFragmentsBeing( 2609 &src) 2610 if err != nil { 2611 return nil, fmt.Errorf( 2612 "Unable to marshal queryWithInterfaceNoFragmentsResponse.Being: %w", err) 2613 } 2614 } 2615 retval.Me = v.Me 2616 return &retval, nil 2617 } 2618 2619 // queryWithNamedFragmentsBeingsAnimal includes the requested fields of the GraphQL type Animal. 2620 type queryWithNamedFragmentsBeingsAnimal struct { 2621 Typename string `json:"__typename"` 2622 Id string `json:"id"` 2623 AnimalFields `json:"-"` 2624 } 2625 2626 // GetTypename returns queryWithNamedFragmentsBeingsAnimal.Typename, and is useful for accessing the field via an interface. 2627 func (v *queryWithNamedFragmentsBeingsAnimal) GetTypename() string { return v.Typename } 2628 2629 // GetId returns queryWithNamedFragmentsBeingsAnimal.Id, and is useful for accessing the field via an interface. 2630 func (v *queryWithNamedFragmentsBeingsAnimal) GetId() string { return v.Id } 2631 2632 // GetHair returns queryWithNamedFragmentsBeingsAnimal.Hair, and is useful for accessing the field via an interface. 2633 func (v *queryWithNamedFragmentsBeingsAnimal) GetHair() AnimalFieldsHairBeingsHair { 2634 return v.AnimalFields.Hair 2635 } 2636 2637 // GetOwner returns queryWithNamedFragmentsBeingsAnimal.Owner, and is useful for accessing the field via an interface. 2638 func (v *queryWithNamedFragmentsBeingsAnimal) GetOwner() AnimalFieldsOwnerBeing { 2639 return v.AnimalFields.Owner 2640 } 2641 2642 func (v *queryWithNamedFragmentsBeingsAnimal) UnmarshalJSON(b []byte) error { 2643 2644 if string(b) == "null" { 2645 return nil 2646 } 2647 2648 var firstPass struct { 2649 *queryWithNamedFragmentsBeingsAnimal 2650 graphql.NoUnmarshalJSON 2651 } 2652 firstPass.queryWithNamedFragmentsBeingsAnimal = v 2653 2654 err := json.Unmarshal(b, &firstPass) 2655 if err != nil { 2656 return err 2657 } 2658 2659 err = json.Unmarshal( 2660 b, &v.AnimalFields) 2661 if err != nil { 2662 return err 2663 } 2664 return nil 2665 } 2666 2667 type __premarshalqueryWithNamedFragmentsBeingsAnimal struct { 2668 Typename string `json:"__typename"` 2669 2670 Id string `json:"id"` 2671 2672 Hair AnimalFieldsHairBeingsHair `json:"hair"` 2673 2674 Owner json.RawMessage `json:"owner"` 2675 } 2676 2677 func (v *queryWithNamedFragmentsBeingsAnimal) MarshalJSON() ([]byte, error) { 2678 premarshaled, err := v.__premarshalJSON() 2679 if err != nil { 2680 return nil, err 2681 } 2682 return json.Marshal(premarshaled) 2683 } 2684 2685 func (v *queryWithNamedFragmentsBeingsAnimal) __premarshalJSON() (*__premarshalqueryWithNamedFragmentsBeingsAnimal, error) { 2686 var retval __premarshalqueryWithNamedFragmentsBeingsAnimal 2687 2688 retval.Typename = v.Typename 2689 retval.Id = v.Id 2690 retval.Hair = v.AnimalFields.Hair 2691 { 2692 2693 dst := &retval.Owner 2694 src := v.AnimalFields.Owner 2695 var err error 2696 *dst, err = __marshalAnimalFieldsOwnerBeing( 2697 &src) 2698 if err != nil { 2699 return nil, fmt.Errorf( 2700 "Unable to marshal queryWithNamedFragmentsBeingsAnimal.AnimalFields.Owner: %w", err) 2701 } 2702 } 2703 return &retval, nil 2704 } 2705 2706 // queryWithNamedFragmentsBeingsBeing includes the requested fields of the GraphQL interface Being. 2707 // 2708 // queryWithNamedFragmentsBeingsBeing is implemented by the following types: 2709 // queryWithNamedFragmentsBeingsUser 2710 // queryWithNamedFragmentsBeingsAnimal 2711 type queryWithNamedFragmentsBeingsBeing interface { 2712 implementsGraphQLInterfacequeryWithNamedFragmentsBeingsBeing() 2713 // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). 2714 GetTypename() string 2715 // GetId returns the interface-field "id" from its implementation. 2716 GetId() string 2717 } 2718 2719 func (v *queryWithNamedFragmentsBeingsUser) implementsGraphQLInterfacequeryWithNamedFragmentsBeingsBeing() { 2720 } 2721 func (v *queryWithNamedFragmentsBeingsAnimal) implementsGraphQLInterfacequeryWithNamedFragmentsBeingsBeing() { 2722 } 2723 2724 func __unmarshalqueryWithNamedFragmentsBeingsBeing(b []byte, v *queryWithNamedFragmentsBeingsBeing) error { 2725 if string(b) == "null" { 2726 return nil 2727 } 2728 2729 var tn struct { 2730 TypeName string `json:"__typename"` 2731 } 2732 err := json.Unmarshal(b, &tn) 2733 if err != nil { 2734 return err 2735 } 2736 2737 switch tn.TypeName { 2738 case "User": 2739 *v = new(queryWithNamedFragmentsBeingsUser) 2740 return json.Unmarshal(b, *v) 2741 case "Animal": 2742 *v = new(queryWithNamedFragmentsBeingsAnimal) 2743 return json.Unmarshal(b, *v) 2744 case "": 2745 return fmt.Errorf( 2746 "Response was missing Being.__typename") 2747 default: 2748 return fmt.Errorf( 2749 `Unexpected concrete type for queryWithNamedFragmentsBeingsBeing: "%v"`, tn.TypeName) 2750 } 2751 } 2752 2753 func __marshalqueryWithNamedFragmentsBeingsBeing(v *queryWithNamedFragmentsBeingsBeing) ([]byte, error) { 2754 2755 var typename string 2756 switch v := (*v).(type) { 2757 case *queryWithNamedFragmentsBeingsUser: 2758 typename = "User" 2759 2760 premarshaled, err := v.__premarshalJSON() 2761 if err != nil { 2762 return nil, err 2763 } 2764 result := struct { 2765 TypeName string `json:"__typename"` 2766 *__premarshalqueryWithNamedFragmentsBeingsUser 2767 }{typename, premarshaled} 2768 return json.Marshal(result) 2769 case *queryWithNamedFragmentsBeingsAnimal: 2770 typename = "Animal" 2771 2772 premarshaled, err := v.__premarshalJSON() 2773 if err != nil { 2774 return nil, err 2775 } 2776 result := struct { 2777 TypeName string `json:"__typename"` 2778 *__premarshalqueryWithNamedFragmentsBeingsAnimal 2779 }{typename, premarshaled} 2780 return json.Marshal(result) 2781 case nil: 2782 return []byte("null"), nil 2783 default: 2784 return nil, fmt.Errorf( 2785 `Unexpected concrete type for queryWithNamedFragmentsBeingsBeing: "%T"`, v) 2786 } 2787 } 2788 2789 // queryWithNamedFragmentsBeingsUser includes the requested fields of the GraphQL type User. 2790 type queryWithNamedFragmentsBeingsUser struct { 2791 Typename string `json:"__typename"` 2792 Id string `json:"id"` 2793 UserFields `json:"-"` 2794 } 2795 2796 // GetTypename returns queryWithNamedFragmentsBeingsUser.Typename, and is useful for accessing the field via an interface. 2797 func (v *queryWithNamedFragmentsBeingsUser) GetTypename() string { return v.Typename } 2798 2799 // GetId returns queryWithNamedFragmentsBeingsUser.Id, and is useful for accessing the field via an interface. 2800 func (v *queryWithNamedFragmentsBeingsUser) GetId() string { return v.Id } 2801 2802 // GetLuckyNumber returns queryWithNamedFragmentsBeingsUser.LuckyNumber, and is useful for accessing the field via an interface. 2803 func (v *queryWithNamedFragmentsBeingsUser) GetLuckyNumber() int { 2804 return v.UserFields.LuckyFieldsUser.LuckyNumber 2805 } 2806 2807 // GetHair returns queryWithNamedFragmentsBeingsUser.Hair, and is useful for accessing the field via an interface. 2808 func (v *queryWithNamedFragmentsBeingsUser) GetHair() MoreUserFieldsHair { 2809 return v.UserFields.MoreUserFields.Hair 2810 } 2811 2812 func (v *queryWithNamedFragmentsBeingsUser) UnmarshalJSON(b []byte) error { 2813 2814 if string(b) == "null" { 2815 return nil 2816 } 2817 2818 var firstPass struct { 2819 *queryWithNamedFragmentsBeingsUser 2820 graphql.NoUnmarshalJSON 2821 } 2822 firstPass.queryWithNamedFragmentsBeingsUser = v 2823 2824 err := json.Unmarshal(b, &firstPass) 2825 if err != nil { 2826 return err 2827 } 2828 2829 err = json.Unmarshal( 2830 b, &v.UserFields) 2831 if err != nil { 2832 return err 2833 } 2834 return nil 2835 } 2836 2837 type __premarshalqueryWithNamedFragmentsBeingsUser struct { 2838 Typename string `json:"__typename"` 2839 2840 Id string `json:"id"` 2841 2842 LuckyNumber int `json:"luckyNumber"` 2843 2844 Hair MoreUserFieldsHair `json:"hair"` 2845 } 2846 2847 func (v *queryWithNamedFragmentsBeingsUser) MarshalJSON() ([]byte, error) { 2848 premarshaled, err := v.__premarshalJSON() 2849 if err != nil { 2850 return nil, err 2851 } 2852 return json.Marshal(premarshaled) 2853 } 2854 2855 func (v *queryWithNamedFragmentsBeingsUser) __premarshalJSON() (*__premarshalqueryWithNamedFragmentsBeingsUser, error) { 2856 var retval __premarshalqueryWithNamedFragmentsBeingsUser 2857 2858 retval.Typename = v.Typename 2859 retval.Id = v.Id 2860 retval.LuckyNumber = v.UserFields.LuckyFieldsUser.LuckyNumber 2861 retval.Hair = v.UserFields.MoreUserFields.Hair 2862 return &retval, nil 2863 } 2864 2865 // queryWithNamedFragmentsResponse is returned by queryWithNamedFragments on success. 2866 type queryWithNamedFragmentsResponse struct { 2867 Beings []queryWithNamedFragmentsBeingsBeing `json:"-"` 2868 } 2869 2870 // GetBeings returns queryWithNamedFragmentsResponse.Beings, and is useful for accessing the field via an interface. 2871 func (v *queryWithNamedFragmentsResponse) GetBeings() []queryWithNamedFragmentsBeingsBeing { 2872 return v.Beings 2873 } 2874 2875 func (v *queryWithNamedFragmentsResponse) UnmarshalJSON(b []byte) error { 2876 2877 if string(b) == "null" { 2878 return nil 2879 } 2880 2881 var firstPass struct { 2882 *queryWithNamedFragmentsResponse 2883 Beings []json.RawMessage `json:"beings"` 2884 graphql.NoUnmarshalJSON 2885 } 2886 firstPass.queryWithNamedFragmentsResponse = v 2887 2888 err := json.Unmarshal(b, &firstPass) 2889 if err != nil { 2890 return err 2891 } 2892 2893 { 2894 dst := &v.Beings 2895 src := firstPass.Beings 2896 *dst = make( 2897 []queryWithNamedFragmentsBeingsBeing, 2898 len(src)) 2899 for i, src := range src { 2900 dst := &(*dst)[i] 2901 if len(src) != 0 && string(src) != "null" { 2902 err = __unmarshalqueryWithNamedFragmentsBeingsBeing( 2903 src, dst) 2904 if err != nil { 2905 return fmt.Errorf( 2906 "Unable to unmarshal queryWithNamedFragmentsResponse.Beings: %w", err) 2907 } 2908 } 2909 } 2910 } 2911 return nil 2912 } 2913 2914 type __premarshalqueryWithNamedFragmentsResponse struct { 2915 Beings []json.RawMessage `json:"beings"` 2916 } 2917 2918 func (v *queryWithNamedFragmentsResponse) MarshalJSON() ([]byte, error) { 2919 premarshaled, err := v.__premarshalJSON() 2920 if err != nil { 2921 return nil, err 2922 } 2923 return json.Marshal(premarshaled) 2924 } 2925 2926 func (v *queryWithNamedFragmentsResponse) __premarshalJSON() (*__premarshalqueryWithNamedFragmentsResponse, error) { 2927 var retval __premarshalqueryWithNamedFragmentsResponse 2928 2929 { 2930 2931 dst := &retval.Beings 2932 src := v.Beings 2933 *dst = make( 2934 []json.RawMessage, 2935 len(src)) 2936 for i, src := range src { 2937 dst := &(*dst)[i] 2938 var err error 2939 *dst, err = __marshalqueryWithNamedFragmentsBeingsBeing( 2940 &src) 2941 if err != nil { 2942 return nil, fmt.Errorf( 2943 "Unable to marshal queryWithNamedFragmentsResponse.Beings: %w", err) 2944 } 2945 } 2946 } 2947 return &retval, nil 2948 } 2949 2950 // queryWithOmitemptyResponse is returned by queryWithOmitempty on success. 2951 type queryWithOmitemptyResponse struct { 2952 User queryWithOmitemptyUser `json:"user"` 2953 } 2954 2955 // GetUser returns queryWithOmitemptyResponse.User, and is useful for accessing the field via an interface. 2956 func (v *queryWithOmitemptyResponse) GetUser() queryWithOmitemptyUser { return v.User } 2957 2958 // queryWithOmitemptyUser includes the requested fields of the GraphQL type User. 2959 type queryWithOmitemptyUser struct { 2960 Id string `json:"id"` 2961 Name string `json:"name"` 2962 LuckyNumber int `json:"luckyNumber"` 2963 } 2964 2965 // GetId returns queryWithOmitemptyUser.Id, and is useful for accessing the field via an interface. 2966 func (v *queryWithOmitemptyUser) GetId() string { return v.Id } 2967 2968 // GetName returns queryWithOmitemptyUser.Name, and is useful for accessing the field via an interface. 2969 func (v *queryWithOmitemptyUser) GetName() string { return v.Name } 2970 2971 // GetLuckyNumber returns queryWithOmitemptyUser.LuckyNumber, and is useful for accessing the field via an interface. 2972 func (v *queryWithOmitemptyUser) GetLuckyNumber() int { return v.LuckyNumber } 2973 2974 // queryWithVariablesResponse is returned by queryWithVariables on success. 2975 type queryWithVariablesResponse struct { 2976 User queryWithVariablesUser `json:"user"` 2977 } 2978 2979 // GetUser returns queryWithVariablesResponse.User, and is useful for accessing the field via an interface. 2980 func (v *queryWithVariablesResponse) GetUser() queryWithVariablesUser { return v.User } 2981 2982 // queryWithVariablesUser includes the requested fields of the GraphQL type User. 2983 type queryWithVariablesUser struct { 2984 Id string `json:"id"` 2985 Name string `json:"name"` 2986 LuckyNumber int `json:"luckyNumber"` 2987 } 2988 2989 // GetId returns queryWithVariablesUser.Id, and is useful for accessing the field via an interface. 2990 func (v *queryWithVariablesUser) GetId() string { return v.Id } 2991 2992 // GetName returns queryWithVariablesUser.Name, and is useful for accessing the field via an interface. 2993 func (v *queryWithVariablesUser) GetName() string { return v.Name } 2994 2995 // GetLuckyNumber returns queryWithVariablesUser.LuckyNumber, and is useful for accessing the field via an interface. 2996 func (v *queryWithVariablesUser) GetLuckyNumber() int { return v.LuckyNumber } 2997 2998 // simpleQueryMeUser includes the requested fields of the GraphQL type User. 2999 type simpleQueryMeUser struct { 3000 Id string `json:"id"` 3001 Name string `json:"name"` 3002 LuckyNumber int `json:"luckyNumber"` 3003 } 3004 3005 // GetId returns simpleQueryMeUser.Id, and is useful for accessing the field via an interface. 3006 func (v *simpleQueryMeUser) GetId() string { return v.Id } 3007 3008 // GetName returns simpleQueryMeUser.Name, and is useful for accessing the field via an interface. 3009 func (v *simpleQueryMeUser) GetName() string { return v.Name } 3010 3011 // GetLuckyNumber returns simpleQueryMeUser.LuckyNumber, and is useful for accessing the field via an interface. 3012 func (v *simpleQueryMeUser) GetLuckyNumber() int { return v.LuckyNumber } 3013 3014 // simpleQueryResponse is returned by simpleQuery on success. 3015 type simpleQueryResponse struct { 3016 Me simpleQueryMeUser `json:"me"` 3017 } 3018 3019 // GetMe returns simpleQueryResponse.Me, and is useful for accessing the field via an interface. 3020 func (v *simpleQueryResponse) GetMe() simpleQueryMeUser { return v.Me } 3021 3022 func simpleQuery( 3023 ctx context.Context, 3024 client graphql.Client, 3025 ) (*simpleQueryResponse, error) { 3026 var err error 3027 3028 var retval simpleQueryResponse 3029 err = client.MakeRequest( 3030 ctx, 3031 "simpleQuery", 3032 ` 3033 query simpleQuery { 3034 me { 3035 id 3036 name 3037 luckyNumber 3038 } 3039 } 3040 `, 3041 &retval, 3042 nil, 3043 ) 3044 return &retval, err 3045 } 3046 3047 func failingQuery( 3048 ctx context.Context, 3049 client graphql.Client, 3050 ) (*failingQueryResponse, error) { 3051 var err error 3052 3053 var retval failingQueryResponse 3054 err = client.MakeRequest( 3055 ctx, 3056 "failingQuery", 3057 ` 3058 query failingQuery { 3059 fail 3060 me { 3061 id 3062 } 3063 } 3064 `, 3065 &retval, 3066 nil, 3067 ) 3068 return &retval, err 3069 } 3070 3071 func queryWithVariables( 3072 ctx context.Context, 3073 client graphql.Client, 3074 id string, 3075 ) (*queryWithVariablesResponse, error) { 3076 __input := __queryWithVariablesInput{ 3077 Id: id, 3078 } 3079 var err error 3080 3081 var retval queryWithVariablesResponse 3082 err = client.MakeRequest( 3083 ctx, 3084 "queryWithVariables", 3085 ` 3086 query queryWithVariables ($id: ID!) { 3087 user(id: $id) { 3088 id 3089 name 3090 luckyNumber 3091 } 3092 } 3093 `, 3094 &retval, 3095 &__input, 3096 ) 3097 return &retval, err 3098 } 3099 3100 func queryWithOmitempty( 3101 ctx context.Context, 3102 client graphql.Client, 3103 id string, 3104 ) (*queryWithOmitemptyResponse, error) { 3105 __input := __queryWithOmitemptyInput{ 3106 Id: id, 3107 } 3108 var err error 3109 3110 var retval queryWithOmitemptyResponse 3111 err = client.MakeRequest( 3112 ctx, 3113 "queryWithOmitempty", 3114 ` 3115 query queryWithOmitempty ($id: ID) { 3116 user(id: $id) { 3117 id 3118 name 3119 luckyNumber 3120 } 3121 } 3122 `, 3123 &retval, 3124 &__input, 3125 ) 3126 return &retval, err 3127 } 3128 3129 func queryWithCustomMarshal( 3130 ctx context.Context, 3131 client graphql.Client, 3132 date time.Time, 3133 ) (*queryWithCustomMarshalResponse, error) { 3134 __input := __queryWithCustomMarshalInput{ 3135 Date: date, 3136 } 3137 var err error 3138 3139 var retval queryWithCustomMarshalResponse 3140 err = client.MakeRequest( 3141 ctx, 3142 "queryWithCustomMarshal", 3143 ` 3144 query queryWithCustomMarshal ($date: Date!) { 3145 usersBornOn(date: $date) { 3146 id 3147 name 3148 birthdate 3149 } 3150 } 3151 `, 3152 &retval, 3153 &__input, 3154 ) 3155 return &retval, err 3156 } 3157 3158 func queryWithCustomMarshalSlice( 3159 ctx context.Context, 3160 client graphql.Client, 3161 dates []time.Time, 3162 ) (*queryWithCustomMarshalSliceResponse, error) { 3163 __input := __queryWithCustomMarshalSliceInput{ 3164 Dates: dates, 3165 } 3166 var err error 3167 3168 var retval queryWithCustomMarshalSliceResponse 3169 err = client.MakeRequest( 3170 ctx, 3171 "queryWithCustomMarshalSlice", 3172 ` 3173 query queryWithCustomMarshalSlice ($dates: [Date!]!) { 3174 usersBornOnDates(dates: $dates) { 3175 id 3176 name 3177 birthdate 3178 } 3179 } 3180 `, 3181 &retval, 3182 &__input, 3183 ) 3184 return &retval, err 3185 } 3186 3187 func queryWithCustomMarshalOptional( 3188 ctx context.Context, 3189 client graphql.Client, 3190 date *time.Time, 3191 id *string, 3192 ) (*queryWithCustomMarshalOptionalResponse, error) { 3193 __input := __queryWithCustomMarshalOptionalInput{ 3194 Date: date, 3195 Id: id, 3196 } 3197 var err error 3198 3199 var retval queryWithCustomMarshalOptionalResponse 3200 err = client.MakeRequest( 3201 ctx, 3202 "queryWithCustomMarshalOptional", 3203 ` 3204 query queryWithCustomMarshalOptional ($date: Date, $id: ID) { 3205 userSearch(birthdate: $date, id: $id) { 3206 id 3207 name 3208 birthdate 3209 } 3210 } 3211 `, 3212 &retval, 3213 &__input, 3214 ) 3215 return &retval, err 3216 } 3217 3218 func queryWithInterfaceNoFragments( 3219 ctx context.Context, 3220 client graphql.Client, 3221 id string, 3222 ) (*queryWithInterfaceNoFragmentsResponse, error) { 3223 __input := __queryWithInterfaceNoFragmentsInput{ 3224 Id: id, 3225 } 3226 var err error 3227 3228 var retval queryWithInterfaceNoFragmentsResponse 3229 err = client.MakeRequest( 3230 ctx, 3231 "queryWithInterfaceNoFragments", 3232 ` 3233 query queryWithInterfaceNoFragments ($id: ID!) { 3234 being(id: $id) { 3235 __typename 3236 id 3237 name 3238 } 3239 me { 3240 id 3241 name 3242 } 3243 } 3244 `, 3245 &retval, 3246 &__input, 3247 ) 3248 return &retval, err 3249 } 3250 3251 func queryWithInterfaceListField( 3252 ctx context.Context, 3253 client graphql.Client, 3254 ids []string, 3255 ) (*queryWithInterfaceListFieldResponse, error) { 3256 __input := __queryWithInterfaceListFieldInput{ 3257 Ids: ids, 3258 } 3259 var err error 3260 3261 var retval queryWithInterfaceListFieldResponse 3262 err = client.MakeRequest( 3263 ctx, 3264 "queryWithInterfaceListField", 3265 ` 3266 query queryWithInterfaceListField ($ids: [ID!]!) { 3267 beings(ids: $ids) { 3268 __typename 3269 id 3270 name 3271 } 3272 } 3273 `, 3274 &retval, 3275 &__input, 3276 ) 3277 return &retval, err 3278 } 3279 3280 func queryWithInterfaceListPointerField( 3281 ctx context.Context, 3282 client graphql.Client, 3283 ids []string, 3284 ) (*queryWithInterfaceListPointerFieldResponse, error) { 3285 __input := __queryWithInterfaceListPointerFieldInput{ 3286 Ids: ids, 3287 } 3288 var err error 3289 3290 var retval queryWithInterfaceListPointerFieldResponse 3291 err = client.MakeRequest( 3292 ctx, 3293 "queryWithInterfaceListPointerField", 3294 ` 3295 query queryWithInterfaceListPointerField ($ids: [ID!]!) { 3296 beings(ids: $ids) { 3297 __typename 3298 id 3299 name 3300 } 3301 } 3302 `, 3303 &retval, 3304 &__input, 3305 ) 3306 return &retval, err 3307 } 3308 3309 func queryWithFragments( 3310 ctx context.Context, 3311 client graphql.Client, 3312 ids []string, 3313 ) (*queryWithFragmentsResponse, error) { 3314 __input := __queryWithFragmentsInput{ 3315 Ids: ids, 3316 } 3317 var err error 3318 3319 var retval queryWithFragmentsResponse 3320 err = client.MakeRequest( 3321 ctx, 3322 "queryWithFragments", 3323 ` 3324 query queryWithFragments ($ids: [ID!]!) { 3325 beings(ids: $ids) { 3326 __typename 3327 id 3328 ... on Being { 3329 id 3330 name 3331 } 3332 ... on Animal { 3333 id 3334 hair { 3335 hasHair 3336 } 3337 species 3338 owner { 3339 __typename 3340 id 3341 ... on Being { 3342 name 3343 } 3344 ... on User { 3345 luckyNumber 3346 } 3347 } 3348 } 3349 ... on Lucky { 3350 luckyNumber 3351 } 3352 ... on User { 3353 hair { 3354 color 3355 } 3356 } 3357 } 3358 } 3359 `, 3360 &retval, 3361 &__input, 3362 ) 3363 return &retval, err 3364 } 3365 3366 func queryWithNamedFragments( 3367 ctx context.Context, 3368 client graphql.Client, 3369 ids []string, 3370 ) (*queryWithNamedFragmentsResponse, error) { 3371 __input := __queryWithNamedFragmentsInput{ 3372 Ids: ids, 3373 } 3374 var err error 3375 3376 var retval queryWithNamedFragmentsResponse 3377 err = client.MakeRequest( 3378 ctx, 3379 "queryWithNamedFragments", 3380 ` 3381 query queryWithNamedFragments ($ids: [ID!]!) { 3382 beings(ids: $ids) { 3383 __typename 3384 id 3385 ... AnimalFields 3386 ... UserFields 3387 } 3388 } 3389 fragment AnimalFields on Animal { 3390 id 3391 hair { 3392 hasHair 3393 } 3394 owner { 3395 __typename 3396 id 3397 ... UserFields 3398 ... LuckyFields 3399 } 3400 } 3401 fragment UserFields on User { 3402 id 3403 ... LuckyFields 3404 ... MoreUserFields 3405 } 3406 fragment LuckyFields on Lucky { 3407 ... MoreUserFields 3408 luckyNumber 3409 } 3410 fragment MoreUserFields on User { 3411 id 3412 hair { 3413 color 3414 } 3415 } 3416 `, 3417 &retval, 3418 &__input, 3419 ) 3420 return &retval, err 3421 } 3422 3423 func queryWithFlatten( 3424 ctx context.Context, 3425 client graphql.Client, 3426 ids []string, 3427 ) (*QueryFragment, error) { 3428 __input := __queryWithFlattenInput{ 3429 Ids: ids, 3430 } 3431 var err error 3432 3433 var retval QueryFragment 3434 err = client.MakeRequest( 3435 ctx, 3436 "queryWithFlatten", 3437 ` 3438 query queryWithFlatten ($ids: [ID!]!) { 3439 ... QueryFragment 3440 } 3441 fragment QueryFragment on Query { 3442 beings(ids: $ids) { 3443 __typename 3444 id 3445 ... FlattenedUserFields 3446 ... on Animal { 3447 owner { 3448 __typename 3449 ... BeingFields 3450 } 3451 } 3452 } 3453 } 3454 fragment FlattenedUserFields on User { 3455 ... FlattenedLuckyFields 3456 } 3457 fragment BeingFields on Being { 3458 ... InnerBeingFields 3459 } 3460 fragment FlattenedLuckyFields on Lucky { 3461 ... InnerLuckyFields 3462 } 3463 fragment InnerBeingFields on Being { 3464 id 3465 name 3466 ... on User { 3467 friends { 3468 ... FriendsFields 3469 } 3470 } 3471 } 3472 fragment InnerLuckyFields on Lucky { 3473 luckyNumber 3474 } 3475 fragment FriendsFields on User { 3476 id 3477 name 3478 } 3479 `, 3480 &retval, 3481 &__input, 3482 ) 3483 return &retval, err 3484 }