invoke

inline suspend operator fun invoke(function: String, region: FunctionRegion = config.defaultRegion, crossinline builder: HttpRequestBuilder.() -> Unit): HttpResponse(source)

Invokes a remote edge function. The authorization token is automatically added to the request.

Parameters

function

The function to invoke

builder

The request builder to configure the request

region

The region where the function is invoked

Throws

or one of its subclasses if receiving an error response

HttpRequestTimeoutException

if the request timed out

HttpRequestException

on network related issues


inline suspend operator fun <T : Any> invoke(function: String, body: T, region: FunctionRegion = config.defaultRegion, headers: Headers = Headers.Empty): HttpResponse(source)

Invokes a remote edge function. The authorization token is automatically added to the request. Note, if you want to serialize body to json, you need to add the HttpHeaders.ContentType header yourself.

Parameters

function

The function to invoke

body

The body of the request

headers

Headers to add to the request

region

The region where the function is invoked

Throws

or one of its subclasses if receiving an error response

HttpRequestTimeoutException

if the request timed out

HttpRequestException

on network related issues


inline suspend operator fun invoke(function: String, region: FunctionRegion = config.defaultRegion, headers: Headers = Headers.Empty): HttpResponse(source)

Invokes a remote edge function. The authorization token is automatically added to the request.

Parameters

function

The function to invoke

headers

Headers to add to the request

region

The region where the function is invoked

Throws

or one of its subclasses if receiving an error response

HttpRequestTimeoutException

if the request timed out

HttpRequestException

on network related issues