PATCH()function

PATCH(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>
PATCH(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>
PATCH(path: AbsolutePath, payload: undefined, result: Schema<R>): Endpoint<undefined, R>
ParamType
pathAbsolutePath
The endpoint path, possibly including {placeholders} required
payloadSchema<P>
An optional Schema validating the request payload.
resultSchema<R>
An optional Schema validating the response result.
pathAbsolutePath
Absolute path string starting with a / slash. required
payloadSchema<P>
Schema is an object instance with a validate() method that converts unknown input into a known, valid type T. required
payloadundefined
required
resultSchema<R>
Schema is an object instance with a validate() method that converts unknown input into a known, valid type T. required
Return
Endpoint<P, R>
An Endpoint configured for the PATCH method.
Endpoint<P, undefined>
A typed API resource definition pairing a method and path with payload and result schemas.
Endpoint<undefined, R>
A typed API resource definition pairing a method and path with payload and result schemas.

Define a PATCH endpoint at a path, with validated payload and result types.

  • "The PATCH method applies partial modifications to a resource."

    Factory for Endpoint.

Examples

PATCH("/users/{id}", PARTIAL_USER)