carddb 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -253,8 +253,8 @@ module CardDB
253
253
  end
254
254
 
255
255
  # Builds a myDecks query
256
- def list_my_decks(first: nil, after: nil)
257
- args = build_args({ first: first, after: after })
256
+ def list_my_decks(first: nil, after: nil, include_archived: nil)
257
+ args = build_args({ first: first, after: after, includeArchived: include_archived })
258
258
 
259
259
  <<~GRAPHQL
260
260
  query MyDecks#{args[:definition]} {
@@ -265,6 +265,51 @@ module CardDB
265
265
  GRAPHQL
266
266
  end
267
267
 
268
+ def viewer_decks(filter: nil, first: nil, after: nil)
269
+ args = build_args(
270
+ { filter: filter, first: first, after: after },
271
+ type_overrides: { filter: 'ViewerDecksFilterInput' }
272
+ )
273
+
274
+ <<~GRAPHQL
275
+ query ViewerDecks#{args[:definition]} {
276
+ viewerDecks#{args[:call]} {
277
+ #{deck_connection_fields}
278
+ }
279
+ }
280
+ GRAPHQL
281
+ end
282
+
283
+ def app_decks(filter: nil, first: nil, after: nil)
284
+ args = build_args(
285
+ { filter: filter, first: first, after: after },
286
+ type_overrides: { filter: 'AppDecksFilterInput' }
287
+ )
288
+
289
+ <<~GRAPHQL
290
+ query AppDecks#{args[:definition]} {
291
+ appDecks#{args[:call]} {
292
+ #{deck_connection_fields}
293
+ }
294
+ }
295
+ GRAPHQL
296
+ end
297
+
298
+ def public_decks(filter: nil, first: nil, after: nil)
299
+ args = build_args(
300
+ { filter: filter, first: first, after: after },
301
+ type_overrides: { filter: 'PublicDecksFilterInput' }
302
+ )
303
+
304
+ <<~GRAPHQL
305
+ query PublicDecks#{args[:definition]} {
306
+ publicDecks#{args[:call]} {
307
+ #{deck_connection_fields}
308
+ }
309
+ }
310
+ GRAPHQL
311
+ end
312
+
268
313
  # Builds a fetchDeck query
269
314
  def fetch_deck
270
315
  <<~GRAPHQL
@@ -276,6 +321,16 @@ module CardDB
276
321
  GRAPHQL
277
322
  end
278
323
 
324
+ def deck
325
+ <<~GRAPHQL
326
+ query Deck($id: UUID!) {
327
+ deck(id: $id) {
328
+ #{deck_fields}
329
+ }
330
+ }
331
+ GRAPHQL
332
+ end
333
+
279
334
  # Builds a myDeck query
280
335
  def my_deck
281
336
  <<~GRAPHQL
@@ -298,6 +353,16 @@ module CardDB
298
353
  GRAPHQL
299
354
  end
300
355
 
356
+ def deck_by_slug
357
+ <<~GRAPHQL
358
+ query DeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
359
+ deckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
360
+ #{deck_fields}
361
+ }
362
+ }
363
+ GRAPHQL
364
+ end
365
+
301
366
  # Builds a fetchDeckByExternalRef query
302
367
  def fetch_deck_by_external_ref
303
368
  <<~GRAPHQL
@@ -309,6 +374,16 @@ module CardDB
309
374
  GRAPHQL
310
375
  end
311
376
 
377
+ def deck_by_external_ref
378
+ <<~GRAPHQL
379
+ query DeckByExternalRef($externalRef: String!) {
380
+ deckByExternalRef(externalRef: $externalRef) {
381
+ #{deck_fields}
382
+ }
383
+ }
384
+ GRAPHQL
385
+ end
386
+
312
387
  # Builds a deckVersion query
313
388
  def deck_version
314
389
  <<~GRAPHQL
@@ -344,6 +419,94 @@ module CardDB
344
419
  GRAPHQL
345
420
  end
346
421
 
422
+ def deck_embed
423
+ <<~GRAPHQL
424
+ query DeckEmbed($token: String!) {
425
+ deckEmbed(token: $token) {
426
+ #{deck_fields}
427
+ }
428
+ }
429
+ GRAPHQL
430
+ end
431
+
432
+ def deck_access
433
+ <<~GRAPHQL
434
+ query DeckAccess($token: String!) {
435
+ deckAccess(token: $token) {
436
+ #{deck_fields}
437
+ }
438
+ }
439
+ GRAPHQL
440
+ end
441
+
442
+ def deck_draft_diff
443
+ <<~GRAPHQL
444
+ query DeckDraftDiff($id: UUID!) {
445
+ deckDraftDiff(id: $id) {
446
+ #{deck_diff_fields}
447
+ }
448
+ }
449
+ GRAPHQL
450
+ end
451
+
452
+ def deck_version_diff
453
+ <<~GRAPHQL
454
+ query DeckVersionDiff($fromVersionId: UUID!, $toVersionId: UUID!) {
455
+ deckVersionDiff(fromVersionId: $fromVersionId, toVersionId: $toVersionId) {
456
+ #{deck_diff_fields}
457
+ }
458
+ }
459
+ GRAPHQL
460
+ end
461
+
462
+ def deck_hydrate_entries
463
+ <<~GRAPHQL
464
+ query DeckHydrateEntries($input: DeckHydrateEntriesInput!) {
465
+ deckHydrateEntries(input: $input) {
466
+ #{deck_hydrate_entries_payload_fields}
467
+ }
468
+ }
469
+ GRAPHQL
470
+ end
471
+
472
+ def deck_export
473
+ <<~GRAPHQL
474
+ query DeckExport($id: UUID!, $format: DeckExportFormat!) {
475
+ deckExport(id: $id, format: $format) {
476
+ #{deck_export_payload_fields}
477
+ }
478
+ }
479
+ GRAPHQL
480
+ end
481
+
482
+ def deck_validate
483
+ <<~GRAPHQL
484
+ query DeckValidate($id: UUID!, $input: DeckValidateInput) {
485
+ deckValidate(id: $id, input: $input) {
486
+ #{deck_validation_fields}
487
+ }
488
+ }
489
+ GRAPHQL
490
+ end
491
+
492
+ def deck_section_definitions(publisher_slug: nil, game_key: nil, game_id: nil, ruleset_key: nil, ruleset_version_id: nil)
493
+ args = build_args({
494
+ publisherSlug: publisher_slug,
495
+ gameKey: game_key,
496
+ gameId: game_id,
497
+ rulesetKey: ruleset_key,
498
+ rulesetVersionId: ruleset_version_id
499
+ })
500
+
501
+ <<~GRAPHQL
502
+ query DeckSectionDefinitions#{args[:definition]} {
503
+ deckSectionDefinitions#{args[:call]} {
504
+ #{deck_section_definition_fields}
505
+ }
506
+ }
507
+ GRAPHQL
508
+ end
509
+
347
510
  # Builds a deckCollaborators query
348
511
  def deck_collaborators
349
512
  <<~GRAPHQL
@@ -366,6 +529,81 @@ module CardDB
366
529
  GRAPHQL
367
530
  end
368
531
 
532
+ def deck_embed_tokens
533
+ <<~GRAPHQL
534
+ query DeckEmbedTokens($deckId: UUID!) {
535
+ deckEmbedTokens(deckId: $deckId) {
536
+ #{deck_embed_token_fields}
537
+ }
538
+ }
539
+ GRAPHQL
540
+ end
541
+
542
+ def deck_access_token_issuers
543
+ <<~GRAPHQL
544
+ query DeckAccessTokenIssuers($deckId: UUID!) {
545
+ deckAccessTokenIssuers(deckId: $deckId) {
546
+ #{deck_access_token_issuer_fields}
547
+ }
548
+ }
549
+ GRAPHQL
550
+ end
551
+
552
+ def deck_api_application_accesses
553
+ <<~GRAPHQL
554
+ query DeckApiApplicationAccesses($deckId: UUID!, $includeRevoked: Boolean) {
555
+ deckApiApplicationAccesses(deckId: $deckId, includeRevoked: $includeRevoked) {
556
+ #{deck_api_application_access_fields}
557
+ }
558
+ }
559
+ GRAPHQL
560
+ end
561
+
562
+ def my_deck_api_application_accesses
563
+ <<~GRAPHQL
564
+ query MyDeckApiApplicationAccesses($applicationId: UUID) {
565
+ myDeckApiApplicationAccesses(applicationId: $applicationId) {
566
+ #{deck_api_application_access_fields}
567
+ }
568
+ }
569
+ GRAPHQL
570
+ end
571
+
572
+ def deck_import_formats(game_id:, include_archived: nil, first: nil, after: nil)
573
+ args = build_args(
574
+ { gameId: game_id, includeArchived: include_archived, first: first, after: after },
575
+ required: [:gameId]
576
+ )
577
+
578
+ <<~GRAPHQL
579
+ query DeckImportFormats#{args[:definition]} {
580
+ deckImportFormats#{args[:call]} {
581
+ #{deck_import_format_definition_connection_fields}
582
+ }
583
+ }
584
+ GRAPHQL
585
+ end
586
+
587
+ def deck_import_format
588
+ <<~GRAPHQL
589
+ query DeckImportFormat($id: UUID!) {
590
+ deckImportFormat(id: $id) {
591
+ #{deck_import_format_definition_fields}
592
+ }
593
+ }
594
+ GRAPHQL
595
+ end
596
+
597
+ def deck_import_format_test
598
+ <<~GRAPHQL
599
+ query DeckImportFormatTest($input: DeckImportFormatTestInput!) {
600
+ deckImportFormatTest(input: $input) {
601
+ #{deck_import_format_test_payload_fields}
602
+ }
603
+ }
604
+ GRAPHQL
605
+ end
606
+
369
607
  # Builds a deckCreate mutation
370
608
  def create_deck
371
609
  <<~GRAPHQL
@@ -388,12 +626,196 @@ module CardDB
388
626
  GRAPHQL
389
627
  end
390
628
 
629
+ def add_deck_entry
630
+ <<~GRAPHQL
631
+ mutation DeckEntryAdd($input: DeckEntryAddInput!) {
632
+ deckEntryAdd(input: $input) {
633
+ #{deck_entry_mutation_payload_fields}
634
+ }
635
+ }
636
+ GRAPHQL
637
+ end
638
+
639
+ def update_deck_entry
640
+ <<~GRAPHQL
641
+ mutation DeckEntryUpdate($id: UUID!, $input: DeckEntryUpdateInput!) {
642
+ deckEntryUpdate(id: $id, input: $input) {
643
+ #{deck_entry_mutation_payload_fields}
644
+ }
645
+ }
646
+ GRAPHQL
647
+ end
648
+
649
+ def remove_deck_entry
650
+ <<~GRAPHQL
651
+ mutation DeckEntryRemove($id: UUID!, $expectedDraftRevision: Int!) {
652
+ deckEntryRemove(id: $id, expectedDraftRevision: $expectedDraftRevision) {
653
+ #{deck_entry_mutation_payload_fields}
654
+ }
655
+ }
656
+ GRAPHQL
657
+ end
658
+
659
+ def reorder_deck_entries
660
+ <<~GRAPHQL
661
+ mutation DeckEntryReorder($deckId: UUID!, $input: DeckEntryReorderInput!) {
662
+ deckEntryReorder(deckId: $deckId, input: $input) {
663
+ #{deck_entry_reorder_payload_fields}
664
+ }
665
+ }
666
+ GRAPHQL
667
+ end
668
+
669
+ def replace_deck_entries
670
+ <<~GRAPHQL
671
+ mutation DeckEntriesReplace($deckId: UUID!, $input: DeckEntriesReplaceInput!) {
672
+ deckEntriesReplace(deckId: $deckId, input: $input) {
673
+ #{deck_entry_reorder_payload_fields}
674
+ }
675
+ }
676
+ GRAPHQL
677
+ end
678
+
679
+ def import_deck
680
+ <<~GRAPHQL
681
+ mutation DeckImport($input: DeckImportInput!) {
682
+ deckImport(input: $input) {
683
+ #{deck_import_payload_fields}
684
+ }
685
+ }
686
+ GRAPHQL
687
+ end
688
+
689
+ def create_deck_import_format
690
+ <<~GRAPHQL
691
+ mutation DeckImportFormatCreate($input: DeckImportFormatCreateInput!) {
692
+ deckImportFormatCreate(input: $input) {
693
+ #{deck_import_format_definition_fields}
694
+ }
695
+ }
696
+ GRAPHQL
697
+ end
698
+
699
+ def update_deck_import_format
700
+ <<~GRAPHQL
701
+ mutation DeckImportFormatUpdate($id: UUID!, $input: DeckImportFormatUpdateInput!) {
702
+ deckImportFormatUpdate(id: $id, input: $input) {
703
+ #{deck_import_format_definition_fields}
704
+ }
705
+ }
706
+ GRAPHQL
707
+ end
708
+
709
+ def archive_deck_import_format
710
+ <<~GRAPHQL
711
+ mutation DeckImportFormatArchive($id: UUID!) {
712
+ deckImportFormatArchive(id: $id) {
713
+ #{deck_import_format_definition_fields}
714
+ }
715
+ }
716
+ GRAPHQL
717
+ end
718
+
719
+ def unarchive_deck_import_format
720
+ <<~GRAPHQL
721
+ mutation DeckImportFormatUnarchive($id: UUID!) {
722
+ deckImportFormatUnarchive(id: $id) {
723
+ #{deck_import_format_definition_fields}
724
+ }
725
+ }
726
+ GRAPHQL
727
+ end
728
+
729
+ def upsert_deck_by_external_ref
730
+ <<~GRAPHQL
731
+ mutation DeckUpsertByExternalRef($input: DeckUpsertByExternalRefInput!) {
732
+ deckUpsertByExternalRef(input: $input) {
733
+ deck {
734
+ #{deck_fields}
735
+ }
736
+ created
737
+ idempotentReplay
738
+ }
739
+ }
740
+ GRAPHQL
741
+ end
742
+
743
+ def claim_deck
744
+ <<~GRAPHQL
745
+ mutation DeckClaim($id: UUID!, $input: DeckClaimInput!) {
746
+ deckClaim(id: $id, input: $input) {
747
+ #{deck_ownership_transfer_payload_fields}
748
+ }
749
+ }
750
+ GRAPHQL
751
+ end
752
+
753
+ def transfer_deck_ownership
754
+ <<~GRAPHQL
755
+ mutation DeckTransferOwnership($id: UUID!, $input: DeckTransferOwnershipInput!) {
756
+ deckTransferOwnership(id: $id, input: $input) {
757
+ #{deck_ownership_transfer_payload_fields}
758
+ }
759
+ }
760
+ GRAPHQL
761
+ end
762
+
763
+ def copy_deck
764
+ <<~GRAPHQL
765
+ mutation DeckCopy($id: UUID!, $input: DeckCopyInput!) {
766
+ deckCopy(id: $id, input: $input) {
767
+ #{deck_copy_payload_fields}
768
+ }
769
+ }
770
+ GRAPHQL
771
+ end
772
+
773
+ def archive_deck
774
+ <<~GRAPHQL
775
+ mutation DeckArchive($id: UUID!) {
776
+ deckArchive(id: $id) {
777
+ #{deck_fields}
778
+ }
779
+ }
780
+ GRAPHQL
781
+ end
782
+
783
+ def restore_deck
784
+ <<~GRAPHQL
785
+ mutation DeckRestore($id: UUID!) {
786
+ deckRestore(id: $id) {
787
+ #{deck_fields}
788
+ }
789
+ }
790
+ GRAPHQL
791
+ end
792
+
793
+ def unpublish_deck
794
+ <<~GRAPHQL
795
+ mutation DeckUnpublish($id: UUID!) {
796
+ deckUnpublish(id: $id) {
797
+ #{deck_fields}
798
+ }
799
+ }
800
+ GRAPHQL
801
+ end
802
+
391
803
  # Builds a deckPublish mutation
392
804
  def publish_deck
393
805
  <<~GRAPHQL
394
806
  mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) {
395
807
  deckPublish(id: $id, input: $input) {
396
- #{deck_version_fields}
808
+ #{deck_publish_payload_fields}
809
+ }
810
+ }
811
+ GRAPHQL
812
+ end
813
+
814
+ def remove_invalid_deck_entries
815
+ <<~GRAPHQL
816
+ mutation DeckRemoveInvalidEntries($id: UUID!, $input: DeckRemoveInvalidEntriesInput!) {
817
+ deckRemoveInvalidEntries(id: $id, input: $input) {
818
+ #{deck_fields}
397
819
  }
398
820
  }
399
821
  GRAPHQL
@@ -433,11 +855,99 @@ module CardDB
433
855
  GRAPHQL
434
856
  end
435
857
 
436
- # Builds a deckPreviewTokenRevoke mutation
437
- def revoke_deck_preview_token
858
+ # Builds a deckPreviewTokenRevoke mutation
859
+ def revoke_deck_preview_token
860
+ <<~GRAPHQL
861
+ mutation DeckPreviewTokenRevoke($id: UUID!) {
862
+ deckPreviewTokenRevoke(id: $id)
863
+ }
864
+ GRAPHQL
865
+ end
866
+
867
+ def create_deck_embed_token
868
+ <<~GRAPHQL
869
+ mutation DeckEmbedTokenCreate($input: DeckEmbedTokenCreateInput!) {
870
+ deckEmbedTokenCreate(input: $input) {
871
+ token
872
+ embedToken {
873
+ #{deck_embed_token_fields}
874
+ }
875
+ }
876
+ }
877
+ GRAPHQL
878
+ end
879
+
880
+ def revoke_deck_embed_token
881
+ <<~GRAPHQL
882
+ mutation DeckEmbedTokenRevoke($id: UUID!) {
883
+ deckEmbedTokenRevoke(id: $id)
884
+ }
885
+ GRAPHQL
886
+ end
887
+
888
+ def create_deck_access_token_issuer
889
+ <<~GRAPHQL
890
+ mutation DeckAccessTokenIssuerCreate($input: DeckAccessTokenIssuerCreateInput!) {
891
+ deckAccessTokenIssuerCreate(input: $input) {
892
+ #{deck_access_token_issuer_fields}
893
+ }
894
+ }
895
+ GRAPHQL
896
+ end
897
+
898
+ def revoke_deck_access_token_issuer
899
+ <<~GRAPHQL
900
+ mutation DeckAccessTokenIssuerRevoke($id: UUID!) {
901
+ deckAccessTokenIssuerRevoke(id: $id)
902
+ }
903
+ GRAPHQL
904
+ end
905
+
906
+ def revoke_deck_access_token_issuer_signing_key
907
+ <<~GRAPHQL
908
+ mutation DeckAccessTokenIssuerSigningKeyRevoke($id: UUID!) {
909
+ deckAccessTokenIssuerSigningKeyRevoke(id: $id) {
910
+ #{deck_access_token_issuer_fields}
911
+ }
912
+ }
913
+ GRAPHQL
914
+ end
915
+
916
+ def exchange_deck_access_token
917
+ <<~GRAPHQL
918
+ mutation DeckAccessTokenExchange($input: DeckAccessTokenExchangeInput!) {
919
+ deckAccessTokenExchange(input: $input) {
920
+ token
921
+ accessToken {
922
+ #{deck_access_token_fields}
923
+ }
924
+ }
925
+ }
926
+ GRAPHQL
927
+ end
928
+
929
+ def revoke_deck_access_token
930
+ <<~GRAPHQL
931
+ mutation DeckAccessTokenRevoke($id: UUID!) {
932
+ deckAccessTokenRevoke(id: $id)
933
+ }
934
+ GRAPHQL
935
+ end
936
+
937
+ def grant_deck_api_application_access
938
+ <<~GRAPHQL
939
+ mutation DeckApiApplicationAccessGrant($input: DeckAPIApplicationAccessGrantInput!) {
940
+ deckApiApplicationAccessGrant(input: $input) {
941
+ #{deck_api_application_access_fields}
942
+ }
943
+ }
944
+ GRAPHQL
945
+ end
946
+
947
+ def revoke_deck_api_application_access
438
948
  <<~GRAPHQL
439
- mutation DeckPreviewTokenRevoke($id: UUID!) {
440
- deckPreviewTokenRevoke(id: $id)
949
+ mutation DeckApiApplicationAccessRevoke($deckId: UUID!, $apiApplicationId: UUID!) {
950
+ deckApiApplicationAccessRevoke(deckId: $deckId, apiApplicationId: $apiApplicationId)
441
951
  }
442
952
  GRAPHQL
443
953
  end
@@ -480,7 +990,7 @@ module CardDB
480
990
 
481
991
  private
482
992
 
483
- def build_args(params, required: [])
993
+ def build_args(params, required: [], type_overrides: {})
484
994
  # Filter out nil values
485
995
  params = params.compact
486
996
 
@@ -497,8 +1007,12 @@ module CardDB
497
1007
  resolveLinks: '[String!]',
498
1008
  first: 'Int',
499
1009
  after: 'String',
1010
+ includeArchived: 'Boolean',
500
1011
  externalRef: 'String',
501
1012
  deckId: 'UUID!',
1013
+ gameId: 'UUID',
1014
+ rulesetKey: 'String',
1015
+ rulesetVersionId: 'UUID',
502
1016
  validateSchema: 'Boolean',
503
1017
  purpose: 'DatasetPurpose',
504
1018
  id: 'UUID!',
@@ -506,7 +1020,7 @@ module CardDB
506
1020
  }
507
1021
 
508
1022
  definitions = params.keys.map do |k|
509
- base_type = type_map[k] || 'String'
1023
+ base_type = type_overrides[k] || type_map[k] || 'String'
510
1024
  # Add ! for required fields (unless already has !)
511
1025
  type = required.include?(k) && !base_type.end_with?('!') ? "#{base_type}!" : base_type
512
1026
  "$#{k}: #{type}"
@@ -766,9 +1280,109 @@ module CardDB
766
1280
  FIELDS
767
1281
  end
768
1282
 
1283
+ def deck_section_definition_fields
1284
+ <<~FIELDS
1285
+ key
1286
+ label
1287
+ description
1288
+ order
1289
+ default
1290
+ aliases
1291
+ minCards
1292
+ maxCards
1293
+ excludedFromDeckSize
1294
+ legalCardTypes
1295
+ metadata
1296
+ FIELDS
1297
+ end
1298
+
1299
+ def deck_entry_fields
1300
+ <<~FIELDS
1301
+ id
1302
+ datasetId
1303
+ recordId
1304
+ identifier
1305
+ quantity
1306
+ section
1307
+ sortOrder
1308
+ annotations
1309
+ display
1310
+ record {
1311
+ #{record_fields}
1312
+ }
1313
+ FIELDS
1314
+ end
1315
+
1316
+ def deck_validated_against_fields
1317
+ <<~FIELDS
1318
+ rulesetId
1319
+ rulesetVersionId
1320
+ rulesetVersionLabel
1321
+ cardDatasetId
1322
+ cardDatasetVersionId
1323
+ validatedAt
1324
+ validationResultSummary
1325
+ FIELDS
1326
+ end
1327
+
1328
+ def deck_validation_issue_fields
1329
+ <<~FIELDS
1330
+ code
1331
+ severity
1332
+ message
1333
+ entryIds
1334
+ section
1335
+ datasetId
1336
+ identifier
1337
+ metadata
1338
+ FIELDS
1339
+ end
1340
+
1341
+ def deck_validation_fields
1342
+ <<~FIELDS
1343
+ deckId
1344
+ valid
1345
+ blockers {
1346
+ #{deck_validation_issue_fields}
1347
+ }
1348
+ warnings {
1349
+ #{deck_validation_issue_fields}
1350
+ }
1351
+ affectedEntries {
1352
+ entryId
1353
+ datasetId
1354
+ recordId
1355
+ identifier
1356
+ section
1357
+ quantity
1358
+ }
1359
+ validatedAgainst {
1360
+ #{deck_validated_against_fields}
1361
+ }
1362
+ checkedAt
1363
+ FIELDS
1364
+ end
1365
+
1366
+ def deck_diff_fields
1367
+ <<~FIELDS
1368
+ deckId
1369
+ fromVersionId
1370
+ toVersionId
1371
+ toDraftRevision
1372
+ hasChanges
1373
+ diff
1374
+ FIELDS
1375
+ end
1376
+
769
1377
  def deck_fields
770
1378
  <<~FIELDS
771
1379
  id
1380
+ ownerType
1381
+ ownerAccountId
1382
+ ownerApiApplicationId
1383
+ environment
1384
+ createdByAccountId
1385
+ createdByApiApplicationId
772
1386
  accountId
773
1387
  apiApplicationId
774
1388
  gameId
@@ -778,13 +1392,29 @@ module CardDB
778
1392
  description
779
1393
  formatKey
780
1394
  visibility
1395
+ accessMode
1396
+ discoverability
1397
+ state
1398
+ archivedAt
1399
+ deletedAt
1400
+ unpublishedAt
1401
+ externalRefApiApplicationId
781
1402
  externalRef
1403
+ externalSubjectRef
1404
+ rulesetId
782
1405
  sourceUrl
783
1406
  metadata
1407
+ sectionDefinitions {
1408
+ #{deck_section_definition_fields}
1409
+ }
784
1410
  latestPublishedVersion {
785
1411
  #{deck_version_fields}
786
1412
  }
787
1413
  publishedAt
1414
+ draftRevision
1415
+ draftUpdatedAt
1416
+ draftUpdatedByAccountId
1417
+ draftUpdatedByApiApplicationId
788
1418
  hasUnpublishedChanges
789
1419
  createdAt
790
1420
  updatedAt
@@ -792,18 +1422,58 @@ module CardDB
792
1422
  #{game_fields}
793
1423
  }
794
1424
  entries {
795
- id
796
- datasetId
797
- recordId
798
- identifier
799
- quantity
800
- section
801
- sortOrder
802
- annotations
803
- record {
804
- #{record_fields}
805
- }
1425
+ #{deck_entry_fields}
1426
+ }
1427
+ FIELDS
1428
+ end
1429
+
1430
+ def deck_ownership_transfer_payload_fields
1431
+ <<~FIELDS
1432
+ deck {
1433
+ #{deck_fields}
1434
+ }
1435
+ retainedAppAccess
1436
+ FIELDS
1437
+ end
1438
+
1439
+ def deck_copy_payload_fields
1440
+ <<~FIELDS
1441
+ deck {
1442
+ #{deck_fields}
1443
+ }
1444
+ copiedFromDeckId
1445
+ retainedAppAccess
1446
+ FIELDS
1447
+ end
1448
+
1449
+ def deck_access_application_fields
1450
+ <<~FIELDS
1451
+ id
1452
+ name
1453
+ description
1454
+ revokedAt
1455
+ FIELDS
1456
+ end
1457
+
1458
+ def deck_api_application_access_fields
1459
+ <<~FIELDS
1460
+ id
1461
+ deckId
1462
+ deck {
1463
+ #{deck_fields}
1464
+ }
1465
+ apiApplicationId
1466
+ apiApplication {
1467
+ #{deck_access_application_fields}
806
1468
  }
1469
+ role
1470
+ grantSource
1471
+ externalRef
1472
+ createdByAccountId
1473
+ createdByApiApplicationId
1474
+ revokedAt
1475
+ createdAt
1476
+ updatedAt
807
1477
  FIELDS
808
1478
  end
809
1479
 
@@ -821,23 +1491,67 @@ module CardDB
821
1491
  externalRef
822
1492
  sourceUrl
823
1493
  metadata
1494
+ entries {
1495
+ #{deck_entry_fields}
1496
+ }
824
1497
  publishNote
825
1498
  computedDiff
1499
+ rulesetId
1500
+ rulesetVersionId
1501
+ cardDatasetId
1502
+ cardDatasetVersionId
1503
+ validatedAt
1504
+ validationSummary
1505
+ validatedAgainst {
1506
+ #{deck_validated_against_fields}
1507
+ }
1508
+ sectionDefinitions {
1509
+ #{deck_section_definition_fields}
1510
+ }
826
1511
  publishedByAccountId
827
1512
  publishedByApiApplicationId
828
1513
  createdAt
1514
+ FIELDS
1515
+ end
1516
+
1517
+ def deck_publish_payload_fields
1518
+ <<~FIELDS
1519
+ deck {
1520
+ #{deck_fields}
1521
+ }
1522
+ version {
1523
+ #{deck_version_fields}
1524
+ }
1525
+ validation {
1526
+ #{deck_validation_fields}
1527
+ }
1528
+ blockers {
1529
+ #{deck_validation_issue_fields}
1530
+ }
1531
+ warnings {
1532
+ #{deck_validation_issue_fields}
1533
+ }
1534
+ FIELDS
1535
+ end
1536
+
1537
+ def deck_entry_mutation_payload_fields
1538
+ <<~FIELDS
1539
+ deck {
1540
+ #{deck_fields}
1541
+ }
1542
+ entry {
1543
+ #{deck_entry_fields}
1544
+ }
1545
+ FIELDS
1546
+ end
1547
+
1548
+ def deck_entry_reorder_payload_fields
1549
+ <<~FIELDS
1550
+ deck {
1551
+ #{deck_fields}
1552
+ }
829
1553
  entries {
830
- id
831
- datasetId
832
- recordId
833
- identifier
834
- quantity
835
- section
836
- sortOrder
837
- annotations
838
- record {
839
- #{record_fields}
840
- }
1554
+ #{deck_entry_fields}
841
1555
  }
842
1556
  FIELDS
843
1557
  end
@@ -885,6 +1599,217 @@ module CardDB
885
1599
  FIELDS
886
1600
  end
887
1601
 
1602
+ def deck_embed_token_fields
1603
+ <<~FIELDS
1604
+ id
1605
+ deckId
1606
+ apiApplicationId
1607
+ label
1608
+ readMode
1609
+ allowedOrigins
1610
+ externalSubject
1611
+ expiresAt
1612
+ revokedAt
1613
+ lastUsedAt
1614
+ createdAt
1615
+ updatedAt
1616
+ FIELDS
1617
+ end
1618
+
1619
+ def deck_access_token_issuer_fields
1620
+ <<~FIELDS
1621
+ id
1622
+ deckId
1623
+ apiApplicationId
1624
+ label
1625
+ readModes
1626
+ maxTokenLifetimeSeconds
1627
+ directSigningAlg
1628
+ directSigningKeyId
1629
+ directSigningPublicKey
1630
+ directSigningKeyRevokedAt
1631
+ revokedAt
1632
+ createdAt
1633
+ updatedAt
1634
+ FIELDS
1635
+ end
1636
+
1637
+ def deck_access_token_fields
1638
+ <<~FIELDS
1639
+ id
1640
+ deckId
1641
+ apiApplicationId
1642
+ issuerId
1643
+ readMode
1644
+ externalSubject
1645
+ expiresAt
1646
+ revokedAt
1647
+ lastUsedAt
1648
+ createdAt
1649
+ updatedAt
1650
+ FIELDS
1651
+ end
1652
+
1653
+ def deck_import_entry_fields
1654
+ <<~FIELDS
1655
+ lineNumber
1656
+ raw
1657
+ datasetKey
1658
+ datasetId
1659
+ recordId
1660
+ identifier
1661
+ quantity
1662
+ section
1663
+ sortOrder
1664
+ display
1665
+ record {
1666
+ #{record_fields}
1667
+ }
1668
+ FIELDS
1669
+ end
1670
+
1671
+ def deck_import_issue_fields
1672
+ <<~FIELDS
1673
+ lineNumber
1674
+ raw
1675
+ code
1676
+ message
1677
+ FIELDS
1678
+ end
1679
+
1680
+ def deck_import_unmatched_fields
1681
+ <<~FIELDS
1682
+ lineNumber
1683
+ raw
1684
+ datasetKey
1685
+ identifier
1686
+ quantity
1687
+ section
1688
+ code
1689
+ message
1690
+ FIELDS
1691
+ end
1692
+
1693
+ def deck_import_ambiguous_fields
1694
+ <<~FIELDS
1695
+ lineNumber
1696
+ raw
1697
+ datasetKey
1698
+ identifier
1699
+ quantity
1700
+ section
1701
+ candidates {
1702
+ recordId
1703
+ identifier
1704
+ display
1705
+ }
1706
+ FIELDS
1707
+ end
1708
+
1709
+ def deck_import_format_definition_fields
1710
+ <<~FIELDS
1711
+ id
1712
+ gameId
1713
+ key
1714
+ name
1715
+ description
1716
+ enabled
1717
+ priority
1718
+ datasetKey
1719
+ config
1720
+ archivedAt
1721
+ isArchived
1722
+ createdAt
1723
+ updatedAt
1724
+ FIELDS
1725
+ end
1726
+
1727
+ def deck_import_format_detection_fields
1728
+ <<~FIELDS
1729
+ formatId
1730
+ key
1731
+ name
1732
+ confidence
1733
+ reason
1734
+ FIELDS
1735
+ end
1736
+
1737
+ def deck_import_format_test_payload_fields
1738
+ <<~FIELDS
1739
+ detection {
1740
+ #{deck_import_format_detection_fields}
1741
+ }
1742
+ entries {
1743
+ #{deck_import_entry_fields}
1744
+ }
1745
+ parseErrors {
1746
+ #{deck_import_issue_fields}
1747
+ }
1748
+ unmatched {
1749
+ #{deck_import_unmatched_fields}
1750
+ }
1751
+ ambiguous {
1752
+ #{deck_import_ambiguous_fields}
1753
+ }
1754
+ FIELDS
1755
+ end
1756
+
1757
+ def deck_hydrate_entries_payload_fields
1758
+ <<~FIELDS
1759
+ entries {
1760
+ #{deck_import_entry_fields}
1761
+ }
1762
+ unmatched {
1763
+ #{deck_import_unmatched_fields}
1764
+ }
1765
+ ambiguous {
1766
+ #{deck_import_ambiguous_fields}
1767
+ }
1768
+ FIELDS
1769
+ end
1770
+
1771
+ def deck_import_payload_fields
1772
+ <<~FIELDS
1773
+ deck {
1774
+ #{deck_fields}
1775
+ }
1776
+ applied
1777
+ dryRun
1778
+ replace
1779
+ format
1780
+ importFormat {
1781
+ #{deck_import_format_definition_fields}
1782
+ }
1783
+ detection {
1784
+ #{deck_import_format_detection_fields}
1785
+ }
1786
+ entries {
1787
+ #{deck_import_entry_fields}
1788
+ }
1789
+ parseErrors {
1790
+ #{deck_import_issue_fields}
1791
+ }
1792
+ unmatched {
1793
+ #{deck_import_unmatched_fields}
1794
+ }
1795
+ ambiguous {
1796
+ #{deck_import_ambiguous_fields}
1797
+ }
1798
+ validation {
1799
+ #{deck_validation_fields}
1800
+ }
1801
+ FIELDS
1802
+ end
1803
+
1804
+ def deck_export_payload_fields
1805
+ <<~FIELDS
1806
+ deckId
1807
+ format
1808
+ text
1809
+ entryCount
1810
+ FIELDS
1811
+ end
1812
+
888
1813
  def deck_connection_fields
889
1814
  <<~FIELDS
890
1815
  totalCount
@@ -902,6 +1827,24 @@ module CardDB
902
1827
  }
903
1828
  FIELDS
904
1829
  end
1830
+
1831
+ def deck_import_format_definition_connection_fields
1832
+ <<~FIELDS
1833
+ totalCount
1834
+ pageInfo {
1835
+ hasNextPage
1836
+ hasPreviousPage
1837
+ startCursor
1838
+ endCursor
1839
+ }
1840
+ edges {
1841
+ cursor
1842
+ node {
1843
+ #{deck_import_format_definition_fields}
1844
+ }
1845
+ }
1846
+ FIELDS
1847
+ end
905
1848
  end
906
1849
  # rubocop:enable Metrics/ClassLength
907
1850
  end