PUT()function

PUT(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>
PUT(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>
PUT(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 PUT 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 PUT endpoint at a path, with validated payload and result types.

  • "The PUT method replaces all current representations of the target resource with the request content."

    Factory for Endpoint.

Examples

PUT("/users/{id}", USER)