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

Class Method Details

.add_deck_entryObject



1211
1212
1213
1214
1215
1216
1217
1218
1219
# File 'lib/carddb/query_builder.rb', line 1211

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



928
929
930
931
932
933
934
935
936
937
938
939
940
941
# File 'lib/carddb/query_builder.rb', line 928

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_deckObject



1355
1356
1357
1358
1359
1360
1361
1362
1363
# File 'lib/carddb/query_builder.rb', line 1355

def archive_deck
  <<~GRAPHQL
    mutation DeckArchive($id: UUID!) {
      deckArchive(id: $id) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.archive_deck_import_formatObject



1291
1292
1293
1294
1295
1296
1297
1298
1299
# File 'lib/carddb/query_builder.rb', line 1291

def archive_deck_import_format
  <<~GRAPHQL
    mutation DeckImportFormatArchive($id: UUID!) {
      deckImportFormatArchive(id: $id) {
        #{deck_import_format_definition_fields}
      }
    }
  GRAPHQL
end

.claim_deckObject



1325
1326
1327
1328
1329
1330
1331
1332
1333
# File 'lib/carddb/query_builder.rb', line 1325

def claim_deck
  <<~GRAPHQL
    mutation DeckClaim($id: UUID!, $input: DeckClaimInput!) {
      deckClaim(id: $id, input: $input) {
        #{deck_ownership_transfer_payload_fields}
      }
    }
  GRAPHQL
end

.confirm_scan_uploadObject



693
694
695
696
697
698
699
700
701
# File 'lib/carddb/query_builder.rb', line 693

def confirm_scan_upload
  <<~GRAPHQL
    mutation ConfirmScanUpload($input: ConfirmScanUploadInput!) {
      confirmScanUpload(input: $input) {
        #{file_fields}
      }
    }
  GRAPHQL
end

.copy_deckObject



1345
1346
1347
1348
1349
1350
1351
1352
1353
# File 'lib/carddb/query_builder.rb', line 1345

def copy_deck
  <<~GRAPHQL
    mutation DeckCopy($id: UUID!, $input: DeckCopyInput!) {
      deckCopy(id: $id, input: $input) {
        #{deck_copy_payload_fields}
      }
    }
  GRAPHQL
end

.create_deckObject

Builds a deckCreate mutation



1190
1191
1192
1193
1194
1195
1196
1197
1198
# File 'lib/carddb/query_builder.rb', line 1190

def create_deck
  <<~GRAPHQL
    mutation DeckCreate($input: DeckCreateInput!) {
      deckCreate(input: $input) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.create_deck_import_formatObject



1271
1272
1273
1274
1275
1276
1277
1278
1279
# File 'lib/carddb/query_builder.rb', line 1271

def create_deck_import_format
  <<~GRAPHQL
    mutation DeckImportFormatCreate($input: DeckImportFormatCreateInput!) {
      deckImportFormatCreate(input: $input) {
        #{deck_import_format_definition_fields}
      }
    }
  GRAPHQL
end

.create_deck_token_issuerObject



1426
1427
1428
1429
1430
1431
1432
1433
1434
# File 'lib/carddb/query_builder.rb', line 1426

def create_deck_token_issuer
  <<~GRAPHQL
    mutation DeckTokenIssuerCreate($input: DeckTokenIssuerCreateInput!) {
      deckTokenIssuerCreate(input: $input) {
        #{deck_token_issuer_fields}
      }
    }
  GRAPHQL
end

.create_gameObject



147
148
149
150
151
152
153
154
155
# File 'lib/carddb/query_builder.rb', line 147

def create_game
  <<~GRAPHQL
    mutation GameCreate($input: GameCreateInput!) {
      gameCreate(input: $input) {
        #{game_fields}
      }
    }
  GRAPHQL
end

.create_scan_jobObject



703
704
705
706
707
708
709
710
711
712
713
714
# File 'lib/carddb/query_builder.rb', line 703

def create_scan_job
  <<~GRAPHQL
    mutation CreateScanJob($input: CreateScanJobInput!) {
      createScanJob(input: $input) {
        job {
          #{scan_job_fields}
        }
        created
      }
    }
  GRAPHQL
end

.create_scan_templateObject



781
782
783
784
785
786
787
788
789
790
791
792
793
794
# File 'lib/carddb/query_builder.rb', line 781

def create_scan_template
  <<~GRAPHQL
    mutation CreateScanTemplate($input: SaveScanTemplateInput!) {
      createScanTemplate(input: $input) {
        template {
          #{scan_template_fields}
        }
        warnings {
          #{scan_template_warning_fields}
        }
      }
    }
  GRAPHQL
end

.create_scan_upload_sessionObject



683
684
685
686
687
688
689
690
691
# File 'lib/carddb/query_builder.rb', line 683

def create_scan_upload_session
  <<~GRAPHQL
    mutation CreateScanUploadSession($input: CreateScanUploadSessionInput!) {
      createScanUploadSession(input: $input) {
        #{presigned_upload_fields}
      }
    }
  GRAPHQL
end

.dataset(id: nil, publisher_id: nil, game_id: nil, dataset_key: nil) ⇒ Object



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/carddb/query_builder.rb', line 251

def dataset(id: nil, publisher_id: nil, game_id: nil, dataset_key: nil)
  args = build_args(
    {
      id: id,
      publisherId: publisher_id,
      gameId: game_id,
      datasetKey: dataset_key
    }
  )

  <<~GRAPHQL
    query Dataset#{args[:definition]} {
      dataset#{args[:call]} {
        #{dataset_fields}
        #{schema_fields}
      }
    }
  GRAPHQL
end

.dataset_exportObject



870
871
872
873
874
875
876
877
878
# File 'lib/carddb/query_builder.rb', line 870

def dataset_export
  <<~GRAPHQL
    mutation DatasetExport($input: DatasetExportInput!) {
      datasetExport(input: $input) {
        #{export_job_fields}
      }
    }
  GRAPHQL
end

.dataset_import_from_fileObject



486
487
488
489
490
491
492
493
494
# File 'lib/carddb/query_builder.rb', line 486

def dataset_import_from_file
  <<~GRAPHQL
    mutation DatasetImportFromFile($input: DatasetImportFromFileInput!) {
      datasetImportFromFile(input: $input) {
        #{import_job_fields}
      }
    }
  GRAPHQL
end

.dataset_import_from_payloadObject



496
497
498
499
500
501
502
503
504
# File 'lib/carddb/query_builder.rb', line 496

def dataset_import_from_payload
  <<~GRAPHQL
    mutation DatasetImportFromPayload($input: DatasetImportFromPayloadInput!) {
      datasetImportFromPayload(input: $input) {
        #{import_job_fields}
      }
    }
  GRAPHQL
end

.dataset_import_from_urlObject



506
507
508
509
510
511
512
513
514
# File 'lib/carddb/query_builder.rb', line 506

def dataset_import_from_url
  <<~GRAPHQL
    mutation DatasetImportFromUrl($input: DatasetImportFromUrlInput!) {
      datasetImportFromUrl(input: $input) {
        #{import_job_fields}
      }
    }
  GRAPHQL
end

.dataset_import_previewObject



466
467
468
469
470
471
472
473
474
# File 'lib/carddb/query_builder.rb', line 466

def dataset_import_preview
  <<~GRAPHQL
    query DatasetImportPreview($input: DatasetImportPreviewInput!) {
      datasetImportPreview(input: $input) {
        #{dataset_import_preview_fields}
      }
    }
  GRAPHQL
end

.dataset_import_validateObject



476
477
478
479
480
481
482
483
484
# File 'lib/carddb/query_builder.rb', line 476

def dataset_import_validate
  <<~GRAPHQL
    query DatasetImportValidate($input: DatasetImportValidateInput!) {
      datasetImportValidate(input: $input) {
        #{bulk_import_result_fields}
      }
    }
  GRAPHQL
end

.dataset_record(**params) ⇒ Object



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/carddb/query_builder.rb', line 393

def dataset_record(**params)
  args = build_args(
    {
      id: params[:id],
      datasetId: params[:dataset_id],
      identifier: params[:identifier],
      publisherSlug: params[:publisher_slug],
      gameKey: params[:game_key],
      datasetKey: params[:dataset_key],
      recordId: params[:record_id],
      resolveLinks: params[:resolve_links],
      validateSchema: params[:validate_schema]
    }
  )
  include_links = params[:resolve_links]&.any?
  links_fields = resolved_links_fields if include_links

  <<~GRAPHQL
    query DatasetRecord#{args[:definition]} {
      datasetRecord#{args[:call]} {
        #{record_fields(include_pricing: params.fetch(:include_pricing, false))}
        #{links_fields}
      }
    }
  GRAPHQL
end

.dataset_record_delete_jobObject



440
441
442
443
444
445
446
447
448
# File 'lib/carddb/query_builder.rb', line 440

def dataset_record_delete_job
  <<~GRAPHQL
    query DatasetRecordDeleteJob($id: UUID!) {
      datasetRecordDeleteJob(id: $id) {
        #{dataset_record_delete_job_fields}
      }
    }
  GRAPHQL
end

.dataset_record_delete_jobs(publisher_id:, dataset_id: nil, status: nil, first: nil, after: nil) ⇒ Object



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/carddb/query_builder.rb', line 450

def dataset_record_delete_jobs(publisher_id:, dataset_id: nil, status: nil, first: nil, after: nil)
  args = build_args(
    { publisherId: publisher_id, datasetId: dataset_id, status: status, first: first, after: after },
    required: [:publisherId],
    type_overrides: { status: 'DatasetRecordDeleteJobStatus' }
  )

  <<~GRAPHQL
    query DatasetRecordDeleteJobs#{args[:definition]} {
      datasetRecordDeleteJobs#{args[:call]} {
        #{dataset_record_delete_job_connection_fields}
      }
    }
  GRAPHQL
end

.deckObject



969
970
971
972
973
974
975
976
977
# File 'lib/carddb/query_builder.rb', line 969

def deck
  <<~GRAPHQL
    query Deck($id: UUID!, $readState: DeckReadState!, $version: DeckPublishedVersionSelector) {
      deck(id: $id, readState: $readState, version: $version) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.deck_api_application_accessesObject



1135
1136
1137
1138
1139
1140
1141
1142
1143
# File 'lib/carddb/query_builder.rb', line 1135

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_refObject



1022
1023
1024
1025
1026
1027
1028
1029
1030
# File 'lib/carddb/query_builder.rb', line 1022

def deck_by_external_ref
  <<~GRAPHQL
    query DeckByExternalRef($externalRef: String!, $readState: DeckReadState!, $version: DeckPublishedVersionSelector) {
      deckByExternalRef(externalRef: $externalRef, readState: $readState, version: $version) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.deck_by_slugObject



1001
1002
1003
1004
1005
1006
1007
1008
1009
# File 'lib/carddb/query_builder.rb', line 1001

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_collaboratorsObject

Builds a deckCollaborators query



1125
1126
1127
1128
1129
1130
1131
1132
1133
# File 'lib/carddb/query_builder.rb', line 1125

def deck_collaborators
  <<~GRAPHQL
    query DeckCollaborators($deckId: UUID!) {
      deckCollaborators(deckId: $deckId) {
        #{deck_collaborator_fields}
      }
    }
  GRAPHQL
end

.deck_draft_diffObject



1056
1057
1058
1059
1060
1061
1062
1063
1064
# File 'lib/carddb/query_builder.rb', line 1056

def deck_draft_diff
  <<~GRAPHQL
    query DeckDraftDiff($id: UUID!) {
      deckDraftDiff(id: $id) {
        #{deck_diff_fields}
      }
    }
  GRAPHQL
end

.deck_exportObject



1086
1087
1088
1089
1090
1091
1092
1093
1094
# File 'lib/carddb/query_builder.rb', line 1086

def deck_export
  <<~GRAPHQL
    query DeckExport($id: UUID!, $format: DeckExportFormat!) {
      deckExport(id: $id, format: $format) {
        #{deck_export_payload_fields}
      }
    }
  GRAPHQL
end

.deck_hydrate_entriesObject



1076
1077
1078
1079
1080
1081
1082
1083
1084
# File 'lib/carddb/query_builder.rb', line 1076

def deck_hydrate_entries
  <<~GRAPHQL
    query DeckHydrateEntries($input: DeckHydrateEntriesInput!) {
      deckHydrateEntries(input: $input) {
        #{deck_hydrate_entries_payload_fields}
      }
    }
  GRAPHQL
end

.deck_import_formatObject



1169
1170
1171
1172
1173
1174
1175
1176
1177
# File 'lib/carddb/query_builder.rb', line 1169

def deck_import_format
  <<~GRAPHQL
    query DeckImportFormat($id: UUID, $gameId: UUID, $key: String) {
      deckImportFormat(id: $id, gameId: $gameId, key: $key) {
        #{deck_import_format_definition_fields}
      }
    }
  GRAPHQL
end

.deck_import_format_testObject



1179
1180
1181
1182
1183
1184
1185
1186
1187
# File 'lib/carddb/query_builder.rb', line 1179

def deck_import_format_test
  <<~GRAPHQL
    query DeckImportFormatTest($input: DeckImportFormatTestInput!) {
      deckImportFormatTest(input: $input) {
        #{deck_import_format_test_payload_fields}
      }
    }
  GRAPHQL
end

.deck_import_formats(publisher_id: nil, game_id: nil, include_archived: nil, first: nil, after: nil) ⇒ Object



1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
# File 'lib/carddb/query_builder.rb', line 1155

def deck_import_formats(publisher_id: nil, game_id: nil, include_archived: nil, first: nil, after: nil)
  args = build_args(
    { publisherId: publisher_id, gameId: game_id, includeArchived: include_archived, first: first, after: after }
  )

  <<~GRAPHQL
    query DeckImportFormats#{args[:definition]} {
      deckImportFormats#{args[:call]} {
        #{deck_import_format_definition_connection_fields}
      }
    }
  GRAPHQL
end

.deck_section_definitions(publisher_slug: nil, game_key: nil, game_id: nil, ruleset_key: nil, ruleset_version_id: nil) ⇒ Object



1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
# File 'lib/carddb/query_builder.rb', line 1106

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_validateObject



1096
1097
1098
1099
1100
1101
1102
1103
1104
# File 'lib/carddb/query_builder.rb', line 1096

def deck_validate
  <<~GRAPHQL
    query DeckValidate($id: UUID!, $input: DeckValidateInput) {
      deckValidate(id: $id, input: $input) {
        #{deck_validation_fields}
      }
    }
  GRAPHQL
end

.deck_versionObject

Builds a deckVersion query



1033
1034
1035
1036
1037
1038
1039
1040
1041
# File 'lib/carddb/query_builder.rb', line 1033

def deck_version
  <<~GRAPHQL
    query DeckVersion($id: UUID!) {
      deckVersion(id: $id) {
        #{deck_version_fields}
      }
    }
  GRAPHQL
end

.deck_version_diffObject



1066
1067
1068
1069
1070
1071
1072
1073
1074
# File 'lib/carddb/query_builder.rb', line 1066

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



1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
# File 'lib/carddb/query_builder.rb', line 1044

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_dataset_recordsObject



430
431
432
433
434
435
436
437
438
# File 'lib/carddb/query_builder.rb', line 430

def delete_dataset_records
  <<~GRAPHQL
    mutation DatasetRecordsDelete($input: DatasetRecordsDeleteInput!) {
      datasetRecordsDelete(input: $input) {
        #{dataset_record_delete_job_fields}
      }
    }
  GRAPHQL
end

.delete_deckObject

Builds a deckDelete mutation



1494
1495
1496
1497
1498
1499
1500
# File 'lib/carddb/query_builder.rb', line 1494

def delete_deck
  <<~GRAPHQL
    mutation DeckDelete($id: UUID!) {
      deckDelete(id: $id)
    }
  GRAPHQL
end

.exchange_deck_tokenObject



1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
# File 'lib/carddb/query_builder.rb', line 1454

def exchange_deck_token
  <<~GRAPHQL
    mutation DeckTokenExchange($input: DeckTokenExchangeInput!) {
      deckTokenExchange(input: $input) {
        token
        deckToken {
          #{deck_token_fields}
        }
      }
    }
  GRAPHQL
end

.export_jobObject



837
838
839
840
841
842
843
844
845
# File 'lib/carddb/query_builder.rb', line 837

def export_job
  <<~GRAPHQL
    query ExportJob($id: UUID!) {
      exportJob(id: $id) {
        #{export_job_fields}
      }
    }
  GRAPHQL
end

.export_job_cancelObject



880
881
882
883
884
885
886
887
888
# File 'lib/carddb/query_builder.rb', line 880

def export_job_cancel
  <<~GRAPHQL
    mutation ExportJobCancel($id: UUID!) {
      exportJobCancel(id: $id) {
        #{export_job_fields}
      }
    }
  GRAPHQL
end

.export_job_refresh_urlObject



890
891
892
893
894
895
896
897
898
# File 'lib/carddb/query_builder.rb', line 890

def export_job_refresh_url
  <<~GRAPHQL
    mutation ExportJobRefreshUrl($id: UUID!) {
      exportJobRefreshUrl(id: $id) {
        #{export_job_fields}
      }
    }
  GRAPHQL
end

.export_jobs(publisher_id:, game_id: nil, dataset_id: nil, status: nil, first: nil, after: nil) ⇒ Object



847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
# File 'lib/carddb/query_builder.rb', line 847

def export_jobs(publisher_id:, game_id: nil, dataset_id: nil, status: nil, first: nil, after: nil)
  args = build_args(
    {
      publisherId: publisher_id,
      gameId: game_id,
      datasetId: dataset_id,
      status: status,
      first: first,
      after: after
    },
    required: [:publisherId],
    type_overrides: { status: 'ExportJobStatus' }
  )

  <<~GRAPHQL
    query ExportJobs#{args[:definition]} {
      exportJobs#{args[:call]} {
        #{export_job_connection_fields}
      }
    }
  GRAPHQL
end

.fetch_dataset_by_idObject

Builds a fetchDataset query by id



188
189
190
191
192
193
194
195
196
197
# File 'lib/carddb/query_builder.rb', line 188

def fetch_dataset_by_id
  <<~GRAPHQL
    query FetchDataset($id: UUID!) {
      fetchDataset(id: $id) {
        #{dataset_fields}
        #{schema_fields}
      }
    }
  GRAPHQL
end

.fetch_dataset_by_keysObject

Builds a fetchDataset query by keys (includes schema)



200
201
202
203
204
205
206
207
208
209
# File 'lib/carddb/query_builder.rb', line 200

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_datasetsObject

Builds a fetchDatasets batch query



212
213
214
215
216
217
218
219
220
# File 'lib/carddb/query_builder.rb', line 212

def fetch_datasets
  <<~GRAPHQL
    query FetchDatasets($ids: [UUID!]!) {
      fetchDatasets(ids: $ids) {
        #{dataset_fields}
      }
    }
  GRAPHQL
end

.fetch_deckObject

Builds a fetchDeck query



959
960
961
962
963
964
965
966
967
# File 'lib/carddb/query_builder.rb', line 959

def fetch_deck
  <<~GRAPHQL
    query FetchDeck($id: UUID!) {
      fetchDeck(id: $id) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.fetch_deck_by_external_refObject

Builds a fetchDeckByExternalRef query



1012
1013
1014
1015
1016
1017
1018
1019
1020
# File 'lib/carddb/query_builder.rb', line 1012

def fetch_deck_by_external_ref
  <<~GRAPHQL
    query FetchDeckByExternalRef($externalRef: String!) {
      fetchDeckByExternalRef(externalRef: $externalRef) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.fetch_deck_by_slugObject

Builds a fetchDeckBySlug query



991
992
993
994
995
996
997
998
999
# File 'lib/carddb/query_builder.rb', line 991

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_idObject

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_keysObject

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_gamesObject

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_meObject

Builds a fetchMe query



1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
# File 'lib/carddb/query_builder.rb', line 1503

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_idObject

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_slugObject

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_publishersObject

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



338
339
340
341
342
343
344
345
346
# File 'lib/carddb/query_builder.rb', line 338

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



316
317
318
319
320
321
322
323
324
# File 'lib/carddb/query_builder.rb', line 316

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



349
350
351
352
353
354
355
356
357
# File 'lib/carddb/query_builder.rb', line 349

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



327
328
329
330
331
332
333
334
335
# File 'lib/carddb/query_builder.rb', line 327

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

.fileObject



645
646
647
648
649
650
651
652
653
# File 'lib/carddb/query_builder.rb', line 645

def file
  <<~GRAPHQL
    query File($id: UUID!) {
      file(id: $id) {
        #{file_fields}
      }
    }
  GRAPHQL
end

.file_deleteObject



675
676
677
678
679
680
681
# File 'lib/carddb/query_builder.rb', line 675

def file_delete
  <<~GRAPHQL
    mutation FileDelete($id: UUID!) {
      fileDelete(id: $id)
    }
  GRAPHQL
end

.file_upload_confirmObject



665
666
667
668
669
670
671
672
673
# File 'lib/carddb/query_builder.rb', line 665

def file_upload_confirm
  <<~GRAPHQL
    mutation FileUploadConfirm($id: UUID!) {
      fileUploadConfirm(id: $id) {
        #{file_fields}
      }
    }
  GRAPHQL
end

.file_upload_requestObject



655
656
657
658
659
660
661
662
663
# File 'lib/carddb/query_builder.rb', line 655

def file_upload_request
  <<~GRAPHQL
    mutation FileUploadRequest($input: FileUploadInput!) {
      fileUploadRequest(input: $input) {
        #{presigned_upload_fields}
      }
    }
  GRAPHQL
end

.game(id: nil, publisher_id: nil, publisher_slug: nil, game_key: nil, game_slug: nil) ⇒ Object



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/carddb/query_builder.rb', line 127

def game(id: nil, publisher_id: nil, publisher_slug: nil, game_key: nil, game_slug: nil)
  args = build_args(
    {
      id: id,
      publisherId: publisher_id,
      publisherSlug: publisher_slug,
      gameKey: game_key,
      gameSlug: game_slug
    }
  )

  <<~GRAPHQL
    query Game#{args[:definition]} {
      game#{args[:call]} {
        #{game_fields}
      }
    }
  GRAPHQL
end

.game_import_from_fileObject



579
580
581
582
583
584
585
586
587
# File 'lib/carddb/query_builder.rb', line 579

def game_import_from_file
  <<~GRAPHQL
    mutation GameImportFromFile($input: GameImportFromFileInput!) {
      gameImportFromFile(input: $input) {
        #{game_import_job_fields}
      }
    }
  GRAPHQL
end

.game_import_from_payloadObject



589
590
591
592
593
594
595
596
597
# File 'lib/carddb/query_builder.rb', line 589

def game_import_from_payload
  <<~GRAPHQL
    mutation GameImportFromPayload($input: GameImportFromPayloadInput!) {
      gameImportFromPayload(input: $input) {
        #{game_import_job_fields}
      }
    }
  GRAPHQL
end

.game_import_from_urlObject



599
600
601
602
603
604
605
606
607
# File 'lib/carddb/query_builder.rb', line 599

def game_import_from_url
  <<~GRAPHQL
    mutation GameImportFromUrl($input: GameImportFromUrlInput!) {
      gameImportFromUrl(input: $input) {
        #{game_import_job_fields}
      }
    }
  GRAPHQL
end

.game_import_jobObject



609
610
611
612
613
614
615
616
617
# File 'lib/carddb/query_builder.rb', line 609

def game_import_job
  <<~GRAPHQL
    query GameImportJob($id: UUID!) {
      gameImportJob(id: $id) {
        #{game_import_job_fields}
      }
    }
  GRAPHQL
end

.game_import_job_cancelObject



635
636
637
638
639
640
641
642
643
# File 'lib/carddb/query_builder.rb', line 635

def game_import_job_cancel
  <<~GRAPHQL
    mutation GameImportJobCancel($id: UUID!) {
      gameImportJobCancel(id: $id) {
        #{game_import_job_fields}
      }
    }
  GRAPHQL
end

.game_import_jobs(game_id:, status: nil, first: nil, after: nil) ⇒ Object



619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
# File 'lib/carddb/query_builder.rb', line 619

def game_import_jobs(game_id:, status: nil, first: nil, after: nil)
  args = build_args(
    { gameId: game_id, status: status, first: first, after: after },
    required: [:gameId],
    type_overrides: { status: 'ImportJobStatus' }
  )

  <<~GRAPHQL
    query GameImportJobs#{args[:definition]} {
      gameImportJobs#{args[:call]} {
        #{game_import_job_connection_fields}
      }
    }
  GRAPHQL
end

.game_import_previewObject



569
570
571
572
573
574
575
576
577
# File 'lib/carddb/query_builder.rb', line 569

def game_import_preview
  <<~GRAPHQL
    query GameImportPreview($input: GameImportPreviewInput!) {
      gameImportPreview(input: $input) {
        #{game_import_preview_fields}
      }
    }
  GRAPHQL
end

.game_scan_regionsObject



827
828
829
830
831
832
833
834
835
# File 'lib/carddb/query_builder.rb', line 827

def game_scan_regions
  <<~GRAPHQL
    query GameScanRegions($publisherSlug: String!, $gameKey: String!, $includeInactive: Boolean) {
      gameScanRegions(publisherSlug: $publisherSlug, gameKey: $gameKey, includeInactive: $includeInactive) {
        #{game_scan_region_fields}
      }
    }
  GRAPHQL
end

.grant_deck_api_application_accessObject



1475
1476
1477
1478
1479
1480
1481
1482
1483
# File 'lib/carddb/query_builder.rb', line 1475

def grant_deck_api_application_access
  <<~GRAPHQL
    mutation DeckApiApplicationAccessGrant($input: DeckAPIApplicationAccessGrantInput!) {
      deckApiApplicationAccessGrant(input: $input) {
        #{deck_api_application_access_fields}
      }
    }
  GRAPHQL
end

.import_deckObject



1261
1262
1263
1264
1265
1266
1267
1268
1269
# File 'lib/carddb/query_builder.rb', line 1261

def import_deck
  <<~GRAPHQL
    mutation DeckImport($input: DeckImportInput!) {
      deckImport(input: $input) {
        #{deck_import_payload_fields}
      }
    }
  GRAPHQL
end

.import_jobObject



516
517
518
519
520
521
522
523
524
# File 'lib/carddb/query_builder.rb', line 516

def import_job
  <<~GRAPHQL
    query ImportJob($id: UUID!) {
      importJob(id: $id) {
        #{import_job_fields}
      }
    }
  GRAPHQL
end

.import_job_cancelObject



542
543
544
545
546
547
548
549
550
# File 'lib/carddb/query_builder.rb', line 542

def import_job_cancel
  <<~GRAPHQL
    mutation ImportJobCancel($id: UUID!) {
      importJobCancel(id: $id) {
        #{import_job_fields}
      }
    }
  GRAPHQL
end

.import_job_logs(level: nil, dataset_key: nil, first: nil, after: nil) ⇒ Object



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/carddb/query_builder.rb', line 552

def import_job_logs(level: nil, dataset_key: nil, first: nil, after: nil)
  log_args = build_args(
    { level: level, datasetKey: dataset_key, first: first, after: after },
    type_overrides: { level: 'ImportLogLevel' }
  )

  <<~GRAPHQL
    query ImportJobLogs($importJobId: UUID!#{log_args[:definition].sub('(', ', ').sub(')', '')}) {
      importJob(id: $importJobId) {
        logs#{log_args[:call]} {
          #{import_job_log_connection_fields}
        }
      }
    }
  GRAPHQL
end

.import_jobs(publisher_id:, dataset_id: nil, status: nil, first: nil, after: nil) ⇒ Object



526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# File 'lib/carddb/query_builder.rb', line 526

def import_jobs(publisher_id:, dataset_id: nil, status: nil, first: nil, after: nil)
  args = build_args(
    { publisherId: publisher_id, datasetId: dataset_id, status: status, first: first, after: after },
    required: [:publisherId],
    type_overrides: { status: 'ImportJobStatus' }
  )

  <<~GRAPHQL
    query ImportJobs#{args[:definition]} {
      importJobs#{args[:call]} {
        #{import_job_connection_fields}
      }
    }
  GRAPHQL
end

.list_dataset_records(dataset_id:, filter: nil, order_by: nil, first: nil, after: nil, last: nil, before: nil, validate_schema: nil) ⇒ Object



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/carddb/query_builder.rb', line 359

def list_dataset_records(
  dataset_id:,
  filter: nil,
  order_by: nil,
  first: nil,
  after: nil,
  last: nil,
  before: nil,
  validate_schema: nil
)
  args = build_args(
    {
      datasetId: dataset_id,
      filter: filter,
      orderBy: order_by,
      first: first,
      after: after,
      last: last,
      before: before,
      validateSchema: validate_schema
    },
    required: [:datasetId],
    type_overrides: { orderBy: 'DatasetRecordOrderByInput' }
  )

  <<~GRAPHQL
    query DatasetRecords#{args[:definition]} {
      datasetRecords#{args[:call]} {
        #{record_connection_fields}
      }
    }
  GRAPHQL
end

.list_datasets(publisher_id:, game_id: nil, purpose: nil, first: nil, after: nil, include_archived: nil) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/carddb/query_builder.rb', line 222

def list_datasets(
  publisher_id:,
  game_id: nil,
  purpose: nil,
  first: nil,
  after: nil,
  include_archived: nil
)
  args = build_args(
    {
      publisherId: publisher_id,
      gameId: game_id,
      purpose: purpose,
      first: first,
      after: after,
      includeArchived: include_archived
    },
    required: [:publisherId]
  )

  <<~GRAPHQL
    query Datasets#{args[:definition]} {
      datasets#{args[:call]} {
        #{dataset_connection_fields(include_schema: true)}
      }
    }
  GRAPHQL
end

.list_games(publisher_id:, first: nil, after: nil, include_archived: nil) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/carddb/query_builder.rb', line 112

def list_games(publisher_id:, first: nil, after: nil, include_archived: nil)
  args = build_args(
    { publisherId: publisher_id, first: first, after: after, includeArchived: include_archived },
    required: [:publisherId]
  )

  <<~GRAPHQL
    query Games#{args[:definition]} {
      games#{args[:call]} {
        #{game_connection_fields}
      }
    }
  GRAPHQL
end

.list_my_decks(first: nil, after: nil, include_archived: nil) ⇒ Object

Builds a myDecks query



901
902
903
904
905
906
907
908
909
910
911
# File 'lib/carddb/query_builder.rb', line 901

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_deckObject

Builds a myDeck query



980
981
982
983
984
985
986
987
988
# File 'lib/carddb/query_builder.rb', line 980

def my_deck
  <<~GRAPHQL
    query MyDeck($id: UUID!) {
      myDeck(id: $id) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.my_deck_api_application_accessesObject



1145
1146
1147
1148
1149
1150
1151
1152
1153
# File 'lib/carddb/query_builder.rb', line 1145

def my_deck_api_application_accesses
  <<~GRAPHQL
    query MyDeckApiApplicationAccesses($applicationId: UUID) {
      myDeckApiApplicationAccesses(applicationId: $applicationId) {
        #{deck_api_application_access_fields}
      }
    }
  GRAPHQL
end

.preview_scan_templateObject



811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/carddb/query_builder.rb', line 811

def preview_scan_template
  <<~GRAPHQL
    mutation PreviewScanTemplate($input: PreviewScanTemplateInput!) {
      previewScanTemplate(input: $input) {
        warnings {
          #{scan_template_warning_fields}
        }
        regions {
          #{scan_template_preview_region_fields}
        }
        message
      }
    }
  GRAPHQL
end

.public_decks(filter: nil, first: nil, after: nil) ⇒ Object



943
944
945
946
947
948
949
950
951
952
953
954
955
956
# File 'lib/carddb/query_builder.rb', line 943

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_deckObject

Builds a deckPublish mutation



1386
1387
1388
1389
1390
1391
1392
1393
1394
# File 'lib/carddb/query_builder.rb', line 1386

def publish_deck
  <<~GRAPHQL
    mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) {
      deckPublish(id: $id, input: $input) {
        #{deck_publish_payload_fields}
      }
    }
  GRAPHQL
end

.remove_deck_collaboratorObject

Builds a deckCollaboratorRemove mutation



1418
1419
1420
1421
1422
1423
1424
# File 'lib/carddb/query_builder.rb', line 1418

def remove_deck_collaborator
  <<~GRAPHQL
    mutation DeckCollaboratorRemove($deckId: UUID!, $accountId: UUID!) {
      deckCollaboratorRemove(deckId: $deckId, accountId: $accountId)
    }
  GRAPHQL
end

.remove_deck_entryObject



1231
1232
1233
1234
1235
1236
1237
1238
1239
# File 'lib/carddb/query_builder.rb', line 1231

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_entriesObject



1396
1397
1398
1399
1400
1401
1402
1403
1404
# File 'lib/carddb/query_builder.rb', line 1396

def remove_invalid_deck_entries
  <<~GRAPHQL
    mutation DeckRemoveInvalidEntries($id: UUID!, $input: DeckRemoveInvalidEntriesInput!) {
      deckRemoveInvalidEntries(id: $id, input: $input) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.reorder_deck_entriesObject



1241
1242
1243
1244
1245
1246
1247
1248
1249
# File 'lib/carddb/query_builder.rb', line 1241

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_entriesObject



1251
1252
1253
1254
1255
1256
1257
1258
1259
# File 'lib/carddb/query_builder.rb', line 1251

def replace_deck_entries
  <<~GRAPHQL
    mutation DeckEntriesReplace($deckId: UUID!, $input: DeckEntriesReplaceInput!) {
      deckEntriesReplace(deckId: $deckId, input: $input) {
        #{deck_entry_reorder_payload_fields}
      }
    }
  GRAPHQL
end

.resolve_scan_templateObject



754
755
756
757
758
759
760
761
762
763
764
765
766
767
# File 'lib/carddb/query_builder.rb', line 754

def resolve_scan_template
  <<~GRAPHQL
    query ResolveScanTemplate($input: ResolveScanTemplateInput!) {
      resolveScanTemplate(input: $input) {
        template {
          #{scan_template_fields}
        }
        warnings {
          #{scan_template_warning_fields}
        }
      }
    }
  GRAPHQL
end

.restore_deckObject



1365
1366
1367
1368
1369
1370
1371
1372
1373
# File 'lib/carddb/query_builder.rb', line 1365

def restore_deck
  <<~GRAPHQL
    mutation DeckRestore($id: UUID!) {
      deckRestore(id: $id) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.revoke_deck_api_application_accessObject



1485
1486
1487
1488
1489
1490
1491
# File 'lib/carddb/query_builder.rb', line 1485

def revoke_deck_api_application_access
  <<~GRAPHQL
    mutation DeckApiApplicationAccessRevoke($deckId: UUID!, $apiApplicationId: UUID!) {
      deckApiApplicationAccessRevoke(deckId: $deckId, apiApplicationId: $apiApplicationId)
    }
  GRAPHQL
end

.revoke_deck_tokenObject



1467
1468
1469
1470
1471
1472
1473
# File 'lib/carddb/query_builder.rb', line 1467

def revoke_deck_token
  <<~GRAPHQL
    mutation DeckTokenRevoke($id: UUID!) {
      deckTokenRevoke(id: $id)
    }
  GRAPHQL
end

.revoke_deck_token_issuerObject



1436
1437
1438
1439
1440
1441
1442
# File 'lib/carddb/query_builder.rb', line 1436

def revoke_deck_token_issuer
  <<~GRAPHQL
    mutation DeckTokenIssuerRevoke($id: UUID!) {
      deckTokenIssuerRevoke(id: $id)
    }
  GRAPHQL
end

.revoke_deck_token_issuer_signing_keyObject



1444
1445
1446
1447
1448
1449
1450
1451
1452
# File 'lib/carddb/query_builder.rb', line 1444

def revoke_deck_token_issuer_signing_key
  <<~GRAPHQL
    mutation DeckTokenIssuerSigningKeyRevoke($id: UUID!) {
      deckTokenIssuerSigningKeyRevoke(id: $id) {
        #{deck_token_issuer_fields}
      }
    }
  GRAPHQL
end

.scan_jobObject



716
717
718
719
720
721
722
723
724
# File 'lib/carddb/query_builder.rb', line 716

def scan_job
  <<~GRAPHQL
    query ScanJob($id: UUID!) {
      scanJob(id: $id) {
        #{scan_job_fields}
      }
    }
  GRAPHQL
end

.scan_metricsObject



744
745
746
747
748
749
750
751
752
# File 'lib/carddb/query_builder.rb', line 744

def scan_metrics
  <<~GRAPHQL
    query ScanMetrics($input: ScanMetricsInput!) {
      scanMetrics(input: $input) {
        #{scan_metrics_fields}
      }
    }
  GRAPHQL
end

.scan_templatesObject



769
770
771
772
773
774
775
776
777
778
779
# File 'lib/carddb/query_builder.rb', line 769

def scan_templates
  <<~GRAPHQL
    query ScanTemplates($input: ScanTemplatesInput!) {
      scanTemplates(input: $input) {
        templates {
          #{scan_template_fields}
        }
      }
    }
  GRAPHQL
end

.search_datasets(publisher_slug: nil, game_key: nil, search: nil, purpose: nil, first: nil, after: nil) ⇒ Object

Builds a searchDatasets query



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/carddb/query_builder.rb', line 168

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



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/carddb/query_builder.rb', line 273

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

.submit_scan_feedbackObject



726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
# File 'lib/carddb/query_builder.rb', line 726

def submit_scan_feedback
  <<~GRAPHQL
    mutation SubmitScanFeedback($input: SubmitScanFeedbackInput!) {
      submitScanFeedback(input: $input) {
        feedbackId
        jobId
        status
        persisted
        correct
        predictedRecordId
        selectedRecordId
        featureVersion
        message
      }
    }
  GRAPHQL
end

.transfer_deck_ownershipObject



1335
1336
1337
1338
1339
1340
1341
1342
1343
# File 'lib/carddb/query_builder.rb', line 1335

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_formatObject



1301
1302
1303
1304
1305
1306
1307
1308
1309
# File 'lib/carddb/query_builder.rb', line 1301

def unarchive_deck_import_format
  <<~GRAPHQL
    mutation DeckImportFormatUnarchive($id: UUID!) {
      deckImportFormatUnarchive(id: $id) {
        #{deck_import_format_definition_fields}
      }
    }
  GRAPHQL
end

.unpublish_deckObject



1375
1376
1377
1378
1379
1380
1381
1382
1383
# File 'lib/carddb/query_builder.rb', line 1375

def unpublish_deck
  <<~GRAPHQL
    mutation DeckUnpublish($id: UUID!) {
      deckUnpublish(id: $id) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.update_deckObject

Builds a deckUpdate mutation



1201
1202
1203
1204
1205
1206
1207
1208
1209
# File 'lib/carddb/query_builder.rb', line 1201

def update_deck
  <<~GRAPHQL
    mutation DeckUpdate($id: UUID!, $input: DeckUpdateInput!) {
      deckUpdate(id: $id, input: $input) {
        #{deck_fields}
      }
    }
  GRAPHQL
end

.update_deck_entryObject



1221
1222
1223
1224
1225
1226
1227
1228
1229
# File 'lib/carddb/query_builder.rb', line 1221

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_formatObject



1281
1282
1283
1284
1285
1286
1287
1288
1289
# File 'lib/carddb/query_builder.rb', line 1281

def update_deck_import_format
  <<~GRAPHQL
    mutation DeckImportFormatUpdate($id: UUID!, $input: DeckImportFormatUpdateInput!) {
      deckImportFormatUpdate(id: $id, input: $input) {
        #{deck_import_format_definition_fields}
      }
    }
  GRAPHQL
end

.update_gameObject



157
158
159
160
161
162
163
164
165
# File 'lib/carddb/query_builder.rb', line 157

def update_game
  <<~GRAPHQL
    mutation GameUpdate($id: UUID!, $input: GameUpdateInput!) {
      gameUpdate(id: $id, input: $input) {
        #{game_fields}
      }
    }
  GRAPHQL
end

.update_scan_templateObject



796
797
798
799
800
801
802
803
804
805
806
807
808
809
# File 'lib/carddb/query_builder.rb', line 796

def update_scan_template
  <<~GRAPHQL
    mutation UpdateScanTemplate($id: UUID!, $input: SaveScanTemplateInput!) {
      updateScanTemplate(id: $id, input: $input) {
        template {
          #{scan_template_fields}
        }
        warnings {
          #{scan_template_warning_fields}
        }
      }
    }
  GRAPHQL
end

.upsert_dataset_recordsObject



420
421
422
423
424
425
426
427
428
# File 'lib/carddb/query_builder.rb', line 420

def upsert_dataset_records
  <<~GRAPHQL
    mutation DatasetRecordsUpsert($input: DatasetRecordsUpsertInput!) {
      datasetRecordsUpsert(input: $input) {
        #{dataset_records_upsert_payload_fields}
      }
    }
  GRAPHQL
end

.upsert_deck_by_external_refObject



1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
# File 'lib/carddb/query_builder.rb', line 1311

def upsert_deck_by_external_ref
  <<~GRAPHQL
    mutation DeckUpsertByExternalRef($input: DeckUpsertByExternalRefInput!) {
      deckUpsertByExternalRef(input: $input) {
        deck {
          #{deck_fields}
        }
        created
        idempotentReplay
      }
    }
  GRAPHQL
end

.upsert_deck_collaboratorObject

Builds a deckCollaboratorUpsert mutation



1407
1408
1409
1410
1411
1412
1413
1414
1415
# File 'lib/carddb/query_builder.rb', line 1407

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



913
914
915
916
917
918
919
920
921
922
923
924
925
926
# File 'lib/carddb/query_builder.rb', line 913

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