-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
2,478 additions
and
459 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
import { CoverImage } from "../local/db"; | ||
import { parseISO } from 'date-fns' | ||
|
||
export interface CubeArtisanCardIds { | ||
export interface CubeArtisanImportData { | ||
oracleIds: string[] | ||
printIds: string[] | ||
name: string, | ||
description: string, | ||
cover_image: CoverImage | ||
created_by: string | ||
last_source_update: Date | ||
} | ||
export async function importCubeArtisan(cubeId: string): Promise<CubeArtisanCardIds> { | ||
export async function importCubeArtisan(cubeId: string): Promise<CubeArtisanImportData> { | ||
const response = await fetch(`https://cubeartisan.net/cube/${cubeId}/export/json`) | ||
const cube = await response.json(); | ||
const printIds = cube.cards.map(it => it.cardID) | ||
return { printIds, oracleIds: cube.cardOracles } | ||
return { printIds, oracleIds: cube.cardOracles, name: cube.name, description: cube.description, | ||
cover_image: { | ||
uri: cube.image_uri, | ||
artist: cube.image_artist, | ||
}, | ||
created_by: cube.owner_name, | ||
last_source_update: parseISO(cube.last_updated), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.