ListUtils

object ListUtils

Utility functions for extracting data from ScryfallList.

Kotlin/JS mangles property names, so use these functions to access list data.

Usage:

const listUtils = ListUtils.getInstance();
const results = await api.search('lightning bolt', null);
const cards = listUtils.getData(results);
const total = listUtils.getTotalCards(results);

Functions

Link copied to clipboard
fun <T> getData(list: ScryfallList<T>): Array<T>

Gets the data array from a ScryfallList

Link copied to clipboard
fun <T> getNextPage(list: ScryfallList<T>): String?

Gets the URL for the next page of results, if available

Link copied to clipboard
fun <T> getObjectType(list: ScryfallList<T>): String

Gets the object type (usually "list")

Link copied to clipboard
fun <T> getTotalCards(list: ScryfallList<T>): Int

Gets the total number of cards matching the query

Link copied to clipboard
fun <T> hasMore(list: ScryfallList<T>): Boolean

Returns true if there are more pages of results