SearchQueryBuilder

A DSL builder for constructing Scryfall search queries in a type-safe way.

This builder provides a more intuitive and IDE-friendly way to construct search queries compared to manually building query strings with Scryfall syntax.

Example usage:

val query = searchQuery {
type("creature")
color("red")
powerRange(min = 4)
cmcRange(max = 5)
isLegal("standard")
}

See also

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun artist(name: String)

Searches for cards by artist name.

Link copied to clipboard
fun build(): String

Builds the final query string by joining all parts with spaces.

Link copied to clipboard
fun cmc(value: Int)

Filters by exact converted mana cost/mana value.

Link copied to clipboard
fun cmcRange(min: Int? = null, max: Int? = null)

Filters by converted mana cost/mana value range.

Link copied to clipboard
fun color(vararg colors: String)

Filters by exact color identity.

Link copied to clipboard
fun format(format: String)

Filters by format (Standard, Modern, Legacy, Vintage, Commander, etc.). This finds cards printed in a format, regardless of legality.

Link copied to clipboard
fun isLegal(format: String)

Filters by cards that are legal in a specific format.

Link copied to clipboard
fun keyword(keyword: String)

Filters by keyword ability.

Link copied to clipboard
fun name(value: String)

Adds an exact name match to the query. This will match only cards with exactly the specified name.

Link copied to clipboard
fun nameContains(value: String)

Adds a partial name match to the query. This will match cards whose names contain the specified text.

Link copied to clipboard
fun power(value: Int)

Filters by exact power.

Link copied to clipboard
fun powerRange(min: Int? = null, max: Int? = null)

Filters by power range.

Link copied to clipboard
fun rarity(value: String)

Filters by rarity.

Link copied to clipboard
fun raw(queryPart: String)

Adds a raw query string part. Use this for advanced queries that aren't covered by the DSL methods.

Link copied to clipboard
fun set(code: String)

Filters by set code.

Link copied to clipboard
fun text(value: String)

Searches for text in the oracle text.

Link copied to clipboard
fun toughness(value: Int)

Filters by exact toughness.

Link copied to clipboard
fun toughnessRange(min: Int? = null, max: Int? = null)

Filters by toughness range.

Link copied to clipboard
fun type(value: String)

Filters by card type.