@ affect-aws/ 客户端 - api- gateway - 管理 - api
安装
npm install --save @effect-aws/client-api-gateway-management-api
使用量
默认 ApiGateway 管理ApiClient 实例 :
import { ApiGatewayManagementApi } from "@effect-aws/client-api-gateway-management-api";
const program = ApiGatewayManagementApi.use((svc) => svc.postToConnection(args));
const result = pipe(
program,
Effect.provide(ApiGatewayManagementApi.defaultLayer),
Effect.runPromise,
);
使用自定义 ApiGateway Management 实例 :
import { ApiGatewayManagementApi } from "@effect-aws/client-api-gateway-management-api";
const program = ApiGatewayManagementApi.use((svc) => svc.postToConnection(args));
const result = await pipe(
program,
Effect.provide(
ApiGatewayManagementApi.baseLayer(() => new ApiGatewayManagementApiClient({ endpoint: "https://domain/path" })),
),
Effect.runPromise,
);
使用自定义的 ApiGateway 管理助理配置 :
import { ApiGatewayManagementApi } from "@effect-aws/client-api-gateway-management-api";
const program = ApiGatewayManagementApi.use((svc) => svc.postToConnection(args));
const result = await pipe(
program,
Effect.provide(ApiGatewayManagementApi.layer({ endpoint: "https://domain/path" })),
Effect.runPromiseExit,
);
或用途 ApiGatewayManagementApi.baseLayer((default) => new ApiGatewayManagementApiClient({ ...default, endpoint: "https://domain/path" }))