MCPcopy Create free account
hub / github.com/Effect-TS/effect / make

Function make

packages/effect/src/unstable/httpapi/HttpApiClient.ts:480–498  ·  view source on GitHub ↗
(
  api: HttpApi.HttpApi<ApiId, Groups>,
  options?: {
    readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined
    readonly transformResponse?:
      | ((effect: Effect.Effect<unknown, unknown, unknown>) => Effect.Effect<unknown, unknown, unknown>)
      | undefined
    readonly baseUrl?: URL | string | undefined
  }
)

Source from the content-addressed store, hash-verified

478 * @since 4.0.0
479 */
480export const make = <ApiId extends string, Groups extends HttpApiGroup.Constraint>(
481 api: HttpApi.HttpApi<ApiId, Groups>,
482 options?: {
483 readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined
484 readonly transformResponse?:
485 | ((effect: Effect.Effect<unknown, unknown, unknown>) => Effect.Effect<unknown, unknown, unknown>)
486 | undefined
487 readonly baseUrl?: URL | string | undefined
488 }
489): Effect.Effect<
490 Client<Groups>,
491 never,
492 HttpClient.HttpClient | HttpApiGroup.MiddlewareClient<Groups>
493> =>
494 Effect.flatMap(HttpClient.HttpClient, (httpClient) =>
495 makeWith(api, {
496 ...options,
497 httpClient: options?.transformClient ? options.transformClient(httpClient) : httpClient
498 }))
499
500/**
501 * Constructs a type-safe client for an HTTP API from the supplied `HttpClient`,

Callers

nothing calls this directly

Calls 1

makeWithFunction · 0.70

Tested by

no test coverage detected