HttpApiClient
Constructors
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
>
>;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
>
>;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>
>;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
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] }
>;