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", "...") }Content copied to clipboard
Parameters
request
The request body.
headers
The request headers.
path Params
The path parameters.
query Params
The query parameters.
cookies
The request cookies.
header Block
A block to add custom headers to the request.