From 90f1da1bbe07b54f6706e2c524d0053cc2e86943 Mon Sep 17 00:00:00 2001 From: Ruben Rangel Date: Tue, 8 Aug 2023 19:28:43 -0700 Subject: [PATCH] feat: add `IScryfallMigration` interface --- README.md | 1 + src/IScryfallMigration.ts | 65 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 src/IScryfallMigration.ts diff --git a/README.md b/README.md index 1562f3c..8cd0a8a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ TypeScript types and interfaces for the [Scryfall API](https://scryfall.com/docs - [IScryfallBulkData](./src/IScryfallBulkData.ts) - [IScryfallCardFace](./src/IScryfallCardFace.ts) - [IScryfallError](./src/IScryfallError.ts) + - [IScryfallMigration](./src/IScryfallMigration.ts) - [IScryfallRelatedCard](./src/IScryfallRelatedCard.ts) - [IScryfallRuling](./src/IScryfallRuling.ts) - [IScryfallSet](./src/IScryfallSet.ts) diff --git a/src/IScryfallMigration.ts b/src/IScryfallMigration.ts new file mode 100644 index 0000000..8ff3a89 --- /dev/null +++ b/src/IScryfallMigration.ts @@ -0,0 +1,65 @@ +import { IScryfallObject } from "./IScryfallObject"; + +/** + * For the vast majority of Scryfall’s database, Magic card entries are + * additive. We add new and upcoming cards as we learn about them and obtain + * images. + * + * In rare instances, Scryfall may discover that a card in our database does not + * really exist, or it has been deleted from a digital game permanently. In + * these situations, we provide endpoints to help you reconcile downstream data + * you may have synced or imported from Scryfall. + */ +export interface IScryfallMigration extends IScryfallObject { + object: "migration"; + + /** + * A link to the current object on Scryfall’s API. + */ + uri: string; + + /** + * This migration’s unique UUID. + */ + id: string; + + /** + * The date this migration was performed. + */ + created_at: string; + + /** + * A computer-readable indicator of the migration strategy. + * + * `merge` - You should update your records to replace the given old Scryfall ID + * with the new ID. The old ID is being discarded, and an existing record + * should be used to replace all instances of it. + * + * `delete` - The given UUID is being discarded, and no replacement data is + * being provided. This likely means the old records are fully invalid. This + * migration exists to provide evidence that cards were removed from + * Scryfall’s database. + */ + migration_strategy: "merge" | "delete" | string; + + /** + * The `id` of the affected API Card object. + */ + old_scryfall_id: string; + + /** + * The replacement `id` of the API Card object if this is a `merge`. + */ + new_scryfall_id?: string | null; + + /** + * A note left by the Scryfall team about this migration. + */ + note?: string | null; + + /** + * Additional context Scryfall has provided for this migration, designed to be + * human-read only. + */ + metadata?: Record | null; +}