BlobEndpointImpl

open class BlobEndpointImpl(referrer: Endpoint, relativeUri: URI) : AbstractEndpoint, BlobEndpoint

Endpoint for a binary blob that can be downloaded or uploaded.

Parameters

referrer

The endpoint used to navigate to this one.

relativeUri

The URI of this endpoint relative to the referrer's. Add a ./ prefix here to imply a trailing slash on referrer's URI.

Constructors

Link copied to clipboard
constructor(referrer: Endpoint, relativeUri: URI)
constructor(referrer: Endpoint, relativeUri: String)

Creates a new blob endpoint.

Properties

Link copied to clipboard
open override val errorHandler: ErrorHandler
Link copied to clipboard
open override val httpClient: OkHttpClient
Link copied to clipboard
open override val isDeleteAllowed: Boolean?

Indicates whether the server has specified that deleting is currently allowed.

Link copied to clipboard
open override val isDownloadAllowed: Boolean?

Indicates whether the server has specified that downloading is currently allowed.

Link copied to clipboard
open override val isUploadAllowed: Boolean?

Indicates whether the server has specified that uploading is currently allowed.

Link copied to clipboard
open override val linkExtractor: LinkExtractor
Link copied to clipboard
open override val serializers: List<Serializer>
Link copied to clipboard
open override val uri: URI

Functions

Link copied to clipboard
open override fun delete()

Deletes the blob from the server.

Link copied to clipboard
fun <T> deserialize(body: ResponseBody, type: Class<T>): T?

Deserializes an entity using the first serializer that supports the body's content type.

Link copied to clipboard
fun <T> deserializeList(body: ResponseBody, type: Class<T>): List<T>?

Deserializes a list of entities using the first serializer that supports the body's content type.

Link copied to clipboard
open fun download(path: String): Long

Downloads the blob's content to a file.

open override fun download(): InputStream

Downloads the blob's content to an input stream.

Link copied to clipboard
open override fun getLinks(rel: String): List<Pair<URI, String?>>

Resolves all links with a specific relation type. Uses cached data from last response.

Link copied to clipboard
fun getLinkTemplate(rel: String): UriTemplate

Retrieves a link template with a specific relation type.

Link copied to clipboard
open override fun link(rel: String): URI

Resolves a single link with a specific relation type. Uses cached data from last response if possible.

Link copied to clipboard
open override fun linkTemplate(rel: String, variables: Map<String, Any>): URI

Resolves a link template with a specific relation type. Uses cached data from last response if possible.

Link copied to clipboard
open override fun probe()

Queries the server about capabilities of the endpoint without performing any action.

Link copied to clipboard
fun <T> serialize(entity: T, type: Class<T>): RequestBody

Serializes an entity using the first serializer.

Link copied to clipboard
fun <T> serializeList(entities: Iterable<T>, type: Class<T>): RequestBody

Serializes a list of entities using the first serializer.

Link copied to clipboard
fun setDefaultLink(rel: String, href: String?)

Registers one or more default links for a specific relation type.

Link copied to clipboard

Registers a default link template for a specific relation type.

Link copied to clipboard
open fun uploadFrom(path: String, mimeType: String? = null)

Uploads content as the blob's content from a file.

open override fun uploadFrom(stream: InputStream, mimeType: String?)

Uploads data as the blob's content from an input stream.