The union of the possible ApiRequest types
A basic set of responses where the 200 status corresponds to a payload of type R and 404 and 500 to an Error
Changes the response with status S to have type B
Removes a status from the union of IResponseType(s)
Replaces the parameters of the request T with the type P
Describes the possible header keys of a request
Generates a set of headers with certain keys (KH) from a parameters object of type P.
Describes a set of headers whose keys are of type RequestHeaderKey
Describes the possible methods of a request
The parameters of the request T
Describes the query params for this request
A function that generates a typed representation of a response. It should return undefined in case the response cannot be decoded (e.g. in case of a parsing error).
A union type of the Response statuses of an ApiRequestType
The type of the method that runs an ApiRequestType
The type of the Params of an ApiRequestType
The type of the Response of an ApiRequestType
An header producer that sets the Content-Type to application/json
Returns a RequestHeaderProducer that produces an Authorization header of type "bearer token" with a fixed token value.
Returns a RequestHeaderProducer that produces an Authorization header of type "bearer token" taking the value from the "token" parameter of each request.
A basic ResponseDecoder that returns an Error with the status text if the response status is S.
Returns a ResponseDecoder for BasicResponseType
Composes two RequestHeaderProducer(s)
Composes two ResponseDecoder(s)
A response decoder that ignores the payload and returns a constant value
Returns an async method that implements the provided ApiRequestType backed by the "fetch" API.
An io-ts based ResponseDecoder, it checks the response status and the payload against the provided type.
The response status handled by this decoder
The response type corresponding to the status
A function that takes the object corresponding to the json response as input and returns the processed object (usefull when you want alterate the json body received)
Generated using TypeDoc
Adds the status S with response type A to the responses of the request