patch

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

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

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

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

Parameters

body

The body to send with the request. Make sure your class is marked with @Serializable or provide a custom bodySerializer.


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

A serialize-friendly version of patch that doesn't put any type constraints on the body.

This is useful if your request doesn't require a body to be included, so there shouldn't be a need to specify a body type constraint in that case, or if it is easier to use a custom, handcrafted byte array message instead.