-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
InteractionsProvider.ts
49 lines (36 loc) · 1.11 KB
/
InteractionsProvider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import {
InteractionsProvider,
InteractionsOptions,
InteractionsResponse,
} from '../types';
import { ConsoleLogger as Logger } from '@aws-amplify/core';
const logger = new Logger('AbstractInteractionsProvider');
export abstract class AbstractInteractionsProvider
implements InteractionsProvider {
protected _config: InteractionsOptions;
constructor(options: InteractionsOptions = {}) {
this._config = options;
}
configure(config: InteractionsOptions = {}): InteractionsOptions {
this._config = { ...this._config, ...config };
logger.debug(`configure ${this.getProviderName()}`, this._config);
return this.options;
}
getCategory() {
return 'Interactions';
}
abstract getProviderName(): string;
protected get options(): InteractionsOptions {
return { ...this._config };
}
public abstract sendMessage(
botname: string,
message: string | Object
): Promise<object>;
public abstract onComplete(
botname: string,
callback: (err: any, confirmation: InteractionsResponse) => void
);
}