Managoat.Sandbox.Sprites.Client (managoat_sandbox v0.1.0)

Copy Markdown View Source

SDK client construction and account listing for the Sprites adapter.

Reads SPRITES_TOKEN / SPRITES_BASE_URL / SPRITES_TIMEOUT_MS from application env (set in config/runtime.exs). Nothing outside Managoat.Sandbox.Sprites.* should build a Sprites client.

Summary

Functions

Returns a Sprites client, or raises if SPRITES_TOKEN is not set.

Every sprite name on the account, as a MapSet.

Functions

get!()

Returns a Sprites client, or raises if SPRITES_TOKEN is not set.

list_all_names()

@spec list_all_names() :: {:ok, MapSet.t(String.t())} | {:error, term()}

Every sprite name on the account, as a MapSet.

Sprites.list/2 cannot be used for this. It pattern-matches the "sprites" key out of the response and discards has_more and next_continuation_token, so it returns the first page and gives no indication there is more — against production that was 50 names out of 114. Anything comparing that list to the database would silently treat two thirds of the account as non-existent.

Returns {:error, :truncated} rather than a short list if the account somehow exceeds 40 pages, because a caller deciding what to delete must never be handed a partial view that looks whole.

Errors are raw SDK shapes here; Managoat.Sandbox.Sprites.list_all_names/0 normalizes them into the taxonomy.