Scope

class Scope<R : Resource>(resourceClass: KClass<R>, options: Scope<R>.() -> Unit = {})(source)

A scope for querying the server.

Parameters

resourceClass

The resource to use the scope on.

options

The options for the scope.

Constructors

Link copied to clipboard
constructor(resourceClass: KClass<R>, options: Scope<R>.() -> Unit = {})

Types

Link copied to clipboard
annotation class ScopeMethod

Properties

Link copied to clipboard

The fields to select.

Link copied to clipboard

The filter options.

Link copied to clipboard

The relationships to include.

Link copied to clipboard

The pagination options.

Link copied to clipboard

The extra parameters.

Link copied to clipboard

The sort options.

Functions

Link copied to clipboard
suspend fun all(): CollectionProxy<R>

Get all the resources.

Link copied to clipboard
fun extraParam(key: String, value: String): Scope<R>

Add an extra parameter to the request

Link copied to clipboard
suspend fun find(id: String): RecordProxy<R>

Find a resource by its ID

Link copied to clipboard
suspend fun first(): RecordProxy<R>

Get the first resource

Link copied to clipboard
fun includes(vararg relationships: String): Scope<R>

Include the relationships in the response

Link copied to clipboard
fun limit(limit: Number): Scope<R>

Set the number of items to return (Only for offset-based pagination)

Link copied to clipboard
fun offset(offset: Number): Scope<R>

Set the number of items to skip (Only for offset-based pagination)

Link copied to clipboard
fun order(attribute: String, sortDirection: SortDirection = SortDirection.ASC): Scope<R>

Order the resources by an attribute

Link copied to clipboard
fun page(pageNumber: Number): Scope<R>

Set the page number to return (Only for page-based pagination)

Link copied to clipboard
fun per(pageSize: Number): Scope<R>

Set the number of items per page (Only for page-based pagination)

Link copied to clipboard
fun select(type: String, vararg fields: String): Scope<R>

Select the fields to return

Link copied to clipboard
fun where(attribute: String, value: Any): Scope<R>

Filter the resources by an attribute