Module: CardDB::QueryBuilder
- Defined in:
- lib/carddb/query_builder.rb
Overview
Builds GraphQL queries for the CardDB API. rubocop:disable Metrics/ModuleLength
Constant Summary collapse
- SCHEMA_NESTED_FIELDS_DEPTH =
4
Class Method Summary collapse
- .add_deck_entry ⇒ Object
- .app_decks(filter: nil, first: nil, after: nil) ⇒ Object
- .archive_deck ⇒ Object
- .archive_deck_import_format ⇒ Object
- .claim_deck ⇒ Object
- .copy_deck ⇒ Object
-
.create_deck ⇒ Object
Builds a deckCreate mutation.
- .create_deck_access_token_issuer ⇒ Object
- .create_deck_embed_token ⇒ Object
- .create_deck_import_format ⇒ Object
-
.create_deck_preview_token ⇒ Object
Builds a deckPreviewTokenCreate mutation.
- .deck ⇒ Object
- .deck_access ⇒ Object
- .deck_access_token_issuers ⇒ Object
- .deck_api_application_accesses ⇒ Object
- .deck_by_external_ref ⇒ Object
- .deck_by_slug ⇒ Object
-
.deck_collaborators ⇒ Object
Builds a deckCollaborators query.
- .deck_draft_diff ⇒ Object
- .deck_embed ⇒ Object
- .deck_embed_tokens ⇒ Object
- .deck_export ⇒ Object
- .deck_hydrate_entries ⇒ Object
- .deck_import_format ⇒ Object
- .deck_import_format_test ⇒ Object
- .deck_import_formats(game_id:, include_archived: nil, first: nil, after: nil) ⇒ Object
-
.deck_preview ⇒ Object
Builds a deckPreview query.
-
.deck_preview_tokens ⇒ Object
Builds a deckPreviewTokens query.
- .deck_section_definitions(publisher_slug: nil, game_key: nil, game_id: nil, ruleset_key: nil, ruleset_version_id: nil) ⇒ Object
- .deck_validate ⇒ Object
-
.deck_version ⇒ Object
Builds a deckVersion query.
- .deck_version_diff ⇒ Object
-
.deck_versions(first: nil, after: nil) ⇒ Object
Builds a deckVersions query.
-
.delete_deck ⇒ Object
Builds a deckDelete mutation.
- .exchange_deck_access_token ⇒ Object
-
.fetch_dataset_by_id ⇒ Object
Builds a fetchDataset query by id.
-
.fetch_dataset_by_keys ⇒ Object
Builds a fetchDataset query by keys (includes schema).
-
.fetch_datasets ⇒ Object
Builds a fetchDatasets batch query.
-
.fetch_deck ⇒ Object
Builds a fetchDeck query.
-
.fetch_deck_by_external_ref ⇒ Object
Builds a fetchDeckByExternalRef query.
-
.fetch_deck_by_slug ⇒ Object
Builds a fetchDeckBySlug query.
-
.fetch_game_by_id ⇒ Object
Builds a fetchGame query by id.
-
.fetch_game_by_keys ⇒ Object
Builds a fetchGame query by publisher slug and game key.
-
.fetch_games ⇒ Object
Builds a fetchGames batch query.
-
.fetch_me ⇒ Object
Builds a fetchMe query.
-
.fetch_publisher_by_id ⇒ Object
Builds a fetchPublisher query (by id or slug).
-
.fetch_publisher_by_slug ⇒ Object
Builds a fetchPublisher query by slug.
-
.fetch_publishers ⇒ Object
Builds a fetchPublishers query.
-
.fetch_record(include_pricing: false) ⇒ Object
Builds a fetchRecord query.
-
.fetch_record_by_identifier(include_pricing: false) ⇒ Object
Builds a fetchRecordByIdentifier query.
-
.fetch_records(include_pricing: false) ⇒ Object
Builds a fetchRecords query.
-
.fetch_records_by_identifier(include_pricing: false) ⇒ Object
Builds a fetchRecordsByIdentifier query.
- .grant_deck_api_application_access ⇒ Object
- .import_deck ⇒ Object
-
.list_my_decks(first: nil, after: nil, include_archived: nil) ⇒ Object
Builds a myDecks query.
-
.my_deck ⇒ Object
Builds a myDeck query.
- .my_deck_api_application_accesses ⇒ Object
- .public_decks(filter: nil, first: nil, after: nil) ⇒ Object
-
.publish_deck ⇒ Object
Builds a deckPublish mutation.
-
.remove_deck_collaborator ⇒ Object
Builds a deckCollaboratorRemove mutation.
- .remove_deck_entry ⇒ Object
- .remove_invalid_deck_entries ⇒ Object
- .reorder_deck_entries ⇒ Object
- .replace_deck_entries ⇒ Object
- .restore_deck ⇒ Object
- .revoke_deck_access_token ⇒ Object
- .revoke_deck_access_token_issuer ⇒ Object
- .revoke_deck_access_token_issuer_signing_key ⇒ Object
- .revoke_deck_api_application_access ⇒ Object
- .revoke_deck_embed_token ⇒ Object
-
.revoke_deck_preview_token ⇒ Object
Builds a deckPreviewTokenRevoke mutation.
-
.search_datasets(publisher_slug: nil, game_key: nil, search: nil, purpose: nil, first: nil, after: nil) ⇒ Object
Builds a searchDatasets query.
-
.search_games(publisher_slug: nil, search: nil, first: nil, after: nil) ⇒ Object
Builds a searchGames query.
-
.search_publishers(search: nil, first: nil, after: nil) ⇒ Object
Builds a searchPublishers query.
-
.search_records(publisher_slug:, game_key:, dataset_key:, filter: nil, search: nil, order_by: nil, resolve_links: nil, first: nil, after: nil, validate_schema: nil, include_pricing: false) ⇒ Object
Builds a searchRecords query rubocop:disable Metrics/ParameterLists.
- .transfer_deck_ownership ⇒ Object
- .unarchive_deck_import_format ⇒ Object
- .unpublish_deck ⇒ Object
-
.update_deck ⇒ Object
Builds a deckUpdate mutation.
- .update_deck_entry ⇒ Object
- .update_deck_import_format ⇒ Object
- .upsert_deck_by_external_ref ⇒ Object
-
.upsert_deck_collaborator ⇒ Object
Builds a deckCollaboratorUpsert mutation.
- .viewer_decks(filter: nil, first: nil, after: nil) ⇒ Object
Class Method Details
.add_deck_entry ⇒ Object
629 630 631 632 633 634 635 636 637 |
# File 'lib/carddb/query_builder.rb', line 629 def add_deck_entry <<~GRAPHQL mutation DeckEntryAdd($input: DeckEntryAddInput!) { deckEntryAdd(input: $input) { #{deck_entry_mutation_payload_fields} } } GRAPHQL end |
.app_decks(filter: nil, first: nil, after: nil) ⇒ Object
283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/carddb/query_builder.rb', line 283 def app_decks(filter: nil, first: nil, after: nil) args = build_args( { filter: filter, first: first, after: after }, type_overrides: { filter: 'AppDecksFilterInput' } ) <<~GRAPHQL query AppDecks#{args[:definition]} { appDecks#{args[:call]} { #{deck_connection_fields} } } GRAPHQL end |
.archive_deck ⇒ Object
773 774 775 776 777 778 779 780 781 |
# File 'lib/carddb/query_builder.rb', line 773 def archive_deck <<~GRAPHQL mutation DeckArchive($id: UUID!) { deckArchive(id: $id) { #{deck_fields} } } GRAPHQL end |
.archive_deck_import_format ⇒ Object
709 710 711 712 713 714 715 716 717 |
# File 'lib/carddb/query_builder.rb', line 709 def archive_deck_import_format <<~GRAPHQL mutation DeckImportFormatArchive($id: UUID!) { deckImportFormatArchive(id: $id) { #{deck_import_format_definition_fields} } } GRAPHQL end |
.claim_deck ⇒ Object
743 744 745 746 747 748 749 750 751 |
# File 'lib/carddb/query_builder.rb', line 743 def claim_deck <<~GRAPHQL mutation DeckClaim($id: UUID!, $input: DeckClaimInput!) { deckClaim(id: $id, input: $input) { #{deck_ownership_transfer_payload_fields} } } GRAPHQL end |
.copy_deck ⇒ Object
763 764 765 766 767 768 769 770 771 |
# File 'lib/carddb/query_builder.rb', line 763 def copy_deck <<~GRAPHQL mutation DeckCopy($id: UUID!, $input: DeckCopyInput!) { deckCopy(id: $id, input: $input) { #{deck_copy_payload_fields} } } GRAPHQL end |
.create_deck ⇒ Object
Builds a deckCreate mutation
608 609 610 611 612 613 614 615 616 |
# File 'lib/carddb/query_builder.rb', line 608 def create_deck <<~GRAPHQL mutation DeckCreate($input: DeckCreateInput!) { deckCreate(input: $input) { #{deck_fields} } } GRAPHQL end |
.create_deck_access_token_issuer ⇒ Object
888 889 890 891 892 893 894 895 896 |
# File 'lib/carddb/query_builder.rb', line 888 def create_deck_access_token_issuer <<~GRAPHQL mutation DeckAccessTokenIssuerCreate($input: DeckAccessTokenIssuerCreateInput!) { deckAccessTokenIssuerCreate(input: $input) { #{deck_access_token_issuer_fields} } } GRAPHQL end |
.create_deck_embed_token ⇒ Object
867 868 869 870 871 872 873 874 875 876 877 878 |
# File 'lib/carddb/query_builder.rb', line 867 def <<~GRAPHQL mutation DeckEmbedTokenCreate($input: DeckEmbedTokenCreateInput!) { deckEmbedTokenCreate(input: $input) { token embedToken { #{} } } } GRAPHQL end |
.create_deck_import_format ⇒ Object
689 690 691 692 693 694 695 696 697 |
# File 'lib/carddb/query_builder.rb', line 689 def create_deck_import_format <<~GRAPHQL mutation DeckImportFormatCreate($input: DeckImportFormatCreateInput!) { deckImportFormatCreate(input: $input) { #{deck_import_format_definition_fields} } } GRAPHQL end |
.create_deck_preview_token ⇒ Object
Builds a deckPreviewTokenCreate mutation
845 846 847 848 849 850 851 852 853 854 855 856 |
# File 'lib/carddb/query_builder.rb', line 845 def create_deck_preview_token <<~GRAPHQL mutation DeckPreviewTokenCreate($input: DeckPreviewTokenCreateInput!) { deckPreviewTokenCreate(input: $input) { token previewToken { #{deck_preview_token_fields} } } } GRAPHQL end |
.deck ⇒ Object
324 325 326 327 328 329 330 331 332 |
# File 'lib/carddb/query_builder.rb', line 324 def deck <<~GRAPHQL query Deck($id: UUID!) { deck(id: $id) { #{deck_fields} } } GRAPHQL end |
.deck_access ⇒ Object
432 433 434 435 436 437 438 439 440 |
# File 'lib/carddb/query_builder.rb', line 432 def deck_access <<~GRAPHQL query DeckAccess($token: String!) { deckAccess(token: $token) { #{deck_fields} } } GRAPHQL end |
.deck_access_token_issuers ⇒ Object
542 543 544 545 546 547 548 549 550 |
# File 'lib/carddb/query_builder.rb', line 542 def deck_access_token_issuers <<~GRAPHQL query DeckAccessTokenIssuers($deckId: UUID!) { deckAccessTokenIssuers(deckId: $deckId) { #{deck_access_token_issuer_fields} } } GRAPHQL end |
.deck_api_application_accesses ⇒ Object
552 553 554 555 556 557 558 559 560 |
# File 'lib/carddb/query_builder.rb', line 552 def deck_api_application_accesses <<~GRAPHQL query DeckApiApplicationAccesses($deckId: UUID!, $includeRevoked: Boolean) { deckApiApplicationAccesses(deckId: $deckId, includeRevoked: $includeRevoked) { #{deck_api_application_access_fields} } } GRAPHQL end |
.deck_by_external_ref ⇒ Object
377 378 379 380 381 382 383 384 385 |
# File 'lib/carddb/query_builder.rb', line 377 def deck_by_external_ref <<~GRAPHQL query DeckByExternalRef($externalRef: String!) { deckByExternalRef(externalRef: $externalRef) { #{deck_fields} } } GRAPHQL end |
.deck_by_slug ⇒ Object
356 357 358 359 360 361 362 363 364 |
# File 'lib/carddb/query_builder.rb', line 356 def deck_by_slug <<~GRAPHQL query DeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) { deckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) { #{deck_fields} } } GRAPHQL end |
.deck_collaborators ⇒ Object
Builds a deckCollaborators query
511 512 513 514 515 516 517 518 519 |
# File 'lib/carddb/query_builder.rb', line 511 def deck_collaborators <<~GRAPHQL query DeckCollaborators($deckId: UUID!) { deckCollaborators(deckId: $deckId) { #{deck_collaborator_fields} } } GRAPHQL end |
.deck_draft_diff ⇒ Object
442 443 444 445 446 447 448 449 450 |
# File 'lib/carddb/query_builder.rb', line 442 def deck_draft_diff <<~GRAPHQL query DeckDraftDiff($id: UUID!) { deckDraftDiff(id: $id) { #{deck_diff_fields} } } GRAPHQL end |
.deck_embed ⇒ Object
422 423 424 425 426 427 428 429 430 |
# File 'lib/carddb/query_builder.rb', line 422 def <<~GRAPHQL query DeckEmbed($token: String!) { deckEmbed(token: $token) { #{deck_fields} } } GRAPHQL end |
.deck_embed_tokens ⇒ Object
532 533 534 535 536 537 538 539 540 |
# File 'lib/carddb/query_builder.rb', line 532 def <<~GRAPHQL query DeckEmbedTokens($deckId: UUID!) { deckEmbedTokens(deckId: $deckId) { #{} } } GRAPHQL end |
.deck_export ⇒ Object
472 473 474 475 476 477 478 479 480 |
# File 'lib/carddb/query_builder.rb', line 472 def deck_export <<~GRAPHQL query DeckExport($id: UUID!, $format: DeckExportFormat!) { deckExport(id: $id, format: $format) { #{deck_export_payload_fields} } } GRAPHQL end |
.deck_hydrate_entries ⇒ Object
462 463 464 465 466 467 468 469 470 |
# File 'lib/carddb/query_builder.rb', line 462 def deck_hydrate_entries <<~GRAPHQL query DeckHydrateEntries($input: DeckHydrateEntriesInput!) { deckHydrateEntries(input: $input) { #{deck_hydrate_entries_payload_fields} } } GRAPHQL end |
.deck_import_format ⇒ Object
587 588 589 590 591 592 593 594 595 |
# File 'lib/carddb/query_builder.rb', line 587 def deck_import_format <<~GRAPHQL query DeckImportFormat($id: UUID!) { deckImportFormat(id: $id) { #{deck_import_format_definition_fields} } } GRAPHQL end |
.deck_import_format_test ⇒ Object
597 598 599 600 601 602 603 604 605 |
# File 'lib/carddb/query_builder.rb', line 597 def deck_import_format_test <<~GRAPHQL query DeckImportFormatTest($input: DeckImportFormatTestInput!) { deckImportFormatTest(input: $input) { #{deck_import_format_test_payload_fields} } } GRAPHQL end |
.deck_import_formats(game_id:, include_archived: nil, first: nil, after: nil) ⇒ Object
572 573 574 575 576 577 578 579 580 581 582 583 584 585 |
# File 'lib/carddb/query_builder.rb', line 572 def deck_import_formats(game_id:, include_archived: nil, first: nil, after: nil) args = build_args( { gameId: game_id, includeArchived: include_archived, first: first, after: after }, required: [:gameId] ) <<~GRAPHQL query DeckImportFormats#{args[:definition]} { deckImportFormats#{args[:call]} { #{deck_import_format_definition_connection_fields} } } GRAPHQL end |
.deck_preview ⇒ Object
Builds a deckPreview query
412 413 414 415 416 417 418 419 420 |
# File 'lib/carddb/query_builder.rb', line 412 def deck_preview <<~GRAPHQL query DeckPreview($token: String!) { deckPreview(token: $token) { #{deck_fields} } } GRAPHQL end |
.deck_preview_tokens ⇒ Object
Builds a deckPreviewTokens query
522 523 524 525 526 527 528 529 530 |
# File 'lib/carddb/query_builder.rb', line 522 def deck_preview_tokens <<~GRAPHQL query DeckPreviewTokens($deckId: UUID!) { deckPreviewTokens(deckId: $deckId) { #{deck_preview_token_fields} } } GRAPHQL end |
.deck_section_definitions(publisher_slug: nil, game_key: nil, game_id: nil, ruleset_key: nil, ruleset_version_id: nil) ⇒ Object
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
# File 'lib/carddb/query_builder.rb', line 492 def deck_section_definitions(publisher_slug: nil, game_key: nil, game_id: nil, ruleset_key: nil, ruleset_version_id: nil) args = build_args({ publisherSlug: publisher_slug, gameKey: game_key, gameId: game_id, rulesetKey: ruleset_key, rulesetVersionId: ruleset_version_id }) <<~GRAPHQL query DeckSectionDefinitions#{args[:definition]} { deckSectionDefinitions#{args[:call]} { #{deck_section_definition_fields} } } GRAPHQL end |
.deck_validate ⇒ Object
482 483 484 485 486 487 488 489 490 |
# File 'lib/carddb/query_builder.rb', line 482 def deck_validate <<~GRAPHQL query DeckValidate($id: UUID!, $input: DeckValidateInput) { deckValidate(id: $id, input: $input) { #{deck_validation_fields} } } GRAPHQL end |
.deck_version ⇒ Object
Builds a deckVersion query
388 389 390 391 392 393 394 395 396 |
# File 'lib/carddb/query_builder.rb', line 388 def deck_version <<~GRAPHQL query DeckVersion($id: UUID!) { deckVersion(id: $id) { #{deck_version_fields} } } GRAPHQL end |
.deck_version_diff ⇒ Object
452 453 454 455 456 457 458 459 460 |
# File 'lib/carddb/query_builder.rb', line 452 def deck_version_diff <<~GRAPHQL query DeckVersionDiff($fromVersionId: UUID!, $toVersionId: UUID!) { deckVersionDiff(fromVersionId: $fromVersionId, toVersionId: $toVersionId) { #{deck_diff_fields} } } GRAPHQL end |
.deck_versions(first: nil, after: nil) ⇒ Object
Builds a deckVersions query
399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/carddb/query_builder.rb', line 399 def deck_versions(first: nil, after: nil) args = build_args({ deckId: true, first: first, after: after }, required: [:deckId]) <<~GRAPHQL query DeckVersions#{args[:definition]} { deckVersions#{args[:call]} { #{deck_version_connection_fields} } } GRAPHQL end |
.delete_deck ⇒ Object
Builds a deckDelete mutation
956 957 958 959 960 961 962 |
# File 'lib/carddb/query_builder.rb', line 956 def delete_deck <<~GRAPHQL mutation DeckDelete($id: UUID!) { deckDelete(id: $id) } GRAPHQL end |
.exchange_deck_access_token ⇒ Object
916 917 918 919 920 921 922 923 924 925 926 927 |
# File 'lib/carddb/query_builder.rb', line 916 def exchange_deck_access_token <<~GRAPHQL mutation DeckAccessTokenExchange($input: DeckAccessTokenExchangeInput!) { deckAccessTokenExchange(input: $input) { token accessToken { #{deck_access_token_fields} } } } GRAPHQL end |
.fetch_dataset_by_id ⇒ Object
Builds a fetchDataset query by id
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/carddb/query_builder.rb', line 133 def fetch_dataset_by_id <<~GRAPHQL query FetchDataset($id: UUID!) { fetchDataset(id: $id) { #{dataset_fields} #{schema_fields} } } GRAPHQL end |
.fetch_dataset_by_keys ⇒ Object
Builds a fetchDataset query by keys (includes schema)
145 146 147 148 149 150 151 152 153 154 |
# File 'lib/carddb/query_builder.rb', line 145 def fetch_dataset_by_keys <<~GRAPHQL query FetchDataset($publisherSlug: String!, $gameKey: String!, $datasetKey: String!) { fetchDataset(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey) { #{dataset_fields} #{schema_fields} } } GRAPHQL end |
.fetch_datasets ⇒ Object
Builds a fetchDatasets batch query
157 158 159 160 161 162 163 164 165 |
# File 'lib/carddb/query_builder.rb', line 157 def fetch_datasets <<~GRAPHQL query FetchDatasets($ids: [UUID!]!) { fetchDatasets(ids: $ids) { #{dataset_fields} } } GRAPHQL end |
.fetch_deck ⇒ Object
Builds a fetchDeck query
314 315 316 317 318 319 320 321 322 |
# File 'lib/carddb/query_builder.rb', line 314 def fetch_deck <<~GRAPHQL query FetchDeck($id: UUID!) { fetchDeck(id: $id) { #{deck_fields} } } GRAPHQL end |
.fetch_deck_by_external_ref ⇒ Object
Builds a fetchDeckByExternalRef query
367 368 369 370 371 372 373 374 375 |
# File 'lib/carddb/query_builder.rb', line 367 def fetch_deck_by_external_ref <<~GRAPHQL query FetchDeckByExternalRef($externalRef: String!) { fetchDeckByExternalRef(externalRef: $externalRef) { #{deck_fields} } } GRAPHQL end |
.fetch_deck_by_slug ⇒ Object
Builds a fetchDeckBySlug query
346 347 348 349 350 351 352 353 354 |
# File 'lib/carddb/query_builder.rb', line 346 def fetch_deck_by_slug <<~GRAPHQL query FetchDeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) { fetchDeckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) { #{deck_fields} } } GRAPHQL end |
.fetch_game_by_id ⇒ Object
Builds a fetchGame query by id
80 81 82 83 84 85 86 87 88 |
# File 'lib/carddb/query_builder.rb', line 80 def fetch_game_by_id <<~GRAPHQL query FetchGame($id: UUID!) { fetchGame(id: $id) { #{game_fields} } } GRAPHQL end |
.fetch_game_by_keys ⇒ Object
Builds a fetchGame query by publisher slug and game key
91 92 93 94 95 96 97 98 99 |
# File 'lib/carddb/query_builder.rb', line 91 def fetch_game_by_keys <<~GRAPHQL query FetchGame($publisherSlug: String!, $gameKey: String!) { fetchGame(publisherSlug: $publisherSlug, gameKey: $gameKey) { #{game_fields} } } GRAPHQL end |
.fetch_games ⇒ Object
Builds a fetchGames batch query
102 103 104 105 106 107 108 109 110 |
# File 'lib/carddb/query_builder.rb', line 102 def fetch_games <<~GRAPHQL query FetchGames($ids: [UUID!]!) { fetchGames(ids: $ids) { #{game_fields} } } GRAPHQL end |
.fetch_me ⇒ Object
Builds a fetchMe query
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 |
# File 'lib/carddb/query_builder.rb', line 965 def fetch_me <<~GRAPHQL query FetchMe { fetchMe { application { id name description environment apiKeyPrefix allowedOrigins allowedIps createdAt updatedAt lastUsedAt } account { id displayName createdAt } } } GRAPHQL end |
.fetch_publisher_by_id ⇒ Object
Builds a fetchPublisher query (by id or slug)
29 30 31 32 33 34 35 36 37 |
# File 'lib/carddb/query_builder.rb', line 29 def fetch_publisher_by_id <<~GRAPHQL query FetchPublisher($id: UUID!) { fetchPublisher(id: $id) { #{publisher_fields} } } GRAPHQL end |
.fetch_publisher_by_slug ⇒ Object
Builds a fetchPublisher query by slug
40 41 42 43 44 45 46 47 48 |
# File 'lib/carddb/query_builder.rb', line 40 def fetch_publisher_by_slug <<~GRAPHQL query FetchPublisher($slug: String!) { fetchPublisher(slug: $slug) { #{publisher_fields} } } GRAPHQL end |
.fetch_publishers ⇒ Object
Builds a fetchPublishers query
51 52 53 54 55 56 57 58 59 |
# File 'lib/carddb/query_builder.rb', line 51 def fetch_publishers <<~GRAPHQL query FetchPublishers($slugs: [String!]!) { fetchPublishers(slugs: $slugs) { #{publisher_fields} } } GRAPHQL end |
.fetch_record(include_pricing: false) ⇒ Object
Builds a fetchRecord query
234 235 236 237 238 239 240 241 242 |
# File 'lib/carddb/query_builder.rb', line 234 def fetch_record(include_pricing: false) <<~GRAPHQL query FetchRecord($id: UUID!) { fetchRecord(id: $id) { #{record_fields(include_pricing: include_pricing)} } } GRAPHQL end |
.fetch_record_by_identifier(include_pricing: false) ⇒ Object
Builds a fetchRecordByIdentifier query
212 213 214 215 216 217 218 219 220 |
# File 'lib/carddb/query_builder.rb', line 212 def fetch_record_by_identifier(include_pricing: false) <<~GRAPHQL query FetchRecordByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifier: String!) { fetchRecordByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifier: $identifier) { #{record_fields(include_pricing: include_pricing)} } } GRAPHQL end |
.fetch_records(include_pricing: false) ⇒ Object
Builds a fetchRecords query
245 246 247 248 249 250 251 252 253 |
# File 'lib/carddb/query_builder.rb', line 245 def fetch_records(include_pricing: false) <<~GRAPHQL query FetchRecords($ids: [UUID!]!) { fetchRecords(ids: $ids) { #{record_fields(include_pricing: include_pricing)} } } GRAPHQL end |
.fetch_records_by_identifier(include_pricing: false) ⇒ Object
Builds a fetchRecordsByIdentifier query
223 224 225 226 227 228 229 230 231 |
# File 'lib/carddb/query_builder.rb', line 223 def fetch_records_by_identifier(include_pricing: false) <<~GRAPHQL query FetchRecordsByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifiers: [String!]!) { fetchRecordsByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifiers: $identifiers) { #{record_fields(include_pricing: include_pricing)} } } GRAPHQL end |
.grant_deck_api_application_access ⇒ Object
937 938 939 940 941 942 943 944 945 |
# File 'lib/carddb/query_builder.rb', line 937 def grant_deck_api_application_access <<~GRAPHQL mutation DeckApiApplicationAccessGrant($input: DeckAPIApplicationAccessGrantInput!) { deckApiApplicationAccessGrant(input: $input) { #{deck_api_application_access_fields} } } GRAPHQL end |
.import_deck ⇒ Object
679 680 681 682 683 684 685 686 687 |
# File 'lib/carddb/query_builder.rb', line 679 def import_deck <<~GRAPHQL mutation DeckImport($input: DeckImportInput!) { deckImport(input: $input) { #{deck_import_payload_fields} } } GRAPHQL end |
.list_my_decks(first: nil, after: nil, include_archived: nil) ⇒ Object
Builds a myDecks query
256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/carddb/query_builder.rb', line 256 def list_my_decks(first: nil, after: nil, include_archived: nil) args = build_args({ first: first, after: after, includeArchived: include_archived }) <<~GRAPHQL query MyDecks#{args[:definition]} { myDecks#{args[:call]} { #{deck_connection_fields} } } GRAPHQL end |
.my_deck ⇒ Object
Builds a myDeck query
335 336 337 338 339 340 341 342 343 |
# File 'lib/carddb/query_builder.rb', line 335 def my_deck <<~GRAPHQL query MyDeck($id: UUID!) { myDeck(id: $id) { #{deck_fields} } } GRAPHQL end |
.my_deck_api_application_accesses ⇒ Object
562 563 564 565 566 567 568 569 570 |
# File 'lib/carddb/query_builder.rb', line 562 def my_deck_api_application_accesses <<~GRAPHQL query MyDeckApiApplicationAccesses($applicationId: UUID) { myDeckApiApplicationAccesses(applicationId: $applicationId) { #{deck_api_application_access_fields} } } GRAPHQL end |
.public_decks(filter: nil, first: nil, after: nil) ⇒ Object
298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/carddb/query_builder.rb', line 298 def public_decks(filter: nil, first: nil, after: nil) args = build_args( { filter: filter, first: first, after: after }, type_overrides: { filter: 'PublicDecksFilterInput' } ) <<~GRAPHQL query PublicDecks#{args[:definition]} { publicDecks#{args[:call]} { #{deck_connection_fields} } } GRAPHQL end |
.publish_deck ⇒ Object
Builds a deckPublish mutation
804 805 806 807 808 809 810 811 812 |
# File 'lib/carddb/query_builder.rb', line 804 def publish_deck <<~GRAPHQL mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) { deckPublish(id: $id, input: $input) { #{deck_publish_payload_fields} } } GRAPHQL end |
.remove_deck_collaborator ⇒ Object
Builds a deckCollaboratorRemove mutation
836 837 838 839 840 841 842 |
# File 'lib/carddb/query_builder.rb', line 836 def remove_deck_collaborator <<~GRAPHQL mutation DeckCollaboratorRemove($deckId: UUID!, $accountId: UUID!) { deckCollaboratorRemove(deckId: $deckId, accountId: $accountId) } GRAPHQL end |
.remove_deck_entry ⇒ Object
649 650 651 652 653 654 655 656 657 |
# File 'lib/carddb/query_builder.rb', line 649 def remove_deck_entry <<~GRAPHQL mutation DeckEntryRemove($id: UUID!, $expectedDraftRevision: Int!) { deckEntryRemove(id: $id, expectedDraftRevision: $expectedDraftRevision) { #{deck_entry_mutation_payload_fields} } } GRAPHQL end |
.remove_invalid_deck_entries ⇒ Object
814 815 816 817 818 819 820 821 822 |
# File 'lib/carddb/query_builder.rb', line 814 def remove_invalid_deck_entries <<~GRAPHQL mutation DeckRemoveInvalidEntries($id: UUID!, $input: DeckRemoveInvalidEntriesInput!) { deckRemoveInvalidEntries(id: $id, input: $input) { #{deck_fields} } } GRAPHQL end |
.reorder_deck_entries ⇒ Object
659 660 661 662 663 664 665 666 667 |
# File 'lib/carddb/query_builder.rb', line 659 def reorder_deck_entries <<~GRAPHQL mutation DeckEntryReorder($deckId: UUID!, $input: DeckEntryReorderInput!) { deckEntryReorder(deckId: $deckId, input: $input) { #{deck_entry_reorder_payload_fields} } } GRAPHQL end |
.replace_deck_entries ⇒ Object
669 670 671 672 673 674 675 676 677 |
# File 'lib/carddb/query_builder.rb', line 669 def replace_deck_entries <<~GRAPHQL mutation DeckEntriesReplace($deckId: UUID!, $input: DeckEntriesReplaceInput!) { deckEntriesReplace(deckId: $deckId, input: $input) { #{deck_entry_reorder_payload_fields} } } GRAPHQL end |
.restore_deck ⇒ Object
783 784 785 786 787 788 789 790 791 |
# File 'lib/carddb/query_builder.rb', line 783 def restore_deck <<~GRAPHQL mutation DeckRestore($id: UUID!) { deckRestore(id: $id) { #{deck_fields} } } GRAPHQL end |
.revoke_deck_access_token ⇒ Object
929 930 931 932 933 934 935 |
# File 'lib/carddb/query_builder.rb', line 929 def revoke_deck_access_token <<~GRAPHQL mutation DeckAccessTokenRevoke($id: UUID!) { deckAccessTokenRevoke(id: $id) } GRAPHQL end |
.revoke_deck_access_token_issuer ⇒ Object
898 899 900 901 902 903 904 |
# File 'lib/carddb/query_builder.rb', line 898 def revoke_deck_access_token_issuer <<~GRAPHQL mutation DeckAccessTokenIssuerRevoke($id: UUID!) { deckAccessTokenIssuerRevoke(id: $id) } GRAPHQL end |
.revoke_deck_access_token_issuer_signing_key ⇒ Object
906 907 908 909 910 911 912 913 914 |
# File 'lib/carddb/query_builder.rb', line 906 def revoke_deck_access_token_issuer_signing_key <<~GRAPHQL mutation DeckAccessTokenIssuerSigningKeyRevoke($id: UUID!) { deckAccessTokenIssuerSigningKeyRevoke(id: $id) { #{deck_access_token_issuer_fields} } } GRAPHQL end |
.revoke_deck_api_application_access ⇒ Object
947 948 949 950 951 952 953 |
# File 'lib/carddb/query_builder.rb', line 947 def revoke_deck_api_application_access <<~GRAPHQL mutation DeckApiApplicationAccessRevoke($deckId: UUID!, $apiApplicationId: UUID!) { deckApiApplicationAccessRevoke(deckId: $deckId, apiApplicationId: $apiApplicationId) } GRAPHQL end |
.revoke_deck_embed_token ⇒ Object
880 881 882 883 884 885 886 |
# File 'lib/carddb/query_builder.rb', line 880 def <<~GRAPHQL mutation DeckEmbedTokenRevoke($id: UUID!) { deckEmbedTokenRevoke(id: $id) } GRAPHQL end |
.revoke_deck_preview_token ⇒ Object
Builds a deckPreviewTokenRevoke mutation
859 860 861 862 863 864 865 |
# File 'lib/carddb/query_builder.rb', line 859 def revoke_deck_preview_token <<~GRAPHQL mutation DeckPreviewTokenRevoke($id: UUID!) { deckPreviewTokenRevoke(id: $id) } GRAPHQL end |
.search_datasets(publisher_slug: nil, game_key: nil, search: nil, purpose: nil, first: nil, after: nil) ⇒ Object
Builds a searchDatasets query
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/carddb/query_builder.rb', line 113 def search_datasets(publisher_slug: nil, game_key: nil, search: nil, purpose: nil, first: nil, after: nil) args = build_args({ publisherSlug: publisher_slug, gameKey: game_key, search: search, purpose: purpose, first: first, after: after }) <<~GRAPHQL query SearchDatasets#{args[:definition]} { searchDatasets#{args[:call]} { #{dataset_connection_fields} } } GRAPHQL end |
.search_games(publisher_slug: nil, search: nil, first: nil, after: nil) ⇒ Object
Builds a searchGames query
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/carddb/query_builder.rb', line 62 def search_games(publisher_slug: nil, search: nil, first: nil, after: nil) args = build_args({ publisherSlug: publisher_slug, search: search, first: first, after: after }) <<~GRAPHQL query SearchGames#{args[:definition]} { searchGames#{args[:call]} { #{game_connection_fields} } } GRAPHQL end |
.search_publishers(search: nil, first: nil, after: nil) ⇒ Object
Builds a searchPublishers query
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/carddb/query_builder.rb', line 12 def search_publishers(search: nil, first: nil, after: nil) args = build_args({ search: search, first: first, after: after }) <<~GRAPHQL query SearchPublishers#{args[:definition]} { searchPublishers#{args[:call]} { #{publisher_connection_fields} } } GRAPHQL end |
.search_records(publisher_slug:, game_key:, dataset_key:, filter: nil, search: nil, order_by: nil, resolve_links: nil, first: nil, after: nil, validate_schema: nil, include_pricing: false) ⇒ Object
Builds a searchRecords query rubocop:disable Metrics/ParameterLists
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/carddb/query_builder.rb', line 169 def search_records( publisher_slug:, game_key:, dataset_key:, filter: nil, search: nil, order_by: nil, resolve_links: nil, first: nil, after: nil, validate_schema: nil, include_pricing: false ) args = build_args( { publisherSlug: publisher_slug, gameKey: game_key, datasetKey: dataset_key, filter: filter, search: search, orderBy: order_by, resolveLinks: resolve_links, first: first, after: after, validateSchema: validate_schema }, required: %i[publisherSlug gameKey datasetKey] ) <<~GRAPHQL query SearchRecords#{args[:definition]} { searchRecords#{args[:call]} { #{record_connection_fields( include_resolved_links: resolve_links&.any?, include_pricing: include_pricing )} } } GRAPHQL end |
.transfer_deck_ownership ⇒ Object
753 754 755 756 757 758 759 760 761 |
# File 'lib/carddb/query_builder.rb', line 753 def transfer_deck_ownership <<~GRAPHQL mutation DeckTransferOwnership($id: UUID!, $input: DeckTransferOwnershipInput!) { deckTransferOwnership(id: $id, input: $input) { #{deck_ownership_transfer_payload_fields} } } GRAPHQL end |
.unarchive_deck_import_format ⇒ Object
719 720 721 722 723 724 725 726 727 |
# File 'lib/carddb/query_builder.rb', line 719 def unarchive_deck_import_format <<~GRAPHQL mutation DeckImportFormatUnarchive($id: UUID!) { deckImportFormatUnarchive(id: $id) { #{deck_import_format_definition_fields} } } GRAPHQL end |
.unpublish_deck ⇒ Object
793 794 795 796 797 798 799 800 801 |
# File 'lib/carddb/query_builder.rb', line 793 def unpublish_deck <<~GRAPHQL mutation DeckUnpublish($id: UUID!) { deckUnpublish(id: $id) { #{deck_fields} } } GRAPHQL end |
.update_deck ⇒ Object
Builds a deckUpdate mutation
619 620 621 622 623 624 625 626 627 |
# File 'lib/carddb/query_builder.rb', line 619 def update_deck <<~GRAPHQL mutation DeckUpdate($id: UUID!, $input: DeckUpdateInput!) { deckUpdate(id: $id, input: $input) { #{deck_fields} } } GRAPHQL end |
.update_deck_entry ⇒ Object
639 640 641 642 643 644 645 646 647 |
# File 'lib/carddb/query_builder.rb', line 639 def update_deck_entry <<~GRAPHQL mutation DeckEntryUpdate($id: UUID!, $input: DeckEntryUpdateInput!) { deckEntryUpdate(id: $id, input: $input) { #{deck_entry_mutation_payload_fields} } } GRAPHQL end |
.update_deck_import_format ⇒ Object
699 700 701 702 703 704 705 706 707 |
# File 'lib/carddb/query_builder.rb', line 699 def update_deck_import_format <<~GRAPHQL mutation DeckImportFormatUpdate($id: UUID!, $input: DeckImportFormatUpdateInput!) { deckImportFormatUpdate(id: $id, input: $input) { #{deck_import_format_definition_fields} } } GRAPHQL end |
.upsert_deck_by_external_ref ⇒ Object
729 730 731 732 733 734 735 736 737 738 739 740 741 |
# File 'lib/carddb/query_builder.rb', line 729 def upsert_deck_by_external_ref <<~GRAPHQL mutation DeckUpsertByExternalRef($input: DeckUpsertByExternalRefInput!) { deckUpsertByExternalRef(input: $input) { deck { #{deck_fields} } created idempotentReplay } } GRAPHQL end |
.upsert_deck_collaborator ⇒ Object
Builds a deckCollaboratorUpsert mutation
825 826 827 828 829 830 831 832 833 |
# File 'lib/carddb/query_builder.rb', line 825 def upsert_deck_collaborator <<~GRAPHQL mutation DeckCollaboratorUpsert($deckId: UUID!, $accountId: UUID!, $role: DeckCollaboratorRole!) { deckCollaboratorUpsert(deckId: $deckId, accountId: $accountId, role: $role) { #{deck_collaborator_fields} } } GRAPHQL end |
.viewer_decks(filter: nil, first: nil, after: nil) ⇒ Object
268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/carddb/query_builder.rb', line 268 def viewer_decks(filter: nil, first: nil, after: nil) args = build_args( { filter: filter, first: first, after: after }, type_overrides: { filter: 'ViewerDecksFilterInput' } ) <<~GRAPHQL query ViewerDecks#{args[:definition]} { viewerDecks#{args[:call]} { #{deck_connection_fields} } } GRAPHQL end |