UNPKG

cdk-amazon-chime-resources

Version:

![Experimental](https://img.shields.io/badge/experimental-important.svg?style=for-the-badge)

25 lines (24 loc) 898 B
import { constructStack } from "@aws-sdk/middleware-stack"; export class Client { constructor(config) { this.middlewareStack = constructStack(); this.config = config; } send(command, optionsOrCb, cb) { const options = typeof optionsOrCb !== "function" ? optionsOrCb : undefined; const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb; const handler = command.resolveMiddleware(this.middlewareStack, this.config, options); if (callback) { handler(command) .then((result) => callback(null, result.output), (err) => callback(err)) .catch(() => { }); } else { return handler(command).then((result) => result.output); } } destroy() { if (this.config.requestHandler.destroy) this.config.requestHandler.destroy(); } }