carddb 0.2.2 → 0.3.5

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.
@@ -109,6 +109,61 @@ module CardDB
109
109
  GRAPHQL
110
110
  end
111
111
 
112
+ def list_games(publisher_id:, first: nil, after: nil, include_archived: nil)
113
+ args = build_args(
114
+ { publisherId: publisher_id, first: first, after: after, includeArchived: include_archived },
115
+ required: [:publisherId]
116
+ )
117
+
118
+ <<~GRAPHQL
119
+ query Games#{args[:definition]} {
120
+ games#{args[:call]} {
121
+ #{game_connection_fields}
122
+ }
123
+ }
124
+ GRAPHQL
125
+ end
126
+
127
+ def game(id: nil, publisher_id: nil, publisher_slug: nil, game_key: nil, game_slug: nil)
128
+ args = build_args(
129
+ {
130
+ id: id,
131
+ publisherId: publisher_id,
132
+ publisherSlug: publisher_slug,
133
+ gameKey: game_key,
134
+ gameSlug: game_slug
135
+ }
136
+ )
137
+
138
+ <<~GRAPHQL
139
+ query Game#{args[:definition]} {
140
+ game#{args[:call]} {
141
+ #{game_fields}
142
+ }
143
+ }
144
+ GRAPHQL
145
+ end
146
+
147
+ def create_game
148
+ <<~GRAPHQL
149
+ mutation GameCreate($input: GameCreateInput!) {
150
+ gameCreate(input: $input) {
151
+ #{game_fields}
152
+ }
153
+ }
154
+ GRAPHQL
155
+ end
156
+
157
+ def update_game
158
+ <<~GRAPHQL
159
+ mutation GameUpdate($id: UUID!, $input: GameUpdateInput!) {
160
+ gameUpdate(id: $id, input: $input) {
161
+ #{game_fields}
162
+ }
163
+ }
164
+ GRAPHQL
165
+ end
166
+
112
167
  # Builds a searchDatasets query
113
168
  def search_datasets(publisher_slug: nil, game_key: nil, search: nil, purpose: nil, first: nil, after: nil)
114
169
  args = build_args({
@@ -164,6 +219,55 @@ module CardDB
164
219
  GRAPHQL
165
220
  end
166
221
 
222
+ def list_datasets(
223
+ publisher_id:,
224
+ game_id: nil,
225
+ purpose: nil,
226
+ first: nil,
227
+ after: nil,
228
+ include_archived: nil
229
+ )
230
+ args = build_args(
231
+ {
232
+ publisherId: publisher_id,
233
+ gameId: game_id,
234
+ purpose: purpose,
235
+ first: first,
236
+ after: after,
237
+ includeArchived: include_archived
238
+ },
239
+ required: [:publisherId]
240
+ )
241
+
242
+ <<~GRAPHQL
243
+ query Datasets#{args[:definition]} {
244
+ datasets#{args[:call]} {
245
+ #{dataset_connection_fields(include_schema: true)}
246
+ }
247
+ }
248
+ GRAPHQL
249
+ end
250
+
251
+ def dataset(id: nil, publisher_id: nil, game_id: nil, dataset_key: nil)
252
+ args = build_args(
253
+ {
254
+ id: id,
255
+ publisherId: publisher_id,
256
+ gameId: game_id,
257
+ datasetKey: dataset_key
258
+ }
259
+ )
260
+
261
+ <<~GRAPHQL
262
+ query Dataset#{args[:definition]} {
263
+ dataset#{args[:call]} {
264
+ #{dataset_fields}
265
+ #{schema_fields}
266
+ }
267
+ }
268
+ GRAPHQL
269
+ end
270
+
167
271
  # Builds a searchRecords query
168
272
  # rubocop:disable Metrics/ParameterLists
169
273
  def search_records(
@@ -252,263 +356,1174 @@ module CardDB
252
356
  GRAPHQL
253
357
  end
254
358
 
255
- # Builds a myDecks query
256
- def list_my_decks(first: nil, after: nil)
257
- args = build_args({ first: first, after: after })
359
+ def list_dataset_records(
360
+ dataset_id:,
361
+ filter: nil,
362
+ order_by: nil,
363
+ first: nil,
364
+ after: nil,
365
+ last: nil,
366
+ before: nil,
367
+ validate_schema: nil
368
+ )
369
+ args = build_args(
370
+ {
371
+ datasetId: dataset_id,
372
+ filter: filter,
373
+ orderBy: order_by,
374
+ first: first,
375
+ after: after,
376
+ last: last,
377
+ before: before,
378
+ validateSchema: validate_schema
379
+ },
380
+ required: [:datasetId],
381
+ type_overrides: { orderBy: 'DatasetRecordOrderByInput' }
382
+ )
258
383
 
259
384
  <<~GRAPHQL
260
- query MyDecks#{args[:definition]} {
261
- myDecks#{args[:call]} {
262
- #{deck_connection_fields}
385
+ query DatasetRecords#{args[:definition]} {
386
+ datasetRecords#{args[:call]} {
387
+ #{record_connection_fields}
263
388
  }
264
389
  }
265
390
  GRAPHQL
266
391
  end
267
392
 
268
- # Builds a fetchDeck query
269
- def fetch_deck
393
+ def dataset_record(**params)
394
+ args = build_args(
395
+ {
396
+ id: params[:id],
397
+ datasetId: params[:dataset_id],
398
+ identifier: params[:identifier],
399
+ publisherSlug: params[:publisher_slug],
400
+ gameKey: params[:game_key],
401
+ datasetKey: params[:dataset_key],
402
+ recordId: params[:record_id],
403
+ resolveLinks: params[:resolve_links],
404
+ validateSchema: params[:validate_schema]
405
+ }
406
+ )
407
+ include_links = params[:resolve_links]&.any?
408
+ links_fields = resolved_links_fields if include_links
409
+
270
410
  <<~GRAPHQL
271
- query FetchDeck($id: UUID!) {
272
- fetchDeck(id: $id) {
273
- #{deck_fields}
411
+ query DatasetRecord#{args[:definition]} {
412
+ datasetRecord#{args[:call]} {
413
+ #{record_fields(include_pricing: params.fetch(:include_pricing, false))}
414
+ #{links_fields}
274
415
  }
275
416
  }
276
417
  GRAPHQL
277
418
  end
278
419
 
279
- # Builds a myDeck query
280
- def my_deck
420
+ def upsert_dataset_records
281
421
  <<~GRAPHQL
282
- query MyDeck($id: UUID!) {
283
- myDeck(id: $id) {
284
- #{deck_fields}
422
+ mutation DatasetRecordsUpsert($input: DatasetRecordsUpsertInput!) {
423
+ datasetRecordsUpsert(input: $input) {
424
+ #{dataset_records_upsert_payload_fields}
285
425
  }
286
426
  }
287
427
  GRAPHQL
288
428
  end
289
429
 
290
- # Builds a fetchDeckBySlug query
291
- def fetch_deck_by_slug
430
+ def delete_dataset_records
292
431
  <<~GRAPHQL
293
- query FetchDeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
294
- fetchDeckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
295
- #{deck_fields}
432
+ mutation DatasetRecordsDelete($input: DatasetRecordsDeleteInput!) {
433
+ datasetRecordsDelete(input: $input) {
434
+ #{dataset_record_delete_job_fields}
296
435
  }
297
436
  }
298
437
  GRAPHQL
299
438
  end
300
439
 
301
- # Builds a fetchDeckByExternalRef query
302
- def fetch_deck_by_external_ref
440
+ def dataset_record_delete_job
303
441
  <<~GRAPHQL
304
- query FetchDeckByExternalRef($externalRef: String!) {
305
- fetchDeckByExternalRef(externalRef: $externalRef) {
306
- #{deck_fields}
442
+ query DatasetRecordDeleteJob($id: UUID!) {
443
+ datasetRecordDeleteJob(id: $id) {
444
+ #{dataset_record_delete_job_fields}
307
445
  }
308
446
  }
309
447
  GRAPHQL
310
448
  end
311
449
 
312
- # Builds a deckVersion query
313
- def deck_version
450
+ def dataset_record_delete_jobs(publisher_id:, dataset_id: nil, status: nil, first: nil, after: nil)
451
+ args = build_args(
452
+ { publisherId: publisher_id, datasetId: dataset_id, status: status, first: first, after: after },
453
+ required: [:publisherId],
454
+ type_overrides: { status: 'DatasetRecordDeleteJobStatus' }
455
+ )
456
+
314
457
  <<~GRAPHQL
315
- query DeckVersion($id: UUID!) {
316
- deckVersion(id: $id) {
317
- #{deck_version_fields}
458
+ query DatasetRecordDeleteJobs#{args[:definition]} {
459
+ datasetRecordDeleteJobs#{args[:call]} {
460
+ #{dataset_record_delete_job_connection_fields}
318
461
  }
319
462
  }
320
463
  GRAPHQL
321
464
  end
322
465
 
323
- # Builds a deckVersions query
324
- def deck_versions(first: nil, after: nil)
325
- args = build_args({ deckId: true, first: first, after: after }, required: [:deckId])
466
+ def dataset_import_preview
467
+ <<~GRAPHQL
468
+ query DatasetImportPreview($input: DatasetImportPreviewInput!) {
469
+ datasetImportPreview(input: $input) {
470
+ #{dataset_import_preview_fields}
471
+ }
472
+ }
473
+ GRAPHQL
474
+ end
326
475
 
476
+ def dataset_import_validate
327
477
  <<~GRAPHQL
328
- query DeckVersions#{args[:definition]} {
329
- deckVersions#{args[:call]} {
330
- #{deck_version_connection_fields}
478
+ query DatasetImportValidate($input: DatasetImportValidateInput!) {
479
+ datasetImportValidate(input: $input) {
480
+ #{bulk_import_result_fields}
331
481
  }
332
482
  }
333
483
  GRAPHQL
334
484
  end
335
485
 
336
- # Builds a deckPreview query
337
- def deck_preview
486
+ def dataset_import_from_file
338
487
  <<~GRAPHQL
339
- query DeckPreview($token: String!) {
340
- deckPreview(token: $token) {
341
- #{deck_fields}
488
+ mutation DatasetImportFromFile($input: DatasetImportFromFileInput!) {
489
+ datasetImportFromFile(input: $input) {
490
+ #{import_job_fields}
342
491
  }
343
492
  }
344
493
  GRAPHQL
345
494
  end
346
495
 
347
- # Builds a deckCollaborators query
348
- def deck_collaborators
496
+ def dataset_import_from_payload
349
497
  <<~GRAPHQL
350
- query DeckCollaborators($deckId: UUID!) {
351
- deckCollaborators(deckId: $deckId) {
352
- #{deck_collaborator_fields}
498
+ mutation DatasetImportFromPayload($input: DatasetImportFromPayloadInput!) {
499
+ datasetImportFromPayload(input: $input) {
500
+ #{import_job_fields}
353
501
  }
354
502
  }
355
503
  GRAPHQL
356
504
  end
357
505
 
358
- # Builds a deckPreviewTokens query
359
- def deck_preview_tokens
506
+ def dataset_import_from_url
360
507
  <<~GRAPHQL
361
- query DeckPreviewTokens($deckId: UUID!) {
362
- deckPreviewTokens(deckId: $deckId) {
363
- #{deck_preview_token_fields}
508
+ mutation DatasetImportFromUrl($input: DatasetImportFromUrlInput!) {
509
+ datasetImportFromUrl(input: $input) {
510
+ #{import_job_fields}
364
511
  }
365
512
  }
366
513
  GRAPHQL
367
514
  end
368
515
 
369
- # Builds a deckCreate mutation
370
- def create_deck
516
+ def import_job
371
517
  <<~GRAPHQL
372
- mutation DeckCreate($input: DeckCreateInput!) {
373
- deckCreate(input: $input) {
374
- #{deck_fields}
518
+ query ImportJob($id: UUID!) {
519
+ importJob(id: $id) {
520
+ #{import_job_fields}
375
521
  }
376
522
  }
377
523
  GRAPHQL
378
524
  end
379
525
 
380
- # Builds a deckUpdate mutation
381
- def update_deck
526
+ def import_jobs(publisher_id:, dataset_id: nil, status: nil, first: nil, after: nil)
527
+ args = build_args(
528
+ { publisherId: publisher_id, datasetId: dataset_id, status: status, first: first, after: after },
529
+ required: [:publisherId],
530
+ type_overrides: { status: 'ImportJobStatus' }
531
+ )
532
+
382
533
  <<~GRAPHQL
383
- mutation DeckUpdate($id: UUID!, $input: DeckUpdateInput!) {
384
- deckUpdate(id: $id, input: $input) {
385
- #{deck_fields}
534
+ query ImportJobs#{args[:definition]} {
535
+ importJobs#{args[:call]} {
536
+ #{import_job_connection_fields}
386
537
  }
387
538
  }
388
539
  GRAPHQL
389
540
  end
390
541
 
391
- # Builds a deckPublish mutation
392
- def publish_deck
542
+ def import_job_cancel
393
543
  <<~GRAPHQL
394
- mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) {
395
- deckPublish(id: $id, input: $input) {
396
- #{deck_version_fields}
544
+ mutation ImportJobCancel($id: UUID!) {
545
+ importJobCancel(id: $id) {
546
+ #{import_job_fields}
397
547
  }
398
548
  }
399
549
  GRAPHQL
400
550
  end
401
551
 
402
- # Builds a deckCollaboratorUpsert mutation
403
- def upsert_deck_collaborator
552
+ def import_job_logs(level: nil, dataset_key: nil, first: nil, after: nil)
553
+ log_args = build_args(
554
+ { level: level, datasetKey: dataset_key, first: first, after: after },
555
+ type_overrides: { level: 'ImportLogLevel' }
556
+ )
557
+
404
558
  <<~GRAPHQL
405
- mutation DeckCollaboratorUpsert($deckId: UUID!, $accountId: UUID!, $role: DeckCollaboratorRole!) {
406
- deckCollaboratorUpsert(deckId: $deckId, accountId: $accountId, role: $role) {
407
- #{deck_collaborator_fields}
559
+ query ImportJobLogs($importJobId: UUID!#{log_args[:definition].sub('(', ', ').sub(')', '')}) {
560
+ importJob(id: $importJobId) {
561
+ logs#{log_args[:call]} {
562
+ #{import_job_log_connection_fields}
563
+ }
408
564
  }
409
565
  }
410
566
  GRAPHQL
411
567
  end
412
568
 
413
- # Builds a deckCollaboratorRemove mutation
414
- def remove_deck_collaborator
569
+ def game_import_preview
415
570
  <<~GRAPHQL
416
- mutation DeckCollaboratorRemove($deckId: UUID!, $accountId: UUID!) {
417
- deckCollaboratorRemove(deckId: $deckId, accountId: $accountId)
571
+ query GameImportPreview($input: GameImportPreviewInput!) {
572
+ gameImportPreview(input: $input) {
573
+ #{game_import_preview_fields}
574
+ }
418
575
  }
419
576
  GRAPHQL
420
577
  end
421
578
 
422
- # Builds a deckPreviewTokenCreate mutation
423
- def create_deck_preview_token
579
+ def game_import_from_file
424
580
  <<~GRAPHQL
425
- mutation DeckPreviewTokenCreate($input: DeckPreviewTokenCreateInput!) {
426
- deckPreviewTokenCreate(input: $input) {
427
- token
428
- previewToken {
429
- #{deck_preview_token_fields}
430
- }
581
+ mutation GameImportFromFile($input: GameImportFromFileInput!) {
582
+ gameImportFromFile(input: $input) {
583
+ #{game_import_job_fields}
431
584
  }
432
585
  }
433
586
  GRAPHQL
434
587
  end
435
588
 
436
- # Builds a deckPreviewTokenRevoke mutation
437
- def revoke_deck_preview_token
589
+ def game_import_from_payload
438
590
  <<~GRAPHQL
439
- mutation DeckPreviewTokenRevoke($id: UUID!) {
440
- deckPreviewTokenRevoke(id: $id)
591
+ mutation GameImportFromPayload($input: GameImportFromPayloadInput!) {
592
+ gameImportFromPayload(input: $input) {
593
+ #{game_import_job_fields}
594
+ }
441
595
  }
442
596
  GRAPHQL
443
597
  end
444
598
 
445
- # Builds a deckDelete mutation
446
- def delete_deck
599
+ def game_import_from_url
447
600
  <<~GRAPHQL
448
- mutation DeckDelete($id: UUID!) {
449
- deckDelete(id: $id)
601
+ mutation GameImportFromUrl($input: GameImportFromUrlInput!) {
602
+ gameImportFromUrl(input: $input) {
603
+ #{game_import_job_fields}
604
+ }
450
605
  }
451
606
  GRAPHQL
452
607
  end
453
608
 
454
- # Builds a fetchMe query
455
- def fetch_me
609
+ def game_import_job
456
610
  <<~GRAPHQL
457
- query FetchMe {
458
- fetchMe {
459
- application {
460
- id
461
- name
462
- description
463
- environment
464
- apiKeyPrefix
465
- allowedOrigins
466
- allowedIps
467
- createdAt
468
- updatedAt
469
- lastUsedAt
470
- }
471
- account {
472
- id
473
- displayName
474
- createdAt
475
- }
611
+ query GameImportJob($id: UUID!) {
612
+ gameImportJob(id: $id) {
613
+ #{game_import_job_fields}
476
614
  }
477
615
  }
478
616
  GRAPHQL
479
617
  end
480
618
 
481
- private
619
+ def game_import_jobs(game_id:, status: nil, first: nil, after: nil)
620
+ args = build_args(
621
+ { gameId: game_id, status: status, first: first, after: after },
622
+ required: [:gameId],
623
+ type_overrides: { status: 'ImportJobStatus' }
624
+ )
482
625
 
483
- def build_args(params, required: [])
484
- # Filter out nil values
485
- params = params.compact
626
+ <<~GRAPHQL
627
+ query GameImportJobs#{args[:definition]} {
628
+ gameImportJobs#{args[:call]} {
629
+ #{game_import_job_connection_fields}
630
+ }
631
+ }
632
+ GRAPHQL
633
+ end
486
634
 
487
- return { definition: '', call: '' } if params.empty?
635
+ def game_import_job_cancel
636
+ <<~GRAPHQL
637
+ mutation GameImportJobCancel($id: UUID!) {
638
+ gameImportJobCancel(id: $id) {
639
+ #{game_import_job_fields}
640
+ }
641
+ }
642
+ GRAPHQL
643
+ end
488
644
 
489
- # Map Ruby types to GraphQL types (base types, without !)
490
- type_map = {
491
- publisherSlug: 'String',
492
- gameKey: 'String',
493
- datasetKey: 'String',
494
- search: 'String',
495
- orderBy: 'String',
496
- filter: 'JSON',
497
- resolveLinks: '[String!]',
498
- first: 'Int',
499
- after: 'String',
500
- externalRef: 'String',
501
- deckId: 'UUID!',
502
- validateSchema: 'Boolean',
503
- purpose: 'DatasetPurpose',
504
- id: 'UUID!',
505
- ids: '[UUID!]!'
506
- }
645
+ def file
646
+ <<~GRAPHQL
647
+ query File($id: UUID!) {
648
+ file(id: $id) {
649
+ #{file_fields}
650
+ }
651
+ }
652
+ GRAPHQL
653
+ end
507
654
 
508
- definitions = params.keys.map do |k|
509
- base_type = type_map[k] || 'String'
510
- # Add ! for required fields (unless already has !)
511
- type = required.include?(k) && !base_type.end_with?('!') ? "#{base_type}!" : base_type
655
+ def file_upload_request
656
+ <<~GRAPHQL
657
+ mutation FileUploadRequest($input: FileUploadInput!) {
658
+ fileUploadRequest(input: $input) {
659
+ #{presigned_upload_fields}
660
+ }
661
+ }
662
+ GRAPHQL
663
+ end
664
+
665
+ def file_upload_confirm
666
+ <<~GRAPHQL
667
+ mutation FileUploadConfirm($id: UUID!) {
668
+ fileUploadConfirm(id: $id) {
669
+ #{file_fields}
670
+ }
671
+ }
672
+ GRAPHQL
673
+ end
674
+
675
+ def file_delete
676
+ <<~GRAPHQL
677
+ mutation FileDelete($id: UUID!) {
678
+ fileDelete(id: $id)
679
+ }
680
+ GRAPHQL
681
+ end
682
+
683
+ def export_job
684
+ <<~GRAPHQL
685
+ query ExportJob($id: UUID!) {
686
+ exportJob(id: $id) {
687
+ #{export_job_fields}
688
+ }
689
+ }
690
+ GRAPHQL
691
+ end
692
+
693
+ def export_jobs(publisher_id:, game_id: nil, dataset_id: nil, status: nil, first: nil, after: nil)
694
+ args = build_args(
695
+ {
696
+ publisherId: publisher_id,
697
+ gameId: game_id,
698
+ datasetId: dataset_id,
699
+ status: status,
700
+ first: first,
701
+ after: after
702
+ },
703
+ required: [:publisherId],
704
+ type_overrides: { status: 'ExportJobStatus' }
705
+ )
706
+
707
+ <<~GRAPHQL
708
+ query ExportJobs#{args[:definition]} {
709
+ exportJobs#{args[:call]} {
710
+ #{export_job_connection_fields}
711
+ }
712
+ }
713
+ GRAPHQL
714
+ end
715
+
716
+ def dataset_export
717
+ <<~GRAPHQL
718
+ mutation DatasetExport($input: DatasetExportInput!) {
719
+ datasetExport(input: $input) {
720
+ #{export_job_fields}
721
+ }
722
+ }
723
+ GRAPHQL
724
+ end
725
+
726
+ def export_job_cancel
727
+ <<~GRAPHQL
728
+ mutation ExportJobCancel($id: UUID!) {
729
+ exportJobCancel(id: $id) {
730
+ #{export_job_fields}
731
+ }
732
+ }
733
+ GRAPHQL
734
+ end
735
+
736
+ def export_job_refresh_url
737
+ <<~GRAPHQL
738
+ mutation ExportJobRefreshUrl($id: UUID!) {
739
+ exportJobRefreshUrl(id: $id) {
740
+ #{export_job_fields}
741
+ }
742
+ }
743
+ GRAPHQL
744
+ end
745
+
746
+ # Builds a myDecks query
747
+ def list_my_decks(first: nil, after: nil, include_archived: nil)
748
+ args = build_args({ first: first, after: after, includeArchived: include_archived })
749
+
750
+ <<~GRAPHQL
751
+ query MyDecks#{args[:definition]} {
752
+ myDecks#{args[:call]} {
753
+ #{deck_connection_fields}
754
+ }
755
+ }
756
+ GRAPHQL
757
+ end
758
+
759
+ def viewer_decks(filter: nil, first: nil, after: nil)
760
+ args = build_args(
761
+ { filter: filter, first: first, after: after },
762
+ type_overrides: { filter: 'ViewerDecksFilterInput' }
763
+ )
764
+
765
+ <<~GRAPHQL
766
+ query ViewerDecks#{args[:definition]} {
767
+ viewerDecks#{args[:call]} {
768
+ #{deck_connection_fields}
769
+ }
770
+ }
771
+ GRAPHQL
772
+ end
773
+
774
+ def app_decks(filter: nil, first: nil, after: nil)
775
+ args = build_args(
776
+ { filter: filter, first: first, after: after },
777
+ type_overrides: { filter: 'AppDecksFilterInput' }
778
+ )
779
+
780
+ <<~GRAPHQL
781
+ query AppDecks#{args[:definition]} {
782
+ appDecks#{args[:call]} {
783
+ #{deck_connection_fields}
784
+ }
785
+ }
786
+ GRAPHQL
787
+ end
788
+
789
+ def public_decks(filter: nil, first: nil, after: nil)
790
+ args = build_args(
791
+ { filter: filter, first: first, after: after },
792
+ type_overrides: { filter: 'PublicDecksFilterInput' }
793
+ )
794
+
795
+ <<~GRAPHQL
796
+ query PublicDecks#{args[:definition]} {
797
+ publicDecks#{args[:call]} {
798
+ #{deck_connection_fields}
799
+ }
800
+ }
801
+ GRAPHQL
802
+ end
803
+
804
+ # Builds a fetchDeck query
805
+ def fetch_deck
806
+ <<~GRAPHQL
807
+ query FetchDeck($id: UUID!) {
808
+ fetchDeck(id: $id) {
809
+ #{deck_fields}
810
+ }
811
+ }
812
+ GRAPHQL
813
+ end
814
+
815
+ def deck
816
+ <<~GRAPHQL
817
+ query Deck($id: UUID!) {
818
+ deck(id: $id) {
819
+ #{deck_fields}
820
+ }
821
+ }
822
+ GRAPHQL
823
+ end
824
+
825
+ # Builds a myDeck query
826
+ def my_deck
827
+ <<~GRAPHQL
828
+ query MyDeck($id: UUID!) {
829
+ myDeck(id: $id) {
830
+ #{deck_fields}
831
+ }
832
+ }
833
+ GRAPHQL
834
+ end
835
+
836
+ # Builds a fetchDeckBySlug query
837
+ def fetch_deck_by_slug
838
+ <<~GRAPHQL
839
+ query FetchDeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
840
+ fetchDeckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
841
+ #{deck_fields}
842
+ }
843
+ }
844
+ GRAPHQL
845
+ end
846
+
847
+ def deck_by_slug
848
+ <<~GRAPHQL
849
+ query DeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
850
+ deckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
851
+ #{deck_fields}
852
+ }
853
+ }
854
+ GRAPHQL
855
+ end
856
+
857
+ # Builds a fetchDeckByExternalRef query
858
+ def fetch_deck_by_external_ref
859
+ <<~GRAPHQL
860
+ query FetchDeckByExternalRef($externalRef: String!) {
861
+ fetchDeckByExternalRef(externalRef: $externalRef) {
862
+ #{deck_fields}
863
+ }
864
+ }
865
+ GRAPHQL
866
+ end
867
+
868
+ def deck_by_external_ref
869
+ <<~GRAPHQL
870
+ query DeckByExternalRef($externalRef: String!) {
871
+ deckByExternalRef(externalRef: $externalRef) {
872
+ #{deck_fields}
873
+ }
874
+ }
875
+ GRAPHQL
876
+ end
877
+
878
+ # Builds a deckVersion query
879
+ def deck_version
880
+ <<~GRAPHQL
881
+ query DeckVersion($id: UUID!) {
882
+ deckVersion(id: $id) {
883
+ #{deck_version_fields}
884
+ }
885
+ }
886
+ GRAPHQL
887
+ end
888
+
889
+ # Builds a deckVersions query
890
+ def deck_versions(first: nil, after: nil)
891
+ args = build_args({ deckId: true, first: first, after: after }, required: [:deckId])
892
+
893
+ <<~GRAPHQL
894
+ query DeckVersions#{args[:definition]} {
895
+ deckVersions#{args[:call]} {
896
+ #{deck_version_connection_fields}
897
+ }
898
+ }
899
+ GRAPHQL
900
+ end
901
+
902
+ # Builds a deckPreview query
903
+ def deck_preview
904
+ <<~GRAPHQL
905
+ query DeckPreview($token: String!) {
906
+ deckPreview(token: $token) {
907
+ #{deck_fields}
908
+ }
909
+ }
910
+ GRAPHQL
911
+ end
912
+
913
+ def deck_embed
914
+ <<~GRAPHQL
915
+ query DeckEmbed($token: String!) {
916
+ deckEmbed(token: $token) {
917
+ #{deck_fields}
918
+ }
919
+ }
920
+ GRAPHQL
921
+ end
922
+
923
+ def deck_access
924
+ <<~GRAPHQL
925
+ query DeckAccess($token: String!) {
926
+ deckAccess(token: $token) {
927
+ #{deck_fields}
928
+ }
929
+ }
930
+ GRAPHQL
931
+ end
932
+
933
+ def deck_draft_diff
934
+ <<~GRAPHQL
935
+ query DeckDraftDiff($id: UUID!) {
936
+ deckDraftDiff(id: $id) {
937
+ #{deck_diff_fields}
938
+ }
939
+ }
940
+ GRAPHQL
941
+ end
942
+
943
+ def deck_version_diff
944
+ <<~GRAPHQL
945
+ query DeckVersionDiff($fromVersionId: UUID!, $toVersionId: UUID!) {
946
+ deckVersionDiff(fromVersionId: $fromVersionId, toVersionId: $toVersionId) {
947
+ #{deck_diff_fields}
948
+ }
949
+ }
950
+ GRAPHQL
951
+ end
952
+
953
+ def deck_hydrate_entries
954
+ <<~GRAPHQL
955
+ query DeckHydrateEntries($input: DeckHydrateEntriesInput!) {
956
+ deckHydrateEntries(input: $input) {
957
+ #{deck_hydrate_entries_payload_fields}
958
+ }
959
+ }
960
+ GRAPHQL
961
+ end
962
+
963
+ def deck_export
964
+ <<~GRAPHQL
965
+ query DeckExport($id: UUID!, $format: DeckExportFormat!) {
966
+ deckExport(id: $id, format: $format) {
967
+ #{deck_export_payload_fields}
968
+ }
969
+ }
970
+ GRAPHQL
971
+ end
972
+
973
+ def deck_validate
974
+ <<~GRAPHQL
975
+ query DeckValidate($id: UUID!, $input: DeckValidateInput) {
976
+ deckValidate(id: $id, input: $input) {
977
+ #{deck_validation_fields}
978
+ }
979
+ }
980
+ GRAPHQL
981
+ end
982
+
983
+ def deck_section_definitions(publisher_slug: nil, game_key: nil, game_id: nil, ruleset_key: nil, ruleset_version_id: nil)
984
+ args = build_args({
985
+ publisherSlug: publisher_slug,
986
+ gameKey: game_key,
987
+ gameId: game_id,
988
+ rulesetKey: ruleset_key,
989
+ rulesetVersionId: ruleset_version_id
990
+ })
991
+
992
+ <<~GRAPHQL
993
+ query DeckSectionDefinitions#{args[:definition]} {
994
+ deckSectionDefinitions#{args[:call]} {
995
+ #{deck_section_definition_fields}
996
+ }
997
+ }
998
+ GRAPHQL
999
+ end
1000
+
1001
+ # Builds a deckCollaborators query
1002
+ def deck_collaborators
1003
+ <<~GRAPHQL
1004
+ query DeckCollaborators($deckId: UUID!) {
1005
+ deckCollaborators(deckId: $deckId) {
1006
+ #{deck_collaborator_fields}
1007
+ }
1008
+ }
1009
+ GRAPHQL
1010
+ end
1011
+
1012
+ # Builds a deckPreviewTokens query
1013
+ def deck_preview_tokens
1014
+ <<~GRAPHQL
1015
+ query DeckPreviewTokens($deckId: UUID!) {
1016
+ deckPreviewTokens(deckId: $deckId) {
1017
+ #{deck_preview_token_fields}
1018
+ }
1019
+ }
1020
+ GRAPHQL
1021
+ end
1022
+
1023
+ def deck_embed_tokens
1024
+ <<~GRAPHQL
1025
+ query DeckEmbedTokens($deckId: UUID!) {
1026
+ deckEmbedTokens(deckId: $deckId) {
1027
+ #{deck_embed_token_fields}
1028
+ }
1029
+ }
1030
+ GRAPHQL
1031
+ end
1032
+
1033
+ def deck_access_token_issuers
1034
+ <<~GRAPHQL
1035
+ query DeckAccessTokenIssuers($deckId: UUID!) {
1036
+ deckAccessTokenIssuers(deckId: $deckId) {
1037
+ #{deck_access_token_issuer_fields}
1038
+ }
1039
+ }
1040
+ GRAPHQL
1041
+ end
1042
+
1043
+ def deck_api_application_accesses
1044
+ <<~GRAPHQL
1045
+ query DeckApiApplicationAccesses($deckId: UUID!, $includeRevoked: Boolean) {
1046
+ deckApiApplicationAccesses(deckId: $deckId, includeRevoked: $includeRevoked) {
1047
+ #{deck_api_application_access_fields}
1048
+ }
1049
+ }
1050
+ GRAPHQL
1051
+ end
1052
+
1053
+ def my_deck_api_application_accesses
1054
+ <<~GRAPHQL
1055
+ query MyDeckApiApplicationAccesses($applicationId: UUID) {
1056
+ myDeckApiApplicationAccesses(applicationId: $applicationId) {
1057
+ #{deck_api_application_access_fields}
1058
+ }
1059
+ }
1060
+ GRAPHQL
1061
+ end
1062
+
1063
+ def deck_import_formats(publisher_id: nil, game_id: nil, include_archived: nil, first: nil, after: nil)
1064
+ args = build_args(
1065
+ { publisherId: publisher_id, gameId: game_id, includeArchived: include_archived, first: first, after: after }
1066
+ )
1067
+
1068
+ <<~GRAPHQL
1069
+ query DeckImportFormats#{args[:definition]} {
1070
+ deckImportFormats#{args[:call]} {
1071
+ #{deck_import_format_definition_connection_fields}
1072
+ }
1073
+ }
1074
+ GRAPHQL
1075
+ end
1076
+
1077
+ def deck_import_format
1078
+ <<~GRAPHQL
1079
+ query DeckImportFormat($id: UUID, $gameId: UUID, $key: String) {
1080
+ deckImportFormat(id: $id, gameId: $gameId, key: $key) {
1081
+ #{deck_import_format_definition_fields}
1082
+ }
1083
+ }
1084
+ GRAPHQL
1085
+ end
1086
+
1087
+ def deck_import_format_test
1088
+ <<~GRAPHQL
1089
+ query DeckImportFormatTest($input: DeckImportFormatTestInput!) {
1090
+ deckImportFormatTest(input: $input) {
1091
+ #{deck_import_format_test_payload_fields}
1092
+ }
1093
+ }
1094
+ GRAPHQL
1095
+ end
1096
+
1097
+ # Builds a deckCreate mutation
1098
+ def create_deck
1099
+ <<~GRAPHQL
1100
+ mutation DeckCreate($input: DeckCreateInput!) {
1101
+ deckCreate(input: $input) {
1102
+ #{deck_fields}
1103
+ }
1104
+ }
1105
+ GRAPHQL
1106
+ end
1107
+
1108
+ # Builds a deckUpdate mutation
1109
+ def update_deck
1110
+ <<~GRAPHQL
1111
+ mutation DeckUpdate($id: UUID!, $input: DeckUpdateInput!) {
1112
+ deckUpdate(id: $id, input: $input) {
1113
+ #{deck_fields}
1114
+ }
1115
+ }
1116
+ GRAPHQL
1117
+ end
1118
+
1119
+ def add_deck_entry
1120
+ <<~GRAPHQL
1121
+ mutation DeckEntryAdd($input: DeckEntryAddInput!) {
1122
+ deckEntryAdd(input: $input) {
1123
+ #{deck_entry_mutation_payload_fields}
1124
+ }
1125
+ }
1126
+ GRAPHQL
1127
+ end
1128
+
1129
+ def update_deck_entry
1130
+ <<~GRAPHQL
1131
+ mutation DeckEntryUpdate($id: UUID!, $input: DeckEntryUpdateInput!) {
1132
+ deckEntryUpdate(id: $id, input: $input) {
1133
+ #{deck_entry_mutation_payload_fields}
1134
+ }
1135
+ }
1136
+ GRAPHQL
1137
+ end
1138
+
1139
+ def remove_deck_entry
1140
+ <<~GRAPHQL
1141
+ mutation DeckEntryRemove($id: UUID!, $expectedDraftRevision: Int!) {
1142
+ deckEntryRemove(id: $id, expectedDraftRevision: $expectedDraftRevision) {
1143
+ #{deck_entry_mutation_payload_fields}
1144
+ }
1145
+ }
1146
+ GRAPHQL
1147
+ end
1148
+
1149
+ def reorder_deck_entries
1150
+ <<~GRAPHQL
1151
+ mutation DeckEntryReorder($deckId: UUID!, $input: DeckEntryReorderInput!) {
1152
+ deckEntryReorder(deckId: $deckId, input: $input) {
1153
+ #{deck_entry_reorder_payload_fields}
1154
+ }
1155
+ }
1156
+ GRAPHQL
1157
+ end
1158
+
1159
+ def replace_deck_entries
1160
+ <<~GRAPHQL
1161
+ mutation DeckEntriesReplace($deckId: UUID!, $input: DeckEntriesReplaceInput!) {
1162
+ deckEntriesReplace(deckId: $deckId, input: $input) {
1163
+ #{deck_entry_reorder_payload_fields}
1164
+ }
1165
+ }
1166
+ GRAPHQL
1167
+ end
1168
+
1169
+ def import_deck
1170
+ <<~GRAPHQL
1171
+ mutation DeckImport($input: DeckImportInput!) {
1172
+ deckImport(input: $input) {
1173
+ #{deck_import_payload_fields}
1174
+ }
1175
+ }
1176
+ GRAPHQL
1177
+ end
1178
+
1179
+ def create_deck_import_format
1180
+ <<~GRAPHQL
1181
+ mutation DeckImportFormatCreate($input: DeckImportFormatCreateInput!) {
1182
+ deckImportFormatCreate(input: $input) {
1183
+ #{deck_import_format_definition_fields}
1184
+ }
1185
+ }
1186
+ GRAPHQL
1187
+ end
1188
+
1189
+ def update_deck_import_format
1190
+ <<~GRAPHQL
1191
+ mutation DeckImportFormatUpdate($id: UUID!, $input: DeckImportFormatUpdateInput!) {
1192
+ deckImportFormatUpdate(id: $id, input: $input) {
1193
+ #{deck_import_format_definition_fields}
1194
+ }
1195
+ }
1196
+ GRAPHQL
1197
+ end
1198
+
1199
+ def archive_deck_import_format
1200
+ <<~GRAPHQL
1201
+ mutation DeckImportFormatArchive($id: UUID!) {
1202
+ deckImportFormatArchive(id: $id) {
1203
+ #{deck_import_format_definition_fields}
1204
+ }
1205
+ }
1206
+ GRAPHQL
1207
+ end
1208
+
1209
+ def unarchive_deck_import_format
1210
+ <<~GRAPHQL
1211
+ mutation DeckImportFormatUnarchive($id: UUID!) {
1212
+ deckImportFormatUnarchive(id: $id) {
1213
+ #{deck_import_format_definition_fields}
1214
+ }
1215
+ }
1216
+ GRAPHQL
1217
+ end
1218
+
1219
+ def upsert_deck_by_external_ref
1220
+ <<~GRAPHQL
1221
+ mutation DeckUpsertByExternalRef($input: DeckUpsertByExternalRefInput!) {
1222
+ deckUpsertByExternalRef(input: $input) {
1223
+ deck {
1224
+ #{deck_fields}
1225
+ }
1226
+ created
1227
+ idempotentReplay
1228
+ }
1229
+ }
1230
+ GRAPHQL
1231
+ end
1232
+
1233
+ def claim_deck
1234
+ <<~GRAPHQL
1235
+ mutation DeckClaim($id: UUID!, $input: DeckClaimInput!) {
1236
+ deckClaim(id: $id, input: $input) {
1237
+ #{deck_ownership_transfer_payload_fields}
1238
+ }
1239
+ }
1240
+ GRAPHQL
1241
+ end
1242
+
1243
+ def transfer_deck_ownership
1244
+ <<~GRAPHQL
1245
+ mutation DeckTransferOwnership($id: UUID!, $input: DeckTransferOwnershipInput!) {
1246
+ deckTransferOwnership(id: $id, input: $input) {
1247
+ #{deck_ownership_transfer_payload_fields}
1248
+ }
1249
+ }
1250
+ GRAPHQL
1251
+ end
1252
+
1253
+ def copy_deck
1254
+ <<~GRAPHQL
1255
+ mutation DeckCopy($id: UUID!, $input: DeckCopyInput!) {
1256
+ deckCopy(id: $id, input: $input) {
1257
+ #{deck_copy_payload_fields}
1258
+ }
1259
+ }
1260
+ GRAPHQL
1261
+ end
1262
+
1263
+ def archive_deck
1264
+ <<~GRAPHQL
1265
+ mutation DeckArchive($id: UUID!) {
1266
+ deckArchive(id: $id) {
1267
+ #{deck_fields}
1268
+ }
1269
+ }
1270
+ GRAPHQL
1271
+ end
1272
+
1273
+ def restore_deck
1274
+ <<~GRAPHQL
1275
+ mutation DeckRestore($id: UUID!) {
1276
+ deckRestore(id: $id) {
1277
+ #{deck_fields}
1278
+ }
1279
+ }
1280
+ GRAPHQL
1281
+ end
1282
+
1283
+ def unpublish_deck
1284
+ <<~GRAPHQL
1285
+ mutation DeckUnpublish($id: UUID!) {
1286
+ deckUnpublish(id: $id) {
1287
+ #{deck_fields}
1288
+ }
1289
+ }
1290
+ GRAPHQL
1291
+ end
1292
+
1293
+ # Builds a deckPublish mutation
1294
+ def publish_deck
1295
+ <<~GRAPHQL
1296
+ mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) {
1297
+ deckPublish(id: $id, input: $input) {
1298
+ #{deck_publish_payload_fields}
1299
+ }
1300
+ }
1301
+ GRAPHQL
1302
+ end
1303
+
1304
+ def remove_invalid_deck_entries
1305
+ <<~GRAPHQL
1306
+ mutation DeckRemoveInvalidEntries($id: UUID!, $input: DeckRemoveInvalidEntriesInput!) {
1307
+ deckRemoveInvalidEntries(id: $id, input: $input) {
1308
+ #{deck_fields}
1309
+ }
1310
+ }
1311
+ GRAPHQL
1312
+ end
1313
+
1314
+ # Builds a deckCollaboratorUpsert mutation
1315
+ def upsert_deck_collaborator
1316
+ <<~GRAPHQL
1317
+ mutation DeckCollaboratorUpsert($deckId: UUID!, $accountId: UUID!, $role: DeckCollaboratorRole!) {
1318
+ deckCollaboratorUpsert(deckId: $deckId, accountId: $accountId, role: $role) {
1319
+ #{deck_collaborator_fields}
1320
+ }
1321
+ }
1322
+ GRAPHQL
1323
+ end
1324
+
1325
+ # Builds a deckCollaboratorRemove mutation
1326
+ def remove_deck_collaborator
1327
+ <<~GRAPHQL
1328
+ mutation DeckCollaboratorRemove($deckId: UUID!, $accountId: UUID!) {
1329
+ deckCollaboratorRemove(deckId: $deckId, accountId: $accountId)
1330
+ }
1331
+ GRAPHQL
1332
+ end
1333
+
1334
+ # Builds a deckPreviewTokenCreate mutation
1335
+ def create_deck_preview_token
1336
+ <<~GRAPHQL
1337
+ mutation DeckPreviewTokenCreate($input: DeckPreviewTokenCreateInput!) {
1338
+ deckPreviewTokenCreate(input: $input) {
1339
+ token
1340
+ previewToken {
1341
+ #{deck_preview_token_fields}
1342
+ }
1343
+ }
1344
+ }
1345
+ GRAPHQL
1346
+ end
1347
+
1348
+ # Builds a deckPreviewTokenRevoke mutation
1349
+ def revoke_deck_preview_token
1350
+ <<~GRAPHQL
1351
+ mutation DeckPreviewTokenRevoke($id: UUID!) {
1352
+ deckPreviewTokenRevoke(id: $id)
1353
+ }
1354
+ GRAPHQL
1355
+ end
1356
+
1357
+ def create_deck_embed_token
1358
+ <<~GRAPHQL
1359
+ mutation DeckEmbedTokenCreate($input: DeckEmbedTokenCreateInput!) {
1360
+ deckEmbedTokenCreate(input: $input) {
1361
+ token
1362
+ embedToken {
1363
+ #{deck_embed_token_fields}
1364
+ }
1365
+ }
1366
+ }
1367
+ GRAPHQL
1368
+ end
1369
+
1370
+ def revoke_deck_embed_token
1371
+ <<~GRAPHQL
1372
+ mutation DeckEmbedTokenRevoke($id: UUID!) {
1373
+ deckEmbedTokenRevoke(id: $id)
1374
+ }
1375
+ GRAPHQL
1376
+ end
1377
+
1378
+ def create_deck_access_token_issuer
1379
+ <<~GRAPHQL
1380
+ mutation DeckAccessTokenIssuerCreate($input: DeckAccessTokenIssuerCreateInput!) {
1381
+ deckAccessTokenIssuerCreate(input: $input) {
1382
+ #{deck_access_token_issuer_fields}
1383
+ }
1384
+ }
1385
+ GRAPHQL
1386
+ end
1387
+
1388
+ def revoke_deck_access_token_issuer
1389
+ <<~GRAPHQL
1390
+ mutation DeckAccessTokenIssuerRevoke($id: UUID!) {
1391
+ deckAccessTokenIssuerRevoke(id: $id)
1392
+ }
1393
+ GRAPHQL
1394
+ end
1395
+
1396
+ def revoke_deck_access_token_issuer_signing_key
1397
+ <<~GRAPHQL
1398
+ mutation DeckAccessTokenIssuerSigningKeyRevoke($id: UUID!) {
1399
+ deckAccessTokenIssuerSigningKeyRevoke(id: $id) {
1400
+ #{deck_access_token_issuer_fields}
1401
+ }
1402
+ }
1403
+ GRAPHQL
1404
+ end
1405
+
1406
+ def exchange_deck_access_token
1407
+ <<~GRAPHQL
1408
+ mutation DeckAccessTokenExchange($input: DeckAccessTokenExchangeInput!) {
1409
+ deckAccessTokenExchange(input: $input) {
1410
+ token
1411
+ accessToken {
1412
+ #{deck_access_token_fields}
1413
+ }
1414
+ }
1415
+ }
1416
+ GRAPHQL
1417
+ end
1418
+
1419
+ def revoke_deck_access_token
1420
+ <<~GRAPHQL
1421
+ mutation DeckAccessTokenRevoke($id: UUID!) {
1422
+ deckAccessTokenRevoke(id: $id)
1423
+ }
1424
+ GRAPHQL
1425
+ end
1426
+
1427
+ def grant_deck_api_application_access
1428
+ <<~GRAPHQL
1429
+ mutation DeckApiApplicationAccessGrant($input: DeckAPIApplicationAccessGrantInput!) {
1430
+ deckApiApplicationAccessGrant(input: $input) {
1431
+ #{deck_api_application_access_fields}
1432
+ }
1433
+ }
1434
+ GRAPHQL
1435
+ end
1436
+
1437
+ def revoke_deck_api_application_access
1438
+ <<~GRAPHQL
1439
+ mutation DeckApiApplicationAccessRevoke($deckId: UUID!, $apiApplicationId: UUID!) {
1440
+ deckApiApplicationAccessRevoke(deckId: $deckId, apiApplicationId: $apiApplicationId)
1441
+ }
1442
+ GRAPHQL
1443
+ end
1444
+
1445
+ # Builds a deckDelete mutation
1446
+ def delete_deck
1447
+ <<~GRAPHQL
1448
+ mutation DeckDelete($id: UUID!) {
1449
+ deckDelete(id: $id)
1450
+ }
1451
+ GRAPHQL
1452
+ end
1453
+
1454
+ # Builds a fetchMe query
1455
+ def fetch_me
1456
+ <<~GRAPHQL
1457
+ query FetchMe {
1458
+ fetchMe {
1459
+ application {
1460
+ id
1461
+ name
1462
+ description
1463
+ environment
1464
+ apiKeyPrefix
1465
+ allowedOrigins
1466
+ allowedIps
1467
+ createdAt
1468
+ updatedAt
1469
+ lastUsedAt
1470
+ }
1471
+ account {
1472
+ id
1473
+ displayName
1474
+ createdAt
1475
+ }
1476
+ }
1477
+ }
1478
+ GRAPHQL
1479
+ end
1480
+
1481
+ private
1482
+
1483
+ # rubocop:disable Metrics/MethodLength
1484
+ def build_args(params, required: [], type_overrides: {})
1485
+ # Filter out nil values
1486
+ params = params.compact
1487
+
1488
+ return { definition: '', call: '' } if params.empty?
1489
+
1490
+ # Map Ruby types to GraphQL types (base types, without !)
1491
+ type_map = {
1492
+ publisherSlug: 'String',
1493
+ publisherId: 'UUID',
1494
+ gameKey: 'String',
1495
+ gameSlug: 'String',
1496
+ datasetKey: 'String',
1497
+ datasetId: 'UUID',
1498
+ recordId: 'UUID',
1499
+ identifier: 'String',
1500
+ search: 'String',
1501
+ orderBy: 'String',
1502
+ filter: 'JSON',
1503
+ resolveLinks: '[String!]',
1504
+ first: 'Int',
1505
+ after: 'String',
1506
+ last: 'Int',
1507
+ before: 'String',
1508
+ includeArchived: 'Boolean',
1509
+ externalRef: 'String',
1510
+ deckId: 'UUID!',
1511
+ gameId: 'UUID',
1512
+ rulesetKey: 'String',
1513
+ rulesetVersionId: 'UUID',
1514
+ validateSchema: 'Boolean',
1515
+ purpose: 'DatasetPurpose',
1516
+ status: 'String',
1517
+ level: 'String',
1518
+ key: 'String',
1519
+ id: 'UUID!',
1520
+ ids: '[UUID!]!'
1521
+ }
1522
+
1523
+ definitions = params.keys.map do |k|
1524
+ base_type = type_overrides[k] || type_map[k] || 'String'
1525
+ # Add ! for required fields (unless already has !)
1526
+ type = required.include?(k) && !base_type.end_with?('!') ? "#{base_type}!" : base_type
512
1527
  "$#{k}: #{type}"
513
1528
  end
514
1529
  calls = params.keys.map { |k| "#{k}: $#{k}" }
@@ -518,6 +1533,34 @@ module CardDB
518
1533
  call: "(#{calls.join(', ')})"
519
1534
  }
520
1535
  end
1536
+ # rubocop:enable Metrics/MethodLength
1537
+
1538
+ def file_fields
1539
+ <<~FIELDS
1540
+ id
1541
+ createdAt
1542
+ updatedAt
1543
+ key
1544
+ filename
1545
+ contentType
1546
+ size
1547
+ status
1548
+ isPublic
1549
+ entityType
1550
+ entityId
1551
+ url
1552
+ FIELDS
1553
+ end
1554
+
1555
+ def presigned_upload_fields
1556
+ <<~FIELDS
1557
+ file {
1558
+ #{file_fields}
1559
+ }
1560
+ uploadUrl
1561
+ expiresAt
1562
+ FIELDS
1563
+ end
521
1564
 
522
1565
  def publisher_fields
523
1566
  <<~FIELDS
@@ -565,8 +1608,11 @@ module CardDB
565
1608
  key
566
1609
  name
567
1610
  description
1611
+ metafyGameUuid
1612
+ metafyGameSlug
568
1613
  website
569
1614
  visibility
1615
+ archivedAt
570
1616
  isArchived
571
1617
  createdAt
572
1618
  updatedAt
@@ -613,8 +1659,13 @@ module CardDB
613
1659
  name
614
1660
  description
615
1661
  purpose
1662
+ activeVersionId
616
1663
  tcgplayerProductIdFieldKey
617
1664
  visibility
1665
+ posX
1666
+ posY
1667
+ sortOrder
1668
+ archivedAt
618
1669
  isArchived
619
1670
  createdAt
620
1671
  updatedAt
@@ -645,11 +1696,16 @@ module CardDB
645
1696
  targetDatasetKey
646
1697
  targetDatasetName
647
1698
  targetDatasetId
1699
+ targetFieldKey
1700
+ linkAlias
1701
+ linkDirection
1702
+ isArray
648
1703
  }
649
1704
  }
650
1705
  FIELDS
651
1706
  end
652
1707
 
1708
+ # rubocop:disable Metrics/MethodLength
653
1709
  def field_info_fields(depth:)
654
1710
  nested_fields = if depth.positive?
655
1711
  <<~FIELDS
@@ -668,15 +1724,36 @@ module CardDB
668
1724
  filterable
669
1725
  searchable
670
1726
  isIdentifier
1727
+ sortOrder
671
1728
  itemType
1729
+ linkDatasetId
1730
+ linkDatasetKey
1731
+ linkDatasetName
1732
+ linkFieldKey
1733
+ linkAlias
1734
+ linkDirection
672
1735
  displayFormat
673
1736
  semanticType
1737
+ placeholder
1738
+ isHidden
1739
+ isComputed
1740
+ isSystemField
1741
+ defaultValue
674
1742
  allowedValues
1743
+ minLength
1744
+ maxLength
1745
+ minValue
1746
+ maxValue
1747
+ pattern
1748
+ isUnique
675
1749
  #{nested_fields}
676
1750
  FIELDS
677
1751
  end
1752
+ # rubocop:enable Metrics/MethodLength
1753
+
1754
+ def dataset_connection_fields(include_schema: false)
1755
+ node_fields = include_schema ? "#{dataset_fields}\n#{schema_fields}" : dataset_fields
678
1756
 
679
- def dataset_connection_fields
680
1757
  <<~FIELDS
681
1758
  totalCount
682
1759
  pageInfo {
@@ -688,7 +1765,7 @@ module CardDB
688
1765
  edges {
689
1766
  cursor
690
1767
  node {
691
- #{dataset_fields}
1768
+ #{node_fields}
692
1769
  }
693
1770
  }
694
1771
  FIELDS
@@ -730,24 +1807,448 @@ module CardDB
730
1807
  FIELDS
731
1808
  end
732
1809
 
733
- def record_connection_fields(include_resolved_links: false, include_pricing: false)
734
- resolved_links_field = if include_resolved_links
735
- <<~FIELDS
736
- resolvedLinks {
737
- field
738
- linkFieldKey
739
- values
740
- records {
741
- id
742
- datasetId
743
- data
744
- }
745
- }
746
- FIELDS
747
- else
748
- ''
749
- end
1810
+ def record_connection_fields(include_resolved_links: false, include_pricing: false)
1811
+ resolved_links_field = include_resolved_links ? resolved_links_fields : ''
1812
+
1813
+ <<~FIELDS
1814
+ totalCount
1815
+ pageInfo {
1816
+ hasNextPage
1817
+ hasPreviousPage
1818
+ startCursor
1819
+ endCursor
1820
+ }
1821
+ edges {
1822
+ cursor
1823
+ node {
1824
+ #{record_fields(include_pricing: include_pricing)}
1825
+ #{resolved_links_field}
1826
+ }
1827
+ }
1828
+ FIELDS
1829
+ end
1830
+
1831
+ def resolved_links_fields
1832
+ <<~FIELDS
1833
+ resolvedLinks {
1834
+ field
1835
+ linkFieldKey
1836
+ values
1837
+ records {
1838
+ id
1839
+ datasetId
1840
+ data
1841
+ }
1842
+ }
1843
+ FIELDS
1844
+ end
1845
+
1846
+ def object_field_fields
1847
+ <<~FIELDS
1848
+ id
1849
+ objectTypeId
1850
+ key
1851
+ label
1852
+ dataType
1853
+ isRequired
1854
+ isFilterable
1855
+ isSearchable
1856
+ isIdentifier
1857
+ sortOrder
1858
+ description
1859
+ placeholder
1860
+ displayFormat
1861
+ semanticType
1862
+ isHidden
1863
+ isComputed
1864
+ isSystemField
1865
+ defaultValue
1866
+ allowedValues
1867
+ minLength
1868
+ maxLength
1869
+ minValue
1870
+ maxValue
1871
+ pattern
1872
+ isUnique
1873
+ itemType
1874
+ linkDatasetId
1875
+ linkFieldKey
1876
+ linkAlias
1877
+ linkDirection
1878
+ parentFieldId
1879
+ createdAt
1880
+ updatedAt
1881
+ FIELDS
1882
+ end
1883
+
1884
+ def bulk_record_error_fields
1885
+ <<~FIELDS
1886
+ datasetKey
1887
+ index
1888
+ errors {
1889
+ field
1890
+ message
1891
+ details
1892
+ }
1893
+ FIELDS
1894
+ end
1895
+
1896
+ def import_stats_fields
1897
+ <<~FIELDS
1898
+ total
1899
+ inserted
1900
+ updated
1901
+ skipped
1902
+ failed
1903
+ FIELDS
1904
+ end
1905
+
1906
+ def bulk_import_result_fields
1907
+ <<~FIELDS
1908
+ inserted {
1909
+ #{record_fields}
1910
+ }
1911
+ updated {
1912
+ #{record_fields}
1913
+ }
1914
+ skipped
1915
+ errors {
1916
+ #{bulk_record_error_fields}
1917
+ }
1918
+ createdFields {
1919
+ #{object_field_fields}
1920
+ }
1921
+ stats {
1922
+ #{import_stats_fields}
1923
+ }
1924
+ FIELDS
1925
+ end
1926
+
1927
+ def import_job_asset_fields
1928
+ <<~FIELDS
1929
+ fileId
1930
+ filename
1931
+ file {
1932
+ #{file_fields}
1933
+ }
1934
+ FIELDS
1935
+ end
1936
+
1937
+ def import_job_fields
1938
+ <<~FIELDS
1939
+ id
1940
+ publisherId
1941
+ publisher {
1942
+ #{publisher_fields}
1943
+ }
1944
+ datasetId
1945
+ dataset {
1946
+ #{dataset_fields}
1947
+ #{schema_fields}
1948
+ }
1949
+ accountId
1950
+ status
1951
+ mode
1952
+ onConflict
1953
+ format
1954
+ fileId
1955
+ progress
1956
+ totalRecords
1957
+ processedRecords
1958
+ insertedCount
1959
+ updatedCount
1960
+ skippedCount
1961
+ failedCount
1962
+ createdFields {
1963
+ #{object_field_fields}
1964
+ }
1965
+ errors {
1966
+ #{bulk_record_error_fields}
1967
+ }
1968
+ errorMessage
1969
+ assets {
1970
+ #{import_job_asset_fields}
1971
+ }
1972
+ startedAt
1973
+ completedAt
1974
+ createdAt
1975
+ updatedAt
1976
+ lastCheckpointIndex
1977
+ isResumed
1978
+ imagesPending
1979
+ imagesCompleted
1980
+ imagesFailed
1981
+ FIELDS
1982
+ end
1983
+
1984
+ def import_job_log_fields
1985
+ <<~FIELDS
1986
+ id
1987
+ importJobId
1988
+ level
1989
+ message
1990
+ datasetKey
1991
+ recordIndex
1992
+ fieldKey
1993
+ details
1994
+ createdAt
1995
+ FIELDS
1996
+ end
1997
+
1998
+ def dataset_records_upsert_payload_fields
1999
+ <<~FIELDS
2000
+ job {
2001
+ #{import_job_fields}
2002
+ }
2003
+ dryRunResult {
2004
+ #{bulk_import_result_fields}
2005
+ }
2006
+ FIELDS
2007
+ end
2008
+
2009
+ def dataset_record_delete_job_result_fields
2010
+ <<~FIELDS
2011
+ target
2012
+ recordId
2013
+ identifier
2014
+ status
2015
+ message
2016
+ FIELDS
2017
+ end
2018
+
2019
+ def dataset_record_delete_job_fields
2020
+ <<~FIELDS
2021
+ id
2022
+ publisherId
2023
+ publisher {
2024
+ #{publisher_fields}
2025
+ }
2026
+ datasetId
2027
+ dataset {
2028
+ #{dataset_fields}
2029
+ }
2030
+ accountId
2031
+ status
2032
+ targetType
2033
+ dryRun
2034
+ targets
2035
+ progress
2036
+ totalTargets
2037
+ processedTargets
2038
+ matchedCount
2039
+ deletedCount
2040
+ missingCount
2041
+ blockedCount
2042
+ failedCount
2043
+ results {
2044
+ #{dataset_record_delete_job_result_fields}
2045
+ }
2046
+ errorMessage
2047
+ startedAt
2048
+ completedAt
2049
+ createdAt
2050
+ updatedAt
2051
+ FIELDS
2052
+ end
2053
+
2054
+ def field_mapping_fields
2055
+ <<~FIELDS
2056
+ sourceField
2057
+ targetField
2058
+ targetFieldLabel
2059
+ inferredType
2060
+ inferredItemType
2061
+ inferredChildren {
2062
+ key
2063
+ label
2064
+ type
2065
+ required
2066
+ itemType
2067
+ children {
2068
+ key
2069
+ label
2070
+ type
2071
+ required
2072
+ itemType
2073
+ }
2074
+ }
2075
+ inferredLinkDataset
2076
+ inferredLinkFieldKey
2077
+ inferredLinkDirection
2078
+ targetFieldType
2079
+ sampleValues
2080
+ status
2081
+ FIELDS
2082
+ end
2083
+
2084
+ def import_warning_fields
2085
+ <<~FIELDS
2086
+ datasetKey
2087
+ field
2088
+ message
2089
+ severity
2090
+ FIELDS
2091
+ end
2092
+
2093
+ def dataset_import_preview_fields
2094
+ <<~FIELDS
2095
+ datasetKey
2096
+ datasetName
2097
+ datasetId
2098
+ exists
2099
+ recordCount
2100
+ fieldMappings {
2101
+ #{field_mapping_fields}
2102
+ }
2103
+ warnings {
2104
+ #{import_warning_fields}
2105
+ }
2106
+ canProceed
2107
+ sampleRecords
2108
+ availableDatasets {
2109
+ #{dataset_fields}
2110
+ #{schema_fields}
2111
+ }
2112
+ FIELDS
2113
+ end
2114
+
2115
+ def game_import_preview_fields
2116
+ <<~FIELDS
2117
+ datasets {
2118
+ datasetKey
2119
+ datasetName
2120
+ datasetId
2121
+ exists
2122
+ recordCount
2123
+ fieldMappings {
2124
+ #{field_mapping_fields}
2125
+ }
2126
+ warnings {
2127
+ #{import_warning_fields}
2128
+ }
2129
+ sampleRecords
2130
+ }
2131
+ importOrder
2132
+ warnings {
2133
+ #{import_warning_fields}
2134
+ }
2135
+ canProceed
2136
+ FIELDS
2137
+ end
2138
+
2139
+ def game_import_dataset_status_fields
2140
+ <<~FIELDS
2141
+ datasetKey
2142
+ datasetId
2143
+ datasetName
2144
+ status
2145
+ recordCount
2146
+ insertedCount
2147
+ updatedCount
2148
+ skippedCount
2149
+ failedCount
2150
+ errorMessage
2151
+ FIELDS
2152
+ end
2153
+
2154
+ def game_import_job_fields
2155
+ <<~FIELDS
2156
+ id
2157
+ publisherId
2158
+ publisher {
2159
+ #{publisher_fields}
2160
+ }
2161
+ gameId
2162
+ game {
2163
+ #{game_fields}
2164
+ }
2165
+ accountId
2166
+ status
2167
+ mode
2168
+ onConflict
2169
+ fileId
2170
+ assets {
2171
+ #{import_job_asset_fields}
2172
+ }
2173
+ totalDatasets
2174
+ completedDatasets
2175
+ progress
2176
+ importOrder
2177
+ datasetStatuses {
2178
+ #{game_import_dataset_status_fields}
2179
+ }
2180
+ errorMessage
2181
+ startedAt
2182
+ completedAt
2183
+ createdAt
2184
+ updatedAt
2185
+ completedDatasetKeys
2186
+ currentDatasetKey
2187
+ lastCheckpointIndex
2188
+ isResumed
2189
+ imagesPending
2190
+ imagesCompleted
2191
+ imagesFailed
2192
+ phase
2193
+ linkBuildingDataset
2194
+ linkBuildingTotalDatasets
2195
+ linkBuildingCompletedDatasets
2196
+ linkBuildingProcessedRecords
2197
+ linkBuildingTotalRecords
2198
+ FIELDS
2199
+ end
2200
+
2201
+ def export_job_fields
2202
+ <<~FIELDS
2203
+ id
2204
+ publisherId
2205
+ publisher {
2206
+ #{publisher_fields}
2207
+ }
2208
+ datasetId
2209
+ dataset {
2210
+ #{dataset_fields}
2211
+ }
2212
+ accountId
2213
+ status
2214
+ format
2215
+ filter
2216
+ totalRecords
2217
+ processedRecords
2218
+ progress
2219
+ fileId
2220
+ downloadUrl
2221
+ downloadExpiresAt
2222
+ errorMessage
2223
+ startedAt
2224
+ completedAt
2225
+ createdAt
2226
+ updatedAt
2227
+ lastCheckpointIndex
2228
+ FIELDS
2229
+ end
2230
+
2231
+ def import_job_connection_fields
2232
+ connection_fields(import_job_fields)
2233
+ end
2234
+
2235
+ def import_job_log_connection_fields
2236
+ connection_fields(import_job_log_fields)
2237
+ end
2238
+
2239
+ def game_import_job_connection_fields
2240
+ connection_fields(game_import_job_fields)
2241
+ end
2242
+
2243
+ def dataset_record_delete_job_connection_fields
2244
+ connection_fields(dataset_record_delete_job_fields)
2245
+ end
2246
+
2247
+ def export_job_connection_fields
2248
+ connection_fields(export_job_fields)
2249
+ end
750
2250
 
2251
+ def connection_fields(node_fields)
751
2252
  <<~FIELDS
752
2253
  totalCount
753
2254
  pageInfo {
@@ -759,16 +2260,115 @@ module CardDB
759
2260
  edges {
760
2261
  cursor
761
2262
  node {
762
- #{record_fields(include_pricing: include_pricing)}
763
- #{resolved_links_field}
2263
+ #{node_fields}
764
2264
  }
765
2265
  }
766
2266
  FIELDS
767
2267
  end
768
2268
 
2269
+ def deck_section_definition_fields
2270
+ <<~FIELDS
2271
+ key
2272
+ label
2273
+ description
2274
+ order
2275
+ default
2276
+ aliases
2277
+ minCards
2278
+ maxCards
2279
+ excludedFromDeckSize
2280
+ legalCardTypes
2281
+ metadata
2282
+ FIELDS
2283
+ end
2284
+
2285
+ def deck_entry_fields
2286
+ <<~FIELDS
2287
+ id
2288
+ datasetId
2289
+ recordId
2290
+ identifier
2291
+ quantity
2292
+ section
2293
+ sortOrder
2294
+ annotations
2295
+ display
2296
+ record {
2297
+ #{record_fields}
2298
+ }
2299
+ FIELDS
2300
+ end
2301
+
2302
+ def deck_validated_against_fields
2303
+ <<~FIELDS
2304
+ rulesetId
2305
+ rulesetVersionId
2306
+ rulesetVersionLabel
2307
+ cardDatasetId
2308
+ cardDatasetVersionId
2309
+ validatedAt
2310
+ validationResultSummary
2311
+ FIELDS
2312
+ end
2313
+
2314
+ def deck_validation_issue_fields
2315
+ <<~FIELDS
2316
+ code
2317
+ severity
2318
+ message
2319
+ entryIds
2320
+ section
2321
+ datasetId
2322
+ identifier
2323
+ metadata
2324
+ FIELDS
2325
+ end
2326
+
2327
+ def deck_validation_fields
2328
+ <<~FIELDS
2329
+ deckId
2330
+ valid
2331
+ blockers {
2332
+ #{deck_validation_issue_fields}
2333
+ }
2334
+ warnings {
2335
+ #{deck_validation_issue_fields}
2336
+ }
2337
+ affectedEntries {
2338
+ entryId
2339
+ datasetId
2340
+ recordId
2341
+ identifier
2342
+ section
2343
+ quantity
2344
+ }
2345
+ validatedAgainst {
2346
+ #{deck_validated_against_fields}
2347
+ }
2348
+ checkedAt
2349
+ FIELDS
2350
+ end
2351
+
2352
+ def deck_diff_fields
2353
+ <<~FIELDS
2354
+ deckId
2355
+ fromVersionId
2356
+ toVersionId
2357
+ toDraftRevision
2358
+ hasChanges
2359
+ diff
2360
+ FIELDS
2361
+ end
2362
+
769
2363
  def deck_fields
770
2364
  <<~FIELDS
771
2365
  id
2366
+ ownerType
2367
+ ownerAccountId
2368
+ ownerApiApplicationId
2369
+ environment
2370
+ createdByAccountId
2371
+ createdByApiApplicationId
772
2372
  accountId
773
2373
  apiApplicationId
774
2374
  gameId
@@ -778,13 +2378,29 @@ module CardDB
778
2378
  description
779
2379
  formatKey
780
2380
  visibility
2381
+ accessMode
2382
+ discoverability
2383
+ state
2384
+ archivedAt
2385
+ deletedAt
2386
+ unpublishedAt
2387
+ externalRefApiApplicationId
781
2388
  externalRef
2389
+ externalSubjectRef
2390
+ rulesetId
782
2391
  sourceUrl
783
2392
  metadata
2393
+ sectionDefinitions {
2394
+ #{deck_section_definition_fields}
2395
+ }
784
2396
  latestPublishedVersion {
785
2397
  #{deck_version_fields}
786
2398
  }
787
2399
  publishedAt
2400
+ draftRevision
2401
+ draftUpdatedAt
2402
+ draftUpdatedByAccountId
2403
+ draftUpdatedByApiApplicationId
788
2404
  hasUnpublishedChanges
789
2405
  createdAt
790
2406
  updatedAt
@@ -792,18 +2408,58 @@ module CardDB
792
2408
  #{game_fields}
793
2409
  }
794
2410
  entries {
795
- id
796
- datasetId
797
- recordId
798
- identifier
799
- quantity
800
- section
801
- sortOrder
802
- annotations
803
- record {
804
- #{record_fields}
805
- }
2411
+ #{deck_entry_fields}
2412
+ }
2413
+ FIELDS
2414
+ end
2415
+
2416
+ def deck_ownership_transfer_payload_fields
2417
+ <<~FIELDS
2418
+ deck {
2419
+ #{deck_fields}
2420
+ }
2421
+ retainedAppAccess
2422
+ FIELDS
2423
+ end
2424
+
2425
+ def deck_copy_payload_fields
2426
+ <<~FIELDS
2427
+ deck {
2428
+ #{deck_fields}
2429
+ }
2430
+ copiedFromDeckId
2431
+ retainedAppAccess
2432
+ FIELDS
2433
+ end
2434
+
2435
+ def deck_access_application_fields
2436
+ <<~FIELDS
2437
+ id
2438
+ name
2439
+ description
2440
+ revokedAt
2441
+ FIELDS
2442
+ end
2443
+
2444
+ def deck_api_application_access_fields
2445
+ <<~FIELDS
2446
+ id
2447
+ deckId
2448
+ deck {
2449
+ #{deck_fields}
2450
+ }
2451
+ apiApplicationId
2452
+ apiApplication {
2453
+ #{deck_access_application_fields}
806
2454
  }
2455
+ role
2456
+ grantSource
2457
+ externalRef
2458
+ createdByAccountId
2459
+ createdByApiApplicationId
2460
+ revokedAt
2461
+ createdAt
2462
+ updatedAt
807
2463
  FIELDS
808
2464
  end
809
2465
 
@@ -821,23 +2477,67 @@ module CardDB
821
2477
  externalRef
822
2478
  sourceUrl
823
2479
  metadata
2480
+ entries {
2481
+ #{deck_entry_fields}
2482
+ }
824
2483
  publishNote
825
2484
  computedDiff
2485
+ rulesetId
2486
+ rulesetVersionId
2487
+ cardDatasetId
2488
+ cardDatasetVersionId
2489
+ validatedAt
2490
+ validationSummary
2491
+ validatedAgainst {
2492
+ #{deck_validated_against_fields}
2493
+ }
2494
+ sectionDefinitions {
2495
+ #{deck_section_definition_fields}
2496
+ }
826
2497
  publishedByAccountId
827
2498
  publishedByApiApplicationId
828
2499
  createdAt
2500
+ FIELDS
2501
+ end
2502
+
2503
+ def deck_publish_payload_fields
2504
+ <<~FIELDS
2505
+ deck {
2506
+ #{deck_fields}
2507
+ }
2508
+ version {
2509
+ #{deck_version_fields}
2510
+ }
2511
+ validation {
2512
+ #{deck_validation_fields}
2513
+ }
2514
+ blockers {
2515
+ #{deck_validation_issue_fields}
2516
+ }
2517
+ warnings {
2518
+ #{deck_validation_issue_fields}
2519
+ }
2520
+ FIELDS
2521
+ end
2522
+
2523
+ def deck_entry_mutation_payload_fields
2524
+ <<~FIELDS
2525
+ deck {
2526
+ #{deck_fields}
2527
+ }
2528
+ entry {
2529
+ #{deck_entry_fields}
2530
+ }
2531
+ FIELDS
2532
+ end
2533
+
2534
+ def deck_entry_reorder_payload_fields
2535
+ <<~FIELDS
2536
+ deck {
2537
+ #{deck_fields}
2538
+ }
829
2539
  entries {
830
- id
831
- datasetId
832
- recordId
833
- identifier
834
- quantity
835
- section
836
- sortOrder
837
- annotations
838
- record {
839
- #{record_fields}
840
- }
2540
+ #{deck_entry_fields}
841
2541
  }
842
2542
  FIELDS
843
2543
  end
@@ -885,6 +2585,217 @@ module CardDB
885
2585
  FIELDS
886
2586
  end
887
2587
 
2588
+ def deck_embed_token_fields
2589
+ <<~FIELDS
2590
+ id
2591
+ deckId
2592
+ apiApplicationId
2593
+ label
2594
+ readMode
2595
+ allowedOrigins
2596
+ externalSubject
2597
+ expiresAt
2598
+ revokedAt
2599
+ lastUsedAt
2600
+ createdAt
2601
+ updatedAt
2602
+ FIELDS
2603
+ end
2604
+
2605
+ def deck_access_token_issuer_fields
2606
+ <<~FIELDS
2607
+ id
2608
+ deckId
2609
+ apiApplicationId
2610
+ label
2611
+ readModes
2612
+ maxTokenLifetimeSeconds
2613
+ directSigningAlg
2614
+ directSigningKeyId
2615
+ directSigningPublicKey
2616
+ directSigningKeyRevokedAt
2617
+ revokedAt
2618
+ createdAt
2619
+ updatedAt
2620
+ FIELDS
2621
+ end
2622
+
2623
+ def deck_access_token_fields
2624
+ <<~FIELDS
2625
+ id
2626
+ deckId
2627
+ apiApplicationId
2628
+ issuerId
2629
+ readMode
2630
+ externalSubject
2631
+ expiresAt
2632
+ revokedAt
2633
+ lastUsedAt
2634
+ createdAt
2635
+ updatedAt
2636
+ FIELDS
2637
+ end
2638
+
2639
+ def deck_import_entry_fields
2640
+ <<~FIELDS
2641
+ lineNumber
2642
+ raw
2643
+ datasetKey
2644
+ datasetId
2645
+ recordId
2646
+ identifier
2647
+ quantity
2648
+ section
2649
+ sortOrder
2650
+ display
2651
+ record {
2652
+ #{record_fields}
2653
+ }
2654
+ FIELDS
2655
+ end
2656
+
2657
+ def deck_import_issue_fields
2658
+ <<~FIELDS
2659
+ lineNumber
2660
+ raw
2661
+ code
2662
+ message
2663
+ FIELDS
2664
+ end
2665
+
2666
+ def deck_import_unmatched_fields
2667
+ <<~FIELDS
2668
+ lineNumber
2669
+ raw
2670
+ datasetKey
2671
+ identifier
2672
+ quantity
2673
+ section
2674
+ code
2675
+ message
2676
+ FIELDS
2677
+ end
2678
+
2679
+ def deck_import_ambiguous_fields
2680
+ <<~FIELDS
2681
+ lineNumber
2682
+ raw
2683
+ datasetKey
2684
+ identifier
2685
+ quantity
2686
+ section
2687
+ candidates {
2688
+ recordId
2689
+ identifier
2690
+ display
2691
+ }
2692
+ FIELDS
2693
+ end
2694
+
2695
+ def deck_import_format_definition_fields
2696
+ <<~FIELDS
2697
+ id
2698
+ gameId
2699
+ key
2700
+ name
2701
+ description
2702
+ enabled
2703
+ priority
2704
+ datasetKey
2705
+ config
2706
+ archivedAt
2707
+ isArchived
2708
+ createdAt
2709
+ updatedAt
2710
+ FIELDS
2711
+ end
2712
+
2713
+ def deck_import_format_detection_fields
2714
+ <<~FIELDS
2715
+ formatId
2716
+ key
2717
+ name
2718
+ confidence
2719
+ reason
2720
+ FIELDS
2721
+ end
2722
+
2723
+ def deck_import_format_test_payload_fields
2724
+ <<~FIELDS
2725
+ detection {
2726
+ #{deck_import_format_detection_fields}
2727
+ }
2728
+ entries {
2729
+ #{deck_import_entry_fields}
2730
+ }
2731
+ parseErrors {
2732
+ #{deck_import_issue_fields}
2733
+ }
2734
+ unmatched {
2735
+ #{deck_import_unmatched_fields}
2736
+ }
2737
+ ambiguous {
2738
+ #{deck_import_ambiguous_fields}
2739
+ }
2740
+ FIELDS
2741
+ end
2742
+
2743
+ def deck_hydrate_entries_payload_fields
2744
+ <<~FIELDS
2745
+ entries {
2746
+ #{deck_import_entry_fields}
2747
+ }
2748
+ unmatched {
2749
+ #{deck_import_unmatched_fields}
2750
+ }
2751
+ ambiguous {
2752
+ #{deck_import_ambiguous_fields}
2753
+ }
2754
+ FIELDS
2755
+ end
2756
+
2757
+ def deck_import_payload_fields
2758
+ <<~FIELDS
2759
+ deck {
2760
+ #{deck_fields}
2761
+ }
2762
+ applied
2763
+ dryRun
2764
+ replace
2765
+ format
2766
+ importFormat {
2767
+ #{deck_import_format_definition_fields}
2768
+ }
2769
+ detection {
2770
+ #{deck_import_format_detection_fields}
2771
+ }
2772
+ entries {
2773
+ #{deck_import_entry_fields}
2774
+ }
2775
+ parseErrors {
2776
+ #{deck_import_issue_fields}
2777
+ }
2778
+ unmatched {
2779
+ #{deck_import_unmatched_fields}
2780
+ }
2781
+ ambiguous {
2782
+ #{deck_import_ambiguous_fields}
2783
+ }
2784
+ validation {
2785
+ #{deck_validation_fields}
2786
+ }
2787
+ FIELDS
2788
+ end
2789
+
2790
+ def deck_export_payload_fields
2791
+ <<~FIELDS
2792
+ deckId
2793
+ format
2794
+ text
2795
+ entryCount
2796
+ FIELDS
2797
+ end
2798
+
888
2799
  def deck_connection_fields
889
2800
  <<~FIELDS
890
2801
  totalCount
@@ -902,6 +2813,24 @@ module CardDB
902
2813
  }
903
2814
  FIELDS
904
2815
  end
2816
+
2817
+ def deck_import_format_definition_connection_fields
2818
+ <<~FIELDS
2819
+ totalCount
2820
+ pageInfo {
2821
+ hasNextPage
2822
+ hasPreviousPage
2823
+ startCursor
2824
+ endCursor
2825
+ }
2826
+ edges {
2827
+ cursor
2828
+ node {
2829
+ #{deck_import_format_definition_fields}
2830
+ }
2831
+ }
2832
+ FIELDS
2833
+ end
905
2834
  end
906
2835
  # rubocop:enable Metrics/ClassLength
907
2836
  end