ApiService

com.alecdorrington.iris.api.ApiService
trait ApiService[F[_]]

A provider's API, the lowest layer of Iris: one exchange of the provider's own JSON, with its credentials, endpoints, timeouts and refusals handled. Its one method, stream, is what an implementation or a middleware writes, which send gathers.

Type parameters

F

The effect type.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def stream(request: ApiRequest): Stream[F, Json]

Sends a request, giving its response's JSON: the body whole, or each event of a streamed one as it arrives. A refusal or failure of the provider's fails the stream with an ApiError.

Sends a request, giving its response's JSON: the body whole, or each event of a streamed one as it arrives. A refusal or failure of the provider's fails the stream with an ApiError.

Value parameters

request

The request.

Attributes

Returns

A stream of the response's JSON.

Concrete methods

final def retrying(config: ApiConfig)(using Async[F]): ApiService[F]

This service, sending a request again where the provider refused or failed it for now (ApiError.RateLimited, ApiError.Overloaded, ApiError.Transient), as the configuration says, while nothing of its response has arrived. A transport failure or ApiError.TimedOut is not sent again, as a request given up on may have been answered, and charged for.

This service, sending a request again where the provider refused or failed it for now (ApiError.RateLimited, ApiError.Overloaded, ApiError.Transient), as the configuration says, while nothing of its response has arrived. A transport failure or ApiError.TimedOut is not sent again, as a request given up on may have been answered, and charged for.

Value parameters

config

The configuration, whose maxRetries, backoff and patience say how often and how long to try.

Attributes

Returns

A service trying each request until it is answered or may not be tried again.

final def send(request: ApiRequest)(using Compiler[F, F], MonadThrow[F]): F[Json]

Sends a request for one body, giving it whole.

Sends a request for one body, giving it whole.

Value parameters

request

The request, sent unstreamed.

Attributes

Returns

An effect producing the response's body.