carddb 0.3.0 → 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(
@@ -206,47 +310,434 @@ module CardDB
206
310
  }
207
311
  GRAPHQL
208
312
  end
209
- # rubocop:enable Metrics/ParameterLists
313
+ # rubocop:enable Metrics/ParameterLists
314
+
315
+ # Builds a fetchRecordByIdentifier query
316
+ def fetch_record_by_identifier(include_pricing: false)
317
+ <<~GRAPHQL
318
+ query FetchRecordByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifier: String!) {
319
+ fetchRecordByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifier: $identifier) {
320
+ #{record_fields(include_pricing: include_pricing)}
321
+ }
322
+ }
323
+ GRAPHQL
324
+ end
325
+
326
+ # Builds a fetchRecordsByIdentifier query
327
+ def fetch_records_by_identifier(include_pricing: false)
328
+ <<~GRAPHQL
329
+ query FetchRecordsByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifiers: [String!]!) {
330
+ fetchRecordsByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifiers: $identifiers) {
331
+ #{record_fields(include_pricing: include_pricing)}
332
+ }
333
+ }
334
+ GRAPHQL
335
+ end
336
+
337
+ # Builds a fetchRecord query
338
+ def fetch_record(include_pricing: false)
339
+ <<~GRAPHQL
340
+ query FetchRecord($id: UUID!) {
341
+ fetchRecord(id: $id) {
342
+ #{record_fields(include_pricing: include_pricing)}
343
+ }
344
+ }
345
+ GRAPHQL
346
+ end
347
+
348
+ # Builds a fetchRecords query
349
+ def fetch_records(include_pricing: false)
350
+ <<~GRAPHQL
351
+ query FetchRecords($ids: [UUID!]!) {
352
+ fetchRecords(ids: $ids) {
353
+ #{record_fields(include_pricing: include_pricing)}
354
+ }
355
+ }
356
+ GRAPHQL
357
+ end
358
+
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
+ )
383
+
384
+ <<~GRAPHQL
385
+ query DatasetRecords#{args[:definition]} {
386
+ datasetRecords#{args[:call]} {
387
+ #{record_connection_fields}
388
+ }
389
+ }
390
+ GRAPHQL
391
+ end
392
+
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
+
410
+ <<~GRAPHQL
411
+ query DatasetRecord#{args[:definition]} {
412
+ datasetRecord#{args[:call]} {
413
+ #{record_fields(include_pricing: params.fetch(:include_pricing, false))}
414
+ #{links_fields}
415
+ }
416
+ }
417
+ GRAPHQL
418
+ end
419
+
420
+ def upsert_dataset_records
421
+ <<~GRAPHQL
422
+ mutation DatasetRecordsUpsert($input: DatasetRecordsUpsertInput!) {
423
+ datasetRecordsUpsert(input: $input) {
424
+ #{dataset_records_upsert_payload_fields}
425
+ }
426
+ }
427
+ GRAPHQL
428
+ end
429
+
430
+ def delete_dataset_records
431
+ <<~GRAPHQL
432
+ mutation DatasetRecordsDelete($input: DatasetRecordsDeleteInput!) {
433
+ datasetRecordsDelete(input: $input) {
434
+ #{dataset_record_delete_job_fields}
435
+ }
436
+ }
437
+ GRAPHQL
438
+ end
439
+
440
+ def dataset_record_delete_job
441
+ <<~GRAPHQL
442
+ query DatasetRecordDeleteJob($id: UUID!) {
443
+ datasetRecordDeleteJob(id: $id) {
444
+ #{dataset_record_delete_job_fields}
445
+ }
446
+ }
447
+ GRAPHQL
448
+ end
449
+
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
+
457
+ <<~GRAPHQL
458
+ query DatasetRecordDeleteJobs#{args[:definition]} {
459
+ datasetRecordDeleteJobs#{args[:call]} {
460
+ #{dataset_record_delete_job_connection_fields}
461
+ }
462
+ }
463
+ GRAPHQL
464
+ end
465
+
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
475
+
476
+ def dataset_import_validate
477
+ <<~GRAPHQL
478
+ query DatasetImportValidate($input: DatasetImportValidateInput!) {
479
+ datasetImportValidate(input: $input) {
480
+ #{bulk_import_result_fields}
481
+ }
482
+ }
483
+ GRAPHQL
484
+ end
485
+
486
+ def dataset_import_from_file
487
+ <<~GRAPHQL
488
+ mutation DatasetImportFromFile($input: DatasetImportFromFileInput!) {
489
+ datasetImportFromFile(input: $input) {
490
+ #{import_job_fields}
491
+ }
492
+ }
493
+ GRAPHQL
494
+ end
495
+
496
+ def dataset_import_from_payload
497
+ <<~GRAPHQL
498
+ mutation DatasetImportFromPayload($input: DatasetImportFromPayloadInput!) {
499
+ datasetImportFromPayload(input: $input) {
500
+ #{import_job_fields}
501
+ }
502
+ }
503
+ GRAPHQL
504
+ end
505
+
506
+ def dataset_import_from_url
507
+ <<~GRAPHQL
508
+ mutation DatasetImportFromUrl($input: DatasetImportFromUrlInput!) {
509
+ datasetImportFromUrl(input: $input) {
510
+ #{import_job_fields}
511
+ }
512
+ }
513
+ GRAPHQL
514
+ end
515
+
516
+ def import_job
517
+ <<~GRAPHQL
518
+ query ImportJob($id: UUID!) {
519
+ importJob(id: $id) {
520
+ #{import_job_fields}
521
+ }
522
+ }
523
+ GRAPHQL
524
+ end
525
+
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
+
533
+ <<~GRAPHQL
534
+ query ImportJobs#{args[:definition]} {
535
+ importJobs#{args[:call]} {
536
+ #{import_job_connection_fields}
537
+ }
538
+ }
539
+ GRAPHQL
540
+ end
541
+
542
+ def import_job_cancel
543
+ <<~GRAPHQL
544
+ mutation ImportJobCancel($id: UUID!) {
545
+ importJobCancel(id: $id) {
546
+ #{import_job_fields}
547
+ }
548
+ }
549
+ GRAPHQL
550
+ end
551
+
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
+
558
+ <<~GRAPHQL
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
+ }
564
+ }
565
+ }
566
+ GRAPHQL
567
+ end
568
+
569
+ def game_import_preview
570
+ <<~GRAPHQL
571
+ query GameImportPreview($input: GameImportPreviewInput!) {
572
+ gameImportPreview(input: $input) {
573
+ #{game_import_preview_fields}
574
+ }
575
+ }
576
+ GRAPHQL
577
+ end
578
+
579
+ def game_import_from_file
580
+ <<~GRAPHQL
581
+ mutation GameImportFromFile($input: GameImportFromFileInput!) {
582
+ gameImportFromFile(input: $input) {
583
+ #{game_import_job_fields}
584
+ }
585
+ }
586
+ GRAPHQL
587
+ end
588
+
589
+ def game_import_from_payload
590
+ <<~GRAPHQL
591
+ mutation GameImportFromPayload($input: GameImportFromPayloadInput!) {
592
+ gameImportFromPayload(input: $input) {
593
+ #{game_import_job_fields}
594
+ }
595
+ }
596
+ GRAPHQL
597
+ end
598
+
599
+ def game_import_from_url
600
+ <<~GRAPHQL
601
+ mutation GameImportFromUrl($input: GameImportFromUrlInput!) {
602
+ gameImportFromUrl(input: $input) {
603
+ #{game_import_job_fields}
604
+ }
605
+ }
606
+ GRAPHQL
607
+ end
608
+
609
+ def game_import_job
610
+ <<~GRAPHQL
611
+ query GameImportJob($id: UUID!) {
612
+ gameImportJob(id: $id) {
613
+ #{game_import_job_fields}
614
+ }
615
+ }
616
+ GRAPHQL
617
+ end
618
+
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
+ )
625
+
626
+ <<~GRAPHQL
627
+ query GameImportJobs#{args[:definition]} {
628
+ gameImportJobs#{args[:call]} {
629
+ #{game_import_job_connection_fields}
630
+ }
631
+ }
632
+ GRAPHQL
633
+ end
634
+
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
644
+
645
+ def file
646
+ <<~GRAPHQL
647
+ query File($id: UUID!) {
648
+ file(id: $id) {
649
+ #{file_fields}
650
+ }
651
+ }
652
+ GRAPHQL
653
+ end
654
+
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
+ )
210
706
 
211
- # Builds a fetchRecordByIdentifier query
212
- def fetch_record_by_identifier(include_pricing: false)
213
707
  <<~GRAPHQL
214
- query FetchRecordByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifier: String!) {
215
- fetchRecordByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifier: $identifier) {
216
- #{record_fields(include_pricing: include_pricing)}
708
+ query ExportJobs#{args[:definition]} {
709
+ exportJobs#{args[:call]} {
710
+ #{export_job_connection_fields}
217
711
  }
218
712
  }
219
713
  GRAPHQL
220
714
  end
221
715
 
222
- # Builds a fetchRecordsByIdentifier query
223
- def fetch_records_by_identifier(include_pricing: false)
716
+ def dataset_export
224
717
  <<~GRAPHQL
225
- query FetchRecordsByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifiers: [String!]!) {
226
- fetchRecordsByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifiers: $identifiers) {
227
- #{record_fields(include_pricing: include_pricing)}
718
+ mutation DatasetExport($input: DatasetExportInput!) {
719
+ datasetExport(input: $input) {
720
+ #{export_job_fields}
228
721
  }
229
722
  }
230
723
  GRAPHQL
231
724
  end
232
725
 
233
- # Builds a fetchRecord query
234
- def fetch_record(include_pricing: false)
726
+ def export_job_cancel
235
727
  <<~GRAPHQL
236
- query FetchRecord($id: UUID!) {
237
- fetchRecord(id: $id) {
238
- #{record_fields(include_pricing: include_pricing)}
728
+ mutation ExportJobCancel($id: UUID!) {
729
+ exportJobCancel(id: $id) {
730
+ #{export_job_fields}
239
731
  }
240
732
  }
241
733
  GRAPHQL
242
734
  end
243
735
 
244
- # Builds a fetchRecords query
245
- def fetch_records(include_pricing: false)
736
+ def export_job_refresh_url
246
737
  <<~GRAPHQL
247
- query FetchRecords($ids: [UUID!]!) {
248
- fetchRecords(ids: $ids) {
249
- #{record_fields(include_pricing: include_pricing)}
738
+ mutation ExportJobRefreshUrl($id: UUID!) {
739
+ exportJobRefreshUrl(id: $id) {
740
+ #{export_job_fields}
250
741
  }
251
742
  }
252
743
  GRAPHQL
@@ -569,10 +1060,9 @@ module CardDB
569
1060
  GRAPHQL
570
1061
  end
571
1062
 
572
- def deck_import_formats(game_id:, include_archived: nil, first: nil, after: nil)
1063
+ def deck_import_formats(publisher_id: nil, game_id: nil, include_archived: nil, first: nil, after: nil)
573
1064
  args = build_args(
574
- { gameId: game_id, includeArchived: include_archived, first: first, after: after },
575
- required: [:gameId]
1065
+ { publisherId: publisher_id, gameId: game_id, includeArchived: include_archived, first: first, after: after }
576
1066
  )
577
1067
 
578
1068
  <<~GRAPHQL
@@ -586,8 +1076,8 @@ module CardDB
586
1076
 
587
1077
  def deck_import_format
588
1078
  <<~GRAPHQL
589
- query DeckImportFormat($id: UUID!) {
590
- deckImportFormat(id: $id) {
1079
+ query DeckImportFormat($id: UUID, $gameId: UUID, $key: String) {
1080
+ deckImportFormat(id: $id, gameId: $gameId, key: $key) {
591
1081
  #{deck_import_format_definition_fields}
592
1082
  }
593
1083
  }
@@ -990,6 +1480,7 @@ module CardDB
990
1480
 
991
1481
  private
992
1482
 
1483
+ # rubocop:disable Metrics/MethodLength
993
1484
  def build_args(params, required: [], type_overrides: {})
994
1485
  # Filter out nil values
995
1486
  params = params.compact
@@ -999,14 +1490,21 @@ module CardDB
999
1490
  # Map Ruby types to GraphQL types (base types, without !)
1000
1491
  type_map = {
1001
1492
  publisherSlug: 'String',
1493
+ publisherId: 'UUID',
1002
1494
  gameKey: 'String',
1495
+ gameSlug: 'String',
1003
1496
  datasetKey: 'String',
1497
+ datasetId: 'UUID',
1498
+ recordId: 'UUID',
1499
+ identifier: 'String',
1004
1500
  search: 'String',
1005
1501
  orderBy: 'String',
1006
1502
  filter: 'JSON',
1007
1503
  resolveLinks: '[String!]',
1008
1504
  first: 'Int',
1009
1505
  after: 'String',
1506
+ last: 'Int',
1507
+ before: 'String',
1010
1508
  includeArchived: 'Boolean',
1011
1509
  externalRef: 'String',
1012
1510
  deckId: 'UUID!',
@@ -1015,6 +1513,9 @@ module CardDB
1015
1513
  rulesetVersionId: 'UUID',
1016
1514
  validateSchema: 'Boolean',
1017
1515
  purpose: 'DatasetPurpose',
1516
+ status: 'String',
1517
+ level: 'String',
1518
+ key: 'String',
1018
1519
  id: 'UUID!',
1019
1520
  ids: '[UUID!]!'
1020
1521
  }
@@ -1032,6 +1533,34 @@ module CardDB
1032
1533
  call: "(#{calls.join(', ')})"
1033
1534
  }
1034
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
1035
1564
 
1036
1565
  def publisher_fields
1037
1566
  <<~FIELDS
@@ -1079,8 +1608,11 @@ module CardDB
1079
1608
  key
1080
1609
  name
1081
1610
  description
1611
+ metafyGameUuid
1612
+ metafyGameSlug
1082
1613
  website
1083
1614
  visibility
1615
+ archivedAt
1084
1616
  isArchived
1085
1617
  createdAt
1086
1618
  updatedAt
@@ -1127,8 +1659,13 @@ module CardDB
1127
1659
  name
1128
1660
  description
1129
1661
  purpose
1662
+ activeVersionId
1130
1663
  tcgplayerProductIdFieldKey
1131
1664
  visibility
1665
+ posX
1666
+ posY
1667
+ sortOrder
1668
+ archivedAt
1132
1669
  isArchived
1133
1670
  createdAt
1134
1671
  updatedAt
@@ -1159,11 +1696,16 @@ module CardDB
1159
1696
  targetDatasetKey
1160
1697
  targetDatasetName
1161
1698
  targetDatasetId
1699
+ targetFieldKey
1700
+ linkAlias
1701
+ linkDirection
1702
+ isArray
1162
1703
  }
1163
1704
  }
1164
1705
  FIELDS
1165
1706
  end
1166
1707
 
1708
+ # rubocop:disable Metrics/MethodLength
1167
1709
  def field_info_fields(depth:)
1168
1710
  nested_fields = if depth.positive?
1169
1711
  <<~FIELDS
@@ -1182,15 +1724,36 @@ module CardDB
1182
1724
  filterable
1183
1725
  searchable
1184
1726
  isIdentifier
1727
+ sortOrder
1185
1728
  itemType
1729
+ linkDatasetId
1730
+ linkDatasetKey
1731
+ linkDatasetName
1732
+ linkFieldKey
1733
+ linkAlias
1734
+ linkDirection
1186
1735
  displayFormat
1187
1736
  semanticType
1737
+ placeholder
1738
+ isHidden
1739
+ isComputed
1740
+ isSystemField
1741
+ defaultValue
1188
1742
  allowedValues
1743
+ minLength
1744
+ maxLength
1745
+ minValue
1746
+ maxValue
1747
+ pattern
1748
+ isUnique
1189
1749
  #{nested_fields}
1190
1750
  FIELDS
1191
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
1192
1756
 
1193
- def dataset_connection_fields
1194
1757
  <<~FIELDS
1195
1758
  totalCount
1196
1759
  pageInfo {
@@ -1202,7 +1765,7 @@ module CardDB
1202
1765
  edges {
1203
1766
  cursor
1204
1767
  node {
1205
- #{dataset_fields}
1768
+ #{node_fields}
1206
1769
  }
1207
1770
  }
1208
1771
  FIELDS
@@ -1245,22 +1808,7 @@ module CardDB
1245
1808
  end
1246
1809
 
1247
1810
  def record_connection_fields(include_resolved_links: false, include_pricing: false)
1248
- resolved_links_field = if include_resolved_links
1249
- <<~FIELDS
1250
- resolvedLinks {
1251
- field
1252
- linkFieldKey
1253
- values
1254
- records {
1255
- id
1256
- datasetId
1257
- data
1258
- }
1259
- }
1260
- FIELDS
1261
- else
1262
- ''
1263
- end
1811
+ resolved_links_field = include_resolved_links ? resolved_links_fields : ''
1264
1812
 
1265
1813
  <<~FIELDS
1266
1814
  totalCount
@@ -1280,6 +1828,444 @@ module CardDB
1280
1828
  FIELDS
1281
1829
  end
1282
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
2250
+
2251
+ def connection_fields(node_fields)
2252
+ <<~FIELDS
2253
+ totalCount
2254
+ pageInfo {
2255
+ hasNextPage
2256
+ hasPreviousPage
2257
+ startCursor
2258
+ endCursor
2259
+ }
2260
+ edges {
2261
+ cursor
2262
+ node {
2263
+ #{node_fields}
2264
+ }
2265
+ }
2266
+ FIELDS
2267
+ end
2268
+
1283
2269
  def deck_section_definition_fields
1284
2270
  <<~FIELDS
1285
2271
  key