Resource

@Serializable(with = ResourceSerializer::class)
abstract class Resource(source)

A JSON:API resource.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
interface CompanionObj<R : Resource>

A companion object for the resource.

Properties

Link copied to clipboard

The attributes of the resource.

Link copied to clipboard

The companion object of the resource.

Link copied to clipboard
var id: String?

The ID of the resource.

Link copied to clipboard

Whether the resource is persisted.

Link copied to clipboard

The links of the resource.

Link copied to clipboard

The meta of the resource.

Link copied to clipboard

The relationships of the resource.

Link copied to clipboard

The type of the resource.

Functions

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

Deserialize the resource from a JSON:API response.

Link copied to clipboard

Deserialize the resource from a JSON:API response.

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

Serialize the resource to a JSON:API object.

Link copied to clipboard
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
fun toUrl(): String

Convert the resource to a URL.