Skip to main content Link Search Menu Expand Document (external link)

HttpApiClient overview

Added in v1.0.0


Table of contents


constructors

make

Signature

export declare const make: <A extends HttpApi.HttpApi.Any>(
  api: A,
  options?: {
    readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined
    readonly baseUrl?: string | undefined
  }
) => Effect.Effect<Simplify<Client<A>>, never, HttpApi.HttpApi.Context<A> | HttpClient.HttpClient>

Added in v1.0.0

models

Client (type alias)

Signature

export type Client<A extends HttpApi.HttpApi.Any> = [A] extends [
  HttpApi.HttpApi<infer _Groups, infer _ApiError, infer _ApiErrorR>
]
  ? {
      readonly [GroupName in _Groups["identifier"]]: [HttpApiGroup.WithName<_Groups, GroupName>] extends [
        HttpApiGroup<GroupName, infer _Endpoints, infer _GroupError, infer _GroupErrorR>
      ]
        ? {
            readonly [Name in _Endpoints["name"]]: [HttpApiEndpoint.WithName<_Endpoints, Name>] extends [
              HttpApiEndpoint<
                Name,
                infer _Method,
                infer _Path,
                infer _Payload,
                infer _Headers,
                infer _Success,
                infer _Error,
                infer _R
              >
            ]
              ? (
                  request: Simplify<HttpApiEndpoint.ClientRequest<_Path, _Payload, _Headers>>
                ) => Effect.Effect<_Success, _Error | _GroupError | _ApiError | HttpClientError.HttpClientError>
              : never
          }
        : never
    }
  : never

Added in v1.0.0