@superoffice/webapi 11.7.727 → 11.8.788

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/LICENSE.md +15 -15
  2. package/README.md +184 -184
  3. package/__tests__/Appointment63-notz.json +1925 -1925
  4. package/__tests__/Appointment63-utctz.json +1925 -1925
  5. package/__tests__/Appointment63.json +1925 -1925
  6. package/__tests__/AppointmentTzTest.ts +115 -115
  7. package/__tests__/AxiosNockTest.ts +28 -28
  8. package/__tests__/ContactDefault.json +699 -699
  9. package/__tests__/ContactEntity.json +272 -272
  10. package/__tests__/ContactRestTest.ts +144 -144
  11. package/__tests__/ContactTest.ts +395 -395
  12. package/__tests__/ConvertersTest.ts +97 -97
  13. package/__tests__/DocumentTest.ts +101 -101
  14. package/__tests__/Person210-notz.json +1932 -1932
  15. package/__tests__/Person210-utctz.json +1932 -1932
  16. package/__tests__/Person210.json +1932 -1932
  17. package/__tests__/PersonImageData.nock +22 -22
  18. package/__tests__/PersonTest.ts +41 -41
  19. package/__tests__/PersonTzTest.ts +113 -113
  20. package/__tests__/RecurrenceInfo.json +55 -55
  21. package/__tests__/ResponseCallbackTest.ts +23 -23
  22. package/__tests__/TableRights.json +441 -441
  23. package/__tests__/WebapiTest.ts +264 -264
  24. package/__tests__/Webhook.json +16 -16
  25. package/__tests__/WebhookTest.ts +209 -209
  26. package/dist/cjs/Carriers.d.ts +367 -4
  27. package/dist/cjs/Carriers.d.ts.map +1 -1
  28. package/dist/cjs/Converters.d.ts +9 -0
  29. package/dist/cjs/Converters.d.ts.map +1 -1
  30. package/dist/cjs/Converters.js +185 -17
  31. package/dist/cjs/Converters.js.map +1 -1
  32. package/dist/cjs/DiagnosticsAgent.d.ts +38 -0
  33. package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
  34. package/dist/cjs/DiagnosticsAgent.js +91 -0
  35. package/dist/cjs/DiagnosticsAgent.js.map +1 -1
  36. package/dist/cjs/Enums.d.ts +18 -0
  37. package/dist/cjs/Enums.d.ts.map +1 -1
  38. package/dist/cjs/Enums.js +20 -1
  39. package/dist/cjs/Enums.js.map +1 -1
  40. package/dist/cjs/ListAgent.d.ts +71 -6
  41. package/dist/cjs/ListAgent.d.ts.map +1 -1
  42. package/dist/cjs/ListAgent.js +157 -0
  43. package/dist/cjs/ListAgent.js.map +1 -1
  44. package/dist/cjs/TicketAgent.d.ts +23 -0
  45. package/dist/cjs/TicketAgent.d.ts.map +1 -1
  46. package/dist/cjs/TicketAgent.js +65 -0
  47. package/dist/cjs/TicketAgent.js.map +1 -1
  48. package/dist/esm/Carriers.d.ts +367 -4
  49. package/dist/esm/Carriers.d.ts.map +1 -1
  50. package/dist/esm/Converters.d.ts +9 -0
  51. package/dist/esm/Converters.d.ts.map +1 -1
  52. package/dist/esm/Converters.js +159 -0
  53. package/dist/esm/Converters.js.map +1 -1
  54. package/dist/esm/DiagnosticsAgent.d.ts +38 -0
  55. package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
  56. package/dist/esm/DiagnosticsAgent.js +91 -0
  57. package/dist/esm/DiagnosticsAgent.js.map +1 -1
  58. package/dist/esm/Enums.d.ts +18 -0
  59. package/dist/esm/Enums.d.ts.map +1 -1
  60. package/dist/esm/Enums.js +19 -0
  61. package/dist/esm/Enums.js.map +1 -1
  62. package/dist/esm/ListAgent.d.ts +71 -6
  63. package/dist/esm/ListAgent.d.ts.map +1 -1
  64. package/dist/esm/ListAgent.js +157 -0
  65. package/dist/esm/ListAgent.js.map +1 -1
  66. package/dist/esm/TicketAgent.d.ts +23 -0
  67. package/dist/esm/TicketAgent.d.ts.map +1 -1
  68. package/dist/esm/TicketAgent.js +65 -0
  69. package/dist/esm/TicketAgent.js.map +1 -1
  70. package/examples-js/hello.js +12 -12
  71. package/examples-ts/hello.ts +8 -8
  72. package/package.json +93 -93
  73. package/scripts/postbuild.js +22 -22
  74. package/scripts/setVersion.js +44 -44
  75. package/src/AIAgent.ts +1992 -1992
  76. package/src/AppointmentAgent.ts +6263 -6263
  77. package/src/AppointmentRestApi.ts +225 -225
  78. package/src/ArchiveAgent.ts +1950 -1950
  79. package/src/AssociateAgent.ts +422 -422
  80. package/src/AxiosCacheHandler.ts +74 -74
  81. package/src/BLOBAgent.ts +2100 -2100
  82. package/src/Base64.ts +285 -285
  83. package/src/BatchAgent.ts +910 -910
  84. package/src/BulkUpdateAgent.ts +504 -504
  85. package/src/CRMScriptAgent.ts +1390 -1390
  86. package/src/Carriers.ts +52750 -52274
  87. package/src/ChatAgent.ts +1422 -1422
  88. package/src/ConfigurationAgent.ts +2228 -2228
  89. package/src/ContactAgent.ts +1756 -1756
  90. package/src/ContactRestApi.ts +237 -237
  91. package/src/Converters.ts +23271 -23090
  92. package/src/CustomerServiceAgent.ts +1799 -1799
  93. package/src/DashAgent.ts +1674 -1674
  94. package/src/DatabaseAgent.ts +120 -120
  95. package/src/DatabaseTableAgent.ts +534 -534
  96. package/src/Day_js.ts +41 -41
  97. package/src/DiagnosticsAgent.ts +1384 -1240
  98. package/src/DocumentAgent.ts +5079 -5079
  99. package/src/DocumentMigrationAgent.ts +524 -524
  100. package/src/DocumentRestApi.ts +259 -259
  101. package/src/EMailAgent.ts +5328 -5328
  102. package/src/Enums.ts +6936 -6916
  103. package/src/ErpSyncAgent.ts +2658 -2658
  104. package/src/FavouriteAgent.ts +720 -720
  105. package/src/FindAgent.ts +2330 -2330
  106. package/src/ForeignSystemAgent.ts +1710 -1710
  107. package/src/FreeTextAgent.ts +372 -372
  108. package/src/ImportAgent.ts +304 -304
  109. package/src/LicenseAgent.ts +1230 -1230
  110. package/src/ListAgent.ts +11451 -11237
  111. package/src/MDOAgent.ts +748 -748
  112. package/src/MarketingAgent.ts +890 -890
  113. package/src/MessagingAgent.ts +384 -384
  114. package/src/NavigatorAgent.ts +140 -140
  115. package/src/NumberAllocationAgent.ts +296 -296
  116. package/src/PersonAgent.ts +3287 -3287
  117. package/src/PersonRestApi.ts +241 -241
  118. package/src/PhoneListAgent.ts +458 -458
  119. package/src/PocketAgent.ts +780 -780
  120. package/src/PreferenceAgent.ts +1900 -1900
  121. package/src/PreviewsAgent.ts +116 -116
  122. package/src/ProjectAgent.ts +2391 -2391
  123. package/src/ProjectRestApi.ts +239 -239
  124. package/src/QuoteAgent.ts +5159 -5159
  125. package/src/RelationAgent.ts +220 -220
  126. package/src/ReportAgent.ts +154 -154
  127. package/src/ResourceAgent.ts +358 -358
  128. package/src/SaintAgent.ts +601 -601
  129. package/src/SaleAgent.ts +2034 -2034
  130. package/src/SaleRestApi.ts +233 -233
  131. package/src/SelectionAgent.ts +3195 -3195
  132. package/src/SentryAgent.ts +462 -462
  133. package/src/SoApiConstants.ts +8 -8
  134. package/src/TargetsAgent.ts +1104 -1104
  135. package/src/TicketAgent.ts +3708 -3638
  136. package/src/TimeZoneAgent.ts +528 -528
  137. package/src/TooltipsAgent.ts +116 -116
  138. package/src/UserAgent.ts +4856 -4856
  139. package/src/UserDefinedFieldInfoAgent.ts +1764 -1764
  140. package/src/ViewStateAgent.ts +858 -858
  141. package/src/WebApi.ts +872 -872
  142. package/src/WebApiBase.ts +565 -565
  143. package/src/WebhookAgent.ts +388 -388
  144. package/src/WorkflowAgent.ts +1338 -1338
  145. package/tsconfig.esm.json +8 -8
  146. package/tsconfig.jest.json +8 -8
  147. package/tsconfig.json +34 -34
package/src/ChatAgent.ts CHANGED
@@ -1,1422 +1,1422 @@
1
- // <auto-generated>
2
- // SuperOffice Code Generator
3
- // modelling\templates\servicestswebapi\tswebapiagents.tt
4
- // </auto-generated>
5
-
6
-
7
- /* tslint:disable */
8
- //----------------------------------------------------------------------------
9
- // G E N E R A T E D F I L E ! D O N O T E D I T !
10
- //----------------------------------------------------------------------------
11
- //
12
- // File: WebApi/ChatAgent.ts
13
- //
14
- //----------------------------------------------------------------------------
15
- // Copyright (C) SuperOffice AS
16
- //----------------------------------------------------------------------------
17
-
18
- import { AxiosRequestConfig } from 'axios';
19
- import { Duration } from 'dayjs/plugin/duration';
20
- import * as enums from './Enums';
21
- import * as base from './WebApiBase';
22
- import * as carriers from './Carriers';
23
- import * as converters from './Converters';
24
- import { FromBase64ToString, ToBase64 } from './Base64';
25
-
26
- /**
27
- * Chat functions. Manage chat channels, sessions and messages.
28
- */
29
- export interface IChatAgent {
30
- createDefaultChatSessionEntityAsync(): Promise< carriers.ChatSessionEntity >;
31
- saveChatSessionEntityAsync(entity: carriers.ChatSessionEntity) : Promise< carriers.ChatSessionEntity >;
32
- deleteChatSessionEntityAsync(ChatSessionEntityId: number) : Promise<void>;
33
- createDefaultChatTopicAgentAsync(): Promise< carriers.ChatTopicAgent >;
34
- createDefaultChatTopicEntityAsync(): Promise< carriers.ChatTopicEntity >;
35
- saveChatTopicEntityAsync(entity: carriers.ChatTopicEntity) : Promise< carriers.ChatTopicEntity >;
36
- deleteChatTopicEntityAsync(ChatTopicEntityId: number) : Promise<void>;
37
- getChatPresenceAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatPresence[] >;
38
- saveChatPresenceAsync(request: carriers.Chat_SaveChatPresenceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
39
- saveChatPresenceAsync(chatPresence: carriers.ChatPresence[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
40
- getChatSessionEntityAsync(chatSessionEntityId: number) : Promise< carriers.ChatSessionEntity >;
41
- chatSessionsForUserAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity[] >;
42
- transferChatSessionAsync(request: carriers.Chat_TransferChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
43
- transferChatSessionAsync(chatSessionId: number, toAssociate: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
44
- acceptChatSessionTransferAsync(request: carriers.Chat_AcceptChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
45
- acceptChatSessionTransferAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
46
- rejectChatSessionTransferAsync(request: carriers.Chat_RejectChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
47
- rejectChatSessionTransferAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
48
- pickUpChatSessionAsync(request: carriers.Chat_PickUpChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
49
- pickUpChatSessionAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
50
- pickUpFirstChatSessionAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
51
- resetChatSessionAsync(request: carriers.Chat_ResetChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
52
- resetChatSessionAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
53
- getChatTranscriptAsync(request: carriers.Chat_GetChatTranscriptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
54
- getChatTranscriptAsync(chatSessionId: number, html: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
55
- getChatMessagesAsync(request: carriers.Chat_GetChatMessagesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] >;
56
- getChatMessagesAsync(chatSessionId: number, after: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] >;
57
- addChatMessageAsync(request: carriers.Chat_AddChatMessageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage >;
58
- addChatMessageAsync(chatSessionId: number, message: carriers.ChatMessage, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage >;
59
- getChatTopicEntityAsync(chatTopicEntityId: number) : Promise< carriers.ChatTopicEntity >;
60
- isWithinOpeningHoursAsync(request: carriers.Chat_IsWithinOpeningHoursRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
61
- isWithinOpeningHoursAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
62
- chatTopicsForUserAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity[] >;
63
- getUserAgentListAsync(request: carriers.Chat_GetUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] >;
64
- getUserAgentListAsync(flat: boolean, onlyPresent: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] >;
65
- getChatTopicUserAgentListAsync(request: carriers.Chat_GetChatTopicUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
66
- getChatTopicUserAgentListAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
67
- getChatTopicUserAgentAsync(request: carriers.Chat_GetChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
68
- getChatTopicUserAgentAsync(chatTopicId: number, username: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
69
- addChatTopicUserAgentAsync(request: carriers.Chat_AddChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
70
- addChatTopicUserAgentAsync(chatTopicId: number, useragent: carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
71
- updateChatTopicUserAgentAsync(request: carriers.Chat_UpdateChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
72
- updateChatTopicUserAgentAsync(chatTopicId: number, username: string, useragent: carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
73
- updateChatTopicUserAgentsAsync(request: carriers.Chat_UpdateChatTopicUserAgentsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
74
- updateChatTopicUserAgentsAsync(chatTopicId: number, useragents: carriers.ChatTopicAgent[], webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
75
- deleteChatTopicUserAgentAsync(request: carriers.Chat_DeleteChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
76
- deleteChatTopicUserAgentAsync(chatTopicId: number, username: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
77
- createChatSessionForTopicAsync(request: carriers.Chat_CreateChatSessionForTopicRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
78
- createChatSessionForTopicAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
79
- } // interface IChatAgent
80
-
81
-
82
-
83
-
84
- /**
85
- * Chat functions. Manage chat channels, sessions and messages.
86
- */
87
- export class ChatAgent extends base.WebApiBase implements IChatAgent {
88
- constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
89
- constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
90
- constructor(baseUrl: string, resourceManager:any);
91
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
92
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
93
- constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
94
- constructor(options: base.WebApiOptions);
95
-
96
- constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
97
- langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
98
- langOrResourceOrRM?:string|base.ResourceParsing|any,
99
- cultureCode?: string,
100
- ) {
101
- const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
102
- options.basePath = "v1/Agents/Chat/";
103
- super(options);
104
- }
105
-
106
-
107
-
108
- /**
109
- * Set default values into a new ChatSessionEntity.
110
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
111
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
112
- * @returns A blank entity.
113
- */
114
- public async createDefaultChatSessionEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
115
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
116
- base.WebApiBase.SetPending(options);
117
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
118
- try {
119
- const response = await this._axios.post("CreateDefaultChatSessionEntity", null, config);
120
- base.WebApiBase.SetCompleted(options, response);
121
- const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
122
- resolve(res);
123
- }
124
- catch( err ) {
125
- base.WebApiBase.HandleError(options, config, err);
126
- reject(err);
127
- }
128
- });
129
- }
130
- /**
131
- * Replace the existing ChatSessionEntity or creates a new ChatSessionEntity if the id parameter is empty
132
- * @param entity - The ChatSessionEntity to be saved.
133
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
134
- * @returns New or updated ChatSessionEntity
135
- */
136
- public async saveChatSessionEntityAsync(entity: carriers.ChatSessionEntity, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
137
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
138
- base.WebApiBase.SetPending(options);
139
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
140
- try {
141
- const response = await this._axios.post("SaveChatSessionEntity", entity, config);
142
- base.WebApiBase.SetCompleted(options, response);
143
- const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
144
- resolve(res);
145
- }
146
- catch( err ) {
147
- base.WebApiBase.HandleError(options, config, err);
148
- reject(err);
149
- }
150
- });
151
- }
152
-
153
- /**
154
- * Deletes the ChatSessionEntity
155
- * @param ChatSessionEntityId - The id of the ChatSessionEntity to be deleted.
156
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
157
- */
158
- public async deleteChatSessionEntityAsync(ChatSessionEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
159
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
160
- base.WebApiBase.SetPending(options);
161
- return new Promise< void >(async (resolve, reject) => {
162
- try {
163
- const response = await this._axios.post("DeleteChatSessionEntity?ChatSessionEntityId=" + ChatSessionEntityId, null, config );
164
- base.WebApiBase.SetCompleted(options, response);
165
- const res = response.data;
166
- resolve(res);
167
- }
168
- catch( err ) {
169
- base.WebApiBase.HandleError(options, config, err);
170
- reject(err);
171
- }
172
- });
173
- }
174
-
175
- /**
176
- * Set default values into a new ChatTopicAgent.
177
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
178
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
179
- * @returns A blank entity.
180
- */
181
- public async createDefaultChatTopicAgentAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
182
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
183
- base.WebApiBase.SetPending(options);
184
- return new Promise< carriers.ChatTopicAgent >(async (resolve, reject) => {
185
- try {
186
- const response = await this._axios.post("CreateDefaultChatTopicAgent", null, config);
187
- base.WebApiBase.SetCompleted(options, response);
188
- const res : carriers.ChatTopicAgent = converters.Create_ChatTopicAgent_From( response.data );
189
- resolve(res);
190
- }
191
- catch( err ) {
192
- base.WebApiBase.HandleError(options, config, err);
193
- reject(err);
194
- }
195
- });
196
- }
197
-
198
- /**
199
- * Set default values into a new ChatTopicEntity.
200
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
201
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
202
- * @returns A blank entity.
203
- */
204
- public async createDefaultChatTopicEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity > {
205
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
206
- base.WebApiBase.SetPending(options);
207
- return new Promise< carriers.ChatTopicEntity >(async (resolve, reject) => {
208
- try {
209
- const response = await this._axios.post("CreateDefaultChatTopicEntity", null, config);
210
- base.WebApiBase.SetCompleted(options, response);
211
- const res : carriers.ChatTopicEntity = converters.Create_ChatTopicEntity_From( response.data );
212
- resolve(res);
213
- }
214
- catch( err ) {
215
- base.WebApiBase.HandleError(options, config, err);
216
- reject(err);
217
- }
218
- });
219
- }
220
- /**
221
- * Replace the existing ChatTopicEntity or creates a new ChatTopicEntity if the id parameter is empty
222
- * @param entity - The ChatTopicEntity to be saved.
223
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
224
- * @returns New or updated ChatTopicEntity
225
- */
226
- public async saveChatTopicEntityAsync(entity: carriers.ChatTopicEntity, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity > {
227
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
228
- base.WebApiBase.SetPending(options);
229
- return new Promise< carriers.ChatTopicEntity >(async (resolve, reject) => {
230
- try {
231
- const response = await this._axios.post("SaveChatTopicEntity", entity, config);
232
- base.WebApiBase.SetCompleted(options, response);
233
- const res : carriers.ChatTopicEntity = converters.Create_ChatTopicEntity_From( response.data );
234
- resolve(res);
235
- }
236
- catch( err ) {
237
- base.WebApiBase.HandleError(options, config, err);
238
- reject(err);
239
- }
240
- });
241
- }
242
-
243
- /**
244
- * Deletes the ChatTopicEntity
245
- * @param ChatTopicEntityId - The id of the ChatTopicEntity to be deleted.
246
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
247
- */
248
- public async deleteChatTopicEntityAsync(ChatTopicEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
249
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
250
- base.WebApiBase.SetPending(options);
251
- return new Promise< void >(async (resolve, reject) => {
252
- try {
253
- const response = await this._axios.post("DeleteChatTopicEntity?ChatTopicEntityId=" + ChatTopicEntityId, null, config );
254
- base.WebApiBase.SetCompleted(options, response);
255
- const res = response.data;
256
- resolve(res);
257
- }
258
- catch( err ) {
259
- base.WebApiBase.HandleError(options, config, err);
260
- reject(err);
261
- }
262
- });
263
- }
264
-
265
- private async _getChatPresenceAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ChatPresence[] > {
266
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
267
- base.WebApiBase.SetPending(options);
268
- return new Promise< carriers.ChatPresence[] >(async (resolve, reject) => {
269
- try {
270
- config.baseURL = this._options.baseUrl;
271
- const response = await this._axios.post("GetChatPresence", undefined , config);
272
- base.WebApiBase.SetCompleted(options, response);
273
- const res : carriers.ChatPresence[] = converters.Create_ChatPresenceArray_From( response.data );
274
- resolve(res);
275
- }
276
- catch( err ) {
277
- base.WebApiBase.HandleError(options, config, err);
278
- reject(err);
279
- }
280
- });
281
- }
282
-
283
-
284
- /**
285
- * Get the chat presence status for all chat users
286
- * @returns An array with ChatPresence objects for each user
287
- */
288
- public async getChatPresenceAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatPresence[] >
289
- {
290
- return this._getChatPresenceAsync(webapi_options);
291
- }
292
-
293
-
294
- private async _saveChatPresenceAsync(request: carriers.Chat_SaveChatPresenceRequest, options?:base.WebApiRequestOptions) : Promise< void > {
295
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
296
- base.WebApiBase.SetPending(options);
297
- return new Promise< void >(async (resolve, reject) => {
298
- try {
299
- config.baseURL = this._options.baseUrl;
300
- const response = await this._axios.post("SaveChatPresence", request , config);
301
- base.WebApiBase.SetCompleted(options, response);
302
- const res = response.data;
303
- resolve(res);
304
- }
305
- catch( err ) {
306
- base.WebApiBase.HandleError(options, config, err);
307
- reject(err);
308
- }
309
- });
310
- }
311
-
312
-
313
-
314
- /**
315
- * Save the chat presence for specified users
316
- * @param request - ChatPresence
317
- * @returns void
318
- */
319
- public async saveChatPresenceAsync(request: carriers.Chat_SaveChatPresenceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
320
-
321
- /**
322
- * Save the chat presence for specified users
323
- * @param chatPresence - An array with ChatPresence objects. Only the UserId and Present information is used while saving
324
- * @returns void
325
- */
326
- public async saveChatPresenceAsync(chatPresence: carriers.ChatPresence[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
327
-
328
- public async saveChatPresenceAsync(chatPresence:carriers.ChatPresence[]|carriers.Chat_SaveChatPresenceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
329
- let _request : carriers.Chat_SaveChatPresenceRequest = null;
330
- let _options : base.WebApiRequestOptions = null;
331
- const first : any = chatPresence;
332
- if( typeof( first ) === "object" && first && ( typeof(first.chatPresence)!='undefined' ) )
333
- {
334
- _request = chatPresence as carriers.Chat_SaveChatPresenceRequest;
335
- _options = webapi_options as base.WebApiRequestOptions;
336
- }
337
- else
338
- {
339
- _request = {
340
- chatPresence: chatPresence as carriers.ChatPresence[],
341
- };
342
- _options = webapi_options;
343
- }
344
- return this._saveChatPresenceAsync( _request, _options );
345
- }
346
-
347
- /**
348
- * Gets a ChatSessionEntity object.
349
- * @param chatSessionEntityId - The primary key.
350
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
351
- * @returns A single ChatSessionEntity
352
- */
353
- public async getChatSessionEntityAsync(chatSessionEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
354
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
355
- base.WebApiBase.SetPending(options);
356
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
357
- try {
358
- const response = await this._axios.post("GetChatSessionEntity?chatSessionEntityId=" + chatSessionEntityId, null, config);
359
- base.WebApiBase.SetCompleted(options, response);
360
- const res = converters.Create_ChatSessionEntity_From( response.data );
361
- resolve(res);
362
- }
363
- catch( err ) {
364
- base.WebApiBase.HandleError(options, config, err);
365
- reject(err);
366
- }
367
- });
368
- }
369
-
370
-
371
- private async _chatSessionsForUserAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity[] > {
372
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
373
- base.WebApiBase.SetPending(options);
374
- return new Promise< carriers.ChatSessionEntity[] >(async (resolve, reject) => {
375
- try {
376
- config.baseURL = this._options.baseUrl;
377
- const response = await this._axios.post("ChatSessionsForUser", undefined , config);
378
- base.WebApiBase.SetCompleted(options, response);
379
- const res : carriers.ChatSessionEntity[] = converters.Create_ChatSessionEntityArray_From( response.data );
380
- resolve(res);
381
- }
382
- catch( err ) {
383
- base.WebApiBase.HandleError(options, config, err);
384
- reject(err);
385
- }
386
- });
387
- }
388
-
389
-
390
- /**
391
- * Get all chat sessions which this user is a member of. Members means that you have at least one of: Can Respond, Notifications, Listen or Manager
392
- * @returns Array of chat sessions the current user can access
393
- */
394
- public async chatSessionsForUserAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity[] >
395
- {
396
- return this._chatSessionsForUserAsync(webapi_options);
397
- }
398
-
399
-
400
- private async _transferChatSessionAsync(request: carriers.Chat_TransferChatSessionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
401
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
402
- base.WebApiBase.SetPending(options);
403
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
404
- try {
405
- config.baseURL = this._options.baseUrl;
406
- const response = await this._axios.post("TransferChatSession", request , config);
407
- base.WebApiBase.SetCompleted(options, response);
408
- const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
409
- resolve(res);
410
- }
411
- catch( err ) {
412
- base.WebApiBase.HandleError(options, config, err);
413
- reject(err);
414
- }
415
- });
416
- }
417
-
418
-
419
-
420
- /**
421
- * Request to send the session to another user. If the session does not belong to the user, nothing happens.
422
- * @param request - ChatSessionId, ToAssociate
423
- * @returns The updated chat session
424
- */
425
- public async transferChatSessionAsync(request: carriers.Chat_TransferChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
426
-
427
- /**
428
- * Request to send the session to another user. If the session does not belong to the user, nothing happens.
429
- * @param chatSessionId - id of the chat session to send
430
- * @param toAssociate - Associate username or associate id to send session to.
431
- * @returns The updated chat session
432
- */
433
- public async transferChatSessionAsync(chatSessionId: number, toAssociate: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
434
-
435
- public async transferChatSessionAsync(chatSessionId:number|carriers.Chat_TransferChatSessionRequest, toAssociate?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
436
- let _request : carriers.Chat_TransferChatSessionRequest = null;
437
- let _options : base.WebApiRequestOptions = null;
438
- const first : any = chatSessionId;
439
- if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' || typeof(first.toAssociate)!='undefined' ) )
440
- {
441
- _request = chatSessionId as carriers.Chat_TransferChatSessionRequest;
442
- _options = toAssociate as base.WebApiRequestOptions;
443
- }
444
- else
445
- {
446
- _request = {
447
- chatSessionId: chatSessionId as number,
448
- toAssociate: toAssociate as string,
449
- };
450
- _options = webapi_options;
451
- }
452
- return this._transferChatSessionAsync( _request, _options );
453
- }
454
-
455
-
456
- private async _acceptChatSessionTransferAsync(request: carriers.Chat_AcceptChatSessionTransferRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
457
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
458
- base.WebApiBase.SetPending(options);
459
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
460
- try {
461
- config.baseURL = this._options.baseUrl;
462
- const response = await this._axios.post("AcceptChatSessionTransfer", request , config);
463
- base.WebApiBase.SetCompleted(options, response);
464
- const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
465
- resolve(res);
466
- }
467
- catch( err ) {
468
- base.WebApiBase.HandleError(options, config, err);
469
- reject(err);
470
- }
471
- });
472
- }
473
-
474
-
475
-
476
- /**
477
- * Accept the transfer: assign the session to the user. If the session is not being transferred, nothing happens.
478
- * @param request - ChatSessionId
479
- * @returns The updated chat session
480
- */
481
- public async acceptChatSessionTransferAsync(request: carriers.Chat_AcceptChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
482
-
483
- /**
484
- * Accept the transfer: assign the session to the user. If the session is not being transferred, nothing happens.
485
- * @param chatSessionId - id of the chat session to send
486
- * @returns The updated chat session
487
- */
488
- public async acceptChatSessionTransferAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
489
-
490
- public async acceptChatSessionTransferAsync(chatSessionId:number|carriers.Chat_AcceptChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
491
- let _request : carriers.Chat_AcceptChatSessionTransferRequest = null;
492
- let _options : base.WebApiRequestOptions = null;
493
- const first : any = chatSessionId;
494
- if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' ) )
495
- {
496
- _request = chatSessionId as carriers.Chat_AcceptChatSessionTransferRequest;
497
- _options = webapi_options as base.WebApiRequestOptions;
498
- }
499
- else
500
- {
501
- _request = {
502
- chatSessionId: chatSessionId as number,
503
- };
504
- _options = webapi_options;
505
- }
506
- return this._acceptChatSessionTransferAsync( _request, _options );
507
- }
508
-
509
-
510
- private async _rejectChatSessionTransferAsync(request: carriers.Chat_RejectChatSessionTransferRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
511
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
512
- base.WebApiBase.SetPending(options);
513
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
514
- try {
515
- config.baseURL = this._options.baseUrl;
516
- const response = await this._axios.post("RejectChatSessionTransfer", request , config);
517
- base.WebApiBase.SetCompleted(options, response);
518
- const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
519
- resolve(res);
520
- }
521
- catch( err ) {
522
- base.WebApiBase.HandleError(options, config, err);
523
- reject(err);
524
- }
525
- });
526
- }
527
-
528
-
529
-
530
- /**
531
- * Do not want. Deny the transfer to the user. If the session is not being transferred, nothing happens.
532
- * @param request - ChatSessionId
533
- * @returns The updated chat session
534
- */
535
- public async rejectChatSessionTransferAsync(request: carriers.Chat_RejectChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
536
-
537
- /**
538
- * Do not want. Deny the transfer to the user. If the session is not being transferred, nothing happens.
539
- * @param chatSessionId - id of the chat session to send back
540
- * @returns The updated chat session
541
- */
542
- public async rejectChatSessionTransferAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
543
-
544
- public async rejectChatSessionTransferAsync(chatSessionId:number|carriers.Chat_RejectChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
545
- let _request : carriers.Chat_RejectChatSessionTransferRequest = null;
546
- let _options : base.WebApiRequestOptions = null;
547
- const first : any = chatSessionId;
548
- if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' ) )
549
- {
550
- _request = chatSessionId as carriers.Chat_RejectChatSessionTransferRequest;
551
- _options = webapi_options as base.WebApiRequestOptions;
552
- }
553
- else
554
- {
555
- _request = {
556
- chatSessionId: chatSessionId as number,
557
- };
558
- _options = webapi_options;
559
- }
560
- return this._rejectChatSessionTransferAsync( _request, _options );
561
- }
562
-
563
-
564
- private async _pickUpChatSessionAsync(request: carriers.Chat_PickUpChatSessionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
565
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
566
- base.WebApiBase.SetPending(options);
567
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
568
- try {
569
- config.baseURL = this._options.baseUrl;
570
- const response = await this._axios.post("PickUpChatSession", request , config);
571
- base.WebApiBase.SetCompleted(options, response);
572
- const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
573
- resolve(res);
574
- }
575
- catch( err ) {
576
- base.WebApiBase.HandleError(options, config, err);
577
- reject(err);
578
- }
579
- });
580
- }
581
-
582
-
583
-
584
- /**
585
- * &apos;answer&apos; the session: assign the session to the user. The welcome message is sent to the customer. Returns NULL if session was not in queue.
586
- * @param request - ChatSessionId
587
- * @returns The chat session
588
- */
589
- public async pickUpChatSessionAsync(request: carriers.Chat_PickUpChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
590
-
591
- /**
592
- * &apos;answer&apos; the session: assign the session to the user. The welcome message is sent to the customer. Returns NULL if session was not in queue.
593
- * @param chatSessionId - id of the chat session to answer
594
- * @returns The chat session
595
- */
596
- public async pickUpChatSessionAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
597
-
598
- public async pickUpChatSessionAsync(chatSessionId:number|carriers.Chat_PickUpChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
599
- let _request : carriers.Chat_PickUpChatSessionRequest = null;
600
- let _options : base.WebApiRequestOptions = null;
601
- const first : any = chatSessionId;
602
- if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' ) )
603
- {
604
- _request = chatSessionId as carriers.Chat_PickUpChatSessionRequest;
605
- _options = webapi_options as base.WebApiRequestOptions;
606
- }
607
- else
608
- {
609
- _request = {
610
- chatSessionId: chatSessionId as number,
611
- };
612
- _options = webapi_options;
613
- }
614
- return this._pickUpChatSessionAsync( _request, _options );
615
- }
616
-
617
-
618
- private async _pickUpFirstChatSessionAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
619
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
620
- base.WebApiBase.SetPending(options);
621
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
622
- try {
623
- config.baseURL = this._options.baseUrl;
624
- const response = await this._axios.post("PickUpFirstChatSession", undefined , config);
625
- base.WebApiBase.SetCompleted(options, response);
626
- const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
627
- resolve(res);
628
- }
629
- catch( err ) {
630
- base.WebApiBase.HandleError(options, config, err);
631
- reject(err);
632
- }
633
- });
634
- }
635
-
636
-
637
- /**
638
- * &apos;answer&apos; the first available session from the queue: assign the session to the user. The welcome message is sent to the customer.
639
- * @returns The picked-up chat session
640
- */
641
- public async pickUpFirstChatSessionAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >
642
- {
643
- return this._pickUpFirstChatSessionAsync(webapi_options);
644
- }
645
-
646
-
647
- private async _resetChatSessionAsync(request: carriers.Chat_ResetChatSessionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
648
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
649
- base.WebApiBase.SetPending(options);
650
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
651
- try {
652
- config.baseURL = this._options.baseUrl;
653
- const response = await this._axios.post("ResetChatSession", request , config);
654
- base.WebApiBase.SetCompleted(options, response);
655
- const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
656
- resolve(res);
657
- }
658
- catch( err ) {
659
- base.WebApiBase.HandleError(options, config, err);
660
- reject(err);
661
- }
662
- });
663
- }
664
-
665
-
666
-
667
- /**
668
- * Reset chat session, put it back on the queue for pickup. Used by bots to hand off a session to human
669
- * @param request - ChatSessionId
670
- * @returns The updated chat session
671
- */
672
- public async resetChatSessionAsync(request: carriers.Chat_ResetChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
673
-
674
- /**
675
- * Reset chat session, put it back on the queue for pickup. Used by bots to hand off a session to human
676
- * @param chatSessionId - id of the chat session to reset
677
- * @returns The updated chat session
678
- */
679
- public async resetChatSessionAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
680
-
681
- public async resetChatSessionAsync(chatSessionId:number|carriers.Chat_ResetChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
682
- let _request : carriers.Chat_ResetChatSessionRequest = null;
683
- let _options : base.WebApiRequestOptions = null;
684
- const first : any = chatSessionId;
685
- if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' ) )
686
- {
687
- _request = chatSessionId as carriers.Chat_ResetChatSessionRequest;
688
- _options = webapi_options as base.WebApiRequestOptions;
689
- }
690
- else
691
- {
692
- _request = {
693
- chatSessionId: chatSessionId as number,
694
- };
695
- _options = webapi_options;
696
- }
697
- return this._resetChatSessionAsync( _request, _options );
698
- }
699
-
700
-
701
- private async _getChatTranscriptAsync(request: carriers.Chat_GetChatTranscriptRequest, options?:base.WebApiRequestOptions) : Promise< string > {
702
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
703
- base.WebApiBase.SetPending(options);
704
- return new Promise< string >(async (resolve, reject) => {
705
- try {
706
- config.baseURL = this._options.baseUrl;
707
- const response = await this._axios.post("GetChatTranscript", request , config);
708
- base.WebApiBase.SetCompleted(options, response);
709
- const res : string = response.data as string;
710
- resolve(res);
711
- }
712
- catch( err ) {
713
- base.WebApiBase.HandleError(options, config, err);
714
- reject(err);
715
- }
716
- });
717
- }
718
-
719
-
720
-
721
- /**
722
- * Get the chat transcript, formatted as plain text or html
723
- * @param request - ChatSessionId, Html
724
- * @returns The transcript in text or HTML
725
- */
726
- public async getChatTranscriptAsync(request: carriers.Chat_GetChatTranscriptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
727
-
728
- /**
729
- * Get the chat transcript, formatted as plain text or html
730
- * @param chatSessionId - id of the chat session to get the transcript for
731
- * @param html - Get transcript as HTML
732
- * @returns The transcript in text or HTML
733
- */
734
- public async getChatTranscriptAsync(chatSessionId: number, html: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
735
-
736
- public async getChatTranscriptAsync(chatSessionId:number|carriers.Chat_GetChatTranscriptRequest, html?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
737
- let _request : carriers.Chat_GetChatTranscriptRequest = null;
738
- let _options : base.WebApiRequestOptions = null;
739
- const first : any = chatSessionId;
740
- if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' || typeof(first.html)!='undefined' ) )
741
- {
742
- _request = chatSessionId as carriers.Chat_GetChatTranscriptRequest;
743
- _options = html as base.WebApiRequestOptions;
744
- }
745
- else
746
- {
747
- _request = {
748
- chatSessionId: chatSessionId as number,
749
- html: html as boolean,
750
- };
751
- _options = webapi_options;
752
- }
753
- return this._getChatTranscriptAsync( _request, _options );
754
- }
755
-
756
-
757
- private async _getChatMessagesAsync(request: carriers.Chat_GetChatMessagesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] > {
758
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
759
- base.WebApiBase.SetPending(options);
760
- return new Promise< carriers.ChatMessage[] >(async (resolve, reject) => {
761
- try {
762
- config.baseURL = this._options.baseUrl;
763
- const response = await this._axios.post("GetChatMessages", request , config);
764
- base.WebApiBase.SetCompleted(options, response);
765
- const res : carriers.ChatMessage[] = converters.Create_ChatMessageArray_From( response.data );
766
- resolve(res);
767
- }
768
- catch( err ) {
769
- base.WebApiBase.HandleError(options, config, err);
770
- reject(err);
771
- }
772
- });
773
- }
774
-
775
-
776
-
777
- /**
778
- * Get all or some of the messages in a chat session
779
- * @param request - ChatSessionId, After
780
- * @returns Array of chat messages in the session
781
- */
782
- public async getChatMessagesAsync(request: carriers.Chat_GetChatMessagesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] >;
783
-
784
- /**
785
- * Get all or some of the messages in a chat session
786
- * @param chatSessionId - id of the chat session to reset
787
- * @param after - Return messages after this message id
788
- * @returns Array of chat messages in the session
789
- */
790
- public async getChatMessagesAsync(chatSessionId: number, after: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] >;
791
-
792
- public async getChatMessagesAsync(chatSessionId:number|carriers.Chat_GetChatMessagesRequest, after?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] > {
793
- let _request : carriers.Chat_GetChatMessagesRequest = null;
794
- let _options : base.WebApiRequestOptions = null;
795
- const first : any = chatSessionId;
796
- if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' || typeof(first.after)!='undefined' ) )
797
- {
798
- _request = chatSessionId as carriers.Chat_GetChatMessagesRequest;
799
- _options = after as base.WebApiRequestOptions;
800
- }
801
- else
802
- {
803
- _request = {
804
- chatSessionId: chatSessionId as number,
805
- after: after as number,
806
- };
807
- _options = webapi_options;
808
- }
809
- return this._getChatMessagesAsync( _request, _options );
810
- }
811
-
812
-
813
- private async _addChatMessageAsync(request: carriers.Chat_AddChatMessageRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage > {
814
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
815
- base.WebApiBase.SetPending(options);
816
- return new Promise< carriers.ChatMessage >(async (resolve, reject) => {
817
- try {
818
- config.baseURL = this._options.baseUrl;
819
- const response = await this._axios.post("AddChatMessage", request , config);
820
- base.WebApiBase.SetCompleted(options, response);
821
- const res : carriers.ChatMessage = converters.Create_ChatMessage_From( response.data );
822
- resolve(res);
823
- }
824
- catch( err ) {
825
- base.WebApiBase.HandleError(options, config, err);
826
- reject(err);
827
- }
828
- });
829
- }
830
-
831
-
832
-
833
- /**
834
- * Add a new message to a chat session
835
- * @param request - ChatSessionId, Message
836
- * @returns The chat message added to the session
837
- */
838
- public async addChatMessageAsync(request: carriers.Chat_AddChatMessageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage >;
839
-
840
- /**
841
- * Add a new message to a chat session
842
- * @param chatSessionId - id of the chat session to add message to
843
- * @param message - Message to add
844
- * @returns The chat message added to the session
845
- */
846
- public async addChatMessageAsync(chatSessionId: number, message: carriers.ChatMessage, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage >;
847
-
848
- public async addChatMessageAsync(chatSessionId:number|carriers.Chat_AddChatMessageRequest, message?:carriers.ChatMessage|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage > {
849
- let _request : carriers.Chat_AddChatMessageRequest = null;
850
- let _options : base.WebApiRequestOptions = null;
851
- const first : any = chatSessionId;
852
- if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' || typeof(first.message)!='undefined' ) )
853
- {
854
- _request = chatSessionId as carriers.Chat_AddChatMessageRequest;
855
- _options = message as base.WebApiRequestOptions;
856
- }
857
- else
858
- {
859
- _request = {
860
- chatSessionId: chatSessionId as number,
861
- message: message as carriers.ChatMessage,
862
- };
863
- _options = webapi_options;
864
- }
865
- return this._addChatMessageAsync( _request, _options );
866
- }
867
-
868
- /**
869
- * Gets a ChatTopicEntity object.
870
- * @param chatTopicEntityId - The primary key.
871
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
872
- * @returns A single ChatTopicEntity
873
- */
874
- public async getChatTopicEntityAsync(chatTopicEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity > {
875
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
876
- base.WebApiBase.SetPending(options);
877
- return new Promise< carriers.ChatTopicEntity >(async (resolve, reject) => {
878
- try {
879
- const response = await this._axios.post("GetChatTopicEntity?chatTopicEntityId=" + chatTopicEntityId, null, config);
880
- base.WebApiBase.SetCompleted(options, response);
881
- const res = converters.Create_ChatTopicEntity_From( response.data );
882
- resolve(res);
883
- }
884
- catch( err ) {
885
- base.WebApiBase.HandleError(options, config, err);
886
- reject(err);
887
- }
888
- });
889
- }
890
-
891
-
892
- private async _isWithinOpeningHoursAsync(request: carriers.Chat_IsWithinOpeningHoursRequest, options?:base.WebApiRequestOptions) : Promise< boolean > {
893
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
894
- base.WebApiBase.SetPending(options);
895
- return new Promise< boolean >(async (resolve, reject) => {
896
- try {
897
- config.baseURL = this._options.baseUrl;
898
- const response = await this._axios.post("IsWithinOpeningHours", request , config);
899
- base.WebApiBase.SetCompleted(options, response);
900
- const res : boolean = response.data as boolean;
901
- resolve(res);
902
- }
903
- catch( err ) {
904
- base.WebApiBase.HandleError(options, config, err);
905
- reject(err);
906
- }
907
- });
908
- }
909
-
910
-
911
-
912
- /**
913
- * Check if we are right now within the opening hours of the given topic. Will use timezones to calculate if configured.
914
- * @param request - ChatTopicId
915
- * @returns True if we are within opening hours, or if the topic does not use opening hours
916
- */
917
- public async isWithinOpeningHoursAsync(request: carriers.Chat_IsWithinOpeningHoursRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
918
-
919
- /**
920
- * Check if we are right now within the opening hours of the given topic. Will use timezones to calculate if configured.
921
- * @param chatTopicId - The id of the topic to check
922
- * @returns True if we are within opening hours, or if the topic does not use opening hours
923
- */
924
- public async isWithinOpeningHoursAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
925
-
926
- public async isWithinOpeningHoursAsync(chatTopicId:number|carriers.Chat_IsWithinOpeningHoursRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean > {
927
- let _request : carriers.Chat_IsWithinOpeningHoursRequest = null;
928
- let _options : base.WebApiRequestOptions = null;
929
- const first : any = chatTopicId;
930
- if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' ) )
931
- {
932
- _request = chatTopicId as carriers.Chat_IsWithinOpeningHoursRequest;
933
- _options = webapi_options as base.WebApiRequestOptions;
934
- }
935
- else
936
- {
937
- _request = {
938
- chatTopicId: chatTopicId as number,
939
- };
940
- _options = webapi_options;
941
- }
942
- return this._isWithinOpeningHoursAsync( _request, _options );
943
- }
944
-
945
-
946
- private async _chatTopicsForUserAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity[] > {
947
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
948
- base.WebApiBase.SetPending(options);
949
- return new Promise< carriers.ChatTopicEntity[] >(async (resolve, reject) => {
950
- try {
951
- config.baseURL = this._options.baseUrl;
952
- const response = await this._axios.post("ChatTopicsForUser", undefined , config);
953
- base.WebApiBase.SetCompleted(options, response);
954
- const res : carriers.ChatTopicEntity[] = converters.Create_ChatTopicEntityArray_From( response.data );
955
- resolve(res);
956
- }
957
- catch( err ) {
958
- base.WebApiBase.HandleError(options, config, err);
959
- reject(err);
960
- }
961
- });
962
- }
963
-
964
-
965
- /**
966
- * Get all chat topics which this user is a member of. Members means that you have at least one of: Can Respond, Notifications, Listen or Manager
967
- * @returns Array of chat topics the current user can access
968
- */
969
- public async chatTopicsForUserAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity[] >
970
- {
971
- return this._chatTopicsForUserAsync(webapi_options);
972
- }
973
-
974
-
975
- private async _getUserAgentListAsync(request: carriers.Chat_GetUserAgentListRequest, options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] > {
976
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
977
- base.WebApiBase.SetPending(options);
978
- return new Promise< carriers.MDOListItem[] >(async (resolve, reject) => {
979
- try {
980
- config.baseURL = this._options.baseUrl;
981
- const response = await this._axios.post("GetUserAgentList", request , config);
982
- base.WebApiBase.SetCompleted(options, response);
983
- const res : carriers.MDOListItem[] = converters.Create_MDOListItemArray_From( response.data );
984
- resolve(res);
985
- }
986
- catch( err ) {
987
- base.WebApiBase.HandleError(options, config, err);
988
- reject(err);
989
- }
990
- });
991
- }
992
-
993
-
994
-
995
- /**
996
- * Get list of users that can be assigned to chat topics. Users with Chat-CALs from the MDO list &apos;chatuser&apos;
997
- * @param request - Flat, OnlyPresent
998
- * @returns List of user agents that can be assigned to chat topics, possibly grouped by usergroup.
999
- */
1000
- public async getUserAgentListAsync(request: carriers.Chat_GetUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] >;
1001
-
1002
- /**
1003
- * Get list of users that can be assigned to chat topics. Users with Chat-CALs from the MDO list &apos;chatuser&apos;
1004
- * @param flat - Return flat list instead of grouping by usergroup.
1005
- * @param onlyPresent - Only show users who are present
1006
- * @returns List of user agents that can be assigned to chat topics, possibly grouped by usergroup.
1007
- */
1008
- public async getUserAgentListAsync(flat: boolean, onlyPresent: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] >;
1009
-
1010
- public async getUserAgentListAsync(flat:boolean|carriers.Chat_GetUserAgentListRequest, onlyPresent?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] > {
1011
- let _request : carriers.Chat_GetUserAgentListRequest = null;
1012
- let _options : base.WebApiRequestOptions = null;
1013
- const first : any = flat;
1014
- if( typeof( first ) === "object" && first && ( typeof(first.flat)!='undefined' || typeof(first.onlyPresent)!='undefined' ) )
1015
- {
1016
- _request = flat as carriers.Chat_GetUserAgentListRequest;
1017
- _options = onlyPresent as base.WebApiRequestOptions;
1018
- }
1019
- else
1020
- {
1021
- _request = {
1022
- flat: flat as boolean,
1023
- onlyPresent: onlyPresent as boolean,
1024
- };
1025
- _options = webapi_options;
1026
- }
1027
- return this._getUserAgentListAsync( _request, _options );
1028
- }
1029
-
1030
-
1031
- private async _getChatTopicUserAgentListAsync(request: carriers.Chat_GetChatTopicUserAgentListRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] > {
1032
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1033
- base.WebApiBase.SetPending(options);
1034
- return new Promise< carriers.ChatTopicAgent[] >(async (resolve, reject) => {
1035
- try {
1036
- config.baseURL = this._options.baseUrl;
1037
- const response = await this._axios.post("GetChatTopicUserAgentList", request , config);
1038
- base.WebApiBase.SetCompleted(options, response);
1039
- const res : carriers.ChatTopicAgent[] = converters.Create_ChatTopicAgentArray_From( response.data );
1040
- resolve(res);
1041
- }
1042
- catch( err ) {
1043
- base.WebApiBase.HandleError(options, config, err);
1044
- reject(err);
1045
- }
1046
- });
1047
- }
1048
-
1049
-
1050
-
1051
- /**
1052
- * Get list of users assigned to a chat topic
1053
- * @param request - ChatTopicId
1054
- * @returns List of user agents assigned to chat topic.
1055
- */
1056
- public async getChatTopicUserAgentListAsync(request: carriers.Chat_GetChatTopicUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
1057
-
1058
- /**
1059
- * Get list of users assigned to a chat topic
1060
- * @param chatTopicId - Id of the chat topic
1061
- * @returns List of user agents assigned to chat topic.
1062
- */
1063
- public async getChatTopicUserAgentListAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
1064
-
1065
- public async getChatTopicUserAgentListAsync(chatTopicId:number|carriers.Chat_GetChatTopicUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] > {
1066
- let _request : carriers.Chat_GetChatTopicUserAgentListRequest = null;
1067
- let _options : base.WebApiRequestOptions = null;
1068
- const first : any = chatTopicId;
1069
- if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' ) )
1070
- {
1071
- _request = chatTopicId as carriers.Chat_GetChatTopicUserAgentListRequest;
1072
- _options = webapi_options as base.WebApiRequestOptions;
1073
- }
1074
- else
1075
- {
1076
- _request = {
1077
- chatTopicId: chatTopicId as number,
1078
- };
1079
- _options = webapi_options;
1080
- }
1081
- return this._getChatTopicUserAgentListAsync( _request, _options );
1082
- }
1083
-
1084
-
1085
- private async _getChatTopicUserAgentAsync(request: carriers.Chat_GetChatTopicUserAgentRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1086
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1087
- base.WebApiBase.SetPending(options);
1088
- return new Promise< carriers.ChatTopicAgent >(async (resolve, reject) => {
1089
- try {
1090
- config.baseURL = this._options.baseUrl;
1091
- const response = await this._axios.post("GetChatTopicUserAgent", request , config);
1092
- base.WebApiBase.SetCompleted(options, response);
1093
- const res : carriers.ChatTopicAgent = converters.Create_ChatTopicAgent_From( response.data );
1094
- resolve(res);
1095
- }
1096
- catch( err ) {
1097
- base.WebApiBase.HandleError(options, config, err);
1098
- reject(err);
1099
- }
1100
- });
1101
- }
1102
-
1103
-
1104
-
1105
- /**
1106
- * Get a user assigned to a topic
1107
- * @param request - ChatTopicId, Username
1108
- * @returns The user's role within the chat topic.
1109
- */
1110
- public async getChatTopicUserAgentAsync(request: carriers.Chat_GetChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1111
-
1112
- /**
1113
- * Get a user assigned to a topic
1114
- * @param chatTopicId - Id of the chat topic
1115
- * @param username - Associate username or associate id to get.
1116
- * @returns The user's role within the chat topic.
1117
- */
1118
- public async getChatTopicUserAgentAsync(chatTopicId: number, username: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1119
-
1120
- public async getChatTopicUserAgentAsync(chatTopicId:number|carriers.Chat_GetChatTopicUserAgentRequest, username?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1121
- let _request : carriers.Chat_GetChatTopicUserAgentRequest = null;
1122
- let _options : base.WebApiRequestOptions = null;
1123
- const first : any = chatTopicId;
1124
- if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.username)!='undefined' ) )
1125
- {
1126
- _request = chatTopicId as carriers.Chat_GetChatTopicUserAgentRequest;
1127
- _options = username as base.WebApiRequestOptions;
1128
- }
1129
- else
1130
- {
1131
- _request = {
1132
- chatTopicId: chatTopicId as number,
1133
- username: username as string,
1134
- };
1135
- _options = webapi_options;
1136
- }
1137
- return this._getChatTopicUserAgentAsync( _request, _options );
1138
- }
1139
-
1140
-
1141
- private async _addChatTopicUserAgentAsync(request: carriers.Chat_AddChatTopicUserAgentRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1142
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1143
- base.WebApiBase.SetPending(options);
1144
- return new Promise< carriers.ChatTopicAgent >(async (resolve, reject) => {
1145
- try {
1146
- config.baseURL = this._options.baseUrl;
1147
- const response = await this._axios.post("AddChatTopicUserAgent", request , config);
1148
- base.WebApiBase.SetCompleted(options, response);
1149
- const res : carriers.ChatTopicAgent = converters.Create_ChatTopicAgent_From( response.data );
1150
- resolve(res);
1151
- }
1152
- catch( err ) {
1153
- base.WebApiBase.HandleError(options, config, err);
1154
- reject(err);
1155
- }
1156
- });
1157
- }
1158
-
1159
-
1160
-
1161
- /**
1162
- * Add a user to a chat topic
1163
- * @param request - ChatTopicId, Useragent
1164
- * @returns The user's role within the chat topic.
1165
- */
1166
- public async addChatTopicUserAgentAsync(request: carriers.Chat_AddChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1167
-
1168
- /**
1169
- * Add a user to a chat topic
1170
- * @param chatTopicId - Id of the chat topic
1171
- * @param useragent - User's role within the chat topic to add to topic.
1172
- * @returns The user's role within the chat topic.
1173
- */
1174
- public async addChatTopicUserAgentAsync(chatTopicId: number, useragent: carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1175
-
1176
- public async addChatTopicUserAgentAsync(chatTopicId:number|carriers.Chat_AddChatTopicUserAgentRequest, useragent?:carriers.ChatTopicAgent|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1177
- let _request : carriers.Chat_AddChatTopicUserAgentRequest = null;
1178
- let _options : base.WebApiRequestOptions = null;
1179
- const first : any = chatTopicId;
1180
- if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.useragent)!='undefined' ) )
1181
- {
1182
- _request = chatTopicId as carriers.Chat_AddChatTopicUserAgentRequest;
1183
- _options = useragent as base.WebApiRequestOptions;
1184
- }
1185
- else
1186
- {
1187
- _request = {
1188
- chatTopicId: chatTopicId as number,
1189
- useragent: useragent as carriers.ChatTopicAgent,
1190
- };
1191
- _options = webapi_options;
1192
- }
1193
- return this._addChatTopicUserAgentAsync( _request, _options );
1194
- }
1195
-
1196
-
1197
- private async _updateChatTopicUserAgentAsync(request: carriers.Chat_UpdateChatTopicUserAgentRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1198
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1199
- base.WebApiBase.SetPending(options);
1200
- return new Promise< carriers.ChatTopicAgent >(async (resolve, reject) => {
1201
- try {
1202
- config.baseURL = this._options.baseUrl;
1203
- const response = await this._axios.post("UpdateChatTopicUserAgent", request , config);
1204
- base.WebApiBase.SetCompleted(options, response);
1205
- const res : carriers.ChatTopicAgent = converters.Create_ChatTopicAgent_From( response.data );
1206
- resolve(res);
1207
- }
1208
- catch( err ) {
1209
- base.WebApiBase.HandleError(options, config, err);
1210
- reject(err);
1211
- }
1212
- });
1213
- }
1214
-
1215
-
1216
-
1217
- /**
1218
- * Update a user&apos;s role in a chat topic
1219
- * @param request - ChatTopicId, Username, Useragent
1220
- * @returns The user's role within the chat topic.
1221
- */
1222
- public async updateChatTopicUserAgentAsync(request: carriers.Chat_UpdateChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1223
-
1224
- /**
1225
- * Update a user&apos;s role in a chat topic
1226
- * @param chatTopicId - Id of the chat topic
1227
- * @param username - Associate username or associate id to get.
1228
- * @param useragent - User's updated role within the chat topic.
1229
- * @returns The user's role within the chat topic.
1230
- */
1231
- public async updateChatTopicUserAgentAsync(chatTopicId: number, username: string, useragent: carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1232
-
1233
- public async updateChatTopicUserAgentAsync(chatTopicId:number|carriers.Chat_UpdateChatTopicUserAgentRequest, username?:string|base.WebApiRequestOptions, useragent?:carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1234
- let _request : carriers.Chat_UpdateChatTopicUserAgentRequest = null;
1235
- let _options : base.WebApiRequestOptions = null;
1236
- const first : any = chatTopicId;
1237
- if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.username)!='undefined' || typeof(first.useragent)!='undefined' ) )
1238
- {
1239
- _request = chatTopicId as carriers.Chat_UpdateChatTopicUserAgentRequest;
1240
- _options = username as base.WebApiRequestOptions;
1241
- }
1242
- else
1243
- {
1244
- _request = {
1245
- chatTopicId: chatTopicId as number,
1246
- username: username as string,
1247
- useragent: useragent as carriers.ChatTopicAgent,
1248
- };
1249
- _options = webapi_options;
1250
- }
1251
- return this._updateChatTopicUserAgentAsync( _request, _options );
1252
- }
1253
-
1254
-
1255
- private async _updateChatTopicUserAgentsAsync(request: carriers.Chat_UpdateChatTopicUserAgentsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] > {
1256
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1257
- base.WebApiBase.SetPending(options);
1258
- return new Promise< carriers.ChatTopicAgent[] >(async (resolve, reject) => {
1259
- try {
1260
- config.baseURL = this._options.baseUrl;
1261
- const response = await this._axios.post("UpdateChatTopicUserAgents", request , config);
1262
- base.WebApiBase.SetCompleted(options, response);
1263
- const res : carriers.ChatTopicAgent[] = converters.Create_ChatTopicAgentArray_From( response.data );
1264
- resolve(res);
1265
- }
1266
- catch( err ) {
1267
- base.WebApiBase.HandleError(options, config, err);
1268
- reject(err);
1269
- }
1270
- });
1271
- }
1272
-
1273
-
1274
-
1275
- /**
1276
- * Update users roles in a chat topic
1277
- * @param request - ChatTopicId, Useragents
1278
- * @returns The updated agents within the chat topic.
1279
- */
1280
- public async updateChatTopicUserAgentsAsync(request: carriers.Chat_UpdateChatTopicUserAgentsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
1281
-
1282
- /**
1283
- * Update users roles in a chat topic
1284
- * @param chatTopicId - Id of the chat topic
1285
- * @param useragents - Users new/updated roles within the chat topic. Replaces existing roles
1286
- * @returns The updated agents within the chat topic.
1287
- */
1288
- public async updateChatTopicUserAgentsAsync(chatTopicId: number, useragents: carriers.ChatTopicAgent[], webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
1289
-
1290
- public async updateChatTopicUserAgentsAsync(chatTopicId:number|carriers.Chat_UpdateChatTopicUserAgentsRequest, useragents?:carriers.ChatTopicAgent[]|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] > {
1291
- let _request : carriers.Chat_UpdateChatTopicUserAgentsRequest = null;
1292
- let _options : base.WebApiRequestOptions = null;
1293
- const first : any = chatTopicId;
1294
- if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.useragents)!='undefined' ) )
1295
- {
1296
- _request = chatTopicId as carriers.Chat_UpdateChatTopicUserAgentsRequest;
1297
- _options = useragents as base.WebApiRequestOptions;
1298
- }
1299
- else
1300
- {
1301
- _request = {
1302
- chatTopicId: chatTopicId as number,
1303
- useragents: useragents as carriers.ChatTopicAgent[],
1304
- };
1305
- _options = webapi_options;
1306
- }
1307
- return this._updateChatTopicUserAgentsAsync( _request, _options );
1308
- }
1309
-
1310
-
1311
- private async _deleteChatTopicUserAgentAsync(request: carriers.Chat_DeleteChatTopicUserAgentRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1312
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1313
- base.WebApiBase.SetPending(options);
1314
- return new Promise< void >(async (resolve, reject) => {
1315
- try {
1316
- config.baseURL = this._options.baseUrl;
1317
- const response = await this._axios.post("DeleteChatTopicUserAgent", request , config);
1318
- base.WebApiBase.SetCompleted(options, response);
1319
- const res = response.data;
1320
- resolve(res);
1321
- }
1322
- catch( err ) {
1323
- base.WebApiBase.HandleError(options, config, err);
1324
- reject(err);
1325
- }
1326
- });
1327
- }
1328
-
1329
-
1330
-
1331
- /**
1332
- * Remove a user from a topic
1333
- * @param request - ChatTopicId, Username
1334
- * @returns This method has no return value
1335
- */
1336
- public async deleteChatTopicUserAgentAsync(request: carriers.Chat_DeleteChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1337
-
1338
- /**
1339
- * Remove a user from a topic
1340
- * @param chatTopicId - Id of the chat topic
1341
- * @param username - Associate username or associate id to delete.
1342
- * @returns This method has no return value
1343
- */
1344
- public async deleteChatTopicUserAgentAsync(chatTopicId: number, username: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1345
-
1346
- public async deleteChatTopicUserAgentAsync(chatTopicId:number|carriers.Chat_DeleteChatTopicUserAgentRequest, username?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1347
- let _request : carriers.Chat_DeleteChatTopicUserAgentRequest = null;
1348
- let _options : base.WebApiRequestOptions = null;
1349
- const first : any = chatTopicId;
1350
- if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.username)!='undefined' ) )
1351
- {
1352
- _request = chatTopicId as carriers.Chat_DeleteChatTopicUserAgentRequest;
1353
- _options = username as base.WebApiRequestOptions;
1354
- }
1355
- else
1356
- {
1357
- _request = {
1358
- chatTopicId: chatTopicId as number,
1359
- username: username as string,
1360
- };
1361
- _options = webapi_options;
1362
- }
1363
- return this._deleteChatTopicUserAgentAsync( _request, _options );
1364
- }
1365
-
1366
-
1367
- private async _createChatSessionForTopicAsync(request: carriers.Chat_CreateChatSessionForTopicRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
1368
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1369
- base.WebApiBase.SetPending(options);
1370
- return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
1371
- try {
1372
- config.baseURL = this._options.baseUrl;
1373
- const response = await this._axios.post("CreateChatSessionForTopic", request , config);
1374
- base.WebApiBase.SetCompleted(options, response);
1375
- const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
1376
- resolve(res);
1377
- }
1378
- catch( err ) {
1379
- base.WebApiBase.HandleError(options, config, err);
1380
- reject(err);
1381
- }
1382
- });
1383
- }
1384
-
1385
-
1386
-
1387
- /**
1388
- * Create a new session on a chat topic
1389
- * @param request - ChatTopicId
1390
- * @returns The new chat session.
1391
- */
1392
- public async createChatSessionForTopicAsync(request: carriers.Chat_CreateChatSessionForTopicRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
1393
-
1394
- /**
1395
- * Create a new session on a chat topic
1396
- * @param chatTopicId - Id of the chat topic
1397
- * @returns The new chat session.
1398
- */
1399
- public async createChatSessionForTopicAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
1400
-
1401
- public async createChatSessionForTopicAsync(chatTopicId:number|carriers.Chat_CreateChatSessionForTopicRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
1402
- let _request : carriers.Chat_CreateChatSessionForTopicRequest = null;
1403
- let _options : base.WebApiRequestOptions = null;
1404
- const first : any = chatTopicId;
1405
- if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' ) )
1406
- {
1407
- _request = chatTopicId as carriers.Chat_CreateChatSessionForTopicRequest;
1408
- _options = webapi_options as base.WebApiRequestOptions;
1409
- }
1410
- else
1411
- {
1412
- _request = {
1413
- chatTopicId: chatTopicId as number,
1414
- };
1415
- _options = webapi_options;
1416
- }
1417
- return this._createChatSessionForTopicAsync( _request, _options );
1418
- }
1419
-
1420
- } // class v1ChatAgentController
1421
-
1422
-
1
+ // <auto-generated>
2
+ // SuperOffice Code Generator
3
+ // modelling\templates\servicestswebapi\tswebapiagents.tt
4
+ // </auto-generated>
5
+
6
+
7
+ /* tslint:disable */
8
+ //----------------------------------------------------------------------------
9
+ // G E N E R A T E D F I L E ! D O N O T E D I T !
10
+ //----------------------------------------------------------------------------
11
+ //
12
+ // File: WebApi/ChatAgent.ts
13
+ //
14
+ //----------------------------------------------------------------------------
15
+ // Copyright (C) SuperOffice AS
16
+ //----------------------------------------------------------------------------
17
+
18
+ import { AxiosRequestConfig } from 'axios';
19
+ import { Duration } from 'dayjs/plugin/duration';
20
+ import * as enums from './Enums';
21
+ import * as base from './WebApiBase';
22
+ import * as carriers from './Carriers';
23
+ import * as converters from './Converters';
24
+ import { FromBase64ToString, ToBase64 } from './Base64';
25
+
26
+ /**
27
+ * Chat functions. Manage chat channels, sessions and messages.
28
+ */
29
+ export interface IChatAgent {
30
+ createDefaultChatSessionEntityAsync(): Promise< carriers.ChatSessionEntity >;
31
+ saveChatSessionEntityAsync(entity: carriers.ChatSessionEntity) : Promise< carriers.ChatSessionEntity >;
32
+ deleteChatSessionEntityAsync(ChatSessionEntityId: number) : Promise<void>;
33
+ createDefaultChatTopicAgentAsync(): Promise< carriers.ChatTopicAgent >;
34
+ createDefaultChatTopicEntityAsync(): Promise< carriers.ChatTopicEntity >;
35
+ saveChatTopicEntityAsync(entity: carriers.ChatTopicEntity) : Promise< carriers.ChatTopicEntity >;
36
+ deleteChatTopicEntityAsync(ChatTopicEntityId: number) : Promise<void>;
37
+ getChatPresenceAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatPresence[] >;
38
+ saveChatPresenceAsync(request: carriers.Chat_SaveChatPresenceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
39
+ saveChatPresenceAsync(chatPresence: carriers.ChatPresence[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
40
+ getChatSessionEntityAsync(chatSessionEntityId: number) : Promise< carriers.ChatSessionEntity >;
41
+ chatSessionsForUserAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity[] >;
42
+ transferChatSessionAsync(request: carriers.Chat_TransferChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
43
+ transferChatSessionAsync(chatSessionId: number, toAssociate: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
44
+ acceptChatSessionTransferAsync(request: carriers.Chat_AcceptChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
45
+ acceptChatSessionTransferAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
46
+ rejectChatSessionTransferAsync(request: carriers.Chat_RejectChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
47
+ rejectChatSessionTransferAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
48
+ pickUpChatSessionAsync(request: carriers.Chat_PickUpChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
49
+ pickUpChatSessionAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
50
+ pickUpFirstChatSessionAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
51
+ resetChatSessionAsync(request: carriers.Chat_ResetChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
52
+ resetChatSessionAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
53
+ getChatTranscriptAsync(request: carriers.Chat_GetChatTranscriptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
54
+ getChatTranscriptAsync(chatSessionId: number, html: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
55
+ getChatMessagesAsync(request: carriers.Chat_GetChatMessagesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] >;
56
+ getChatMessagesAsync(chatSessionId: number, after: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] >;
57
+ addChatMessageAsync(request: carriers.Chat_AddChatMessageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage >;
58
+ addChatMessageAsync(chatSessionId: number, message: carriers.ChatMessage, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage >;
59
+ getChatTopicEntityAsync(chatTopicEntityId: number) : Promise< carriers.ChatTopicEntity >;
60
+ isWithinOpeningHoursAsync(request: carriers.Chat_IsWithinOpeningHoursRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
61
+ isWithinOpeningHoursAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
62
+ chatTopicsForUserAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity[] >;
63
+ getUserAgentListAsync(request: carriers.Chat_GetUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] >;
64
+ getUserAgentListAsync(flat: boolean, onlyPresent: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] >;
65
+ getChatTopicUserAgentListAsync(request: carriers.Chat_GetChatTopicUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
66
+ getChatTopicUserAgentListAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
67
+ getChatTopicUserAgentAsync(request: carriers.Chat_GetChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
68
+ getChatTopicUserAgentAsync(chatTopicId: number, username: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
69
+ addChatTopicUserAgentAsync(request: carriers.Chat_AddChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
70
+ addChatTopicUserAgentAsync(chatTopicId: number, useragent: carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
71
+ updateChatTopicUserAgentAsync(request: carriers.Chat_UpdateChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
72
+ updateChatTopicUserAgentAsync(chatTopicId: number, username: string, useragent: carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
73
+ updateChatTopicUserAgentsAsync(request: carriers.Chat_UpdateChatTopicUserAgentsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
74
+ updateChatTopicUserAgentsAsync(chatTopicId: number, useragents: carriers.ChatTopicAgent[], webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
75
+ deleteChatTopicUserAgentAsync(request: carriers.Chat_DeleteChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
76
+ deleteChatTopicUserAgentAsync(chatTopicId: number, username: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
77
+ createChatSessionForTopicAsync(request: carriers.Chat_CreateChatSessionForTopicRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
78
+ createChatSessionForTopicAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
79
+ } // interface IChatAgent
80
+
81
+
82
+
83
+
84
+ /**
85
+ * Chat functions. Manage chat channels, sessions and messages.
86
+ */
87
+ export class ChatAgent extends base.WebApiBase implements IChatAgent {
88
+ constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
89
+ constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
90
+ constructor(baseUrl: string, resourceManager:any);
91
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
92
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
93
+ constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
94
+ constructor(options: base.WebApiOptions);
95
+
96
+ constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
97
+ langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
98
+ langOrResourceOrRM?:string|base.ResourceParsing|any,
99
+ cultureCode?: string,
100
+ ) {
101
+ const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
102
+ options.basePath = "v1/Agents/Chat/";
103
+ super(options);
104
+ }
105
+
106
+
107
+
108
+ /**
109
+ * Set default values into a new ChatSessionEntity.
110
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
111
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
112
+ * @returns A blank entity.
113
+ */
114
+ public async createDefaultChatSessionEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
115
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
116
+ base.WebApiBase.SetPending(options);
117
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
118
+ try {
119
+ const response = await this._axios.post("CreateDefaultChatSessionEntity", null, config);
120
+ base.WebApiBase.SetCompleted(options, response);
121
+ const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
122
+ resolve(res);
123
+ }
124
+ catch( err ) {
125
+ base.WebApiBase.HandleError(options, config, err);
126
+ reject(err);
127
+ }
128
+ });
129
+ }
130
+ /**
131
+ * Replace the existing ChatSessionEntity or creates a new ChatSessionEntity if the id parameter is empty
132
+ * @param entity - The ChatSessionEntity to be saved.
133
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
134
+ * @returns New or updated ChatSessionEntity
135
+ */
136
+ public async saveChatSessionEntityAsync(entity: carriers.ChatSessionEntity, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
137
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
138
+ base.WebApiBase.SetPending(options);
139
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
140
+ try {
141
+ const response = await this._axios.post("SaveChatSessionEntity", entity, config);
142
+ base.WebApiBase.SetCompleted(options, response);
143
+ const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
144
+ resolve(res);
145
+ }
146
+ catch( err ) {
147
+ base.WebApiBase.HandleError(options, config, err);
148
+ reject(err);
149
+ }
150
+ });
151
+ }
152
+
153
+ /**
154
+ * Deletes the ChatSessionEntity
155
+ * @param ChatSessionEntityId - The id of the ChatSessionEntity to be deleted.
156
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
157
+ */
158
+ public async deleteChatSessionEntityAsync(ChatSessionEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
159
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
160
+ base.WebApiBase.SetPending(options);
161
+ return new Promise< void >(async (resolve, reject) => {
162
+ try {
163
+ const response = await this._axios.post("DeleteChatSessionEntity?ChatSessionEntityId=" + ChatSessionEntityId, null, config );
164
+ base.WebApiBase.SetCompleted(options, response);
165
+ const res = response.data;
166
+ resolve(res);
167
+ }
168
+ catch( err ) {
169
+ base.WebApiBase.HandleError(options, config, err);
170
+ reject(err);
171
+ }
172
+ });
173
+ }
174
+
175
+ /**
176
+ * Set default values into a new ChatTopicAgent.
177
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
178
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
179
+ * @returns A blank entity.
180
+ */
181
+ public async createDefaultChatTopicAgentAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
182
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
183
+ base.WebApiBase.SetPending(options);
184
+ return new Promise< carriers.ChatTopicAgent >(async (resolve, reject) => {
185
+ try {
186
+ const response = await this._axios.post("CreateDefaultChatTopicAgent", null, config);
187
+ base.WebApiBase.SetCompleted(options, response);
188
+ const res : carriers.ChatTopicAgent = converters.Create_ChatTopicAgent_From( response.data );
189
+ resolve(res);
190
+ }
191
+ catch( err ) {
192
+ base.WebApiBase.HandleError(options, config, err);
193
+ reject(err);
194
+ }
195
+ });
196
+ }
197
+
198
+ /**
199
+ * Set default values into a new ChatTopicEntity.
200
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
201
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
202
+ * @returns A blank entity.
203
+ */
204
+ public async createDefaultChatTopicEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity > {
205
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
206
+ base.WebApiBase.SetPending(options);
207
+ return new Promise< carriers.ChatTopicEntity >(async (resolve, reject) => {
208
+ try {
209
+ const response = await this._axios.post("CreateDefaultChatTopicEntity", null, config);
210
+ base.WebApiBase.SetCompleted(options, response);
211
+ const res : carriers.ChatTopicEntity = converters.Create_ChatTopicEntity_From( response.data );
212
+ resolve(res);
213
+ }
214
+ catch( err ) {
215
+ base.WebApiBase.HandleError(options, config, err);
216
+ reject(err);
217
+ }
218
+ });
219
+ }
220
+ /**
221
+ * Replace the existing ChatTopicEntity or creates a new ChatTopicEntity if the id parameter is empty
222
+ * @param entity - The ChatTopicEntity to be saved.
223
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
224
+ * @returns New or updated ChatTopicEntity
225
+ */
226
+ public async saveChatTopicEntityAsync(entity: carriers.ChatTopicEntity, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity > {
227
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
228
+ base.WebApiBase.SetPending(options);
229
+ return new Promise< carriers.ChatTopicEntity >(async (resolve, reject) => {
230
+ try {
231
+ const response = await this._axios.post("SaveChatTopicEntity", entity, config);
232
+ base.WebApiBase.SetCompleted(options, response);
233
+ const res : carriers.ChatTopicEntity = converters.Create_ChatTopicEntity_From( response.data );
234
+ resolve(res);
235
+ }
236
+ catch( err ) {
237
+ base.WebApiBase.HandleError(options, config, err);
238
+ reject(err);
239
+ }
240
+ });
241
+ }
242
+
243
+ /**
244
+ * Deletes the ChatTopicEntity
245
+ * @param ChatTopicEntityId - The id of the ChatTopicEntity to be deleted.
246
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
247
+ */
248
+ public async deleteChatTopicEntityAsync(ChatTopicEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
249
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
250
+ base.WebApiBase.SetPending(options);
251
+ return new Promise< void >(async (resolve, reject) => {
252
+ try {
253
+ const response = await this._axios.post("DeleteChatTopicEntity?ChatTopicEntityId=" + ChatTopicEntityId, null, config );
254
+ base.WebApiBase.SetCompleted(options, response);
255
+ const res = response.data;
256
+ resolve(res);
257
+ }
258
+ catch( err ) {
259
+ base.WebApiBase.HandleError(options, config, err);
260
+ reject(err);
261
+ }
262
+ });
263
+ }
264
+
265
+ private async _getChatPresenceAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ChatPresence[] > {
266
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
267
+ base.WebApiBase.SetPending(options);
268
+ return new Promise< carriers.ChatPresence[] >(async (resolve, reject) => {
269
+ try {
270
+ config.baseURL = this._options.baseUrl;
271
+ const response = await this._axios.post("GetChatPresence", undefined , config);
272
+ base.WebApiBase.SetCompleted(options, response);
273
+ const res : carriers.ChatPresence[] = converters.Create_ChatPresenceArray_From( response.data );
274
+ resolve(res);
275
+ }
276
+ catch( err ) {
277
+ base.WebApiBase.HandleError(options, config, err);
278
+ reject(err);
279
+ }
280
+ });
281
+ }
282
+
283
+
284
+ /**
285
+ * Get the chat presence status for all chat users
286
+ * @returns An array with ChatPresence objects for each user
287
+ */
288
+ public async getChatPresenceAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatPresence[] >
289
+ {
290
+ return this._getChatPresenceAsync(webapi_options);
291
+ }
292
+
293
+
294
+ private async _saveChatPresenceAsync(request: carriers.Chat_SaveChatPresenceRequest, options?:base.WebApiRequestOptions) : Promise< void > {
295
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
296
+ base.WebApiBase.SetPending(options);
297
+ return new Promise< void >(async (resolve, reject) => {
298
+ try {
299
+ config.baseURL = this._options.baseUrl;
300
+ const response = await this._axios.post("SaveChatPresence", request , config);
301
+ base.WebApiBase.SetCompleted(options, response);
302
+ const res = response.data;
303
+ resolve(res);
304
+ }
305
+ catch( err ) {
306
+ base.WebApiBase.HandleError(options, config, err);
307
+ reject(err);
308
+ }
309
+ });
310
+ }
311
+
312
+
313
+
314
+ /**
315
+ * Save the chat presence for specified users
316
+ * @param request - ChatPresence
317
+ * @returns void
318
+ */
319
+ public async saveChatPresenceAsync(request: carriers.Chat_SaveChatPresenceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
320
+
321
+ /**
322
+ * Save the chat presence for specified users
323
+ * @param chatPresence - An array with ChatPresence objects. Only the UserId and Present information is used while saving
324
+ * @returns void
325
+ */
326
+ public async saveChatPresenceAsync(chatPresence: carriers.ChatPresence[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
327
+
328
+ public async saveChatPresenceAsync(chatPresence:carriers.ChatPresence[]|carriers.Chat_SaveChatPresenceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
329
+ let _request : carriers.Chat_SaveChatPresenceRequest = null;
330
+ let _options : base.WebApiRequestOptions = null;
331
+ const first : any = chatPresence;
332
+ if( typeof( first ) === "object" && first && ( typeof(first.chatPresence)!='undefined' ) )
333
+ {
334
+ _request = chatPresence as carriers.Chat_SaveChatPresenceRequest;
335
+ _options = webapi_options as base.WebApiRequestOptions;
336
+ }
337
+ else
338
+ {
339
+ _request = {
340
+ chatPresence: chatPresence as carriers.ChatPresence[],
341
+ };
342
+ _options = webapi_options;
343
+ }
344
+ return this._saveChatPresenceAsync( _request, _options );
345
+ }
346
+
347
+ /**
348
+ * Gets a ChatSessionEntity object.
349
+ * @param chatSessionEntityId - The primary key.
350
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
351
+ * @returns A single ChatSessionEntity
352
+ */
353
+ public async getChatSessionEntityAsync(chatSessionEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
354
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
355
+ base.WebApiBase.SetPending(options);
356
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
357
+ try {
358
+ const response = await this._axios.post("GetChatSessionEntity?chatSessionEntityId=" + chatSessionEntityId, null, config);
359
+ base.WebApiBase.SetCompleted(options, response);
360
+ const res = converters.Create_ChatSessionEntity_From( response.data );
361
+ resolve(res);
362
+ }
363
+ catch( err ) {
364
+ base.WebApiBase.HandleError(options, config, err);
365
+ reject(err);
366
+ }
367
+ });
368
+ }
369
+
370
+
371
+ private async _chatSessionsForUserAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity[] > {
372
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
373
+ base.WebApiBase.SetPending(options);
374
+ return new Promise< carriers.ChatSessionEntity[] >(async (resolve, reject) => {
375
+ try {
376
+ config.baseURL = this._options.baseUrl;
377
+ const response = await this._axios.post("ChatSessionsForUser", undefined , config);
378
+ base.WebApiBase.SetCompleted(options, response);
379
+ const res : carriers.ChatSessionEntity[] = converters.Create_ChatSessionEntityArray_From( response.data );
380
+ resolve(res);
381
+ }
382
+ catch( err ) {
383
+ base.WebApiBase.HandleError(options, config, err);
384
+ reject(err);
385
+ }
386
+ });
387
+ }
388
+
389
+
390
+ /**
391
+ * Get all chat sessions which this user is a member of. Members means that you have at least one of: Can Respond, Notifications, Listen or Manager
392
+ * @returns Array of chat sessions the current user can access
393
+ */
394
+ public async chatSessionsForUserAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity[] >
395
+ {
396
+ return this._chatSessionsForUserAsync(webapi_options);
397
+ }
398
+
399
+
400
+ private async _transferChatSessionAsync(request: carriers.Chat_TransferChatSessionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
401
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
402
+ base.WebApiBase.SetPending(options);
403
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
404
+ try {
405
+ config.baseURL = this._options.baseUrl;
406
+ const response = await this._axios.post("TransferChatSession", request , config);
407
+ base.WebApiBase.SetCompleted(options, response);
408
+ const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
409
+ resolve(res);
410
+ }
411
+ catch( err ) {
412
+ base.WebApiBase.HandleError(options, config, err);
413
+ reject(err);
414
+ }
415
+ });
416
+ }
417
+
418
+
419
+
420
+ /**
421
+ * Request to send the session to another user. If the session does not belong to the user, nothing happens.
422
+ * @param request - ChatSessionId, ToAssociate
423
+ * @returns The updated chat session
424
+ */
425
+ public async transferChatSessionAsync(request: carriers.Chat_TransferChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
426
+
427
+ /**
428
+ * Request to send the session to another user. If the session does not belong to the user, nothing happens.
429
+ * @param chatSessionId - id of the chat session to send
430
+ * @param toAssociate - Associate username or associate id to send session to.
431
+ * @returns The updated chat session
432
+ */
433
+ public async transferChatSessionAsync(chatSessionId: number, toAssociate: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
434
+
435
+ public async transferChatSessionAsync(chatSessionId:number|carriers.Chat_TransferChatSessionRequest, toAssociate?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
436
+ let _request : carriers.Chat_TransferChatSessionRequest = null;
437
+ let _options : base.WebApiRequestOptions = null;
438
+ const first : any = chatSessionId;
439
+ if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' || typeof(first.toAssociate)!='undefined' ) )
440
+ {
441
+ _request = chatSessionId as carriers.Chat_TransferChatSessionRequest;
442
+ _options = toAssociate as base.WebApiRequestOptions;
443
+ }
444
+ else
445
+ {
446
+ _request = {
447
+ chatSessionId: chatSessionId as number,
448
+ toAssociate: toAssociate as string,
449
+ };
450
+ _options = webapi_options;
451
+ }
452
+ return this._transferChatSessionAsync( _request, _options );
453
+ }
454
+
455
+
456
+ private async _acceptChatSessionTransferAsync(request: carriers.Chat_AcceptChatSessionTransferRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
457
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
458
+ base.WebApiBase.SetPending(options);
459
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
460
+ try {
461
+ config.baseURL = this._options.baseUrl;
462
+ const response = await this._axios.post("AcceptChatSessionTransfer", request , config);
463
+ base.WebApiBase.SetCompleted(options, response);
464
+ const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
465
+ resolve(res);
466
+ }
467
+ catch( err ) {
468
+ base.WebApiBase.HandleError(options, config, err);
469
+ reject(err);
470
+ }
471
+ });
472
+ }
473
+
474
+
475
+
476
+ /**
477
+ * Accept the transfer: assign the session to the user. If the session is not being transferred, nothing happens.
478
+ * @param request - ChatSessionId
479
+ * @returns The updated chat session
480
+ */
481
+ public async acceptChatSessionTransferAsync(request: carriers.Chat_AcceptChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
482
+
483
+ /**
484
+ * Accept the transfer: assign the session to the user. If the session is not being transferred, nothing happens.
485
+ * @param chatSessionId - id of the chat session to send
486
+ * @returns The updated chat session
487
+ */
488
+ public async acceptChatSessionTransferAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
489
+
490
+ public async acceptChatSessionTransferAsync(chatSessionId:number|carriers.Chat_AcceptChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
491
+ let _request : carriers.Chat_AcceptChatSessionTransferRequest = null;
492
+ let _options : base.WebApiRequestOptions = null;
493
+ const first : any = chatSessionId;
494
+ if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' ) )
495
+ {
496
+ _request = chatSessionId as carriers.Chat_AcceptChatSessionTransferRequest;
497
+ _options = webapi_options as base.WebApiRequestOptions;
498
+ }
499
+ else
500
+ {
501
+ _request = {
502
+ chatSessionId: chatSessionId as number,
503
+ };
504
+ _options = webapi_options;
505
+ }
506
+ return this._acceptChatSessionTransferAsync( _request, _options );
507
+ }
508
+
509
+
510
+ private async _rejectChatSessionTransferAsync(request: carriers.Chat_RejectChatSessionTransferRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
511
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
512
+ base.WebApiBase.SetPending(options);
513
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
514
+ try {
515
+ config.baseURL = this._options.baseUrl;
516
+ const response = await this._axios.post("RejectChatSessionTransfer", request , config);
517
+ base.WebApiBase.SetCompleted(options, response);
518
+ const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
519
+ resolve(res);
520
+ }
521
+ catch( err ) {
522
+ base.WebApiBase.HandleError(options, config, err);
523
+ reject(err);
524
+ }
525
+ });
526
+ }
527
+
528
+
529
+
530
+ /**
531
+ * Do not want. Deny the transfer to the user. If the session is not being transferred, nothing happens.
532
+ * @param request - ChatSessionId
533
+ * @returns The updated chat session
534
+ */
535
+ public async rejectChatSessionTransferAsync(request: carriers.Chat_RejectChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
536
+
537
+ /**
538
+ * Do not want. Deny the transfer to the user. If the session is not being transferred, nothing happens.
539
+ * @param chatSessionId - id of the chat session to send back
540
+ * @returns The updated chat session
541
+ */
542
+ public async rejectChatSessionTransferAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
543
+
544
+ public async rejectChatSessionTransferAsync(chatSessionId:number|carriers.Chat_RejectChatSessionTransferRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
545
+ let _request : carriers.Chat_RejectChatSessionTransferRequest = null;
546
+ let _options : base.WebApiRequestOptions = null;
547
+ const first : any = chatSessionId;
548
+ if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' ) )
549
+ {
550
+ _request = chatSessionId as carriers.Chat_RejectChatSessionTransferRequest;
551
+ _options = webapi_options as base.WebApiRequestOptions;
552
+ }
553
+ else
554
+ {
555
+ _request = {
556
+ chatSessionId: chatSessionId as number,
557
+ };
558
+ _options = webapi_options;
559
+ }
560
+ return this._rejectChatSessionTransferAsync( _request, _options );
561
+ }
562
+
563
+
564
+ private async _pickUpChatSessionAsync(request: carriers.Chat_PickUpChatSessionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
565
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
566
+ base.WebApiBase.SetPending(options);
567
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
568
+ try {
569
+ config.baseURL = this._options.baseUrl;
570
+ const response = await this._axios.post("PickUpChatSession", request , config);
571
+ base.WebApiBase.SetCompleted(options, response);
572
+ const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
573
+ resolve(res);
574
+ }
575
+ catch( err ) {
576
+ base.WebApiBase.HandleError(options, config, err);
577
+ reject(err);
578
+ }
579
+ });
580
+ }
581
+
582
+
583
+
584
+ /**
585
+ * &apos;answer&apos; the session: assign the session to the user. The welcome message is sent to the customer. Returns NULL if session was not in queue.
586
+ * @param request - ChatSessionId
587
+ * @returns The chat session
588
+ */
589
+ public async pickUpChatSessionAsync(request: carriers.Chat_PickUpChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
590
+
591
+ /**
592
+ * &apos;answer&apos; the session: assign the session to the user. The welcome message is sent to the customer. Returns NULL if session was not in queue.
593
+ * @param chatSessionId - id of the chat session to answer
594
+ * @returns The chat session
595
+ */
596
+ public async pickUpChatSessionAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
597
+
598
+ public async pickUpChatSessionAsync(chatSessionId:number|carriers.Chat_PickUpChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
599
+ let _request : carriers.Chat_PickUpChatSessionRequest = null;
600
+ let _options : base.WebApiRequestOptions = null;
601
+ const first : any = chatSessionId;
602
+ if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' ) )
603
+ {
604
+ _request = chatSessionId as carriers.Chat_PickUpChatSessionRequest;
605
+ _options = webapi_options as base.WebApiRequestOptions;
606
+ }
607
+ else
608
+ {
609
+ _request = {
610
+ chatSessionId: chatSessionId as number,
611
+ };
612
+ _options = webapi_options;
613
+ }
614
+ return this._pickUpChatSessionAsync( _request, _options );
615
+ }
616
+
617
+
618
+ private async _pickUpFirstChatSessionAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
619
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
620
+ base.WebApiBase.SetPending(options);
621
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
622
+ try {
623
+ config.baseURL = this._options.baseUrl;
624
+ const response = await this._axios.post("PickUpFirstChatSession", undefined , config);
625
+ base.WebApiBase.SetCompleted(options, response);
626
+ const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
627
+ resolve(res);
628
+ }
629
+ catch( err ) {
630
+ base.WebApiBase.HandleError(options, config, err);
631
+ reject(err);
632
+ }
633
+ });
634
+ }
635
+
636
+
637
+ /**
638
+ * &apos;answer&apos; the first available session from the queue: assign the session to the user. The welcome message is sent to the customer.
639
+ * @returns The picked-up chat session
640
+ */
641
+ public async pickUpFirstChatSessionAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >
642
+ {
643
+ return this._pickUpFirstChatSessionAsync(webapi_options);
644
+ }
645
+
646
+
647
+ private async _resetChatSessionAsync(request: carriers.Chat_ResetChatSessionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
648
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
649
+ base.WebApiBase.SetPending(options);
650
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
651
+ try {
652
+ config.baseURL = this._options.baseUrl;
653
+ const response = await this._axios.post("ResetChatSession", request , config);
654
+ base.WebApiBase.SetCompleted(options, response);
655
+ const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
656
+ resolve(res);
657
+ }
658
+ catch( err ) {
659
+ base.WebApiBase.HandleError(options, config, err);
660
+ reject(err);
661
+ }
662
+ });
663
+ }
664
+
665
+
666
+
667
+ /**
668
+ * Reset chat session, put it back on the queue for pickup. Used by bots to hand off a session to human
669
+ * @param request - ChatSessionId
670
+ * @returns The updated chat session
671
+ */
672
+ public async resetChatSessionAsync(request: carriers.Chat_ResetChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
673
+
674
+ /**
675
+ * Reset chat session, put it back on the queue for pickup. Used by bots to hand off a session to human
676
+ * @param chatSessionId - id of the chat session to reset
677
+ * @returns The updated chat session
678
+ */
679
+ public async resetChatSessionAsync(chatSessionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
680
+
681
+ public async resetChatSessionAsync(chatSessionId:number|carriers.Chat_ResetChatSessionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
682
+ let _request : carriers.Chat_ResetChatSessionRequest = null;
683
+ let _options : base.WebApiRequestOptions = null;
684
+ const first : any = chatSessionId;
685
+ if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' ) )
686
+ {
687
+ _request = chatSessionId as carriers.Chat_ResetChatSessionRequest;
688
+ _options = webapi_options as base.WebApiRequestOptions;
689
+ }
690
+ else
691
+ {
692
+ _request = {
693
+ chatSessionId: chatSessionId as number,
694
+ };
695
+ _options = webapi_options;
696
+ }
697
+ return this._resetChatSessionAsync( _request, _options );
698
+ }
699
+
700
+
701
+ private async _getChatTranscriptAsync(request: carriers.Chat_GetChatTranscriptRequest, options?:base.WebApiRequestOptions) : Promise< string > {
702
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
703
+ base.WebApiBase.SetPending(options);
704
+ return new Promise< string >(async (resolve, reject) => {
705
+ try {
706
+ config.baseURL = this._options.baseUrl;
707
+ const response = await this._axios.post("GetChatTranscript", request , config);
708
+ base.WebApiBase.SetCompleted(options, response);
709
+ const res : string = response.data as string;
710
+ resolve(res);
711
+ }
712
+ catch( err ) {
713
+ base.WebApiBase.HandleError(options, config, err);
714
+ reject(err);
715
+ }
716
+ });
717
+ }
718
+
719
+
720
+
721
+ /**
722
+ * Get the chat transcript, formatted as plain text or html
723
+ * @param request - ChatSessionId, Html
724
+ * @returns The transcript in text or HTML
725
+ */
726
+ public async getChatTranscriptAsync(request: carriers.Chat_GetChatTranscriptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
727
+
728
+ /**
729
+ * Get the chat transcript, formatted as plain text or html
730
+ * @param chatSessionId - id of the chat session to get the transcript for
731
+ * @param html - Get transcript as HTML
732
+ * @returns The transcript in text or HTML
733
+ */
734
+ public async getChatTranscriptAsync(chatSessionId: number, html: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
735
+
736
+ public async getChatTranscriptAsync(chatSessionId:number|carriers.Chat_GetChatTranscriptRequest, html?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
737
+ let _request : carriers.Chat_GetChatTranscriptRequest = null;
738
+ let _options : base.WebApiRequestOptions = null;
739
+ const first : any = chatSessionId;
740
+ if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' || typeof(first.html)!='undefined' ) )
741
+ {
742
+ _request = chatSessionId as carriers.Chat_GetChatTranscriptRequest;
743
+ _options = html as base.WebApiRequestOptions;
744
+ }
745
+ else
746
+ {
747
+ _request = {
748
+ chatSessionId: chatSessionId as number,
749
+ html: html as boolean,
750
+ };
751
+ _options = webapi_options;
752
+ }
753
+ return this._getChatTranscriptAsync( _request, _options );
754
+ }
755
+
756
+
757
+ private async _getChatMessagesAsync(request: carriers.Chat_GetChatMessagesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] > {
758
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
759
+ base.WebApiBase.SetPending(options);
760
+ return new Promise< carriers.ChatMessage[] >(async (resolve, reject) => {
761
+ try {
762
+ config.baseURL = this._options.baseUrl;
763
+ const response = await this._axios.post("GetChatMessages", request , config);
764
+ base.WebApiBase.SetCompleted(options, response);
765
+ const res : carriers.ChatMessage[] = converters.Create_ChatMessageArray_From( response.data );
766
+ resolve(res);
767
+ }
768
+ catch( err ) {
769
+ base.WebApiBase.HandleError(options, config, err);
770
+ reject(err);
771
+ }
772
+ });
773
+ }
774
+
775
+
776
+
777
+ /**
778
+ * Get all or some of the messages in a chat session
779
+ * @param request - ChatSessionId, After
780
+ * @returns Array of chat messages in the session
781
+ */
782
+ public async getChatMessagesAsync(request: carriers.Chat_GetChatMessagesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] >;
783
+
784
+ /**
785
+ * Get all or some of the messages in a chat session
786
+ * @param chatSessionId - id of the chat session to reset
787
+ * @param after - Return messages after this message id
788
+ * @returns Array of chat messages in the session
789
+ */
790
+ public async getChatMessagesAsync(chatSessionId: number, after: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] >;
791
+
792
+ public async getChatMessagesAsync(chatSessionId:number|carriers.Chat_GetChatMessagesRequest, after?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage[] > {
793
+ let _request : carriers.Chat_GetChatMessagesRequest = null;
794
+ let _options : base.WebApiRequestOptions = null;
795
+ const first : any = chatSessionId;
796
+ if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' || typeof(first.after)!='undefined' ) )
797
+ {
798
+ _request = chatSessionId as carriers.Chat_GetChatMessagesRequest;
799
+ _options = after as base.WebApiRequestOptions;
800
+ }
801
+ else
802
+ {
803
+ _request = {
804
+ chatSessionId: chatSessionId as number,
805
+ after: after as number,
806
+ };
807
+ _options = webapi_options;
808
+ }
809
+ return this._getChatMessagesAsync( _request, _options );
810
+ }
811
+
812
+
813
+ private async _addChatMessageAsync(request: carriers.Chat_AddChatMessageRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage > {
814
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
815
+ base.WebApiBase.SetPending(options);
816
+ return new Promise< carriers.ChatMessage >(async (resolve, reject) => {
817
+ try {
818
+ config.baseURL = this._options.baseUrl;
819
+ const response = await this._axios.post("AddChatMessage", request , config);
820
+ base.WebApiBase.SetCompleted(options, response);
821
+ const res : carriers.ChatMessage = converters.Create_ChatMessage_From( response.data );
822
+ resolve(res);
823
+ }
824
+ catch( err ) {
825
+ base.WebApiBase.HandleError(options, config, err);
826
+ reject(err);
827
+ }
828
+ });
829
+ }
830
+
831
+
832
+
833
+ /**
834
+ * Add a new message to a chat session
835
+ * @param request - ChatSessionId, Message
836
+ * @returns The chat message added to the session
837
+ */
838
+ public async addChatMessageAsync(request: carriers.Chat_AddChatMessageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage >;
839
+
840
+ /**
841
+ * Add a new message to a chat session
842
+ * @param chatSessionId - id of the chat session to add message to
843
+ * @param message - Message to add
844
+ * @returns The chat message added to the session
845
+ */
846
+ public async addChatMessageAsync(chatSessionId: number, message: carriers.ChatMessage, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage >;
847
+
848
+ public async addChatMessageAsync(chatSessionId:number|carriers.Chat_AddChatMessageRequest, message?:carriers.ChatMessage|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatMessage > {
849
+ let _request : carriers.Chat_AddChatMessageRequest = null;
850
+ let _options : base.WebApiRequestOptions = null;
851
+ const first : any = chatSessionId;
852
+ if( typeof( first ) === "object" && first && ( typeof(first.chatSessionId)!='undefined' || typeof(first.message)!='undefined' ) )
853
+ {
854
+ _request = chatSessionId as carriers.Chat_AddChatMessageRequest;
855
+ _options = message as base.WebApiRequestOptions;
856
+ }
857
+ else
858
+ {
859
+ _request = {
860
+ chatSessionId: chatSessionId as number,
861
+ message: message as carriers.ChatMessage,
862
+ };
863
+ _options = webapi_options;
864
+ }
865
+ return this._addChatMessageAsync( _request, _options );
866
+ }
867
+
868
+ /**
869
+ * Gets a ChatTopicEntity object.
870
+ * @param chatTopicEntityId - The primary key.
871
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
872
+ * @returns A single ChatTopicEntity
873
+ */
874
+ public async getChatTopicEntityAsync(chatTopicEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity > {
875
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
876
+ base.WebApiBase.SetPending(options);
877
+ return new Promise< carriers.ChatTopicEntity >(async (resolve, reject) => {
878
+ try {
879
+ const response = await this._axios.post("GetChatTopicEntity?chatTopicEntityId=" + chatTopicEntityId, null, config);
880
+ base.WebApiBase.SetCompleted(options, response);
881
+ const res = converters.Create_ChatTopicEntity_From( response.data );
882
+ resolve(res);
883
+ }
884
+ catch( err ) {
885
+ base.WebApiBase.HandleError(options, config, err);
886
+ reject(err);
887
+ }
888
+ });
889
+ }
890
+
891
+
892
+ private async _isWithinOpeningHoursAsync(request: carriers.Chat_IsWithinOpeningHoursRequest, options?:base.WebApiRequestOptions) : Promise< boolean > {
893
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
894
+ base.WebApiBase.SetPending(options);
895
+ return new Promise< boolean >(async (resolve, reject) => {
896
+ try {
897
+ config.baseURL = this._options.baseUrl;
898
+ const response = await this._axios.post("IsWithinOpeningHours", request , config);
899
+ base.WebApiBase.SetCompleted(options, response);
900
+ const res : boolean = response.data as boolean;
901
+ resolve(res);
902
+ }
903
+ catch( err ) {
904
+ base.WebApiBase.HandleError(options, config, err);
905
+ reject(err);
906
+ }
907
+ });
908
+ }
909
+
910
+
911
+
912
+ /**
913
+ * Check if we are right now within the opening hours of the given topic. Will use timezones to calculate if configured.
914
+ * @param request - ChatTopicId
915
+ * @returns True if we are within opening hours, or if the topic does not use opening hours
916
+ */
917
+ public async isWithinOpeningHoursAsync(request: carriers.Chat_IsWithinOpeningHoursRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
918
+
919
+ /**
920
+ * Check if we are right now within the opening hours of the given topic. Will use timezones to calculate if configured.
921
+ * @param chatTopicId - The id of the topic to check
922
+ * @returns True if we are within opening hours, or if the topic does not use opening hours
923
+ */
924
+ public async isWithinOpeningHoursAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
925
+
926
+ public async isWithinOpeningHoursAsync(chatTopicId:number|carriers.Chat_IsWithinOpeningHoursRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean > {
927
+ let _request : carriers.Chat_IsWithinOpeningHoursRequest = null;
928
+ let _options : base.WebApiRequestOptions = null;
929
+ const first : any = chatTopicId;
930
+ if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' ) )
931
+ {
932
+ _request = chatTopicId as carriers.Chat_IsWithinOpeningHoursRequest;
933
+ _options = webapi_options as base.WebApiRequestOptions;
934
+ }
935
+ else
936
+ {
937
+ _request = {
938
+ chatTopicId: chatTopicId as number,
939
+ };
940
+ _options = webapi_options;
941
+ }
942
+ return this._isWithinOpeningHoursAsync( _request, _options );
943
+ }
944
+
945
+
946
+ private async _chatTopicsForUserAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity[] > {
947
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
948
+ base.WebApiBase.SetPending(options);
949
+ return new Promise< carriers.ChatTopicEntity[] >(async (resolve, reject) => {
950
+ try {
951
+ config.baseURL = this._options.baseUrl;
952
+ const response = await this._axios.post("ChatTopicsForUser", undefined , config);
953
+ base.WebApiBase.SetCompleted(options, response);
954
+ const res : carriers.ChatTopicEntity[] = converters.Create_ChatTopicEntityArray_From( response.data );
955
+ resolve(res);
956
+ }
957
+ catch( err ) {
958
+ base.WebApiBase.HandleError(options, config, err);
959
+ reject(err);
960
+ }
961
+ });
962
+ }
963
+
964
+
965
+ /**
966
+ * Get all chat topics which this user is a member of. Members means that you have at least one of: Can Respond, Notifications, Listen or Manager
967
+ * @returns Array of chat topics the current user can access
968
+ */
969
+ public async chatTopicsForUserAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicEntity[] >
970
+ {
971
+ return this._chatTopicsForUserAsync(webapi_options);
972
+ }
973
+
974
+
975
+ private async _getUserAgentListAsync(request: carriers.Chat_GetUserAgentListRequest, options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] > {
976
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
977
+ base.WebApiBase.SetPending(options);
978
+ return new Promise< carriers.MDOListItem[] >(async (resolve, reject) => {
979
+ try {
980
+ config.baseURL = this._options.baseUrl;
981
+ const response = await this._axios.post("GetUserAgentList", request , config);
982
+ base.WebApiBase.SetCompleted(options, response);
983
+ const res : carriers.MDOListItem[] = converters.Create_MDOListItemArray_From( response.data );
984
+ resolve(res);
985
+ }
986
+ catch( err ) {
987
+ base.WebApiBase.HandleError(options, config, err);
988
+ reject(err);
989
+ }
990
+ });
991
+ }
992
+
993
+
994
+
995
+ /**
996
+ * Get list of users that can be assigned to chat topics. Users with Chat-CALs from the MDO list &apos;chatuser&apos;
997
+ * @param request - Flat, OnlyPresent
998
+ * @returns List of user agents that can be assigned to chat topics, possibly grouped by usergroup.
999
+ */
1000
+ public async getUserAgentListAsync(request: carriers.Chat_GetUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] >;
1001
+
1002
+ /**
1003
+ * Get list of users that can be assigned to chat topics. Users with Chat-CALs from the MDO list &apos;chatuser&apos;
1004
+ * @param flat - Return flat list instead of grouping by usergroup.
1005
+ * @param onlyPresent - Only show users who are present
1006
+ * @returns List of user agents that can be assigned to chat topics, possibly grouped by usergroup.
1007
+ */
1008
+ public async getUserAgentListAsync(flat: boolean, onlyPresent: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] >;
1009
+
1010
+ public async getUserAgentListAsync(flat:boolean|carriers.Chat_GetUserAgentListRequest, onlyPresent?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.MDOListItem[] > {
1011
+ let _request : carriers.Chat_GetUserAgentListRequest = null;
1012
+ let _options : base.WebApiRequestOptions = null;
1013
+ const first : any = flat;
1014
+ if( typeof( first ) === "object" && first && ( typeof(first.flat)!='undefined' || typeof(first.onlyPresent)!='undefined' ) )
1015
+ {
1016
+ _request = flat as carriers.Chat_GetUserAgentListRequest;
1017
+ _options = onlyPresent as base.WebApiRequestOptions;
1018
+ }
1019
+ else
1020
+ {
1021
+ _request = {
1022
+ flat: flat as boolean,
1023
+ onlyPresent: onlyPresent as boolean,
1024
+ };
1025
+ _options = webapi_options;
1026
+ }
1027
+ return this._getUserAgentListAsync( _request, _options );
1028
+ }
1029
+
1030
+
1031
+ private async _getChatTopicUserAgentListAsync(request: carriers.Chat_GetChatTopicUserAgentListRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] > {
1032
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1033
+ base.WebApiBase.SetPending(options);
1034
+ return new Promise< carriers.ChatTopicAgent[] >(async (resolve, reject) => {
1035
+ try {
1036
+ config.baseURL = this._options.baseUrl;
1037
+ const response = await this._axios.post("GetChatTopicUserAgentList", request , config);
1038
+ base.WebApiBase.SetCompleted(options, response);
1039
+ const res : carriers.ChatTopicAgent[] = converters.Create_ChatTopicAgentArray_From( response.data );
1040
+ resolve(res);
1041
+ }
1042
+ catch( err ) {
1043
+ base.WebApiBase.HandleError(options, config, err);
1044
+ reject(err);
1045
+ }
1046
+ });
1047
+ }
1048
+
1049
+
1050
+
1051
+ /**
1052
+ * Get list of users assigned to a chat topic
1053
+ * @param request - ChatTopicId
1054
+ * @returns List of user agents assigned to chat topic.
1055
+ */
1056
+ public async getChatTopicUserAgentListAsync(request: carriers.Chat_GetChatTopicUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
1057
+
1058
+ /**
1059
+ * Get list of users assigned to a chat topic
1060
+ * @param chatTopicId - Id of the chat topic
1061
+ * @returns List of user agents assigned to chat topic.
1062
+ */
1063
+ public async getChatTopicUserAgentListAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
1064
+
1065
+ public async getChatTopicUserAgentListAsync(chatTopicId:number|carriers.Chat_GetChatTopicUserAgentListRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] > {
1066
+ let _request : carriers.Chat_GetChatTopicUserAgentListRequest = null;
1067
+ let _options : base.WebApiRequestOptions = null;
1068
+ const first : any = chatTopicId;
1069
+ if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' ) )
1070
+ {
1071
+ _request = chatTopicId as carriers.Chat_GetChatTopicUserAgentListRequest;
1072
+ _options = webapi_options as base.WebApiRequestOptions;
1073
+ }
1074
+ else
1075
+ {
1076
+ _request = {
1077
+ chatTopicId: chatTopicId as number,
1078
+ };
1079
+ _options = webapi_options;
1080
+ }
1081
+ return this._getChatTopicUserAgentListAsync( _request, _options );
1082
+ }
1083
+
1084
+
1085
+ private async _getChatTopicUserAgentAsync(request: carriers.Chat_GetChatTopicUserAgentRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1086
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1087
+ base.WebApiBase.SetPending(options);
1088
+ return new Promise< carriers.ChatTopicAgent >(async (resolve, reject) => {
1089
+ try {
1090
+ config.baseURL = this._options.baseUrl;
1091
+ const response = await this._axios.post("GetChatTopicUserAgent", request , config);
1092
+ base.WebApiBase.SetCompleted(options, response);
1093
+ const res : carriers.ChatTopicAgent = converters.Create_ChatTopicAgent_From( response.data );
1094
+ resolve(res);
1095
+ }
1096
+ catch( err ) {
1097
+ base.WebApiBase.HandleError(options, config, err);
1098
+ reject(err);
1099
+ }
1100
+ });
1101
+ }
1102
+
1103
+
1104
+
1105
+ /**
1106
+ * Get a user assigned to a topic
1107
+ * @param request - ChatTopicId, Username
1108
+ * @returns The user's role within the chat topic.
1109
+ */
1110
+ public async getChatTopicUserAgentAsync(request: carriers.Chat_GetChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1111
+
1112
+ /**
1113
+ * Get a user assigned to a topic
1114
+ * @param chatTopicId - Id of the chat topic
1115
+ * @param username - Associate username or associate id to get.
1116
+ * @returns The user's role within the chat topic.
1117
+ */
1118
+ public async getChatTopicUserAgentAsync(chatTopicId: number, username: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1119
+
1120
+ public async getChatTopicUserAgentAsync(chatTopicId:number|carriers.Chat_GetChatTopicUserAgentRequest, username?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1121
+ let _request : carriers.Chat_GetChatTopicUserAgentRequest = null;
1122
+ let _options : base.WebApiRequestOptions = null;
1123
+ const first : any = chatTopicId;
1124
+ if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.username)!='undefined' ) )
1125
+ {
1126
+ _request = chatTopicId as carriers.Chat_GetChatTopicUserAgentRequest;
1127
+ _options = username as base.WebApiRequestOptions;
1128
+ }
1129
+ else
1130
+ {
1131
+ _request = {
1132
+ chatTopicId: chatTopicId as number,
1133
+ username: username as string,
1134
+ };
1135
+ _options = webapi_options;
1136
+ }
1137
+ return this._getChatTopicUserAgentAsync( _request, _options );
1138
+ }
1139
+
1140
+
1141
+ private async _addChatTopicUserAgentAsync(request: carriers.Chat_AddChatTopicUserAgentRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1142
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1143
+ base.WebApiBase.SetPending(options);
1144
+ return new Promise< carriers.ChatTopicAgent >(async (resolve, reject) => {
1145
+ try {
1146
+ config.baseURL = this._options.baseUrl;
1147
+ const response = await this._axios.post("AddChatTopicUserAgent", request , config);
1148
+ base.WebApiBase.SetCompleted(options, response);
1149
+ const res : carriers.ChatTopicAgent = converters.Create_ChatTopicAgent_From( response.data );
1150
+ resolve(res);
1151
+ }
1152
+ catch( err ) {
1153
+ base.WebApiBase.HandleError(options, config, err);
1154
+ reject(err);
1155
+ }
1156
+ });
1157
+ }
1158
+
1159
+
1160
+
1161
+ /**
1162
+ * Add a user to a chat topic
1163
+ * @param request - ChatTopicId, Useragent
1164
+ * @returns The user's role within the chat topic.
1165
+ */
1166
+ public async addChatTopicUserAgentAsync(request: carriers.Chat_AddChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1167
+
1168
+ /**
1169
+ * Add a user to a chat topic
1170
+ * @param chatTopicId - Id of the chat topic
1171
+ * @param useragent - User's role within the chat topic to add to topic.
1172
+ * @returns The user's role within the chat topic.
1173
+ */
1174
+ public async addChatTopicUserAgentAsync(chatTopicId: number, useragent: carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1175
+
1176
+ public async addChatTopicUserAgentAsync(chatTopicId:number|carriers.Chat_AddChatTopicUserAgentRequest, useragent?:carriers.ChatTopicAgent|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1177
+ let _request : carriers.Chat_AddChatTopicUserAgentRequest = null;
1178
+ let _options : base.WebApiRequestOptions = null;
1179
+ const first : any = chatTopicId;
1180
+ if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.useragent)!='undefined' ) )
1181
+ {
1182
+ _request = chatTopicId as carriers.Chat_AddChatTopicUserAgentRequest;
1183
+ _options = useragent as base.WebApiRequestOptions;
1184
+ }
1185
+ else
1186
+ {
1187
+ _request = {
1188
+ chatTopicId: chatTopicId as number,
1189
+ useragent: useragent as carriers.ChatTopicAgent,
1190
+ };
1191
+ _options = webapi_options;
1192
+ }
1193
+ return this._addChatTopicUserAgentAsync( _request, _options );
1194
+ }
1195
+
1196
+
1197
+ private async _updateChatTopicUserAgentAsync(request: carriers.Chat_UpdateChatTopicUserAgentRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1198
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1199
+ base.WebApiBase.SetPending(options);
1200
+ return new Promise< carriers.ChatTopicAgent >(async (resolve, reject) => {
1201
+ try {
1202
+ config.baseURL = this._options.baseUrl;
1203
+ const response = await this._axios.post("UpdateChatTopicUserAgent", request , config);
1204
+ base.WebApiBase.SetCompleted(options, response);
1205
+ const res : carriers.ChatTopicAgent = converters.Create_ChatTopicAgent_From( response.data );
1206
+ resolve(res);
1207
+ }
1208
+ catch( err ) {
1209
+ base.WebApiBase.HandleError(options, config, err);
1210
+ reject(err);
1211
+ }
1212
+ });
1213
+ }
1214
+
1215
+
1216
+
1217
+ /**
1218
+ * Update a user&apos;s role in a chat topic
1219
+ * @param request - ChatTopicId, Username, Useragent
1220
+ * @returns The user's role within the chat topic.
1221
+ */
1222
+ public async updateChatTopicUserAgentAsync(request: carriers.Chat_UpdateChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1223
+
1224
+ /**
1225
+ * Update a user&apos;s role in a chat topic
1226
+ * @param chatTopicId - Id of the chat topic
1227
+ * @param username - Associate username or associate id to get.
1228
+ * @param useragent - User's updated role within the chat topic.
1229
+ * @returns The user's role within the chat topic.
1230
+ */
1231
+ public async updateChatTopicUserAgentAsync(chatTopicId: number, username: string, useragent: carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent >;
1232
+
1233
+ public async updateChatTopicUserAgentAsync(chatTopicId:number|carriers.Chat_UpdateChatTopicUserAgentRequest, username?:string|base.WebApiRequestOptions, useragent?:carriers.ChatTopicAgent, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent > {
1234
+ let _request : carriers.Chat_UpdateChatTopicUserAgentRequest = null;
1235
+ let _options : base.WebApiRequestOptions = null;
1236
+ const first : any = chatTopicId;
1237
+ if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.username)!='undefined' || typeof(first.useragent)!='undefined' ) )
1238
+ {
1239
+ _request = chatTopicId as carriers.Chat_UpdateChatTopicUserAgentRequest;
1240
+ _options = username as base.WebApiRequestOptions;
1241
+ }
1242
+ else
1243
+ {
1244
+ _request = {
1245
+ chatTopicId: chatTopicId as number,
1246
+ username: username as string,
1247
+ useragent: useragent as carriers.ChatTopicAgent,
1248
+ };
1249
+ _options = webapi_options;
1250
+ }
1251
+ return this._updateChatTopicUserAgentAsync( _request, _options );
1252
+ }
1253
+
1254
+
1255
+ private async _updateChatTopicUserAgentsAsync(request: carriers.Chat_UpdateChatTopicUserAgentsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] > {
1256
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1257
+ base.WebApiBase.SetPending(options);
1258
+ return new Promise< carriers.ChatTopicAgent[] >(async (resolve, reject) => {
1259
+ try {
1260
+ config.baseURL = this._options.baseUrl;
1261
+ const response = await this._axios.post("UpdateChatTopicUserAgents", request , config);
1262
+ base.WebApiBase.SetCompleted(options, response);
1263
+ const res : carriers.ChatTopicAgent[] = converters.Create_ChatTopicAgentArray_From( response.data );
1264
+ resolve(res);
1265
+ }
1266
+ catch( err ) {
1267
+ base.WebApiBase.HandleError(options, config, err);
1268
+ reject(err);
1269
+ }
1270
+ });
1271
+ }
1272
+
1273
+
1274
+
1275
+ /**
1276
+ * Update users roles in a chat topic
1277
+ * @param request - ChatTopicId, Useragents
1278
+ * @returns The updated agents within the chat topic.
1279
+ */
1280
+ public async updateChatTopicUserAgentsAsync(request: carriers.Chat_UpdateChatTopicUserAgentsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
1281
+
1282
+ /**
1283
+ * Update users roles in a chat topic
1284
+ * @param chatTopicId - Id of the chat topic
1285
+ * @param useragents - Users new/updated roles within the chat topic. Replaces existing roles
1286
+ * @returns The updated agents within the chat topic.
1287
+ */
1288
+ public async updateChatTopicUserAgentsAsync(chatTopicId: number, useragents: carriers.ChatTopicAgent[], webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] >;
1289
+
1290
+ public async updateChatTopicUserAgentsAsync(chatTopicId:number|carriers.Chat_UpdateChatTopicUserAgentsRequest, useragents?:carriers.ChatTopicAgent[]|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatTopicAgent[] > {
1291
+ let _request : carriers.Chat_UpdateChatTopicUserAgentsRequest = null;
1292
+ let _options : base.WebApiRequestOptions = null;
1293
+ const first : any = chatTopicId;
1294
+ if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.useragents)!='undefined' ) )
1295
+ {
1296
+ _request = chatTopicId as carriers.Chat_UpdateChatTopicUserAgentsRequest;
1297
+ _options = useragents as base.WebApiRequestOptions;
1298
+ }
1299
+ else
1300
+ {
1301
+ _request = {
1302
+ chatTopicId: chatTopicId as number,
1303
+ useragents: useragents as carriers.ChatTopicAgent[],
1304
+ };
1305
+ _options = webapi_options;
1306
+ }
1307
+ return this._updateChatTopicUserAgentsAsync( _request, _options );
1308
+ }
1309
+
1310
+
1311
+ private async _deleteChatTopicUserAgentAsync(request: carriers.Chat_DeleteChatTopicUserAgentRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1312
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1313
+ base.WebApiBase.SetPending(options);
1314
+ return new Promise< void >(async (resolve, reject) => {
1315
+ try {
1316
+ config.baseURL = this._options.baseUrl;
1317
+ const response = await this._axios.post("DeleteChatTopicUserAgent", request , config);
1318
+ base.WebApiBase.SetCompleted(options, response);
1319
+ const res = response.data;
1320
+ resolve(res);
1321
+ }
1322
+ catch( err ) {
1323
+ base.WebApiBase.HandleError(options, config, err);
1324
+ reject(err);
1325
+ }
1326
+ });
1327
+ }
1328
+
1329
+
1330
+
1331
+ /**
1332
+ * Remove a user from a topic
1333
+ * @param request - ChatTopicId, Username
1334
+ * @returns This method has no return value
1335
+ */
1336
+ public async deleteChatTopicUserAgentAsync(request: carriers.Chat_DeleteChatTopicUserAgentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1337
+
1338
+ /**
1339
+ * Remove a user from a topic
1340
+ * @param chatTopicId - Id of the chat topic
1341
+ * @param username - Associate username or associate id to delete.
1342
+ * @returns This method has no return value
1343
+ */
1344
+ public async deleteChatTopicUserAgentAsync(chatTopicId: number, username: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1345
+
1346
+ public async deleteChatTopicUserAgentAsync(chatTopicId:number|carriers.Chat_DeleteChatTopicUserAgentRequest, username?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1347
+ let _request : carriers.Chat_DeleteChatTopicUserAgentRequest = null;
1348
+ let _options : base.WebApiRequestOptions = null;
1349
+ const first : any = chatTopicId;
1350
+ if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.username)!='undefined' ) )
1351
+ {
1352
+ _request = chatTopicId as carriers.Chat_DeleteChatTopicUserAgentRequest;
1353
+ _options = username as base.WebApiRequestOptions;
1354
+ }
1355
+ else
1356
+ {
1357
+ _request = {
1358
+ chatTopicId: chatTopicId as number,
1359
+ username: username as string,
1360
+ };
1361
+ _options = webapi_options;
1362
+ }
1363
+ return this._deleteChatTopicUserAgentAsync( _request, _options );
1364
+ }
1365
+
1366
+
1367
+ private async _createChatSessionForTopicAsync(request: carriers.Chat_CreateChatSessionForTopicRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
1368
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1369
+ base.WebApiBase.SetPending(options);
1370
+ return new Promise< carriers.ChatSessionEntity >(async (resolve, reject) => {
1371
+ try {
1372
+ config.baseURL = this._options.baseUrl;
1373
+ const response = await this._axios.post("CreateChatSessionForTopic", request , config);
1374
+ base.WebApiBase.SetCompleted(options, response);
1375
+ const res : carriers.ChatSessionEntity = converters.Create_ChatSessionEntity_From( response.data );
1376
+ resolve(res);
1377
+ }
1378
+ catch( err ) {
1379
+ base.WebApiBase.HandleError(options, config, err);
1380
+ reject(err);
1381
+ }
1382
+ });
1383
+ }
1384
+
1385
+
1386
+
1387
+ /**
1388
+ * Create a new session on a chat topic
1389
+ * @param request - ChatTopicId
1390
+ * @returns The new chat session.
1391
+ */
1392
+ public async createChatSessionForTopicAsync(request: carriers.Chat_CreateChatSessionForTopicRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
1393
+
1394
+ /**
1395
+ * Create a new session on a chat topic
1396
+ * @param chatTopicId - Id of the chat topic
1397
+ * @returns The new chat session.
1398
+ */
1399
+ public async createChatSessionForTopicAsync(chatTopicId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity >;
1400
+
1401
+ public async createChatSessionForTopicAsync(chatTopicId:number|carriers.Chat_CreateChatSessionForTopicRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatSessionEntity > {
1402
+ let _request : carriers.Chat_CreateChatSessionForTopicRequest = null;
1403
+ let _options : base.WebApiRequestOptions = null;
1404
+ const first : any = chatTopicId;
1405
+ if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' ) )
1406
+ {
1407
+ _request = chatTopicId as carriers.Chat_CreateChatSessionForTopicRequest;
1408
+ _options = webapi_options as base.WebApiRequestOptions;
1409
+ }
1410
+ else
1411
+ {
1412
+ _request = {
1413
+ chatTopicId: chatTopicId as number,
1414
+ };
1415
+ _options = webapi_options;
1416
+ }
1417
+ return this._createChatSessionForTopicAsync( _request, _options );
1418
+ }
1419
+
1420
+ } // class v1ChatAgentController
1421
+
1422
+