HttpApiClient overview
Added in v1.0.0
Table of contents
constructors
make
Signature
export declare const make: <Groups extends HttpApiGroup.Any, ApiError, ApiR>(
api: HttpApi.HttpApi<Groups, ApiError, ApiR>,
options?: {
readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined
readonly transformResponse?:
| ((effect: Effect.Effect<unknown, unknown, Scope>) => Effect.Effect<unknown, unknown, Scope>)
| undefined
readonly baseUrl?: string | undefined
}
) => Effect.Effect<
Simplify<Client<Groups, ApiError>>,
never,
HttpApiMiddleware.HttpApiMiddleware.Without<ApiR | HttpApiGroup.ClientContext<Groups>> | HttpClient.HttpClient
>
Added in v1.0.0
models
Client (type alias)
Signature
export type Client<Groups extends HttpApiGroup.Any, ApiError> = Simplify<
{
readonly [Group in Extract<Groups, { readonly topLevel: false }> as HttpApiGroup.Name<Group>]: [Group] extends [
HttpApiGroup<infer _GroupName, infer _Endpoints, infer _GroupError, infer _GroupErrorR>
]
? {
readonly [Endpoint in _Endpoints as HttpApiEndpoint.Name<Endpoint>]: Client.Method<
Endpoint,
ApiError,
_GroupError
>
}
: never
} & {
readonly [Method in Client.TopLevelMethods<Groups, ApiError> as Method[0]]: Method[1]
}
>
Added in v1.0.0
Client (namespace)
Added in v1.0.0
Method (type alias)
Signature
export type Method<Endpoint, ApiError, GroupError> = [Endpoint] extends [
HttpApiEndpoint<
infer _Name,
infer _Method,
infer _Path,
infer _UrlParams,
infer _Payload,
infer _Headers,
infer _Success,
infer _Error,
infer _R,
infer _RE
>
]
? <WithResponse extends boolean = false>(
request: Simplify<HttpApiEndpoint.ClientRequest<_Path, _UrlParams, _Payload, _Headers, WithResponse>>
) => Effect.Effect<
WithResponse extends true ? [_Success, HttpClientResponse.HttpClientResponse] : _Success,
_Error | GroupError | ApiError | HttpClientError.HttpClientError
>
: never
Added in v1.0.0
TopLevelMethods (type alias)
Signature
export type TopLevelMethods<Groups extends HttpApiGroup.Any, ApiError> =
Extract<Groups, { readonly topLevel: true }> extends HttpApiGroup<
infer _Id,
infer _Endpoints,
infer _Error,
infer _ErrorR,
infer _TopLevel
>
? _Endpoints extends infer Endpoint
? [HttpApiEndpoint.Name<Endpoint>, Client.Method<Endpoint, ApiError, _Error>]
: never
: never
Added in v1.0.0