scruffy/client/bulk_data

Functions for calling Scryfall’s Bulk Data endpoints.

Each function builds its request with scruffy/client/request and sends it with the client.Requester you provide, so what comes back is already the decoded object – or a client.ClientError describing what went wrong. Call new once with your Requester to get a Client back with all of them already wired up, if you’d rather not pass one at every call site.

See https://scryfall.com/docs/api/bulk-data for the upstream reference.

Types

Every function above, already wired up to a Requester – see new.

pub type Client(e) {
  Client(
    list_bulk_data: fn() -> Result(
      scryfall_list.ScryfallList(bulk_data.BulkData),
      client.ClientError(e),
    ),
    get_bulk_data_by_id: fn(String) -> Result(
      bulk_data.BulkData,
      client.ClientError(e),
    ),
    get_bulk_data_by_type: fn(bulk_data.BulkDataType) -> Result(
      bulk_data.BulkData,
      client.ClientError(e),
    ),
  )
}

Constructors

Values

pub fn get_bulk_data_by_id(
  requester: fn(request.Request(String)) -> Result(
    response.Response(String),
    e,
  ),
  id: String,
) -> Result(bulk_data.BulkData, client.ClientError(e))

Get a single Bulk Data file by its Scryfall ID.

pub fn get_bulk_data_by_type(
  requester: fn(request.Request(String)) -> Result(
    response.Response(String),
    e,
  ),
  bulk_data_type: bulk_data.BulkDataType,
) -> Result(bulk_data.BulkData, client.ClientError(e))

Get a single Bulk Data file by its type, such as OracleCards.

pub fn list_bulk_data(
  requester: fn(request.Request(String)) -> Result(
    response.Response(String),
    e,
  ),
) -> Result(
  scryfall_list.ScryfallList(bulk_data.BulkData),
  client.ClientError(e),
)

List all of the Bulk Data files Scryfall currently offers.

pub fn new(
  requester: fn(request.Request(String)) -> Result(
    response.Response(String),
    e,
  ),
) -> Client(e)

Build a Client bound to the given Requester, so you don’t have to pass one to every call: let bulk_data = bulk_data.new(httpc.send) then bulk_data.list_bulk_data().

Search Document