scruffy/client/migrations
Functions for calling Scryfall’s Card Migrations 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 both of them already wired up, if you’d rather not
pass one at every call site.
See https://scryfall.com/docs/api/migrations for the upstream reference.
Types
Both functions above, already wired up to a Requester – see new.
pub type Client(e) {
Client(
list_migrations: fn(option.Option(Int)) -> Result(
scryfall_list.ScryfallList(migrations.CardMigration),
client.ClientError(e),
),
get_migration: fn(String) -> Result(
migrations.CardMigration,
client.ClientError(e),
),
)
}
Constructors
-
Client( list_migrations: fn(option.Option(Int)) -> Result( scryfall_list.ScryfallList(migrations.CardMigration), client.ClientError(e), ), get_migration: fn(String) -> Result( migrations.CardMigration, client.ClientError(e), ), )
Values
pub fn get_migration(
requester: fn(request.Request(String)) -> Result(
response.Response(String),
e,
),
id: String,
) -> Result(migrations.CardMigration, client.ClientError(e))
Get a single card migration by its Scryfall migration ID.
pub fn list_migrations(
requester: fn(request.Request(String)) -> Result(
response.Response(String),
e,
),
page: option.Option(Int),
) -> Result(
scryfall_list.ScryfallList(migrations.CardMigration),
client.ClientError(e),
)
List Scryfall’s card migrations, paginated and ordered with the most recently performed migration first.
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 migrations = migrations.new(httpc.send)
then migrations.list_migrations(option.None).