patch

inline suspend fun <B> ApiFetcher.patch(apiPath: String, body: B, headers: Map<String, Any>? = FetchDefaults.Headers, redirect: RequestRedirect? = FetchDefaults.Redirect, abortController: AbortController? = null, bodySerializer: SerializationStrategy<B> = serializer()): Response(source)

A version of patch that accepts a serializable body.

Use bodyAs on the returned Response if you want to deserialize returned bytes, e.g. patch<RequestClass>(/*...*/).bodyAs<ReplyClass>().

Note: you should NOT prepend your path with "api/", as that will be added automatically.


inline suspend fun <B, R> ApiFetcher.patch(apiPath: String, body: B, headers: Map<String, Any>? = FetchDefaults.Headers, redirect: RequestRedirect? = FetchDefaults.Redirect, abortController: AbortController? = null, bodySerializer: SerializationStrategy<B> = serializer(), responseDeserializer: DeserializationStrategy<R> = serializer()): R(source)

Deprecated

With these serialization-aware network methods, we are moving response deserialization handling to a separate `bodyAs` call. This lets us accomplish the same amount of functionality with fewer methods.

Replace with

import com.varabyte.kobweb.browser.patch
import com.varabyte.kobweb.browser.http.FetchDefaults
import com.varabyte.kobweb.browser.http.bodyAs
import kotlinx.serialization.serializer
patch(apiPath, body, headers, redirect, abortController, bodySerializer).bodyAs(responseDeserializer)

Call PATCH on a target API path with R as the expected return type.

You can set R to Unit if this request doesn't expect a response body.

See also tryPatch, which will return null if the request fails.

Note: you should NOT prepend your path with "api/", as that will be added automatically.


inline suspend fun <R> ApiFetcher.patch(apiPath: String, headers: Map<String, Any>? = FetchDefaults.Headers, redirect: RequestRedirect? = FetchDefaults.Redirect, abortController: AbortController? = null, responseDeserializer: DeserializationStrategy<R> = serializer()): R(source)

Deprecated

With these serialization-aware network methods, we are moving response deserialization handling to a separate `bodyAs` call. This lets us accomplish the same amount of functionality with fewer methods.

Replace with

import com.varabyte.kobweb.browser.patch
import com.varabyte.kobweb.browser.http.FetchDefaults
import com.varabyte.kobweb.browser.http.bodyAs
import kotlinx.serialization.serializer
patch(apiPath, body = null, headers, redirect, abortController).bodyAs(responseDeserializer)

A serialize-friendly version of patch that has no body but provides a serialized response.

Note: you should NOT prepend your path with "api/", as that will be added automatically.