@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,528 +1,528 @@
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/TimeZoneAgent.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
- * TimeZone maintenance
28
- */
29
- export interface ITimeZoneAgent {
30
- getDefaultTimeZoneInformationAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreferredTimeZone >;
31
- initializeTimeZoneDataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TimeZoneData[] >;
32
- getBaseTimeZoneIdAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >;
33
- updateTimeZoneDataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
34
- checkNewTimeZoneDataAvailableAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
35
- toggleActiveTimeZoneRowAsync(request: carriers.TimeZone_ToggleActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
36
- toggleActiveTimeZoneRowAsync(id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
37
- setActiveTimeZonesByFilterAsync(request: carriers.TimeZone_SetActiveTimeZonesByFilterRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
38
- setActiveTimeZonesByFilterAsync(filter: string, active: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
39
- timeOfLastTimeZoneUpdateAsync(webapi_options?:base.WebApiRequestOptions) : Promise< Date >;
40
- setBaseTimeZoneIdAsync(request: carriers.TimeZone_SetBaseTimeZoneIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
41
- setBaseTimeZoneIdAsync(timezoneId: number, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
42
- getDefaultTimeZonePreferenceAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >;
43
- deleteTimeZonesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >;
44
- setActiveTimeZoneRowAsync(request: carriers.TimeZone_SetActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
45
- setActiveTimeZoneRowAsync(id: number, active: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
46
- } // interface ITimeZoneAgent
47
-
48
-
49
-
50
-
51
- /**
52
- * TimeZone maintenance
53
- */
54
- export class TimeZoneAgent extends base.WebApiBase implements ITimeZoneAgent {
55
- constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
56
- constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
57
- constructor(baseUrl: string, resourceManager:any);
58
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
59
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
60
- constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
61
- constructor(options: base.WebApiOptions);
62
-
63
- constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
64
- langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
65
- langOrResourceOrRM?:string|base.ResourceParsing|any,
66
- cultureCode?: string,
67
- ) {
68
- const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
69
- options.basePath = "v1/Agents/TimeZone/";
70
- super(options);
71
- }
72
-
73
-
74
-
75
- private async _getDefaultTimeZoneInformationAsync( options?:base.WebApiRequestOptions) : Promise< carriers.PreferredTimeZone > {
76
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
77
- base.WebApiBase.SetPending(options);
78
- return new Promise< carriers.PreferredTimeZone >(async (resolve, reject) => {
79
- try {
80
- config.baseURL = this._options.baseUrl;
81
- const response = await this._axios.post("GetDefaultTimeZoneInformation", undefined , config);
82
- base.WebApiBase.SetCompleted(options, response);
83
- const res : carriers.PreferredTimeZone = converters.Create_PreferredTimeZone_From( response.data );
84
- resolve(res);
85
- }
86
- catch( err ) {
87
- base.WebApiBase.HandleError(options, config, err);
88
- reject(err);
89
- }
90
- });
91
- }
92
-
93
-
94
- /**
95
- * Get information about the current, preferred timezone for the current user. If no such preference has been set, returns the correct fallback (and UserPreferenceId is 0)
96
- * @returns Get information about the current, preferred timezone for the current user.
97
- */
98
- public async getDefaultTimeZoneInformationAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreferredTimeZone >
99
- {
100
- return this._getDefaultTimeZoneInformationAsync(webapi_options);
101
- }
102
-
103
-
104
- private async _initializeTimeZoneDataAsync( options?:base.WebApiRequestOptions) : Promise< carriers.TimeZoneData[] > {
105
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
106
- base.WebApiBase.SetPending(options);
107
- return new Promise< carriers.TimeZoneData[] >(async (resolve, reject) => {
108
- try {
109
- config.baseURL = this._options.baseUrl;
110
- const response = await this._axios.post("InitializeTimeZoneData", undefined , config);
111
- base.WebApiBase.SetCompleted(options, response);
112
- const res : carriers.TimeZoneData[] = converters.Create_TimeZoneDataArray_From( response.data );
113
- resolve(res);
114
- }
115
- catch( err ) {
116
- base.WebApiBase.HandleError(options, config, err);
117
- reject(err);
118
- }
119
- });
120
- }
121
-
122
-
123
- /**
124
- * Initalizes the TimeZoneData
125
- * @returns
126
- */
127
- public async initializeTimeZoneDataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TimeZoneData[] >
128
- {
129
- return this._initializeTimeZoneDataAsync(webapi_options);
130
- }
131
-
132
-
133
- private async _getBaseTimeZoneIdAsync( options?:base.WebApiRequestOptions) : Promise< number > {
134
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
135
- base.WebApiBase.SetPending(options);
136
- return new Promise< number >(async (resolve, reject) => {
137
- try {
138
- config.baseURL = this._options.baseUrl;
139
- const response = await this._axios.post("GetBaseTimeZoneId", undefined , config);
140
- base.WebApiBase.SetCompleted(options, response);
141
- const res : number = response.data as number;
142
- resolve(res);
143
- }
144
- catch( err ) {
145
- base.WebApiBase.HandleError(options, config, err);
146
- reject(err);
147
- }
148
- });
149
- }
150
-
151
-
152
- /**
153
- * Get the base timezone id.
154
- * @returns Returns the base timezone id. Returns 0 if not set.
155
- */
156
- public async getBaseTimeZoneIdAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >
157
- {
158
- return this._getBaseTimeZoneIdAsync(webapi_options);
159
- }
160
-
161
-
162
- private async _updateTimeZoneDataAsync( options?:base.WebApiRequestOptions) : Promise< boolean > {
163
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
164
- base.WebApiBase.SetPending(options);
165
- return new Promise< boolean >(async (resolve, reject) => {
166
- try {
167
- config.baseURL = this._options.baseUrl;
168
- const response = await this._axios.post("UpdateTimeZoneData", undefined , config);
169
- base.WebApiBase.SetCompleted(options, response);
170
- const res : boolean = response.data as boolean;
171
- resolve(res);
172
- }
173
- catch( err ) {
174
- base.WebApiBase.HandleError(options, config, err);
175
- reject(err);
176
- }
177
- });
178
- }
179
-
180
-
181
- /**
182
- * Retrieve time zone data from the SuperOffice server and update TimeZone data in the database
183
- * @returns Returns true if the operation succeeded
184
- */
185
- public async updateTimeZoneDataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >
186
- {
187
- return this._updateTimeZoneDataAsync(webapi_options);
188
- }
189
-
190
-
191
- private async _checkNewTimeZoneDataAvailableAsync( options?:base.WebApiRequestOptions) : Promise< boolean > {
192
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
193
- base.WebApiBase.SetPending(options);
194
- return new Promise< boolean >(async (resolve, reject) => {
195
- try {
196
- config.baseURL = this._options.baseUrl;
197
- const response = await this._axios.post("CheckNewTimeZoneDataAvailable", undefined , config);
198
- base.WebApiBase.SetCompleted(options, response);
199
- const res : boolean = response.data as boolean;
200
- resolve(res);
201
- }
202
- catch( err ) {
203
- base.WebApiBase.HandleError(options, config, err);
204
- reject(err);
205
- }
206
- });
207
- }
208
-
209
-
210
- /**
211
- * Check to see if new timezone data is available
212
- * @returns Returns true if new timezone info is found available, false otherwise
213
- */
214
- public async checkNewTimeZoneDataAvailableAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >
215
- {
216
- return this._checkNewTimeZoneDataAvailableAsync(webapi_options);
217
- }
218
-
219
-
220
- private async _toggleActiveTimeZoneRowAsync(request: carriers.TimeZone_ToggleActiveTimeZoneRowRequest, options?:base.WebApiRequestOptions) : Promise< void > {
221
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
222
- base.WebApiBase.SetPending(options);
223
- return new Promise< void >(async (resolve, reject) => {
224
- try {
225
- config.baseURL = this._options.baseUrl;
226
- const response = await this._axios.post("ToggleActiveTimeZoneRow", request , config);
227
- base.WebApiBase.SetCompleted(options, response);
228
- const res = response.data;
229
- resolve(res);
230
- }
231
- catch( err ) {
232
- base.WebApiBase.HandleError(options, config, err);
233
- reject(err);
234
- }
235
- });
236
- }
237
-
238
-
239
-
240
- /**
241
- * Toggles active state of a single row in the TZLocation table
242
- * @param request - Id
243
- * @returns
244
- */
245
- public async toggleActiveTimeZoneRowAsync(request: carriers.TimeZone_ToggleActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
246
-
247
- /**
248
- * Toggles active state of a single row in the TZLocation table
249
- * @param id - Id of row to toggle active state on
250
- * @returns
251
- */
252
- public async toggleActiveTimeZoneRowAsync(id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
253
-
254
- public async toggleActiveTimeZoneRowAsync(id:number|carriers.TimeZone_ToggleActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
255
- let _request : carriers.TimeZone_ToggleActiveTimeZoneRowRequest = null;
256
- let _options : base.WebApiRequestOptions = null;
257
- const first : any = id;
258
- if( typeof( first ) === "object" && first && ( typeof(first.id)!='undefined' ) )
259
- {
260
- _request = id as carriers.TimeZone_ToggleActiveTimeZoneRowRequest;
261
- _options = webapi_options as base.WebApiRequestOptions;
262
- }
263
- else
264
- {
265
- _request = {
266
- id: id as number,
267
- };
268
- _options = webapi_options;
269
- }
270
- return this._toggleActiveTimeZoneRowAsync( _request, _options );
271
- }
272
-
273
-
274
- private async _setActiveTimeZonesByFilterAsync(request: carriers.TimeZone_SetActiveTimeZonesByFilterRequest, options?:base.WebApiRequestOptions) : Promise< void > {
275
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
276
- base.WebApiBase.SetPending(options);
277
- return new Promise< void >(async (resolve, reject) => {
278
- try {
279
- config.baseURL = this._options.baseUrl;
280
- const response = await this._axios.post("SetActiveTimeZonesByFilter", request , config);
281
- base.WebApiBase.SetCompleted(options, response);
282
- const res = response.data;
283
- resolve(res);
284
- }
285
- catch( err ) {
286
- base.WebApiBase.HandleError(options, config, err);
287
- reject(err);
288
- }
289
- });
290
- }
291
-
292
-
293
-
294
- /**
295
- * Toggles active state of a single row in the TZLocation table
296
- * @param request - Filter, Active
297
- * @returns
298
- */
299
- public async setActiveTimeZonesByFilterAsync(request: carriers.TimeZone_SetActiveTimeZonesByFilterRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
300
-
301
- /**
302
- * Toggles active state of a single row in the TZLocation table
303
- * @param filter - Filter timezones
304
- * @param active - Set active to true or false
305
- * @returns
306
- */
307
- public async setActiveTimeZonesByFilterAsync(filter: string, active: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
308
-
309
- public async setActiveTimeZonesByFilterAsync(filter:string|carriers.TimeZone_SetActiveTimeZonesByFilterRequest, active?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
310
- let _request : carriers.TimeZone_SetActiveTimeZonesByFilterRequest = null;
311
- let _options : base.WebApiRequestOptions = null;
312
- const first : any = filter;
313
- if( typeof( first ) === "object" && first && ( typeof(first.filter)!='undefined' || typeof(first.active)!='undefined' ) )
314
- {
315
- _request = filter as carriers.TimeZone_SetActiveTimeZonesByFilterRequest;
316
- _options = active as base.WebApiRequestOptions;
317
- }
318
- else
319
- {
320
- _request = {
321
- filter: filter as string,
322
- active: active as boolean,
323
- };
324
- _options = webapi_options;
325
- }
326
- return this._setActiveTimeZonesByFilterAsync( _request, _options );
327
- }
328
-
329
-
330
- private async _timeOfLastTimeZoneUpdateAsync( options?:base.WebApiRequestOptions) : Promise< Date > {
331
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
332
- base.WebApiBase.SetPending(options);
333
- return new Promise< Date >(async (resolve, reject) => {
334
- try {
335
- config.baseURL = this._options.baseUrl;
336
- const response = await this._axios.post("TimeOfLastTimeZoneUpdate", undefined , config);
337
- base.WebApiBase.SetCompleted(options, response);
338
- const res : Date = response.data as Date;
339
- resolve(res);
340
- }
341
- catch( err ) {
342
- base.WebApiBase.HandleError(options, config, err);
343
- reject(err);
344
- }
345
- });
346
- }
347
-
348
-
349
- /**
350
- * Get the time time zone data was last updated
351
- * @returns Time of last update
352
- */
353
- public async timeOfLastTimeZoneUpdateAsync(webapi_options?:base.WebApiRequestOptions) : Promise< Date >
354
- {
355
- return this._timeOfLastTimeZoneUpdateAsync(webapi_options);
356
- }
357
-
358
-
359
- private async _setBaseTimeZoneIdAsync(request: carriers.TimeZone_SetBaseTimeZoneIdRequest, options?:base.WebApiRequestOptions) : Promise< boolean > {
360
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
361
- base.WebApiBase.SetPending(options);
362
- return new Promise< boolean >(async (resolve, reject) => {
363
- try {
364
- config.baseURL = this._options.baseUrl;
365
- const response = await this._axios.post("SetBaseTimeZoneId", request , config);
366
- base.WebApiBase.SetCompleted(options, response);
367
- const res : boolean = response.data as boolean;
368
- resolve(res);
369
- }
370
- catch( err ) {
371
- base.WebApiBase.HandleError(options, config, err);
372
- reject(err);
373
- }
374
- });
375
- }
376
-
377
-
378
-
379
- /**
380
- * Set the base timezone id.
381
- * @param request - TimezoneId
382
- * @returns Returns true if setting of base timezone was done
383
- */
384
- public async setBaseTimeZoneIdAsync(request: carriers.TimeZone_SetBaseTimeZoneIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
385
-
386
- /**
387
- * Set the base timezone id.
388
- * @param timezoneId - The timezone id to save
389
- * @returns Returns true if setting of base timezone was done
390
- */
391
- public async setBaseTimeZoneIdAsync(timezoneId: number, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
392
-
393
- public async setBaseTimeZoneIdAsync(timezoneId:number|carriers.TimeZone_SetBaseTimeZoneIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean > {
394
- let _request : carriers.TimeZone_SetBaseTimeZoneIdRequest = null;
395
- let _options : base.WebApiRequestOptions = null;
396
- const first : any = timezoneId;
397
- if( typeof( first ) === "object" && first && ( typeof(first.timezoneId)!='undefined' ) )
398
- {
399
- _request = timezoneId as carriers.TimeZone_SetBaseTimeZoneIdRequest;
400
- _options = webapi_options as base.WebApiRequestOptions;
401
- }
402
- else
403
- {
404
- _request = {
405
- timezoneId: timezoneId as number,
406
- };
407
- _options = webapi_options;
408
- }
409
- return this._setBaseTimeZoneIdAsync( _request, _options );
410
- }
411
-
412
-
413
- private async _getDefaultTimeZonePreferenceAsync( options?:base.WebApiRequestOptions) : Promise< number > {
414
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
415
- base.WebApiBase.SetPending(options);
416
- return new Promise< number >(async (resolve, reject) => {
417
- try {
418
- config.baseURL = this._options.baseUrl;
419
- const response = await this._axios.post("GetDefaultTimeZonePreference", undefined , config);
420
- base.WebApiBase.SetCompleted(options, response);
421
- const res : number = response.data as number;
422
- resolve(res);
423
- }
424
- catch( err ) {
425
- base.WebApiBase.HandleError(options, config, err);
426
- reject(err);
427
- }
428
- });
429
- }
430
-
431
-
432
- /**
433
- * Returns the id of the default timezone preference with deflevel system wide
434
- * @returns The id of the system wide default timezone preference
435
- */
436
- public async getDefaultTimeZonePreferenceAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >
437
- {
438
- return this._getDefaultTimeZonePreferenceAsync(webapi_options);
439
- }
440
-
441
-
442
- private async _deleteTimeZonesAsync( options?:base.WebApiRequestOptions) : Promise< void > {
443
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
444
- base.WebApiBase.SetPending(options);
445
- return new Promise< void >(async (resolve, reject) => {
446
- try {
447
- config.baseURL = this._options.baseUrl;
448
- const response = await this._axios.post("DeleteTimeZones", undefined , config);
449
- base.WebApiBase.SetCompleted(options, response);
450
- const res = response.data;
451
- resolve(res);
452
- }
453
- catch( err ) {
454
- base.WebApiBase.HandleError(options, config, err);
455
- reject(err);
456
- }
457
- });
458
- }
459
-
460
-
461
- /**
462
- * Deletes all time zone data (locations and rules) from the database
463
- * @returns
464
- */
465
- public async deleteTimeZonesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >
466
- {
467
- return this._deleteTimeZonesAsync(webapi_options);
468
- }
469
-
470
-
471
- private async _setActiveTimeZoneRowAsync(request: carriers.TimeZone_SetActiveTimeZoneRowRequest, options?:base.WebApiRequestOptions) : Promise< void > {
472
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
473
- base.WebApiBase.SetPending(options);
474
- return new Promise< void >(async (resolve, reject) => {
475
- try {
476
- config.baseURL = this._options.baseUrl;
477
- const response = await this._axios.post("SetActiveTimeZoneRow", request , config);
478
- base.WebApiBase.SetCompleted(options, response);
479
- const res = response.data;
480
- resolve(res);
481
- }
482
- catch( err ) {
483
- base.WebApiBase.HandleError(options, config, err);
484
- reject(err);
485
- }
486
- });
487
- }
488
-
489
-
490
-
491
- /**
492
- * Set active state of singe row in the TZLocation table
493
- * @param request - Id, Active
494
- * @returns
495
- */
496
- public async setActiveTimeZoneRowAsync(request: carriers.TimeZone_SetActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
497
-
498
- /**
499
- * Set active state of singe row in the TZLocation table
500
- * @param id - Id of row to set active state on
501
- * @param active - Set active to true or false
502
- * @returns
503
- */
504
- public async setActiveTimeZoneRowAsync(id: number, active: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
505
-
506
- public async setActiveTimeZoneRowAsync(id:number|carriers.TimeZone_SetActiveTimeZoneRowRequest, active?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
507
- let _request : carriers.TimeZone_SetActiveTimeZoneRowRequest = null;
508
- let _options : base.WebApiRequestOptions = null;
509
- const first : any = id;
510
- if( typeof( first ) === "object" && first && ( typeof(first.id)!='undefined' || typeof(first.active)!='undefined' ) )
511
- {
512
- _request = id as carriers.TimeZone_SetActiveTimeZoneRowRequest;
513
- _options = active as base.WebApiRequestOptions;
514
- }
515
- else
516
- {
517
- _request = {
518
- id: id as number,
519
- active: active as boolean,
520
- };
521
- _options = webapi_options;
522
- }
523
- return this._setActiveTimeZoneRowAsync( _request, _options );
524
- }
525
-
526
- } // class v1TimeZoneAgentController
527
-
528
-
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/TimeZoneAgent.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
+ * TimeZone maintenance
28
+ */
29
+ export interface ITimeZoneAgent {
30
+ getDefaultTimeZoneInformationAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreferredTimeZone >;
31
+ initializeTimeZoneDataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TimeZoneData[] >;
32
+ getBaseTimeZoneIdAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >;
33
+ updateTimeZoneDataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
34
+ checkNewTimeZoneDataAvailableAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
35
+ toggleActiveTimeZoneRowAsync(request: carriers.TimeZone_ToggleActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
36
+ toggleActiveTimeZoneRowAsync(id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
37
+ setActiveTimeZonesByFilterAsync(request: carriers.TimeZone_SetActiveTimeZonesByFilterRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
38
+ setActiveTimeZonesByFilterAsync(filter: string, active: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
39
+ timeOfLastTimeZoneUpdateAsync(webapi_options?:base.WebApiRequestOptions) : Promise< Date >;
40
+ setBaseTimeZoneIdAsync(request: carriers.TimeZone_SetBaseTimeZoneIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
41
+ setBaseTimeZoneIdAsync(timezoneId: number, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
42
+ getDefaultTimeZonePreferenceAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >;
43
+ deleteTimeZonesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >;
44
+ setActiveTimeZoneRowAsync(request: carriers.TimeZone_SetActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
45
+ setActiveTimeZoneRowAsync(id: number, active: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
46
+ } // interface ITimeZoneAgent
47
+
48
+
49
+
50
+
51
+ /**
52
+ * TimeZone maintenance
53
+ */
54
+ export class TimeZoneAgent extends base.WebApiBase implements ITimeZoneAgent {
55
+ constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
56
+ constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
57
+ constructor(baseUrl: string, resourceManager:any);
58
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
59
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
60
+ constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
61
+ constructor(options: base.WebApiOptions);
62
+
63
+ constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
64
+ langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
65
+ langOrResourceOrRM?:string|base.ResourceParsing|any,
66
+ cultureCode?: string,
67
+ ) {
68
+ const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
69
+ options.basePath = "v1/Agents/TimeZone/";
70
+ super(options);
71
+ }
72
+
73
+
74
+
75
+ private async _getDefaultTimeZoneInformationAsync( options?:base.WebApiRequestOptions) : Promise< carriers.PreferredTimeZone > {
76
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
77
+ base.WebApiBase.SetPending(options);
78
+ return new Promise< carriers.PreferredTimeZone >(async (resolve, reject) => {
79
+ try {
80
+ config.baseURL = this._options.baseUrl;
81
+ const response = await this._axios.post("GetDefaultTimeZoneInformation", undefined , config);
82
+ base.WebApiBase.SetCompleted(options, response);
83
+ const res : carriers.PreferredTimeZone = converters.Create_PreferredTimeZone_From( response.data );
84
+ resolve(res);
85
+ }
86
+ catch( err ) {
87
+ base.WebApiBase.HandleError(options, config, err);
88
+ reject(err);
89
+ }
90
+ });
91
+ }
92
+
93
+
94
+ /**
95
+ * Get information about the current, preferred timezone for the current user. If no such preference has been set, returns the correct fallback (and UserPreferenceId is 0)
96
+ * @returns Get information about the current, preferred timezone for the current user.
97
+ */
98
+ public async getDefaultTimeZoneInformationAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreferredTimeZone >
99
+ {
100
+ return this._getDefaultTimeZoneInformationAsync(webapi_options);
101
+ }
102
+
103
+
104
+ private async _initializeTimeZoneDataAsync( options?:base.WebApiRequestOptions) : Promise< carriers.TimeZoneData[] > {
105
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
106
+ base.WebApiBase.SetPending(options);
107
+ return new Promise< carriers.TimeZoneData[] >(async (resolve, reject) => {
108
+ try {
109
+ config.baseURL = this._options.baseUrl;
110
+ const response = await this._axios.post("InitializeTimeZoneData", undefined , config);
111
+ base.WebApiBase.SetCompleted(options, response);
112
+ const res : carriers.TimeZoneData[] = converters.Create_TimeZoneDataArray_From( response.data );
113
+ resolve(res);
114
+ }
115
+ catch( err ) {
116
+ base.WebApiBase.HandleError(options, config, err);
117
+ reject(err);
118
+ }
119
+ });
120
+ }
121
+
122
+
123
+ /**
124
+ * Initalizes the TimeZoneData
125
+ * @returns
126
+ */
127
+ public async initializeTimeZoneDataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TimeZoneData[] >
128
+ {
129
+ return this._initializeTimeZoneDataAsync(webapi_options);
130
+ }
131
+
132
+
133
+ private async _getBaseTimeZoneIdAsync( options?:base.WebApiRequestOptions) : Promise< number > {
134
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
135
+ base.WebApiBase.SetPending(options);
136
+ return new Promise< number >(async (resolve, reject) => {
137
+ try {
138
+ config.baseURL = this._options.baseUrl;
139
+ const response = await this._axios.post("GetBaseTimeZoneId", undefined , config);
140
+ base.WebApiBase.SetCompleted(options, response);
141
+ const res : number = response.data as number;
142
+ resolve(res);
143
+ }
144
+ catch( err ) {
145
+ base.WebApiBase.HandleError(options, config, err);
146
+ reject(err);
147
+ }
148
+ });
149
+ }
150
+
151
+
152
+ /**
153
+ * Get the base timezone id.
154
+ * @returns Returns the base timezone id. Returns 0 if not set.
155
+ */
156
+ public async getBaseTimeZoneIdAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >
157
+ {
158
+ return this._getBaseTimeZoneIdAsync(webapi_options);
159
+ }
160
+
161
+
162
+ private async _updateTimeZoneDataAsync( options?:base.WebApiRequestOptions) : Promise< boolean > {
163
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
164
+ base.WebApiBase.SetPending(options);
165
+ return new Promise< boolean >(async (resolve, reject) => {
166
+ try {
167
+ config.baseURL = this._options.baseUrl;
168
+ const response = await this._axios.post("UpdateTimeZoneData", undefined , config);
169
+ base.WebApiBase.SetCompleted(options, response);
170
+ const res : boolean = response.data as boolean;
171
+ resolve(res);
172
+ }
173
+ catch( err ) {
174
+ base.WebApiBase.HandleError(options, config, err);
175
+ reject(err);
176
+ }
177
+ });
178
+ }
179
+
180
+
181
+ /**
182
+ * Retrieve time zone data from the SuperOffice server and update TimeZone data in the database
183
+ * @returns Returns true if the operation succeeded
184
+ */
185
+ public async updateTimeZoneDataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >
186
+ {
187
+ return this._updateTimeZoneDataAsync(webapi_options);
188
+ }
189
+
190
+
191
+ private async _checkNewTimeZoneDataAvailableAsync( options?:base.WebApiRequestOptions) : Promise< boolean > {
192
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
193
+ base.WebApiBase.SetPending(options);
194
+ return new Promise< boolean >(async (resolve, reject) => {
195
+ try {
196
+ config.baseURL = this._options.baseUrl;
197
+ const response = await this._axios.post("CheckNewTimeZoneDataAvailable", undefined , config);
198
+ base.WebApiBase.SetCompleted(options, response);
199
+ const res : boolean = response.data as boolean;
200
+ resolve(res);
201
+ }
202
+ catch( err ) {
203
+ base.WebApiBase.HandleError(options, config, err);
204
+ reject(err);
205
+ }
206
+ });
207
+ }
208
+
209
+
210
+ /**
211
+ * Check to see if new timezone data is available
212
+ * @returns Returns true if new timezone info is found available, false otherwise
213
+ */
214
+ public async checkNewTimeZoneDataAvailableAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >
215
+ {
216
+ return this._checkNewTimeZoneDataAvailableAsync(webapi_options);
217
+ }
218
+
219
+
220
+ private async _toggleActiveTimeZoneRowAsync(request: carriers.TimeZone_ToggleActiveTimeZoneRowRequest, options?:base.WebApiRequestOptions) : Promise< void > {
221
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
222
+ base.WebApiBase.SetPending(options);
223
+ return new Promise< void >(async (resolve, reject) => {
224
+ try {
225
+ config.baseURL = this._options.baseUrl;
226
+ const response = await this._axios.post("ToggleActiveTimeZoneRow", request , config);
227
+ base.WebApiBase.SetCompleted(options, response);
228
+ const res = response.data;
229
+ resolve(res);
230
+ }
231
+ catch( err ) {
232
+ base.WebApiBase.HandleError(options, config, err);
233
+ reject(err);
234
+ }
235
+ });
236
+ }
237
+
238
+
239
+
240
+ /**
241
+ * Toggles active state of a single row in the TZLocation table
242
+ * @param request - Id
243
+ * @returns
244
+ */
245
+ public async toggleActiveTimeZoneRowAsync(request: carriers.TimeZone_ToggleActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
246
+
247
+ /**
248
+ * Toggles active state of a single row in the TZLocation table
249
+ * @param id - Id of row to toggle active state on
250
+ * @returns
251
+ */
252
+ public async toggleActiveTimeZoneRowAsync(id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
253
+
254
+ public async toggleActiveTimeZoneRowAsync(id:number|carriers.TimeZone_ToggleActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
255
+ let _request : carriers.TimeZone_ToggleActiveTimeZoneRowRequest = null;
256
+ let _options : base.WebApiRequestOptions = null;
257
+ const first : any = id;
258
+ if( typeof( first ) === "object" && first && ( typeof(first.id)!='undefined' ) )
259
+ {
260
+ _request = id as carriers.TimeZone_ToggleActiveTimeZoneRowRequest;
261
+ _options = webapi_options as base.WebApiRequestOptions;
262
+ }
263
+ else
264
+ {
265
+ _request = {
266
+ id: id as number,
267
+ };
268
+ _options = webapi_options;
269
+ }
270
+ return this._toggleActiveTimeZoneRowAsync( _request, _options );
271
+ }
272
+
273
+
274
+ private async _setActiveTimeZonesByFilterAsync(request: carriers.TimeZone_SetActiveTimeZonesByFilterRequest, options?:base.WebApiRequestOptions) : Promise< void > {
275
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
276
+ base.WebApiBase.SetPending(options);
277
+ return new Promise< void >(async (resolve, reject) => {
278
+ try {
279
+ config.baseURL = this._options.baseUrl;
280
+ const response = await this._axios.post("SetActiveTimeZonesByFilter", request , config);
281
+ base.WebApiBase.SetCompleted(options, response);
282
+ const res = response.data;
283
+ resolve(res);
284
+ }
285
+ catch( err ) {
286
+ base.WebApiBase.HandleError(options, config, err);
287
+ reject(err);
288
+ }
289
+ });
290
+ }
291
+
292
+
293
+
294
+ /**
295
+ * Toggles active state of a single row in the TZLocation table
296
+ * @param request - Filter, Active
297
+ * @returns
298
+ */
299
+ public async setActiveTimeZonesByFilterAsync(request: carriers.TimeZone_SetActiveTimeZonesByFilterRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
300
+
301
+ /**
302
+ * Toggles active state of a single row in the TZLocation table
303
+ * @param filter - Filter timezones
304
+ * @param active - Set active to true or false
305
+ * @returns
306
+ */
307
+ public async setActiveTimeZonesByFilterAsync(filter: string, active: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
308
+
309
+ public async setActiveTimeZonesByFilterAsync(filter:string|carriers.TimeZone_SetActiveTimeZonesByFilterRequest, active?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
310
+ let _request : carriers.TimeZone_SetActiveTimeZonesByFilterRequest = null;
311
+ let _options : base.WebApiRequestOptions = null;
312
+ const first : any = filter;
313
+ if( typeof( first ) === "object" && first && ( typeof(first.filter)!='undefined' || typeof(first.active)!='undefined' ) )
314
+ {
315
+ _request = filter as carriers.TimeZone_SetActiveTimeZonesByFilterRequest;
316
+ _options = active as base.WebApiRequestOptions;
317
+ }
318
+ else
319
+ {
320
+ _request = {
321
+ filter: filter as string,
322
+ active: active as boolean,
323
+ };
324
+ _options = webapi_options;
325
+ }
326
+ return this._setActiveTimeZonesByFilterAsync( _request, _options );
327
+ }
328
+
329
+
330
+ private async _timeOfLastTimeZoneUpdateAsync( options?:base.WebApiRequestOptions) : Promise< Date > {
331
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
332
+ base.WebApiBase.SetPending(options);
333
+ return new Promise< Date >(async (resolve, reject) => {
334
+ try {
335
+ config.baseURL = this._options.baseUrl;
336
+ const response = await this._axios.post("TimeOfLastTimeZoneUpdate", undefined , config);
337
+ base.WebApiBase.SetCompleted(options, response);
338
+ const res : Date = response.data as Date;
339
+ resolve(res);
340
+ }
341
+ catch( err ) {
342
+ base.WebApiBase.HandleError(options, config, err);
343
+ reject(err);
344
+ }
345
+ });
346
+ }
347
+
348
+
349
+ /**
350
+ * Get the time time zone data was last updated
351
+ * @returns Time of last update
352
+ */
353
+ public async timeOfLastTimeZoneUpdateAsync(webapi_options?:base.WebApiRequestOptions) : Promise< Date >
354
+ {
355
+ return this._timeOfLastTimeZoneUpdateAsync(webapi_options);
356
+ }
357
+
358
+
359
+ private async _setBaseTimeZoneIdAsync(request: carriers.TimeZone_SetBaseTimeZoneIdRequest, options?:base.WebApiRequestOptions) : Promise< boolean > {
360
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
361
+ base.WebApiBase.SetPending(options);
362
+ return new Promise< boolean >(async (resolve, reject) => {
363
+ try {
364
+ config.baseURL = this._options.baseUrl;
365
+ const response = await this._axios.post("SetBaseTimeZoneId", request , config);
366
+ base.WebApiBase.SetCompleted(options, response);
367
+ const res : boolean = response.data as boolean;
368
+ resolve(res);
369
+ }
370
+ catch( err ) {
371
+ base.WebApiBase.HandleError(options, config, err);
372
+ reject(err);
373
+ }
374
+ });
375
+ }
376
+
377
+
378
+
379
+ /**
380
+ * Set the base timezone id.
381
+ * @param request - TimezoneId
382
+ * @returns Returns true if setting of base timezone was done
383
+ */
384
+ public async setBaseTimeZoneIdAsync(request: carriers.TimeZone_SetBaseTimeZoneIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
385
+
386
+ /**
387
+ * Set the base timezone id.
388
+ * @param timezoneId - The timezone id to save
389
+ * @returns Returns true if setting of base timezone was done
390
+ */
391
+ public async setBaseTimeZoneIdAsync(timezoneId: number, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
392
+
393
+ public async setBaseTimeZoneIdAsync(timezoneId:number|carriers.TimeZone_SetBaseTimeZoneIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean > {
394
+ let _request : carriers.TimeZone_SetBaseTimeZoneIdRequest = null;
395
+ let _options : base.WebApiRequestOptions = null;
396
+ const first : any = timezoneId;
397
+ if( typeof( first ) === "object" && first && ( typeof(first.timezoneId)!='undefined' ) )
398
+ {
399
+ _request = timezoneId as carriers.TimeZone_SetBaseTimeZoneIdRequest;
400
+ _options = webapi_options as base.WebApiRequestOptions;
401
+ }
402
+ else
403
+ {
404
+ _request = {
405
+ timezoneId: timezoneId as number,
406
+ };
407
+ _options = webapi_options;
408
+ }
409
+ return this._setBaseTimeZoneIdAsync( _request, _options );
410
+ }
411
+
412
+
413
+ private async _getDefaultTimeZonePreferenceAsync( options?:base.WebApiRequestOptions) : Promise< number > {
414
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
415
+ base.WebApiBase.SetPending(options);
416
+ return new Promise< number >(async (resolve, reject) => {
417
+ try {
418
+ config.baseURL = this._options.baseUrl;
419
+ const response = await this._axios.post("GetDefaultTimeZonePreference", undefined , config);
420
+ base.WebApiBase.SetCompleted(options, response);
421
+ const res : number = response.data as number;
422
+ resolve(res);
423
+ }
424
+ catch( err ) {
425
+ base.WebApiBase.HandleError(options, config, err);
426
+ reject(err);
427
+ }
428
+ });
429
+ }
430
+
431
+
432
+ /**
433
+ * Returns the id of the default timezone preference with deflevel system wide
434
+ * @returns The id of the system wide default timezone preference
435
+ */
436
+ public async getDefaultTimeZonePreferenceAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >
437
+ {
438
+ return this._getDefaultTimeZonePreferenceAsync(webapi_options);
439
+ }
440
+
441
+
442
+ private async _deleteTimeZonesAsync( options?:base.WebApiRequestOptions) : Promise< void > {
443
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
444
+ base.WebApiBase.SetPending(options);
445
+ return new Promise< void >(async (resolve, reject) => {
446
+ try {
447
+ config.baseURL = this._options.baseUrl;
448
+ const response = await this._axios.post("DeleteTimeZones", undefined , config);
449
+ base.WebApiBase.SetCompleted(options, response);
450
+ const res = response.data;
451
+ resolve(res);
452
+ }
453
+ catch( err ) {
454
+ base.WebApiBase.HandleError(options, config, err);
455
+ reject(err);
456
+ }
457
+ });
458
+ }
459
+
460
+
461
+ /**
462
+ * Deletes all time zone data (locations and rules) from the database
463
+ * @returns
464
+ */
465
+ public async deleteTimeZonesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >
466
+ {
467
+ return this._deleteTimeZonesAsync(webapi_options);
468
+ }
469
+
470
+
471
+ private async _setActiveTimeZoneRowAsync(request: carriers.TimeZone_SetActiveTimeZoneRowRequest, options?:base.WebApiRequestOptions) : Promise< void > {
472
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
473
+ base.WebApiBase.SetPending(options);
474
+ return new Promise< void >(async (resolve, reject) => {
475
+ try {
476
+ config.baseURL = this._options.baseUrl;
477
+ const response = await this._axios.post("SetActiveTimeZoneRow", request , config);
478
+ base.WebApiBase.SetCompleted(options, response);
479
+ const res = response.data;
480
+ resolve(res);
481
+ }
482
+ catch( err ) {
483
+ base.WebApiBase.HandleError(options, config, err);
484
+ reject(err);
485
+ }
486
+ });
487
+ }
488
+
489
+
490
+
491
+ /**
492
+ * Set active state of singe row in the TZLocation table
493
+ * @param request - Id, Active
494
+ * @returns
495
+ */
496
+ public async setActiveTimeZoneRowAsync(request: carriers.TimeZone_SetActiveTimeZoneRowRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
497
+
498
+ /**
499
+ * Set active state of singe row in the TZLocation table
500
+ * @param id - Id of row to set active state on
501
+ * @param active - Set active to true or false
502
+ * @returns
503
+ */
504
+ public async setActiveTimeZoneRowAsync(id: number, active: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
505
+
506
+ public async setActiveTimeZoneRowAsync(id:number|carriers.TimeZone_SetActiveTimeZoneRowRequest, active?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
507
+ let _request : carriers.TimeZone_SetActiveTimeZoneRowRequest = null;
508
+ let _options : base.WebApiRequestOptions = null;
509
+ const first : any = id;
510
+ if( typeof( first ) === "object" && first && ( typeof(first.id)!='undefined' || typeof(first.active)!='undefined' ) )
511
+ {
512
+ _request = id as carriers.TimeZone_SetActiveTimeZoneRowRequest;
513
+ _options = active as base.WebApiRequestOptions;
514
+ }
515
+ else
516
+ {
517
+ _request = {
518
+ id: id as number,
519
+ active: active as boolean,
520
+ };
521
+ _options = webapi_options;
522
+ }
523
+ return this._setActiveTimeZoneRowAsync( _request, _options );
524
+ }
525
+
526
+ } // class v1TimeZoneAgentController
527
+
528
+