Skip to content

Commit

Permalink
feat: add IScryfallMigration interface
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenrangel committed Aug 9, 2023
1 parent a889e0d commit 90f1da1
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
65 changes: 65 additions & 0 deletions src/IScryfallMigration.ts
Original file line number Diff line number Diff line change
@@ -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<string, string> | null;
}

0 comments on commit 90f1da1

Please sign in to comment.