UNPKG

13.1 kBTypeScriptView Raw
1import {Request} from '../lib/request';
2import {Response} from '../lib/response';
3import {AWSError} from '../lib/error';
4import {Service} from '../lib/service';
5import {ServiceConfigurationOptions} from '../lib/service';
6import {ConfigBase as Config} from '../lib/config';
7interface Blob {}
8declare class ConnectParticipant extends Service {
9 /**
10 * Constructs a service object. This object has one method for each API operation.
11 */
12 constructor(options?: ConnectParticipant.Types.ClientConfiguration)
13 config: Config & ConnectParticipant.Types.ClientConfiguration;
14 /**
15 * Creates the participant's connection. Note that ParticipantToken is used for invoking this API instead of ConnectionToken. The participant token is valid for the lifetime of the participant – until the they are part of a contact. The response URL for WEBSOCKET Type has a connect expiry timeout of 100s. Clients must manually connect to the returned websocket URL and subscribe to the desired topic. For chat, you need to publish the following on the established websocket connection: {"topic":"aws/subscribe","content":{"topics":["aws/chat"]}} Upon websocket URL expiry, as specified in the response ConnectionExpiry parameter, clients need to call this API again to obtain a new websocket URL and perform the same steps as before.
16 */
17 createParticipantConnection(params: ConnectParticipant.Types.CreateParticipantConnectionRequest, callback?: (err: AWSError, data: ConnectParticipant.Types.CreateParticipantConnectionResponse) => void): Request<ConnectParticipant.Types.CreateParticipantConnectionResponse, AWSError>;
18 /**
19 * Creates the participant's connection. Note that ParticipantToken is used for invoking this API instead of ConnectionToken. The participant token is valid for the lifetime of the participant – until the they are part of a contact. The response URL for WEBSOCKET Type has a connect expiry timeout of 100s. Clients must manually connect to the returned websocket URL and subscribe to the desired topic. For chat, you need to publish the following on the established websocket connection: {"topic":"aws/subscribe","content":{"topics":["aws/chat"]}} Upon websocket URL expiry, as specified in the response ConnectionExpiry parameter, clients need to call this API again to obtain a new websocket URL and perform the same steps as before.
20 */
21 createParticipantConnection(callback?: (err: AWSError, data: ConnectParticipant.Types.CreateParticipantConnectionResponse) => void): Request<ConnectParticipant.Types.CreateParticipantConnectionResponse, AWSError>;
22 /**
23 * Disconnects a participant. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.
24 */
25 disconnectParticipant(params: ConnectParticipant.Types.DisconnectParticipantRequest, callback?: (err: AWSError, data: ConnectParticipant.Types.DisconnectParticipantResponse) => void): Request<ConnectParticipant.Types.DisconnectParticipantResponse, AWSError>;
26 /**
27 * Disconnects a participant. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.
28 */
29 disconnectParticipant(callback?: (err: AWSError, data: ConnectParticipant.Types.DisconnectParticipantResponse) => void): Request<ConnectParticipant.Types.DisconnectParticipantResponse, AWSError>;
30 /**
31 * Retrieves a transcript of the session. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.
32 */
33 getTranscript(params: ConnectParticipant.Types.GetTranscriptRequest, callback?: (err: AWSError, data: ConnectParticipant.Types.GetTranscriptResponse) => void): Request<ConnectParticipant.Types.GetTranscriptResponse, AWSError>;
34 /**
35 * Retrieves a transcript of the session. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.
36 */
37 getTranscript(callback?: (err: AWSError, data: ConnectParticipant.Types.GetTranscriptResponse) => void): Request<ConnectParticipant.Types.GetTranscriptResponse, AWSError>;
38 /**
39 * Sends an event. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.
40 */
41 sendEvent(params: ConnectParticipant.Types.SendEventRequest, callback?: (err: AWSError, data: ConnectParticipant.Types.SendEventResponse) => void): Request<ConnectParticipant.Types.SendEventResponse, AWSError>;
42 /**
43 * Sends an event. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.
44 */
45 sendEvent(callback?: (err: AWSError, data: ConnectParticipant.Types.SendEventResponse) => void): Request<ConnectParticipant.Types.SendEventResponse, AWSError>;
46 /**
47 * Sends a message. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.
48 */
49 sendMessage(params: ConnectParticipant.Types.SendMessageRequest, callback?: (err: AWSError, data: ConnectParticipant.Types.SendMessageResponse) => void): Request<ConnectParticipant.Types.SendMessageResponse, AWSError>;
50 /**
51 * Sends a message. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.
52 */
53 sendMessage(callback?: (err: AWSError, data: ConnectParticipant.Types.SendMessageResponse) => void): Request<ConnectParticipant.Types.SendMessageResponse, AWSError>;
54}
55declare namespace ConnectParticipant {
56 export type ChatContent = string;
57 export type ChatContentType = string;
58 export type ChatItemId = string;
59 export type ChatItemType = "MESSAGE"|"EVENT"|"CONNECTION_ACK"|string;
60 export type ClientToken = string;
61 export interface ConnectionCredentials {
62 /**
63 * The connection token.
64 */
65 ConnectionToken?: ParticipantToken;
66 /**
67 * The expiration of the token. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.
68 */
69 Expiry?: ISO8601Datetime;
70 }
71 export type ConnectionType = "WEBSOCKET"|"CONNECTION_CREDENTIALS"|string;
72 export type ConnectionTypeList = ConnectionType[];
73 export type ContactId = string;
74 export interface CreateParticipantConnectionRequest {
75 /**
76 * Type of connection information required.
77 */
78 Type: ConnectionTypeList;
79 /**
80 * Participant Token as obtained from StartChatContact API response.
81 */
82 ParticipantToken: ParticipantToken;
83 }
84 export interface CreateParticipantConnectionResponse {
85 /**
86 * Creates the participant's websocket connection.
87 */
88 Websocket?: Websocket;
89 /**
90 * Creates the participant's connection credentials. The authentication token associated with the participant's connection.
91 */
92 ConnectionCredentials?: ConnectionCredentials;
93 }
94 export interface DisconnectParticipantRequest {
95 /**
96 * A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
97 */
98 ClientToken?: ClientToken;
99 /**
100 * The authentication token associated with the participant's connection.
101 */
102 ConnectionToken: ParticipantToken;
103 }
104 export interface DisconnectParticipantResponse {
105 }
106 export type DisplayName = string;
107 export interface GetTranscriptRequest {
108 /**
109 * The contactId from the current contact chain for which transcript is needed.
110 */
111 ContactId?: ContactId;
112 /**
113 * The maximum number of results to return in the page. Default: 10.
114 */
115 MaxResults?: MaxResults;
116 /**
117 * The pagination token. Use the value returned previously in the next subsequent request to retrieve the next set of results.
118 */
119 NextToken?: NextToken;
120 /**
121 * The direction from StartPosition from which to retrieve message. Default: BACKWARD when no StartPosition is provided, FORWARD with StartPosition.
122 */
123 ScanDirection?: ScanDirection;
124 /**
125 * The sort order for the records. Default: DESCENDING.
126 */
127 SortOrder?: SortKey;
128 /**
129 * A filtering option for where to start.
130 */
131 StartPosition?: StartPosition;
132 /**
133 * The authentication token associated with the participant's connection.
134 */
135 ConnectionToken: ParticipantToken;
136 }
137 export interface GetTranscriptResponse {
138 /**
139 * The initial contact ID for the contact.
140 */
141 InitialContactId?: ContactId;
142 /**
143 * The list of messages in the session.
144 */
145 Transcript?: Transcript;
146 /**
147 * The pagination token. Use the value returned previously in the next subsequent request to retrieve the next set of results.
148 */
149 NextToken?: NextToken;
150 }
151 export type ISO8601Datetime = string;
152 export type Instant = string;
153 export interface Item {
154 /**
155 * The time when the message or event was sent. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.
156 */
157 AbsoluteTime?: Instant;
158 /**
159 * The content of the message or event.
160 */
161 Content?: ChatContent;
162 /**
163 * The type of content of the item.
164 */
165 ContentType?: ChatContentType;
166 /**
167 * The ID of the item.
168 */
169 Id?: ChatItemId;
170 /**
171 * Type of the item: message or event.
172 */
173 Type?: ChatItemType;
174 /**
175 * The ID of the sender in the session.
176 */
177 ParticipantId?: ParticipantId;
178 /**
179 * The chat display name of the sender.
180 */
181 DisplayName?: DisplayName;
182 /**
183 * The role of the sender. For example, is it a customer, agent, or system.
184 */
185 ParticipantRole?: ParticipantRole;
186 }
187 export type MaxResults = number;
188 export type MostRecent = number;
189 export type NextToken = string;
190 export type ParticipantId = string;
191 export type ParticipantRole = "AGENT"|"CUSTOMER"|"SYSTEM"|string;
192 export type ParticipantToken = string;
193 export type PreSignedConnectionUrl = string;
194 export type ScanDirection = "FORWARD"|"BACKWARD"|string;
195 export interface SendEventRequest {
196 /**
197 * The content type of the request. Supported types are: application/vnd.amazonaws.connect.event.typing application/vnd.amazonaws.connect.event.connection.acknowledged
198 */
199 ContentType: ChatContentType;
200 /**
201 * The content of the event to be sent (for example, message text). This is not yet supported.
202 */
203 Content?: ChatContent;
204 /**
205 * A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
206 */
207 ClientToken?: ClientToken;
208 /**
209 * The authentication token associated with the participant's connection.
210 */
211 ConnectionToken: ParticipantToken;
212 }
213 export interface SendEventResponse {
214 /**
215 * The ID of the response.
216 */
217 Id?: ChatItemId;
218 /**
219 * The time when the event was sent. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.
220 */
221 AbsoluteTime?: Instant;
222 }
223 export interface SendMessageRequest {
224 /**
225 * The type of the content. Supported types are text/plain.
226 */
227 ContentType: ChatContentType;
228 /**
229 * The content of the message.
230 */
231 Content: ChatContent;
232 /**
233 * A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
234 */
235 ClientToken?: ClientToken;
236 /**
237 * The authentication token associated with the connection.
238 */
239 ConnectionToken: ParticipantToken;
240 }
241 export interface SendMessageResponse {
242 /**
243 * The ID of the message.
244 */
245 Id?: ChatItemId;
246 /**
247 * The time when the message was sent. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.
248 */
249 AbsoluteTime?: Instant;
250 }
251 export type SortKey = "DESCENDING"|"ASCENDING"|string;
252 export interface StartPosition {
253 /**
254 * The ID of the message or event where to start.
255 */
256 Id?: ChatItemId;
257 /**
258 * The time in ISO format where to start. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.
259 */
260 AbsoluteTime?: Instant;
261 /**
262 * The start position of the most recent message where you want to start.
263 */
264 MostRecent?: MostRecent;
265 }
266 export type Transcript = Item[];
267 export interface Websocket {
268 /**
269 * The URL of the websocket.
270 */
271 Url?: PreSignedConnectionUrl;
272 /**
273 * The URL expiration timestamp in ISO date format. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.
274 */
275 ConnectionExpiry?: ISO8601Datetime;
276 }
277 /**
278 * A string in YYYY-MM-DD format that represents the latest possible API version that can be used in this service. Specify 'latest' to use the latest possible version.
279 */
280 export type apiVersion = "2018-09-07"|"latest"|string;
281 export interface ClientApiVersions {
282 /**
283 * A string in YYYY-MM-DD format that represents the latest possible API version that can be used in this service. Specify 'latest' to use the latest possible version.
284 */
285 apiVersion?: apiVersion;
286 }
287 export type ClientConfiguration = ServiceConfigurationOptions & ClientApiVersions;
288 /**
289 * Contains interfaces for use with the ConnectParticipant client.
290 */
291 export import Types = ConnectParticipant;
292}
293export = ConnectParticipant;