MCPcopy Index your code
hub / github.com/Effect-TS/effect / group

Function group

packages/platform/src/HttpApiClient.ts:305–341  ·  view source on GitHub ↗
(
  api: HttpApi.HttpApi<ApiId, Groups, ApiError, ApiR>,
  options: {
    readonly group: GroupName
    readonly httpClient: HttpClient.HttpClient.With<E, R>
    readonly transformResponse?:
      | ((effect: Effect.Effect<unknown, unknown>) => Effect.Effect<unknown, unknown>)
      | undefined
    readonly baseUrl?: URL | string | undefined
  }
)

Source from the content-addressed store, hash-verified

303 * @category constructors
304 */
305export const group = <
306 ApiId extends string,
307 Groups extends HttpApiGroup.Any,
308 ApiError,
309 ApiR,
310 const GroupName extends HttpApiGroup.Name<Groups>,
311 E,
312 R
313>(
314 api: HttpApi.HttpApi<ApiId, Groups, ApiError, ApiR>,
315 options: {
316 readonly group: GroupName
317 readonly httpClient: HttpClient.HttpClient.With<E, R>
318 readonly transformResponse?:
319 | ((effect: Effect.Effect<unknown, unknown>) => Effect.Effect<unknown, unknown>)
320 | undefined
321 readonly baseUrl?: URL | string | undefined
322 }
323): Effect.Effect<
324 Client.Group<Groups, GroupName, ApiError | E, R>,
325 never,
326 HttpApiMiddleware.HttpApiMiddleware.Without<
327 | ApiR
328 | HttpApiGroup.ClientContext<
329 HttpApiGroup.WithName<Groups, GroupName>
330 >
331 >
332> => {
333 const client: Record<string, any> = {}
334 return makeClient(api, {
335 ...options,
336 predicate: ({ group }) => group.identifier === options.group,
337 onEndpoint({ endpoint, endpointFn }) {
338 client[endpoint.name] = endpointFn
339 }
340 }).pipe(Effect.map(() => client)) as any
341}
342
343/**
344 * @since 1.0.0

Callers

nothing calls this directly

Calls 3

makeClientFunction · 0.70
pipeMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…