(
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
}
)
| 303 | * @category constructors |
| 304 | */ |
| 305 | export 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…