Resource

@Serializable(with = Resource.Serializer::class)
interface Resource(source)

A JSON:API resource.

Types

Link copied to clipboard
interface CompanionObj<R : Resource>

A companion object for the resource.

Properties

Link copied to clipboard
abstract val attributes: DirtyMap<String, Any?>

The attributes of the resource.

Link copied to clipboard

The companion object of the resource.

Link copied to clipboard
abstract var id: String?

The ID of the resource.

Link copied to clipboard
abstract var isPersisted: Boolean

Whether the resource is persisted.

Link copied to clipboard
abstract val links: MutableMap<String, Any?>

The links of the resource.

Link copied to clipboard
abstract val meta: MutableMap<String, Any?>

The meta of the resource.

Link copied to clipboard
abstract val relationships: DirtyMap<String, Any?>

The relationships of the resource.

Link copied to clipboard
abstract val type: String

The type of the resource.

Functions

Link copied to clipboard
open fun fromJsonApi(jsonApiData: JsonApiResource, included: List<JsonApiResource> = listOf())

Deserialize the resource from a JSON:API response.

Link copied to clipboard
open fun fromJsonApiResponse(jsonApiResponse: JsonApiSingleResponse)

Deserialize the resource from a JSON:API response.

Link copied to clipboard
open fun toJsonApi(onlyDirty: Boolean = false): Map<String, Any?>

Serialize the resource to a JSON:API object.

Link copied to clipboard
open fun toJsonApiString(from: Json = Json.Default, builder: JsonBuilder.() -> Unit = {}, onlyDirty: Boolean = false): String

Serialize the resource to a JSON:API string.

Link copied to clipboard
open fun toUrl(): String

Convert the resource to a URL.