UNPKG

scryfall-sdk

Version:

A Node.js SDK for https://scryfall.com/docs/api written in Typescript.

46 lines (45 loc) 1.91 kB
/// <reference types="node" /> import { Stream } from "stream"; import MagicQuerier from "../util/MagicQuerier"; declare enum BulkDataTypes { oracle_cards = 0, unique_artwork = 1, default_cards = 2, all_cards = 3, rulings = 4 } export type BulkDataType = keyof typeof BulkDataTypes; export interface BulkDataDefinition { object: "bulk_data"; id: string; uri: string; type: BulkDataType; name: string; description: string; download_uri: string; updated_at: string; size: number; content_type: string; content_encoding: string; } declare class BulkData extends MagicQuerier { /** * Returns a stream for the given bulk data if it has been updated since the last download time. If it hasn't, returns `undefined` * @param lastDownload The last time this bulk data was downloaded. If you want to re-download the data regardless of * the last time it was downloaded, set this to `0`. */ downloadByType(type: BulkDataType, lastDownload: string | number | Date): Promise<ReadableStream<Uint8Array> | Stream | null | undefined>; /** * Returns a stream for the given bulk data if it has been updated since the last download time. If it hasn't, returns `undefined` * @param lastDownload The last time this bulk data was downloaded. If you want to re-download the data regardless of * the last time it was downloaded, set this to `0`. */ downloadById(id: string, lastDownload: string | number | Date): Promise<ReadableStream<Uint8Array> | Stream | null | undefined>; definitions(): Promise<BulkDataDefinition[]>; definitionByType(type: BulkDataType): Promise<BulkDataDefinition>; definitionById(id: string): Promise<BulkDataDefinition>; private download; private definition; } declare const _default: BulkData; export default _default;