call

suspend fun ApiFetcher.call(httpMethod: HttpMethod, path: String, body: RequestBody? = null, headers: Headers = Headers()): Response


inline suspend fun <Req, Res, ReqH, ResH, PathP, QueryP, CookieP> ApiContract<Req, Res, ReqH, ResH, PathP, QueryP, CookieP>.call(request: Req = Unit as Req, headers: ReqH = Empty as ReqH, pathParams: PathP = Empty as PathP, queryParams: QueryP = Empty as QueryP, cookies: CookieP = Empty as CookieP, crossinline headerBlock: Headers.Builder.() -> Unit = {}): Either<Issue, ApiResponse<Res, ResH>>

Extension to make calling contracts more ergonomic.

Usage example:

MyContract.call(myRequest, myHeaders, myPath, myQuery, myCookies) { set("Authorization", "...") }

Parameters

request

The request body.

headers

The request headers.

pathParams

The path parameters.

queryParams

The query parameters.

cookies

The request cookies.

headerBlock

A block to add custom headers to the request.