Skip to content
Effect Days 2026 Get your ticket

HttpApiClient

6 exports Added in v1.0.0 Source

Constructors

endpoint

Added in v1.0.0 Source

Signature

declare function endpoint<ApiId extends string, Groups extends Any, ApiError, ApiR, GroupName extends string, EndpointName extends string, E, R>(api: HttpApi<ApiId, Groups, ApiError, ApiR>, options: {
readonly baseUrl?: string | URL;
readonly endpoint: EndpointName;
readonly group: GroupName;
readonly httpClient: With<E, R>;
readonly transformClient?: (client: HttpClient) => HttpClient;
readonly transformResponse?: (effect: Effect<unknown, unknown>) => Effect<unknown, unknown>;
}): Effect<Method<Extract<Endpoints<Extract<Groups, {
readonly identifier: GroupName;
}>>, {
readonly name: EndpointName;
}>, Error<Extract<Groups, {
readonly identifier: GroupName;
}>>, ApiError | E, R>, never, Exclude<ApiR, AnyId> | Exclude<Context<Extract<Groups, {
readonly identifier: GroupName;
}>>, AnyId> | Exclude<Context<Extract<Endpoints<Extract<Groups, {
readonly identifier: GroupName;
}>>, {
readonly name: EndpointName;
}>>, AnyId> | Exclude<ErrorContext<Extract<Endpoints<Extract<Groups, {
readonly identifier: GroupName;
}>>, {
readonly name: EndpointName;
}>>, AnyId>>

group

Added in v1.0.0 Source

Signature

declare function group<ApiId extends string, Groups extends Any, ApiError, ApiR, GroupName extends string, E, R>(api: HttpApi<ApiId, Groups, ApiError, ApiR>, options: {
readonly baseUrl?: string | URL;
readonly group: GroupName;
readonly httpClient: With<E, R>;
readonly transformResponse?: (effect: Effect<unknown, unknown>) => Effect<unknown, unknown>;
}): Effect<Group<Groups, GroupName, ApiError | E, R>, never, Exclude<ApiR, AnyId> | Exclude<ClientContext<Extract<Groups, {
readonly identifier: GroupName;
}>>, AnyId>>

make

Added in v1.0.0 Source

Signature

declare function make<ApiId extends string, Groups extends Any, ApiError, ApiR>(api: HttpApi<ApiId, Groups, ApiError, ApiR>, options?: {
readonly baseUrl?: string | URL;
readonly transformClient?: (client: HttpClient) => HttpClient;
readonly transformResponse?: (effect: Effect<unknown, unknown>) => Effect<unknown, unknown>;
}): Effect<Simplify<Simplify<{ [Group in {
readonly topLevel: false;
} & Any]: Group<Group, Group["identifier"], ApiError, never> } & { [Method in [never, never]]: Method[1] }>>, never, HttpClient | Exclude<ApiR, AnyId> | Exclude<ClientContext<Groups>, AnyId>>

makeWith

Added in v1.0.0 Source

Signature

declare function makeWith<ApiId extends string, Groups extends Any, ApiError, ApiR, E, R>(api: HttpApi<ApiId, Groups, ApiError, ApiR>, options: {
readonly baseUrl?: string | URL;
readonly httpClient: With<E, R>;
readonly transformResponse?: (effect: Effect<unknown, unknown>) => Effect<unknown, unknown>;
}): Effect<Simplify<Simplify<{ [Group in {
readonly topLevel: false;
} & Any]: Group<Group, Group["identifier"], ApiError | E, R> } & { [Method in [never, never]]: Method[1] }>>, never, Exclude<ApiR, AnyId> | Exclude<ClientContext<Groups>, AnyId>>

Models

Client

Added in v1.0.0 Source

Client type

Added in v1.0.0 Source

Signature

type Client<Groups extends HttpApiGroup.Any, E, R> = Simplify<{ [Group in Extract<Groups, {
readonly topLevel: false;
}>]: Client.Group<Group, Group["identifier"], E, R> } & { [Method in Client.TopLevelMethods<Groups, E, R>]: Method[1] }>