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