@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
@@ -1,780 +1,780 @@
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/PocketAgent.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
- * Agent with Pocket specific functionality
28
- */
29
- export interface IPocketAgent {
30
- getMyCallerIDsAsync(request: carriers.Pocket_GetMyCallerIDsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
31
- getMyCallerIDsAsync(lastHash: string, minDate: Date, maxDate: Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
32
- getCallerIDsFromSelectionAsync(request: carriers.Pocket_GetCallerIDsFromSelectionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
33
- getCallerIDsFromSelectionAsync(selectionId: number, lastHash: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
34
- getPocketStartupDataAsync(request: carriers.Pocket_GetPocketStartupDataRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData >;
35
- getPocketStartupDataAsync(tables: string[], currentClientTime: Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData >;
36
- registerDeviceForPushNotificationAsync(request: carriers.Pocket_RegisterDeviceForPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
37
- registerDeviceForPushNotificationAsync(deviceInfo: carriers.PocketDeviceInfo, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
38
- getRegisteredDevicesAsync(request: carriers.Pocket_GetRegisteredDevicesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] >;
39
- getRegisteredDevicesAsync(associateId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] >;
40
- setPushNotificationTagsForDeviceAsync(request: carriers.Pocket_SetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
41
- setPushNotificationTagsForDeviceAsync(deviceIdentifier: string, tags: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
42
- setPushNotificationTagsForUserAsync(request: carriers.Pocket_SetPushNotificationTagsForUserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
43
- setPushNotificationTagsForUserAsync(associateId: number, tags: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
44
- getPushNotificationTagsForDeviceAsync(request: carriers.Pocket_GetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
45
- getPushNotificationTagsForDeviceAsync(deviceIdentifier: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
46
- sendPushNotificationAsync(request: carriers.Pocket_SendPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
47
- sendPushNotificationAsync(associateIds: number[], message: carriers.PocketNotificationMessage, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
48
- runAppointmentAlarmBrokerAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >;
49
- notifyUsersAsync(request: carriers.Pocket_NotifyUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
50
- notifyUsersAsync(notificationEventType: enums.NotificationEventType, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
51
- notificationHandledAsync(request: carriers.Pocket_NotificationHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
52
- notificationHandledAsync(notificationEventType: enums.NotificationEventType, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
53
- notificationsHandledAsync(request: carriers.Pocket_NotificationsHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
54
- notificationsHandledAsync(notificationEvents: carriers.NotificationEvent[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
55
- } // interface IPocketAgent
56
-
57
-
58
-
59
-
60
- /**
61
- * Agent with Pocket specific functionality
62
- */
63
- export class PocketAgent extends base.WebApiBase implements IPocketAgent {
64
- constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
65
- constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
66
- constructor(baseUrl: string, resourceManager:any);
67
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
68
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
69
- constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
70
- constructor(options: base.WebApiOptions);
71
-
72
- constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
73
- langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
74
- langOrResourceOrRM?:string|base.ResourceParsing|any,
75
- cultureCode?: string,
76
- ) {
77
- const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
78
- options.basePath = "v1/Agents/Pocket/";
79
- super(options);
80
- }
81
-
82
-
83
-
84
- private async _getMyCallerIDsAsync(request: carriers.Pocket_GetMyCallerIDsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection > {
85
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
86
- base.WebApiBase.SetPending(options);
87
- return new Promise< carriers.CallerIDCollection >(async (resolve, reject) => {
88
- try {
89
- config.baseURL = this._options.baseUrl;
90
- const response = await this._axios.post("GetMyCallerIDs", request , config);
91
- base.WebApiBase.SetCompleted(options, response);
92
- const res : carriers.CallerIDCollection = converters.Create_CallerIDCollection_From( response.data );
93
- resolve(res);
94
- }
95
- catch( err ) {
96
- base.WebApiBase.HandleError(options, config, err);
97
- reject(err);
98
- }
99
- });
100
- }
101
-
102
-
103
-
104
- /**
105
- * Get caller ids that the current principal might be interested in (phone numbers of related persons in sales and appointments created/owned/touched by ourselves or colleagues in our primary group
106
- * @param request - LastHash, MinDate, MaxDate
107
- * @returns Collection of caller IDs, containing the hash of the caller ids
108
- */
109
- public async getMyCallerIDsAsync(request: carriers.Pocket_GetMyCallerIDsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
110
-
111
- /**
112
- * Get caller ids that the current principal might be interested in (phone numbers of related persons in sales and appointments created/owned/touched by ourselves or colleagues in our primary group
113
- * @param lastHash - Hash for the previous call, used for checking if the same set of caller ids was sent in a previous call, and returning null in that case
114
- * @param minDate - Only check activities after this date
115
- * @param maxDate - Only check activities before this date
116
- * @returns Collection of caller IDs, containing the hash of the caller ids
117
- */
118
- public async getMyCallerIDsAsync(lastHash: string, minDate: Date, maxDate: Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
119
-
120
- public async getMyCallerIDsAsync(lastHash:string|carriers.Pocket_GetMyCallerIDsRequest, minDate?:Date|base.WebApiRequestOptions, maxDate?:Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection > {
121
- let _request : carriers.Pocket_GetMyCallerIDsRequest = null;
122
- let _options : base.WebApiRequestOptions = null;
123
- const first : any = lastHash;
124
- if( typeof( first ) === "object" && first && ( typeof(first.lastHash)!='undefined' || typeof(first.minDate)!='undefined' || typeof(first.maxDate)!='undefined' ) )
125
- {
126
- _request = lastHash as carriers.Pocket_GetMyCallerIDsRequest;
127
- _options = minDate as base.WebApiRequestOptions;
128
- }
129
- else
130
- {
131
- _request = {
132
- lastHash: lastHash as string,
133
- minDate: minDate as Date,
134
- maxDate: maxDate as Date,
135
- };
136
- _options = webapi_options;
137
- }
138
- return this._getMyCallerIDsAsync( _request, _options );
139
- }
140
-
141
-
142
- private async _getCallerIDsFromSelectionAsync(request: carriers.Pocket_GetCallerIDsFromSelectionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection > {
143
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
144
- base.WebApiBase.SetPending(options);
145
- return new Promise< carriers.CallerIDCollection >(async (resolve, reject) => {
146
- try {
147
- config.baseURL = this._options.baseUrl;
148
- const response = await this._axios.post("GetCallerIDsFromSelection", request , config);
149
- base.WebApiBase.SetCompleted(options, response);
150
- const res : carriers.CallerIDCollection = converters.Create_CallerIDCollection_From( response.data );
151
- resolve(res);
152
- }
153
- catch( err ) {
154
- base.WebApiBase.HandleError(options, config, err);
155
- reject(err);
156
- }
157
- });
158
- }
159
-
160
-
161
-
162
- /**
163
- * Get caller ids from a selection. Queries the shadow selection of persons and companies, so selections of any kind can be used
164
- * @param request - SelectionId, LastHash
165
- * @returns Collection of caller IDs, containing the hash of the caller ids
166
- */
167
- public async getCallerIDsFromSelectionAsync(request: carriers.Pocket_GetCallerIDsFromSelectionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
168
-
169
- /**
170
- * Get caller ids from a selection. Queries the shadow selection of persons and companies, so selections of any kind can be used
171
- * @param selectionId - Id of selection to get caller ids from
172
- * @param lastHash - Hash for the previous call, used for checking if the same set of caller ids was sent in an earlier call, and returning null in that case
173
- * @returns Collection of caller IDs, containing the hash of the caller ids
174
- */
175
- public async getCallerIDsFromSelectionAsync(selectionId: number, lastHash: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
176
-
177
- public async getCallerIDsFromSelectionAsync(selectionId:number|carriers.Pocket_GetCallerIDsFromSelectionRequest, lastHash?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection > {
178
- let _request : carriers.Pocket_GetCallerIDsFromSelectionRequest = null;
179
- let _options : base.WebApiRequestOptions = null;
180
- const first : any = selectionId;
181
- if( typeof( first ) === "object" && first && ( typeof(first.selectionId)!='undefined' || typeof(first.lastHash)!='undefined' ) )
182
- {
183
- _request = selectionId as carriers.Pocket_GetCallerIDsFromSelectionRequest;
184
- _options = lastHash as base.WebApiRequestOptions;
185
- }
186
- else
187
- {
188
- _request = {
189
- selectionId: selectionId as number,
190
- lastHash: lastHash as string,
191
- };
192
- _options = webapi_options;
193
- }
194
- return this._getCallerIDsFromSelectionAsync( _request, _options );
195
- }
196
-
197
-
198
- private async _getPocketStartupDataAsync(request: carriers.Pocket_GetPocketStartupDataRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData > {
199
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
200
- base.WebApiBase.SetPending(options);
201
- return new Promise< carriers.PocketStartupData >(async (resolve, reject) => {
202
- try {
203
- config.baseURL = this._options.baseUrl;
204
- const response = await this._axios.post("GetPocketStartupData", request , config);
205
- base.WebApiBase.SetCompleted(options, response);
206
- const res : carriers.PocketStartupData = converters.Create_PocketStartupData_From( response.data );
207
- resolve(res);
208
- }
209
- catch( err ) {
210
- base.WebApiBase.HandleError(options, config, err);
211
- reject(err);
212
- }
213
- });
214
- }
215
-
216
-
217
-
218
- /**
219
- *
220
- * @param request - Tables, CurrentClientTime
221
- * @returns Startup data for pocket
222
- */
223
- public async getPocketStartupDataAsync(request: carriers.Pocket_GetPocketStartupDataRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData >;
224
-
225
- /**
226
- *
227
- * @param tables - Tables to check for license
228
- * @param currentClientTime - Current time on the client, used for overdue sale lookup having correct timezone relative to client
229
- * @returns Startup data for pocket
230
- */
231
- public async getPocketStartupDataAsync(tables: string[], currentClientTime: Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData >;
232
-
233
- public async getPocketStartupDataAsync(tables:string[]|carriers.Pocket_GetPocketStartupDataRequest, currentClientTime?:Date|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData > {
234
- let _request : carriers.Pocket_GetPocketStartupDataRequest = null;
235
- let _options : base.WebApiRequestOptions = null;
236
- const first : any = tables;
237
- if( typeof( first ) === "object" && first && ( typeof(first.tables)!='undefined' || typeof(first.currentClientTime)!='undefined' ) )
238
- {
239
- _request = tables as carriers.Pocket_GetPocketStartupDataRequest;
240
- _options = currentClientTime as base.WebApiRequestOptions;
241
- }
242
- else
243
- {
244
- _request = {
245
- tables: tables as string[],
246
- currentClientTime: currentClientTime as Date,
247
- };
248
- _options = webapi_options;
249
- }
250
- return this._getPocketStartupDataAsync( _request, _options );
251
- }
252
-
253
-
254
- private async _registerDeviceForPushNotificationAsync(request: carriers.Pocket_RegisterDeviceForPushNotificationRequest, options?:base.WebApiRequestOptions) : Promise< void > {
255
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
256
- base.WebApiBase.SetPending(options);
257
- return new Promise< void >(async (resolve, reject) => {
258
- try {
259
- config.baseURL = this._options.baseUrl;
260
- const response = await this._axios.post("RegisterDeviceForPushNotification", request , config);
261
- base.WebApiBase.SetCompleted(options, response);
262
- const res = response.data;
263
- resolve(res);
264
- }
265
- catch( err ) {
266
- base.WebApiBase.HandleError(options, config, err);
267
- reject(err);
268
- }
269
- });
270
- }
271
-
272
-
273
-
274
- /**
275
- * Register a device that should receive push notifications when notable events occour
276
- * @param request - DeviceInfo
277
- * @returns This method has no return value
278
- */
279
- public async registerDeviceForPushNotificationAsync(request: carriers.Pocket_RegisterDeviceForPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
280
-
281
- /**
282
- * Register a device that should receive push notifications when notable events occour
283
- * @param deviceInfo - Properties for the device to register
284
- * @returns This method has no return value
285
- */
286
- public async registerDeviceForPushNotificationAsync(deviceInfo: carriers.PocketDeviceInfo, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
287
-
288
- public async registerDeviceForPushNotificationAsync(deviceInfo:carriers.PocketDeviceInfo|carriers.Pocket_RegisterDeviceForPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
289
- let _request : carriers.Pocket_RegisterDeviceForPushNotificationRequest = null;
290
- let _options : base.WebApiRequestOptions = null;
291
- const first : any = deviceInfo;
292
- if( typeof( first ) === "object" && first && ( typeof(first.deviceInfo)!='undefined' ) )
293
- {
294
- _request = deviceInfo as carriers.Pocket_RegisterDeviceForPushNotificationRequest;
295
- _options = webapi_options as base.WebApiRequestOptions;
296
- }
297
- else
298
- {
299
- _request = {
300
- deviceInfo: deviceInfo as carriers.PocketDeviceInfo,
301
- };
302
- _options = webapi_options;
303
- }
304
- return this._registerDeviceForPushNotificationAsync( _request, _options );
305
- }
306
-
307
-
308
- private async _getRegisteredDevicesAsync(request: carriers.Pocket_GetRegisteredDevicesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] > {
309
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
310
- base.WebApiBase.SetPending(options);
311
- return new Promise< carriers.PocketDeviceInfo[] >(async (resolve, reject) => {
312
- try {
313
- config.baseURL = this._options.baseUrl;
314
- const response = await this._axios.post("GetRegisteredDevices", request , config);
315
- base.WebApiBase.SetCompleted(options, response);
316
- const res : carriers.PocketDeviceInfo[] = converters.Create_PocketDeviceInfoArray_From( response.data );
317
- resolve(res);
318
- }
319
- catch( err ) {
320
- base.WebApiBase.HandleError(options, config, err);
321
- reject(err);
322
- }
323
- });
324
- }
325
-
326
-
327
-
328
- /**
329
- * Retrieve all registered devices for an associate
330
- * @param request - AssociateId
331
- * @returns
332
- */
333
- public async getRegisteredDevicesAsync(request: carriers.Pocket_GetRegisteredDevicesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] >;
334
-
335
- /**
336
- * Retrieve all registered devices for an associate
337
- * @param associateId - The user to get devices for
338
- * @returns
339
- */
340
- public async getRegisteredDevicesAsync(associateId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] >;
341
-
342
- public async getRegisteredDevicesAsync(associateId:number|carriers.Pocket_GetRegisteredDevicesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] > {
343
- let _request : carriers.Pocket_GetRegisteredDevicesRequest = null;
344
- let _options : base.WebApiRequestOptions = null;
345
- const first : any = associateId;
346
- if( typeof( first ) === "object" && first && ( typeof(first.associateId)!='undefined' ) )
347
- {
348
- _request = associateId as carriers.Pocket_GetRegisteredDevicesRequest;
349
- _options = webapi_options as base.WebApiRequestOptions;
350
- }
351
- else
352
- {
353
- _request = {
354
- associateId: associateId as number,
355
- };
356
- _options = webapi_options;
357
- }
358
- return this._getRegisteredDevicesAsync( _request, _options );
359
- }
360
-
361
-
362
- private async _setPushNotificationTagsForDeviceAsync(request: carriers.Pocket_SetPushNotificationTagsForDeviceRequest, options?:base.WebApiRequestOptions) : Promise< void > {
363
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
364
- base.WebApiBase.SetPending(options);
365
- return new Promise< void >(async (resolve, reject) => {
366
- try {
367
- config.baseURL = this._options.baseUrl;
368
- const response = await this._axios.post("SetPushNotificationTagsForDevice", request , config);
369
- base.WebApiBase.SetCompleted(options, response);
370
- const res = response.data;
371
- resolve(res);
372
- }
373
- catch( err ) {
374
- base.WebApiBase.HandleError(options, config, err);
375
- reject(err);
376
- }
377
- });
378
- }
379
-
380
-
381
-
382
- /**
383
- * Specify what kind of notification events a device should receive push notifications for
384
- * @param request - DeviceIdentifier, Tags
385
- * @returns This method has no return value
386
- */
387
- public async setPushNotificationTagsForDeviceAsync(request: carriers.Pocket_SetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
388
-
389
- /**
390
- * Specify what kind of notification events a device should receive push notifications for
391
- * @param deviceIdentifier - The unique identifier for a device
392
- * @param tags - A comma separated list of events this device should receive push events for
393
- * @returns This method has no return value
394
- */
395
- public async setPushNotificationTagsForDeviceAsync(deviceIdentifier: string, tags: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
396
-
397
- public async setPushNotificationTagsForDeviceAsync(deviceIdentifier:string|carriers.Pocket_SetPushNotificationTagsForDeviceRequest, tags?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
398
- let _request : carriers.Pocket_SetPushNotificationTagsForDeviceRequest = null;
399
- let _options : base.WebApiRequestOptions = null;
400
- const first : any = deviceIdentifier;
401
- if( typeof( first ) === "object" && first && ( typeof(first.deviceIdentifier)!='undefined' || typeof(first.tags)!='undefined' ) )
402
- {
403
- _request = deviceIdentifier as carriers.Pocket_SetPushNotificationTagsForDeviceRequest;
404
- _options = tags as base.WebApiRequestOptions;
405
- }
406
- else
407
- {
408
- _request = {
409
- deviceIdentifier: deviceIdentifier as string,
410
- tags: tags as string,
411
- };
412
- _options = webapi_options;
413
- }
414
- return this._setPushNotificationTagsForDeviceAsync( _request, _options );
415
- }
416
-
417
-
418
- private async _setPushNotificationTagsForUserAsync(request: carriers.Pocket_SetPushNotificationTagsForUserRequest, options?:base.WebApiRequestOptions) : Promise< void > {
419
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
420
- base.WebApiBase.SetPending(options);
421
- return new Promise< void >(async (resolve, reject) => {
422
- try {
423
- config.baseURL = this._options.baseUrl;
424
- const response = await this._axios.post("SetPushNotificationTagsForUser", request , config);
425
- base.WebApiBase.SetCompleted(options, response);
426
- const res = response.data;
427
- resolve(res);
428
- }
429
- catch( err ) {
430
- base.WebApiBase.HandleError(options, config, err);
431
- reject(err);
432
- }
433
- });
434
- }
435
-
436
-
437
-
438
- /**
439
- * Specify what kind of notification events a user should receive push notifications for. This will update all registerred devices for this user.
440
- * @param request - AssociateId, Tags
441
- * @returns This method has no return value
442
- */
443
- public async setPushNotificationTagsForUserAsync(request: carriers.Pocket_SetPushNotificationTagsForUserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
444
-
445
- /**
446
- * Specify what kind of notification events a user should receive push notifications for. This will update all registerred devices for this user.
447
- * @param associateId - The associate to set tags for
448
- * @param tags - A comma separated list of events the associate should receive push events for
449
- * @returns This method has no return value
450
- */
451
- public async setPushNotificationTagsForUserAsync(associateId: number, tags: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
452
-
453
- public async setPushNotificationTagsForUserAsync(associateId:number|carriers.Pocket_SetPushNotificationTagsForUserRequest, tags?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
454
- let _request : carriers.Pocket_SetPushNotificationTagsForUserRequest = null;
455
- let _options : base.WebApiRequestOptions = null;
456
- const first : any = associateId;
457
- if( typeof( first ) === "object" && first && ( typeof(first.associateId)!='undefined' || typeof(first.tags)!='undefined' ) )
458
- {
459
- _request = associateId as carriers.Pocket_SetPushNotificationTagsForUserRequest;
460
- _options = tags as base.WebApiRequestOptions;
461
- }
462
- else
463
- {
464
- _request = {
465
- associateId: associateId as number,
466
- tags: tags as string,
467
- };
468
- _options = webapi_options;
469
- }
470
- return this._setPushNotificationTagsForUserAsync( _request, _options );
471
- }
472
-
473
-
474
- private async _getPushNotificationTagsForDeviceAsync(request: carriers.Pocket_GetPushNotificationTagsForDeviceRequest, options?:base.WebApiRequestOptions) : Promise< string > {
475
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
476
- base.WebApiBase.SetPending(options);
477
- return new Promise< string >(async (resolve, reject) => {
478
- try {
479
- config.baseURL = this._options.baseUrl;
480
- const response = await this._axios.post("GetPushNotificationTagsForDevice", request , config);
481
- base.WebApiBase.SetCompleted(options, response);
482
- const res : string = response.data as string;
483
- resolve(res);
484
- }
485
- catch( err ) {
486
- base.WebApiBase.HandleError(options, config, err);
487
- reject(err);
488
- }
489
- });
490
- }
491
-
492
-
493
-
494
- /**
495
- * Retrieve current tag value for a device
496
- * @param request - DeviceIdentifier
497
- * @returns A comma separated list of events this device should receive push events for
498
- */
499
- public async getPushNotificationTagsForDeviceAsync(request: carriers.Pocket_GetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
500
-
501
- /**
502
- * Retrieve current tag value for a device
503
- * @param deviceIdentifier - The unique identifier of this device
504
- * @returns A comma separated list of events this device should receive push events for
505
- */
506
- public async getPushNotificationTagsForDeviceAsync(deviceIdentifier: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
507
-
508
- public async getPushNotificationTagsForDeviceAsync(deviceIdentifier:string|carriers.Pocket_GetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
509
- let _request : carriers.Pocket_GetPushNotificationTagsForDeviceRequest = null;
510
- let _options : base.WebApiRequestOptions = null;
511
- const first : any = deviceIdentifier;
512
- if( typeof( first ) === "object" && first && ( typeof(first.deviceIdentifier)!='undefined' ) )
513
- {
514
- _request = deviceIdentifier as carriers.Pocket_GetPushNotificationTagsForDeviceRequest;
515
- _options = webapi_options as base.WebApiRequestOptions;
516
- }
517
- else
518
- {
519
- _request = {
520
- deviceIdentifier: deviceIdentifier as string,
521
- };
522
- _options = webapi_options;
523
- }
524
- return this._getPushNotificationTagsForDeviceAsync( _request, _options );
525
- }
526
-
527
-
528
- private async _sendPushNotificationAsync(request: carriers.Pocket_SendPushNotificationRequest, options?:base.WebApiRequestOptions) : Promise< void > {
529
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
530
- base.WebApiBase.SetPending(options);
531
- return new Promise< void >(async (resolve, reject) => {
532
- try {
533
- config.baseURL = this._options.baseUrl;
534
- const response = await this._axios.post("SendPushNotification", request , config);
535
- base.WebApiBase.SetCompleted(options, response);
536
- const res = response.data;
537
- resolve(res);
538
- }
539
- catch( err ) {
540
- base.WebApiBase.HandleError(options, config, err);
541
- reject(err);
542
- }
543
- });
544
- }
545
-
546
-
547
-
548
- /**
549
- * Send a push notification to one or more associates
550
- * @param request - AssociateIds, Message
551
- * @returns This method has no return value
552
- */
553
- public async sendPushNotificationAsync(request: carriers.Pocket_SendPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
554
-
555
- /**
556
- * Send a push notification to one or more associates
557
- * @param associateIds - The associates to send the push notification message to
558
- * @param message - The message to send
559
- * @returns This method has no return value
560
- */
561
- public async sendPushNotificationAsync(associateIds: number[], message: carriers.PocketNotificationMessage, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
562
-
563
- public async sendPushNotificationAsync(associateIds:number[]|carriers.Pocket_SendPushNotificationRequest, message?:carriers.PocketNotificationMessage|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
564
- let _request : carriers.Pocket_SendPushNotificationRequest = null;
565
- let _options : base.WebApiRequestOptions = null;
566
- const first : any = associateIds;
567
- if( typeof( first ) === "object" && first && ( typeof(first.associateIds)!='undefined' || typeof(first.message)!='undefined' ) )
568
- {
569
- _request = associateIds as carriers.Pocket_SendPushNotificationRequest;
570
- _options = message as base.WebApiRequestOptions;
571
- }
572
- else
573
- {
574
- _request = {
575
- associateIds: associateIds as number[],
576
- message: message as carriers.PocketNotificationMessage,
577
- };
578
- _options = webapi_options;
579
- }
580
- return this._sendPushNotificationAsync( _request, _options );
581
- }
582
-
583
-
584
- private async _runAppointmentAlarmBrokerAsync( options?:base.WebApiRequestOptions) : Promise< void > {
585
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
586
- base.WebApiBase.SetPending(options);
587
- return new Promise< void >(async (resolve, reject) => {
588
- try {
589
- config.baseURL = this._options.baseUrl;
590
- const response = await this._axios.post("RunAppointmentAlarmBroker", undefined , config);
591
- base.WebApiBase.SetCompleted(options, response);
592
- const res = response.data;
593
- resolve(res);
594
- }
595
- catch( err ) {
596
- base.WebApiBase.HandleError(options, config, err);
597
- reject(err);
598
- }
599
- });
600
- }
601
-
602
-
603
- /**
604
- * Execute the AppointmentAlarmBroker once
605
- * @returns This method has no return value
606
- */
607
- public async runAppointmentAlarmBrokerAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >
608
- {
609
- return this._runAppointmentAlarmBrokerAsync(webapi_options);
610
- }
611
-
612
-
613
- private async _notifyUsersAsync(request: carriers.Pocket_NotifyUsersRequest, options?:base.WebApiRequestOptions) : Promise< void > {
614
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
615
- base.WebApiBase.SetPending(options);
616
- return new Promise< void >(async (resolve, reject) => {
617
- try {
618
- config.baseURL = this._options.baseUrl;
619
- const response = await this._axios.post("NotifyUsers", request , config);
620
- base.WebApiBase.SetCompleted(options, response);
621
- const res = response.data;
622
- resolve(res);
623
- }
624
- catch( err ) {
625
- base.WebApiBase.HandleError(options, config, err);
626
- reject(err);
627
- }
628
- });
629
- }
630
-
631
-
632
-
633
- /**
634
- * Notify users about a new or changed entity
635
- * @param request - NotificationEventType, Id
636
- * @returns This method has no return value
637
- */
638
- public async notifyUsersAsync(request: carriers.Pocket_NotifyUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
639
-
640
- /**
641
- * Notify users about a new or changed entity
642
- * @param notificationEventType - Type of notification
643
- * @param id - Id of entity to notify about
644
- * @returns This method has no return value
645
- */
646
- public async notifyUsersAsync(notificationEventType: enums.NotificationEventType, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
647
-
648
- public async notifyUsersAsync(notificationEventType:enums.NotificationEventType|carriers.Pocket_NotifyUsersRequest, id?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
649
- let _request : carriers.Pocket_NotifyUsersRequest = null;
650
- let _options : base.WebApiRequestOptions = null;
651
- const first : any = notificationEventType;
652
- if( typeof( first ) === "object" && first && ( typeof(first.notificationEventType)!='undefined' || typeof(first.id)!='undefined' ) )
653
- {
654
- _request = notificationEventType as carriers.Pocket_NotifyUsersRequest;
655
- _options = id as base.WebApiRequestOptions;
656
- }
657
- else
658
- {
659
- _request = {
660
- notificationEventType: notificationEventType as enums.NotificationEventType,
661
- id: id as number,
662
- };
663
- _options = webapi_options;
664
- }
665
- return this._notifyUsersAsync( _request, _options );
666
- }
667
-
668
-
669
- private async _notificationHandledAsync(request: carriers.Pocket_NotificationHandledRequest, options?:base.WebApiRequestOptions) : Promise< void > {
670
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
671
- base.WebApiBase.SetPending(options);
672
- return new Promise< void >(async (resolve, reject) => {
673
- try {
674
- config.baseURL = this._options.baseUrl;
675
- const response = await this._axios.post("NotificationHandled", request , config);
676
- base.WebApiBase.SetCompleted(options, response);
677
- const res = response.data;
678
- resolve(res);
679
- }
680
- catch( err ) {
681
- base.WebApiBase.HandleError(options, config, err);
682
- reject(err);
683
- }
684
- });
685
- }
686
-
687
-
688
-
689
- /**
690
- * Mark a notification as handled, so it can be cleaned up on other clients that have received the notification
691
- * @param request - NotificationEventType, Id
692
- * @returns This method has no return value
693
- */
694
- public async notificationHandledAsync(request: carriers.Pocket_NotificationHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
695
-
696
- /**
697
- * Mark a notification as handled, so it can be cleaned up on other clients that have received the notification
698
- * @param notificationEventType - Type of notification
699
- * @param id - Id of entity to notify about
700
- * @returns This method has no return value
701
- */
702
- public async notificationHandledAsync(notificationEventType: enums.NotificationEventType, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
703
-
704
- public async notificationHandledAsync(notificationEventType:enums.NotificationEventType|carriers.Pocket_NotificationHandledRequest, id?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
705
- let _request : carriers.Pocket_NotificationHandledRequest = null;
706
- let _options : base.WebApiRequestOptions = null;
707
- const first : any = notificationEventType;
708
- if( typeof( first ) === "object" && first && ( typeof(first.notificationEventType)!='undefined' || typeof(first.id)!='undefined' ) )
709
- {
710
- _request = notificationEventType as carriers.Pocket_NotificationHandledRequest;
711
- _options = id as base.WebApiRequestOptions;
712
- }
713
- else
714
- {
715
- _request = {
716
- notificationEventType: notificationEventType as enums.NotificationEventType,
717
- id: id as number,
718
- };
719
- _options = webapi_options;
720
- }
721
- return this._notificationHandledAsync( _request, _options );
722
- }
723
-
724
-
725
- private async _notificationsHandledAsync(request: carriers.Pocket_NotificationsHandledRequest, options?:base.WebApiRequestOptions) : Promise< void > {
726
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
727
- base.WebApiBase.SetPending(options);
728
- return new Promise< void >(async (resolve, reject) => {
729
- try {
730
- config.baseURL = this._options.baseUrl;
731
- const response = await this._axios.post("NotificationsHandled", request , config);
732
- base.WebApiBase.SetCompleted(options, response);
733
- const res = response.data;
734
- resolve(res);
735
- }
736
- catch( err ) {
737
- base.WebApiBase.HandleError(options, config, err);
738
- reject(err);
739
- }
740
- });
741
- }
742
-
743
-
744
-
745
- /**
746
- * Mark a set of notifications as handled, so they can be cleaned up on other clients that have received the notification
747
- * @param request - NotificationEvents
748
- * @returns This method has no return value
749
- */
750
- public async notificationsHandledAsync(request: carriers.Pocket_NotificationsHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
751
-
752
- /**
753
- * Mark a set of notifications as handled, so they can be cleaned up on other clients that have received the notification
754
- * @param notificationEvents - List of notifications to mark as handled
755
- * @returns This method has no return value
756
- */
757
- public async notificationsHandledAsync(notificationEvents: carriers.NotificationEvent[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
758
-
759
- public async notificationsHandledAsync(notificationEvents:carriers.NotificationEvent[]|carriers.Pocket_NotificationsHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
760
- let _request : carriers.Pocket_NotificationsHandledRequest = null;
761
- let _options : base.WebApiRequestOptions = null;
762
- const first : any = notificationEvents;
763
- if( typeof( first ) === "object" && first && ( typeof(first.notificationEvents)!='undefined' ) )
764
- {
765
- _request = notificationEvents as carriers.Pocket_NotificationsHandledRequest;
766
- _options = webapi_options as base.WebApiRequestOptions;
767
- }
768
- else
769
- {
770
- _request = {
771
- notificationEvents: notificationEvents as carriers.NotificationEvent[],
772
- };
773
- _options = webapi_options;
774
- }
775
- return this._notificationsHandledAsync( _request, _options );
776
- }
777
-
778
- } // class v1PocketAgentController
779
-
780
-
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/PocketAgent.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
+ * Agent with Pocket specific functionality
28
+ */
29
+ export interface IPocketAgent {
30
+ getMyCallerIDsAsync(request: carriers.Pocket_GetMyCallerIDsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
31
+ getMyCallerIDsAsync(lastHash: string, minDate: Date, maxDate: Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
32
+ getCallerIDsFromSelectionAsync(request: carriers.Pocket_GetCallerIDsFromSelectionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
33
+ getCallerIDsFromSelectionAsync(selectionId: number, lastHash: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
34
+ getPocketStartupDataAsync(request: carriers.Pocket_GetPocketStartupDataRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData >;
35
+ getPocketStartupDataAsync(tables: string[], currentClientTime: Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData >;
36
+ registerDeviceForPushNotificationAsync(request: carriers.Pocket_RegisterDeviceForPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
37
+ registerDeviceForPushNotificationAsync(deviceInfo: carriers.PocketDeviceInfo, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
38
+ getRegisteredDevicesAsync(request: carriers.Pocket_GetRegisteredDevicesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] >;
39
+ getRegisteredDevicesAsync(associateId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] >;
40
+ setPushNotificationTagsForDeviceAsync(request: carriers.Pocket_SetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
41
+ setPushNotificationTagsForDeviceAsync(deviceIdentifier: string, tags: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
42
+ setPushNotificationTagsForUserAsync(request: carriers.Pocket_SetPushNotificationTagsForUserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
43
+ setPushNotificationTagsForUserAsync(associateId: number, tags: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
44
+ getPushNotificationTagsForDeviceAsync(request: carriers.Pocket_GetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
45
+ getPushNotificationTagsForDeviceAsync(deviceIdentifier: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
46
+ sendPushNotificationAsync(request: carriers.Pocket_SendPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
47
+ sendPushNotificationAsync(associateIds: number[], message: carriers.PocketNotificationMessage, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
48
+ runAppointmentAlarmBrokerAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >;
49
+ notifyUsersAsync(request: carriers.Pocket_NotifyUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
50
+ notifyUsersAsync(notificationEventType: enums.NotificationEventType, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
51
+ notificationHandledAsync(request: carriers.Pocket_NotificationHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
52
+ notificationHandledAsync(notificationEventType: enums.NotificationEventType, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
53
+ notificationsHandledAsync(request: carriers.Pocket_NotificationsHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
54
+ notificationsHandledAsync(notificationEvents: carriers.NotificationEvent[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
55
+ } // interface IPocketAgent
56
+
57
+
58
+
59
+
60
+ /**
61
+ * Agent with Pocket specific functionality
62
+ */
63
+ export class PocketAgent extends base.WebApiBase implements IPocketAgent {
64
+ constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
65
+ constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
66
+ constructor(baseUrl: string, resourceManager:any);
67
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
68
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
69
+ constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
70
+ constructor(options: base.WebApiOptions);
71
+
72
+ constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
73
+ langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
74
+ langOrResourceOrRM?:string|base.ResourceParsing|any,
75
+ cultureCode?: string,
76
+ ) {
77
+ const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
78
+ options.basePath = "v1/Agents/Pocket/";
79
+ super(options);
80
+ }
81
+
82
+
83
+
84
+ private async _getMyCallerIDsAsync(request: carriers.Pocket_GetMyCallerIDsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection > {
85
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
86
+ base.WebApiBase.SetPending(options);
87
+ return new Promise< carriers.CallerIDCollection >(async (resolve, reject) => {
88
+ try {
89
+ config.baseURL = this._options.baseUrl;
90
+ const response = await this._axios.post("GetMyCallerIDs", request , config);
91
+ base.WebApiBase.SetCompleted(options, response);
92
+ const res : carriers.CallerIDCollection = converters.Create_CallerIDCollection_From( response.data );
93
+ resolve(res);
94
+ }
95
+ catch( err ) {
96
+ base.WebApiBase.HandleError(options, config, err);
97
+ reject(err);
98
+ }
99
+ });
100
+ }
101
+
102
+
103
+
104
+ /**
105
+ * Get caller ids that the current principal might be interested in (phone numbers of related persons in sales and appointments created/owned/touched by ourselves or colleagues in our primary group
106
+ * @param request - LastHash, MinDate, MaxDate
107
+ * @returns Collection of caller IDs, containing the hash of the caller ids
108
+ */
109
+ public async getMyCallerIDsAsync(request: carriers.Pocket_GetMyCallerIDsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
110
+
111
+ /**
112
+ * Get caller ids that the current principal might be interested in (phone numbers of related persons in sales and appointments created/owned/touched by ourselves or colleagues in our primary group
113
+ * @param lastHash - Hash for the previous call, used for checking if the same set of caller ids was sent in a previous call, and returning null in that case
114
+ * @param minDate - Only check activities after this date
115
+ * @param maxDate - Only check activities before this date
116
+ * @returns Collection of caller IDs, containing the hash of the caller ids
117
+ */
118
+ public async getMyCallerIDsAsync(lastHash: string, minDate: Date, maxDate: Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
119
+
120
+ public async getMyCallerIDsAsync(lastHash:string|carriers.Pocket_GetMyCallerIDsRequest, minDate?:Date|base.WebApiRequestOptions, maxDate?:Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection > {
121
+ let _request : carriers.Pocket_GetMyCallerIDsRequest = null;
122
+ let _options : base.WebApiRequestOptions = null;
123
+ const first : any = lastHash;
124
+ if( typeof( first ) === "object" && first && ( typeof(first.lastHash)!='undefined' || typeof(first.minDate)!='undefined' || typeof(first.maxDate)!='undefined' ) )
125
+ {
126
+ _request = lastHash as carriers.Pocket_GetMyCallerIDsRequest;
127
+ _options = minDate as base.WebApiRequestOptions;
128
+ }
129
+ else
130
+ {
131
+ _request = {
132
+ lastHash: lastHash as string,
133
+ minDate: minDate as Date,
134
+ maxDate: maxDate as Date,
135
+ };
136
+ _options = webapi_options;
137
+ }
138
+ return this._getMyCallerIDsAsync( _request, _options );
139
+ }
140
+
141
+
142
+ private async _getCallerIDsFromSelectionAsync(request: carriers.Pocket_GetCallerIDsFromSelectionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection > {
143
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
144
+ base.WebApiBase.SetPending(options);
145
+ return new Promise< carriers.CallerIDCollection >(async (resolve, reject) => {
146
+ try {
147
+ config.baseURL = this._options.baseUrl;
148
+ const response = await this._axios.post("GetCallerIDsFromSelection", request , config);
149
+ base.WebApiBase.SetCompleted(options, response);
150
+ const res : carriers.CallerIDCollection = converters.Create_CallerIDCollection_From( response.data );
151
+ resolve(res);
152
+ }
153
+ catch( err ) {
154
+ base.WebApiBase.HandleError(options, config, err);
155
+ reject(err);
156
+ }
157
+ });
158
+ }
159
+
160
+
161
+
162
+ /**
163
+ * Get caller ids from a selection. Queries the shadow selection of persons and companies, so selections of any kind can be used
164
+ * @param request - SelectionId, LastHash
165
+ * @returns Collection of caller IDs, containing the hash of the caller ids
166
+ */
167
+ public async getCallerIDsFromSelectionAsync(request: carriers.Pocket_GetCallerIDsFromSelectionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
168
+
169
+ /**
170
+ * Get caller ids from a selection. Queries the shadow selection of persons and companies, so selections of any kind can be used
171
+ * @param selectionId - Id of selection to get caller ids from
172
+ * @param lastHash - Hash for the previous call, used for checking if the same set of caller ids was sent in an earlier call, and returning null in that case
173
+ * @returns Collection of caller IDs, containing the hash of the caller ids
174
+ */
175
+ public async getCallerIDsFromSelectionAsync(selectionId: number, lastHash: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection >;
176
+
177
+ public async getCallerIDsFromSelectionAsync(selectionId:number|carriers.Pocket_GetCallerIDsFromSelectionRequest, lastHash?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CallerIDCollection > {
178
+ let _request : carriers.Pocket_GetCallerIDsFromSelectionRequest = null;
179
+ let _options : base.WebApiRequestOptions = null;
180
+ const first : any = selectionId;
181
+ if( typeof( first ) === "object" && first && ( typeof(first.selectionId)!='undefined' || typeof(first.lastHash)!='undefined' ) )
182
+ {
183
+ _request = selectionId as carriers.Pocket_GetCallerIDsFromSelectionRequest;
184
+ _options = lastHash as base.WebApiRequestOptions;
185
+ }
186
+ else
187
+ {
188
+ _request = {
189
+ selectionId: selectionId as number,
190
+ lastHash: lastHash as string,
191
+ };
192
+ _options = webapi_options;
193
+ }
194
+ return this._getCallerIDsFromSelectionAsync( _request, _options );
195
+ }
196
+
197
+
198
+ private async _getPocketStartupDataAsync(request: carriers.Pocket_GetPocketStartupDataRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData > {
199
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
200
+ base.WebApiBase.SetPending(options);
201
+ return new Promise< carriers.PocketStartupData >(async (resolve, reject) => {
202
+ try {
203
+ config.baseURL = this._options.baseUrl;
204
+ const response = await this._axios.post("GetPocketStartupData", request , config);
205
+ base.WebApiBase.SetCompleted(options, response);
206
+ const res : carriers.PocketStartupData = converters.Create_PocketStartupData_From( response.data );
207
+ resolve(res);
208
+ }
209
+ catch( err ) {
210
+ base.WebApiBase.HandleError(options, config, err);
211
+ reject(err);
212
+ }
213
+ });
214
+ }
215
+
216
+
217
+
218
+ /**
219
+ *
220
+ * @param request - Tables, CurrentClientTime
221
+ * @returns Startup data for pocket
222
+ */
223
+ public async getPocketStartupDataAsync(request: carriers.Pocket_GetPocketStartupDataRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData >;
224
+
225
+ /**
226
+ *
227
+ * @param tables - Tables to check for license
228
+ * @param currentClientTime - Current time on the client, used for overdue sale lookup having correct timezone relative to client
229
+ * @returns Startup data for pocket
230
+ */
231
+ public async getPocketStartupDataAsync(tables: string[], currentClientTime: Date, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData >;
232
+
233
+ public async getPocketStartupDataAsync(tables:string[]|carriers.Pocket_GetPocketStartupDataRequest, currentClientTime?:Date|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketStartupData > {
234
+ let _request : carriers.Pocket_GetPocketStartupDataRequest = null;
235
+ let _options : base.WebApiRequestOptions = null;
236
+ const first : any = tables;
237
+ if( typeof( first ) === "object" && first && ( typeof(first.tables)!='undefined' || typeof(first.currentClientTime)!='undefined' ) )
238
+ {
239
+ _request = tables as carriers.Pocket_GetPocketStartupDataRequest;
240
+ _options = currentClientTime as base.WebApiRequestOptions;
241
+ }
242
+ else
243
+ {
244
+ _request = {
245
+ tables: tables as string[],
246
+ currentClientTime: currentClientTime as Date,
247
+ };
248
+ _options = webapi_options;
249
+ }
250
+ return this._getPocketStartupDataAsync( _request, _options );
251
+ }
252
+
253
+
254
+ private async _registerDeviceForPushNotificationAsync(request: carriers.Pocket_RegisterDeviceForPushNotificationRequest, options?:base.WebApiRequestOptions) : Promise< void > {
255
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
256
+ base.WebApiBase.SetPending(options);
257
+ return new Promise< void >(async (resolve, reject) => {
258
+ try {
259
+ config.baseURL = this._options.baseUrl;
260
+ const response = await this._axios.post("RegisterDeviceForPushNotification", request , config);
261
+ base.WebApiBase.SetCompleted(options, response);
262
+ const res = response.data;
263
+ resolve(res);
264
+ }
265
+ catch( err ) {
266
+ base.WebApiBase.HandleError(options, config, err);
267
+ reject(err);
268
+ }
269
+ });
270
+ }
271
+
272
+
273
+
274
+ /**
275
+ * Register a device that should receive push notifications when notable events occour
276
+ * @param request - DeviceInfo
277
+ * @returns This method has no return value
278
+ */
279
+ public async registerDeviceForPushNotificationAsync(request: carriers.Pocket_RegisterDeviceForPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
280
+
281
+ /**
282
+ * Register a device that should receive push notifications when notable events occour
283
+ * @param deviceInfo - Properties for the device to register
284
+ * @returns This method has no return value
285
+ */
286
+ public async registerDeviceForPushNotificationAsync(deviceInfo: carriers.PocketDeviceInfo, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
287
+
288
+ public async registerDeviceForPushNotificationAsync(deviceInfo:carriers.PocketDeviceInfo|carriers.Pocket_RegisterDeviceForPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
289
+ let _request : carriers.Pocket_RegisterDeviceForPushNotificationRequest = null;
290
+ let _options : base.WebApiRequestOptions = null;
291
+ const first : any = deviceInfo;
292
+ if( typeof( first ) === "object" && first && ( typeof(first.deviceInfo)!='undefined' ) )
293
+ {
294
+ _request = deviceInfo as carriers.Pocket_RegisterDeviceForPushNotificationRequest;
295
+ _options = webapi_options as base.WebApiRequestOptions;
296
+ }
297
+ else
298
+ {
299
+ _request = {
300
+ deviceInfo: deviceInfo as carriers.PocketDeviceInfo,
301
+ };
302
+ _options = webapi_options;
303
+ }
304
+ return this._registerDeviceForPushNotificationAsync( _request, _options );
305
+ }
306
+
307
+
308
+ private async _getRegisteredDevicesAsync(request: carriers.Pocket_GetRegisteredDevicesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] > {
309
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
310
+ base.WebApiBase.SetPending(options);
311
+ return new Promise< carriers.PocketDeviceInfo[] >(async (resolve, reject) => {
312
+ try {
313
+ config.baseURL = this._options.baseUrl;
314
+ const response = await this._axios.post("GetRegisteredDevices", request , config);
315
+ base.WebApiBase.SetCompleted(options, response);
316
+ const res : carriers.PocketDeviceInfo[] = converters.Create_PocketDeviceInfoArray_From( response.data );
317
+ resolve(res);
318
+ }
319
+ catch( err ) {
320
+ base.WebApiBase.HandleError(options, config, err);
321
+ reject(err);
322
+ }
323
+ });
324
+ }
325
+
326
+
327
+
328
+ /**
329
+ * Retrieve all registered devices for an associate
330
+ * @param request - AssociateId
331
+ * @returns
332
+ */
333
+ public async getRegisteredDevicesAsync(request: carriers.Pocket_GetRegisteredDevicesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] >;
334
+
335
+ /**
336
+ * Retrieve all registered devices for an associate
337
+ * @param associateId - The user to get devices for
338
+ * @returns
339
+ */
340
+ public async getRegisteredDevicesAsync(associateId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] >;
341
+
342
+ public async getRegisteredDevicesAsync(associateId:number|carriers.Pocket_GetRegisteredDevicesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PocketDeviceInfo[] > {
343
+ let _request : carriers.Pocket_GetRegisteredDevicesRequest = null;
344
+ let _options : base.WebApiRequestOptions = null;
345
+ const first : any = associateId;
346
+ if( typeof( first ) === "object" && first && ( typeof(first.associateId)!='undefined' ) )
347
+ {
348
+ _request = associateId as carriers.Pocket_GetRegisteredDevicesRequest;
349
+ _options = webapi_options as base.WebApiRequestOptions;
350
+ }
351
+ else
352
+ {
353
+ _request = {
354
+ associateId: associateId as number,
355
+ };
356
+ _options = webapi_options;
357
+ }
358
+ return this._getRegisteredDevicesAsync( _request, _options );
359
+ }
360
+
361
+
362
+ private async _setPushNotificationTagsForDeviceAsync(request: carriers.Pocket_SetPushNotificationTagsForDeviceRequest, options?:base.WebApiRequestOptions) : Promise< void > {
363
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
364
+ base.WebApiBase.SetPending(options);
365
+ return new Promise< void >(async (resolve, reject) => {
366
+ try {
367
+ config.baseURL = this._options.baseUrl;
368
+ const response = await this._axios.post("SetPushNotificationTagsForDevice", request , config);
369
+ base.WebApiBase.SetCompleted(options, response);
370
+ const res = response.data;
371
+ resolve(res);
372
+ }
373
+ catch( err ) {
374
+ base.WebApiBase.HandleError(options, config, err);
375
+ reject(err);
376
+ }
377
+ });
378
+ }
379
+
380
+
381
+
382
+ /**
383
+ * Specify what kind of notification events a device should receive push notifications for
384
+ * @param request - DeviceIdentifier, Tags
385
+ * @returns This method has no return value
386
+ */
387
+ public async setPushNotificationTagsForDeviceAsync(request: carriers.Pocket_SetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
388
+
389
+ /**
390
+ * Specify what kind of notification events a device should receive push notifications for
391
+ * @param deviceIdentifier - The unique identifier for a device
392
+ * @param tags - A comma separated list of events this device should receive push events for
393
+ * @returns This method has no return value
394
+ */
395
+ public async setPushNotificationTagsForDeviceAsync(deviceIdentifier: string, tags: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
396
+
397
+ public async setPushNotificationTagsForDeviceAsync(deviceIdentifier:string|carriers.Pocket_SetPushNotificationTagsForDeviceRequest, tags?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
398
+ let _request : carriers.Pocket_SetPushNotificationTagsForDeviceRequest = null;
399
+ let _options : base.WebApiRequestOptions = null;
400
+ const first : any = deviceIdentifier;
401
+ if( typeof( first ) === "object" && first && ( typeof(first.deviceIdentifier)!='undefined' || typeof(first.tags)!='undefined' ) )
402
+ {
403
+ _request = deviceIdentifier as carriers.Pocket_SetPushNotificationTagsForDeviceRequest;
404
+ _options = tags as base.WebApiRequestOptions;
405
+ }
406
+ else
407
+ {
408
+ _request = {
409
+ deviceIdentifier: deviceIdentifier as string,
410
+ tags: tags as string,
411
+ };
412
+ _options = webapi_options;
413
+ }
414
+ return this._setPushNotificationTagsForDeviceAsync( _request, _options );
415
+ }
416
+
417
+
418
+ private async _setPushNotificationTagsForUserAsync(request: carriers.Pocket_SetPushNotificationTagsForUserRequest, options?:base.WebApiRequestOptions) : Promise< void > {
419
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
420
+ base.WebApiBase.SetPending(options);
421
+ return new Promise< void >(async (resolve, reject) => {
422
+ try {
423
+ config.baseURL = this._options.baseUrl;
424
+ const response = await this._axios.post("SetPushNotificationTagsForUser", request , config);
425
+ base.WebApiBase.SetCompleted(options, response);
426
+ const res = response.data;
427
+ resolve(res);
428
+ }
429
+ catch( err ) {
430
+ base.WebApiBase.HandleError(options, config, err);
431
+ reject(err);
432
+ }
433
+ });
434
+ }
435
+
436
+
437
+
438
+ /**
439
+ * Specify what kind of notification events a user should receive push notifications for. This will update all registerred devices for this user.
440
+ * @param request - AssociateId, Tags
441
+ * @returns This method has no return value
442
+ */
443
+ public async setPushNotificationTagsForUserAsync(request: carriers.Pocket_SetPushNotificationTagsForUserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
444
+
445
+ /**
446
+ * Specify what kind of notification events a user should receive push notifications for. This will update all registerred devices for this user.
447
+ * @param associateId - The associate to set tags for
448
+ * @param tags - A comma separated list of events the associate should receive push events for
449
+ * @returns This method has no return value
450
+ */
451
+ public async setPushNotificationTagsForUserAsync(associateId: number, tags: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
452
+
453
+ public async setPushNotificationTagsForUserAsync(associateId:number|carriers.Pocket_SetPushNotificationTagsForUserRequest, tags?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
454
+ let _request : carriers.Pocket_SetPushNotificationTagsForUserRequest = null;
455
+ let _options : base.WebApiRequestOptions = null;
456
+ const first : any = associateId;
457
+ if( typeof( first ) === "object" && first && ( typeof(first.associateId)!='undefined' || typeof(first.tags)!='undefined' ) )
458
+ {
459
+ _request = associateId as carriers.Pocket_SetPushNotificationTagsForUserRequest;
460
+ _options = tags as base.WebApiRequestOptions;
461
+ }
462
+ else
463
+ {
464
+ _request = {
465
+ associateId: associateId as number,
466
+ tags: tags as string,
467
+ };
468
+ _options = webapi_options;
469
+ }
470
+ return this._setPushNotificationTagsForUserAsync( _request, _options );
471
+ }
472
+
473
+
474
+ private async _getPushNotificationTagsForDeviceAsync(request: carriers.Pocket_GetPushNotificationTagsForDeviceRequest, options?:base.WebApiRequestOptions) : Promise< string > {
475
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
476
+ base.WebApiBase.SetPending(options);
477
+ return new Promise< string >(async (resolve, reject) => {
478
+ try {
479
+ config.baseURL = this._options.baseUrl;
480
+ const response = await this._axios.post("GetPushNotificationTagsForDevice", request , config);
481
+ base.WebApiBase.SetCompleted(options, response);
482
+ const res : string = response.data as string;
483
+ resolve(res);
484
+ }
485
+ catch( err ) {
486
+ base.WebApiBase.HandleError(options, config, err);
487
+ reject(err);
488
+ }
489
+ });
490
+ }
491
+
492
+
493
+
494
+ /**
495
+ * Retrieve current tag value for a device
496
+ * @param request - DeviceIdentifier
497
+ * @returns A comma separated list of events this device should receive push events for
498
+ */
499
+ public async getPushNotificationTagsForDeviceAsync(request: carriers.Pocket_GetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
500
+
501
+ /**
502
+ * Retrieve current tag value for a device
503
+ * @param deviceIdentifier - The unique identifier of this device
504
+ * @returns A comma separated list of events this device should receive push events for
505
+ */
506
+ public async getPushNotificationTagsForDeviceAsync(deviceIdentifier: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
507
+
508
+ public async getPushNotificationTagsForDeviceAsync(deviceIdentifier:string|carriers.Pocket_GetPushNotificationTagsForDeviceRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
509
+ let _request : carriers.Pocket_GetPushNotificationTagsForDeviceRequest = null;
510
+ let _options : base.WebApiRequestOptions = null;
511
+ const first : any = deviceIdentifier;
512
+ if( typeof( first ) === "object" && first && ( typeof(first.deviceIdentifier)!='undefined' ) )
513
+ {
514
+ _request = deviceIdentifier as carriers.Pocket_GetPushNotificationTagsForDeviceRequest;
515
+ _options = webapi_options as base.WebApiRequestOptions;
516
+ }
517
+ else
518
+ {
519
+ _request = {
520
+ deviceIdentifier: deviceIdentifier as string,
521
+ };
522
+ _options = webapi_options;
523
+ }
524
+ return this._getPushNotificationTagsForDeviceAsync( _request, _options );
525
+ }
526
+
527
+
528
+ private async _sendPushNotificationAsync(request: carriers.Pocket_SendPushNotificationRequest, options?:base.WebApiRequestOptions) : Promise< void > {
529
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
530
+ base.WebApiBase.SetPending(options);
531
+ return new Promise< void >(async (resolve, reject) => {
532
+ try {
533
+ config.baseURL = this._options.baseUrl;
534
+ const response = await this._axios.post("SendPushNotification", request , config);
535
+ base.WebApiBase.SetCompleted(options, response);
536
+ const res = response.data;
537
+ resolve(res);
538
+ }
539
+ catch( err ) {
540
+ base.WebApiBase.HandleError(options, config, err);
541
+ reject(err);
542
+ }
543
+ });
544
+ }
545
+
546
+
547
+
548
+ /**
549
+ * Send a push notification to one or more associates
550
+ * @param request - AssociateIds, Message
551
+ * @returns This method has no return value
552
+ */
553
+ public async sendPushNotificationAsync(request: carriers.Pocket_SendPushNotificationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
554
+
555
+ /**
556
+ * Send a push notification to one or more associates
557
+ * @param associateIds - The associates to send the push notification message to
558
+ * @param message - The message to send
559
+ * @returns This method has no return value
560
+ */
561
+ public async sendPushNotificationAsync(associateIds: number[], message: carriers.PocketNotificationMessage, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
562
+
563
+ public async sendPushNotificationAsync(associateIds:number[]|carriers.Pocket_SendPushNotificationRequest, message?:carriers.PocketNotificationMessage|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
564
+ let _request : carriers.Pocket_SendPushNotificationRequest = null;
565
+ let _options : base.WebApiRequestOptions = null;
566
+ const first : any = associateIds;
567
+ if( typeof( first ) === "object" && first && ( typeof(first.associateIds)!='undefined' || typeof(first.message)!='undefined' ) )
568
+ {
569
+ _request = associateIds as carriers.Pocket_SendPushNotificationRequest;
570
+ _options = message as base.WebApiRequestOptions;
571
+ }
572
+ else
573
+ {
574
+ _request = {
575
+ associateIds: associateIds as number[],
576
+ message: message as carriers.PocketNotificationMessage,
577
+ };
578
+ _options = webapi_options;
579
+ }
580
+ return this._sendPushNotificationAsync( _request, _options );
581
+ }
582
+
583
+
584
+ private async _runAppointmentAlarmBrokerAsync( options?:base.WebApiRequestOptions) : Promise< void > {
585
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
586
+ base.WebApiBase.SetPending(options);
587
+ return new Promise< void >(async (resolve, reject) => {
588
+ try {
589
+ config.baseURL = this._options.baseUrl;
590
+ const response = await this._axios.post("RunAppointmentAlarmBroker", undefined , config);
591
+ base.WebApiBase.SetCompleted(options, response);
592
+ const res = response.data;
593
+ resolve(res);
594
+ }
595
+ catch( err ) {
596
+ base.WebApiBase.HandleError(options, config, err);
597
+ reject(err);
598
+ }
599
+ });
600
+ }
601
+
602
+
603
+ /**
604
+ * Execute the AppointmentAlarmBroker once
605
+ * @returns This method has no return value
606
+ */
607
+ public async runAppointmentAlarmBrokerAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >
608
+ {
609
+ return this._runAppointmentAlarmBrokerAsync(webapi_options);
610
+ }
611
+
612
+
613
+ private async _notifyUsersAsync(request: carriers.Pocket_NotifyUsersRequest, options?:base.WebApiRequestOptions) : Promise< void > {
614
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
615
+ base.WebApiBase.SetPending(options);
616
+ return new Promise< void >(async (resolve, reject) => {
617
+ try {
618
+ config.baseURL = this._options.baseUrl;
619
+ const response = await this._axios.post("NotifyUsers", request , config);
620
+ base.WebApiBase.SetCompleted(options, response);
621
+ const res = response.data;
622
+ resolve(res);
623
+ }
624
+ catch( err ) {
625
+ base.WebApiBase.HandleError(options, config, err);
626
+ reject(err);
627
+ }
628
+ });
629
+ }
630
+
631
+
632
+
633
+ /**
634
+ * Notify users about a new or changed entity
635
+ * @param request - NotificationEventType, Id
636
+ * @returns This method has no return value
637
+ */
638
+ public async notifyUsersAsync(request: carriers.Pocket_NotifyUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
639
+
640
+ /**
641
+ * Notify users about a new or changed entity
642
+ * @param notificationEventType - Type of notification
643
+ * @param id - Id of entity to notify about
644
+ * @returns This method has no return value
645
+ */
646
+ public async notifyUsersAsync(notificationEventType: enums.NotificationEventType, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
647
+
648
+ public async notifyUsersAsync(notificationEventType:enums.NotificationEventType|carriers.Pocket_NotifyUsersRequest, id?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
649
+ let _request : carriers.Pocket_NotifyUsersRequest = null;
650
+ let _options : base.WebApiRequestOptions = null;
651
+ const first : any = notificationEventType;
652
+ if( typeof( first ) === "object" && first && ( typeof(first.notificationEventType)!='undefined' || typeof(first.id)!='undefined' ) )
653
+ {
654
+ _request = notificationEventType as carriers.Pocket_NotifyUsersRequest;
655
+ _options = id as base.WebApiRequestOptions;
656
+ }
657
+ else
658
+ {
659
+ _request = {
660
+ notificationEventType: notificationEventType as enums.NotificationEventType,
661
+ id: id as number,
662
+ };
663
+ _options = webapi_options;
664
+ }
665
+ return this._notifyUsersAsync( _request, _options );
666
+ }
667
+
668
+
669
+ private async _notificationHandledAsync(request: carriers.Pocket_NotificationHandledRequest, options?:base.WebApiRequestOptions) : Promise< void > {
670
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
671
+ base.WebApiBase.SetPending(options);
672
+ return new Promise< void >(async (resolve, reject) => {
673
+ try {
674
+ config.baseURL = this._options.baseUrl;
675
+ const response = await this._axios.post("NotificationHandled", request , config);
676
+ base.WebApiBase.SetCompleted(options, response);
677
+ const res = response.data;
678
+ resolve(res);
679
+ }
680
+ catch( err ) {
681
+ base.WebApiBase.HandleError(options, config, err);
682
+ reject(err);
683
+ }
684
+ });
685
+ }
686
+
687
+
688
+
689
+ /**
690
+ * Mark a notification as handled, so it can be cleaned up on other clients that have received the notification
691
+ * @param request - NotificationEventType, Id
692
+ * @returns This method has no return value
693
+ */
694
+ public async notificationHandledAsync(request: carriers.Pocket_NotificationHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
695
+
696
+ /**
697
+ * Mark a notification as handled, so it can be cleaned up on other clients that have received the notification
698
+ * @param notificationEventType - Type of notification
699
+ * @param id - Id of entity to notify about
700
+ * @returns This method has no return value
701
+ */
702
+ public async notificationHandledAsync(notificationEventType: enums.NotificationEventType, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
703
+
704
+ public async notificationHandledAsync(notificationEventType:enums.NotificationEventType|carriers.Pocket_NotificationHandledRequest, id?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
705
+ let _request : carriers.Pocket_NotificationHandledRequest = null;
706
+ let _options : base.WebApiRequestOptions = null;
707
+ const first : any = notificationEventType;
708
+ if( typeof( first ) === "object" && first && ( typeof(first.notificationEventType)!='undefined' || typeof(first.id)!='undefined' ) )
709
+ {
710
+ _request = notificationEventType as carriers.Pocket_NotificationHandledRequest;
711
+ _options = id as base.WebApiRequestOptions;
712
+ }
713
+ else
714
+ {
715
+ _request = {
716
+ notificationEventType: notificationEventType as enums.NotificationEventType,
717
+ id: id as number,
718
+ };
719
+ _options = webapi_options;
720
+ }
721
+ return this._notificationHandledAsync( _request, _options );
722
+ }
723
+
724
+
725
+ private async _notificationsHandledAsync(request: carriers.Pocket_NotificationsHandledRequest, options?:base.WebApiRequestOptions) : Promise< void > {
726
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
727
+ base.WebApiBase.SetPending(options);
728
+ return new Promise< void >(async (resolve, reject) => {
729
+ try {
730
+ config.baseURL = this._options.baseUrl;
731
+ const response = await this._axios.post("NotificationsHandled", request , config);
732
+ base.WebApiBase.SetCompleted(options, response);
733
+ const res = response.data;
734
+ resolve(res);
735
+ }
736
+ catch( err ) {
737
+ base.WebApiBase.HandleError(options, config, err);
738
+ reject(err);
739
+ }
740
+ });
741
+ }
742
+
743
+
744
+
745
+ /**
746
+ * Mark a set of notifications as handled, so they can be cleaned up on other clients that have received the notification
747
+ * @param request - NotificationEvents
748
+ * @returns This method has no return value
749
+ */
750
+ public async notificationsHandledAsync(request: carriers.Pocket_NotificationsHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
751
+
752
+ /**
753
+ * Mark a set of notifications as handled, so they can be cleaned up on other clients that have received the notification
754
+ * @param notificationEvents - List of notifications to mark as handled
755
+ * @returns This method has no return value
756
+ */
757
+ public async notificationsHandledAsync(notificationEvents: carriers.NotificationEvent[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
758
+
759
+ public async notificationsHandledAsync(notificationEvents:carriers.NotificationEvent[]|carriers.Pocket_NotificationsHandledRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
760
+ let _request : carriers.Pocket_NotificationsHandledRequest = null;
761
+ let _options : base.WebApiRequestOptions = null;
762
+ const first : any = notificationEvents;
763
+ if( typeof( first ) === "object" && first && ( typeof(first.notificationEvents)!='undefined' ) )
764
+ {
765
+ _request = notificationEvents as carriers.Pocket_NotificationsHandledRequest;
766
+ _options = webapi_options as base.WebApiRequestOptions;
767
+ }
768
+ else
769
+ {
770
+ _request = {
771
+ notificationEvents: notificationEvents as carriers.NotificationEvent[],
772
+ };
773
+ _options = webapi_options;
774
+ }
775
+ return this._notificationsHandledAsync( _request, _options );
776
+ }
777
+
778
+ } // class v1PocketAgentController
779
+
780
+