@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,422 +1,422 @@
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/AssociateAgent.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
- * Associate utilities, notes, not user admininstration
28
- */
29
- export interface IAssociateAgent {
30
- getAssociateAsync(associateId: number) : Promise< carriers.Associate >;
31
- getAssociateByPersonIdAsync(request: carriers.Associate_GetAssociateByPersonIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate >;
32
- getAssociateByPersonIdAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate >;
33
- getNoteAsync(request: carriers.Associate_GetNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string[] >;
34
- getNoteAsync(associateId: number, webapi_options?:base.WebApiRequestOptions) : Promise< string[] >;
35
- saveNoteAsync(request: carriers.Associate_SaveNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
36
- saveNoteAsync(associateId: number, note: string[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
37
- getEncryptionKeyAsync(webapi_options?:base.WebApiRequestOptions) : Promise< string >;
38
- getAssociateListAsync(associateIds: number[]) : Promise< carriers.Associate[] >;
39
- getAssociatesByGroupAsync(request: carriers.Associate_GetAssociatesByGroupRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] >;
40
- getAssociatesByGroupAsync(groupId: number, type: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] >;
41
- logOffWindowsUsersAsync(request: carriers.Associate_LogOffWindowsUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
42
- logOffWindowsUsersAsync(associateIds: number[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
43
- } // interface IAssociateAgent
44
-
45
-
46
-
47
-
48
- /**
49
- * Associate utilities, notes, not user admininstration
50
- */
51
- export class AssociateAgent extends base.WebApiBase implements IAssociateAgent {
52
- constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
53
- constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
54
- constructor(baseUrl: string, resourceManager:any);
55
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
56
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
57
- constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
58
- constructor(options: base.WebApiOptions);
59
-
60
- constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
61
- langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
62
- langOrResourceOrRM?:string|base.ResourceParsing|any,
63
- cultureCode?: string,
64
- ) {
65
- const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
66
- options.basePath = "v1/Agents/Associate/";
67
- super(options);
68
- }
69
-
70
-
71
- /**
72
- * Gets a Associate object.
73
- * @param associateId - The primary key.
74
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
75
- * @returns A single Associate
76
- */
77
- public async getAssociateAsync(associateId: number, options?:base.WebApiRequestOptions) : Promise< carriers.Associate > {
78
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
79
- base.WebApiBase.SetPending(options);
80
- return new Promise< carriers.Associate >(async (resolve, reject) => {
81
- try {
82
- const response = await this._axios.post("GetAssociate?associateId=" + associateId, null, config);
83
- base.WebApiBase.SetCompleted(options, response);
84
- const res = converters.Create_Associate_From( response.data );
85
- resolve(res);
86
- }
87
- catch( err ) {
88
- base.WebApiBase.HandleError(options, config, err);
89
- reject(err);
90
- }
91
- });
92
- }
93
-
94
-
95
- private async _getAssociateByPersonIdAsync(request: carriers.Associate_GetAssociateByPersonIdRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Associate > {
96
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
97
- base.WebApiBase.SetPending(options);
98
- return new Promise< carriers.Associate >(async (resolve, reject) => {
99
- try {
100
- config.baseURL = this._options.baseUrl;
101
- const response = await this._axios.post("GetAssociateByPersonId", request , config);
102
- base.WebApiBase.SetCompleted(options, response);
103
- const res : carriers.Associate = converters.Create_Associate_From( response.data );
104
- resolve(res);
105
- }
106
- catch( err ) {
107
- base.WebApiBase.HandleError(options, config, err);
108
- reject(err);
109
- }
110
- });
111
- }
112
-
113
-
114
-
115
- /**
116
- * Returns the associate that belongs to this person if the person is an associate.
117
- * @param request - PersonId
118
- * @returns Associate if person is associate
119
- */
120
- public async getAssociateByPersonIdAsync(request: carriers.Associate_GetAssociateByPersonIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate >;
121
-
122
- /**
123
- * Returns the associate that belongs to this person if the person is an associate.
124
- * @param personId - The person id
125
- * @returns Associate if person is associate
126
- */
127
- public async getAssociateByPersonIdAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate >;
128
-
129
- public async getAssociateByPersonIdAsync(personId:number|carriers.Associate_GetAssociateByPersonIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate > {
130
- let _request : carriers.Associate_GetAssociateByPersonIdRequest = null;
131
- let _options : base.WebApiRequestOptions = null;
132
- const first : any = personId;
133
- if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' ) )
134
- {
135
- _request = personId as carriers.Associate_GetAssociateByPersonIdRequest;
136
- _options = webapi_options as base.WebApiRequestOptions;
137
- }
138
- else
139
- {
140
- _request = {
141
- personId: personId as number,
142
- };
143
- _options = webapi_options;
144
- }
145
- return this._getAssociateByPersonIdAsync( _request, _options );
146
- }
147
-
148
-
149
- private async _getNoteAsync(request: carriers.Associate_GetNoteRequest, options?:base.WebApiRequestOptions) : Promise< string[] > {
150
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
151
- base.WebApiBase.SetPending(options);
152
- return new Promise< string[] >(async (resolve, reject) => {
153
- try {
154
- config.baseURL = this._options.baseUrl;
155
- const response = await this._axios.post("GetNote", request , config);
156
- base.WebApiBase.SetCompleted(options, response);
157
- const res : string[] = response.data as string[];
158
- resolve(res);
159
- }
160
- catch( err ) {
161
- base.WebApiBase.HandleError(options, config, err);
162
- reject(err);
163
- }
164
- });
165
- }
166
-
167
-
168
-
169
- /**
170
- * Returns an array of strings(notepad pages).
171
- * @param request - AssociateId
172
- * @returns Returns an array of strings(notepad pages).
173
- */
174
- public async getNoteAsync(request: carriers.Associate_GetNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string[] >;
175
-
176
- /**
177
- * Returns an array of strings(notepad pages).
178
- * @param associateId - The associate id
179
- * @returns Returns an array of strings(notepad pages).
180
- */
181
- public async getNoteAsync(associateId: number, webapi_options?:base.WebApiRequestOptions) : Promise< string[] >;
182
-
183
- public async getNoteAsync(associateId:number|carriers.Associate_GetNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string[] > {
184
- let _request : carriers.Associate_GetNoteRequest = null;
185
- let _options : base.WebApiRequestOptions = null;
186
- const first : any = associateId;
187
- if( typeof( first ) === "object" && first && ( typeof(first.associateId)!='undefined' ) )
188
- {
189
- _request = associateId as carriers.Associate_GetNoteRequest;
190
- _options = webapi_options as base.WebApiRequestOptions;
191
- }
192
- else
193
- {
194
- _request = {
195
- associateId: associateId as number,
196
- };
197
- _options = webapi_options;
198
- }
199
- return this._getNoteAsync( _request, _options );
200
- }
201
-
202
-
203
- private async _saveNoteAsync(request: carriers.Associate_SaveNoteRequest, options?:base.WebApiRequestOptions) : Promise< void > {
204
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
205
- base.WebApiBase.SetPending(options);
206
- return new Promise< void >(async (resolve, reject) => {
207
- try {
208
- config.baseURL = this._options.baseUrl;
209
- const response = await this._axios.post("SaveNote", request , config);
210
- base.WebApiBase.SetCompleted(options, response);
211
- const res = response.data;
212
- resolve(res);
213
- }
214
- catch( err ) {
215
- base.WebApiBase.HandleError(options, config, err);
216
- reject(err);
217
- }
218
- });
219
- }
220
-
221
-
222
-
223
- /**
224
- * Saves an array of strings(notepad pages).
225
- * @param request - AssociateId, Note
226
- * @returns
227
- */
228
- public async saveNoteAsync(request: carriers.Associate_SaveNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
229
-
230
- /**
231
- * Saves an array of strings(notepad pages).
232
- * @param associateId - The associate id
233
- * @param note - The array of strings(notepad pages).
234
- * @returns
235
- */
236
- public async saveNoteAsync(associateId: number, note: string[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
237
-
238
- public async saveNoteAsync(associateId:number|carriers.Associate_SaveNoteRequest, note?:string[]|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
239
- let _request : carriers.Associate_SaveNoteRequest = null;
240
- let _options : base.WebApiRequestOptions = null;
241
- const first : any = associateId;
242
- if( typeof( first ) === "object" && first && ( typeof(first.associateId)!='undefined' || typeof(first.note)!='undefined' ) )
243
- {
244
- _request = associateId as carriers.Associate_SaveNoteRequest;
245
- _options = note as base.WebApiRequestOptions;
246
- }
247
- else
248
- {
249
- _request = {
250
- associateId: associateId as number,
251
- note: note as string[],
252
- };
253
- _options = webapi_options;
254
- }
255
- return this._saveNoteAsync( _request, _options );
256
- }
257
-
258
-
259
- private async _getEncryptionKeyAsync( options?:base.WebApiRequestOptions) : Promise< string > {
260
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
261
- base.WebApiBase.SetPending(options);
262
- return new Promise< string >(async (resolve, reject) => {
263
- try {
264
- config.baseURL = this._options.baseUrl;
265
- const response = await this._axios.post("GetEncryptionKey", undefined , config);
266
- base.WebApiBase.SetCompleted(options, response);
267
- const res : string = response.data as string;
268
- resolve(res);
269
- }
270
- catch( err ) {
271
- base.WebApiBase.HandleError(options, config, err);
272
- reject(err);
273
- }
274
- });
275
- }
276
-
277
-
278
- /**
279
- * Get unique key made from AssociateId and dbTag used for local storage encryption operations.
280
- * @returns encryptionKey
281
- */
282
- public async getEncryptionKeyAsync(webapi_options?:base.WebApiRequestOptions) : Promise< string >
283
- {
284
- return this._getEncryptionKeyAsync(webapi_options);
285
- }
286
-
287
- /**
288
- * Gets an array of Associate objects.
289
- * @param associateIds - The primary keys.
290
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
291
- * @returns An array of Associate
292
- */
293
- public async getAssociateListAsync(associateIds: number[], options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] > {
294
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
295
- base.WebApiBase.SetPending(options);
296
- return new Promise< carriers.Associate[] >(async (resolve, reject) => {
297
- try {
298
- const response = await this._axios.post("GetAssociateList", associateIds, config);
299
- base.WebApiBase.SetCompleted(options, response);
300
- const res = converters.Create_AssociateArray_From( response.data );
301
- resolve(res);
302
- }
303
- catch( err ) {
304
- base.WebApiBase.HandleError(options, config, err);
305
- reject(err);
306
- }
307
- });
308
- }
309
-
310
-
311
- private async _getAssociatesByGroupAsync(request: carriers.Associate_GetAssociatesByGroupRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] > {
312
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
313
- base.WebApiBase.SetPending(options);
314
- return new Promise< carriers.Associate[] >(async (resolve, reject) => {
315
- try {
316
- config.baseURL = this._options.baseUrl;
317
- const response = await this._axios.post("GetAssociatesByGroup", request , config);
318
- base.WebApiBase.SetCompleted(options, response);
319
- const res : carriers.Associate[] = converters.Create_AssociateArray_From( response.data );
320
- resolve(res);
321
- }
322
- catch( err ) {
323
- base.WebApiBase.HandleError(options, config, err);
324
- reject(err);
325
- }
326
- });
327
- }
328
-
329
-
330
-
331
- /**
332
- * Method that returns a array of associate , based on DiaryGroupType and groupId. The differernt types are, Userdefined, Usergroup and ResourceHeadings
333
- * @param request - GroupId, Type
334
- * @returns Array of associate
335
- */
336
- public async getAssociatesByGroupAsync(request: carriers.Associate_GetAssociatesByGroupRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] >;
337
-
338
- /**
339
- * Method that returns a array of associate , based on DiaryGroupType and groupId. The differernt types are, Userdefined, Usergroup and ResourceHeadings
340
- * @param groupId - Id of the group
341
- * @param type - The type of group. See DiaryGroupType
342
- * @returns Array of associate
343
- */
344
- public async getAssociatesByGroupAsync(groupId: number, type: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] >;
345
-
346
- public async getAssociatesByGroupAsync(groupId:number|carriers.Associate_GetAssociatesByGroupRequest, type?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] > {
347
- let _request : carriers.Associate_GetAssociatesByGroupRequest = null;
348
- let _options : base.WebApiRequestOptions = null;
349
- const first : any = groupId;
350
- if( typeof( first ) === "object" && first && ( typeof(first.groupId)!='undefined' || typeof(first.type)!='undefined' ) )
351
- {
352
- _request = groupId as carriers.Associate_GetAssociatesByGroupRequest;
353
- _options = type as base.WebApiRequestOptions;
354
- }
355
- else
356
- {
357
- _request = {
358
- groupId: groupId as number,
359
- type: type as number,
360
- };
361
- _options = webapi_options;
362
- }
363
- return this._getAssociatesByGroupAsync( _request, _options );
364
- }
365
-
366
-
367
- private async _logOffWindowsUsersAsync(request: carriers.Associate_LogOffWindowsUsersRequest, options?:base.WebApiRequestOptions) : Promise< void > {
368
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
369
- base.WebApiBase.SetPending(options);
370
- return new Promise< void >(async (resolve, reject) => {
371
- try {
372
- config.baseURL = this._options.baseUrl;
373
- const response = await this._axios.post("LogOffWindowsUsers", request , config);
374
- base.WebApiBase.SetCompleted(options, response);
375
- const res = response.data;
376
- resolve(res);
377
- }
378
- catch( err ) {
379
- base.WebApiBase.HandleError(options, config, err);
380
- reject(err);
381
- }
382
- });
383
- }
384
-
385
-
386
-
387
- /**
388
- * Method that logs off associates that are logged on to the win client
389
- * @param request - AssociateIds
390
- * @returns A void return
391
- */
392
- public async logOffWindowsUsersAsync(request: carriers.Associate_LogOffWindowsUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
393
-
394
- /**
395
- * Method that logs off associates that are logged on to the win client
396
- * @param associateIds - The ids of the associates that shall be logged off
397
- * @returns A void return
398
- */
399
- public async logOffWindowsUsersAsync(associateIds: number[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
400
-
401
- public async logOffWindowsUsersAsync(associateIds:number[]|carriers.Associate_LogOffWindowsUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
402
- let _request : carriers.Associate_LogOffWindowsUsersRequest = null;
403
- let _options : base.WebApiRequestOptions = null;
404
- const first : any = associateIds;
405
- if( typeof( first ) === "object" && first && ( typeof(first.associateIds)!='undefined' ) )
406
- {
407
- _request = associateIds as carriers.Associate_LogOffWindowsUsersRequest;
408
- _options = webapi_options as base.WebApiRequestOptions;
409
- }
410
- else
411
- {
412
- _request = {
413
- associateIds: associateIds as number[],
414
- };
415
- _options = webapi_options;
416
- }
417
- return this._logOffWindowsUsersAsync( _request, _options );
418
- }
419
-
420
- } // class v1AssociateAgentController
421
-
422
-
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/AssociateAgent.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
+ * Associate utilities, notes, not user admininstration
28
+ */
29
+ export interface IAssociateAgent {
30
+ getAssociateAsync(associateId: number) : Promise< carriers.Associate >;
31
+ getAssociateByPersonIdAsync(request: carriers.Associate_GetAssociateByPersonIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate >;
32
+ getAssociateByPersonIdAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate >;
33
+ getNoteAsync(request: carriers.Associate_GetNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string[] >;
34
+ getNoteAsync(associateId: number, webapi_options?:base.WebApiRequestOptions) : Promise< string[] >;
35
+ saveNoteAsync(request: carriers.Associate_SaveNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
36
+ saveNoteAsync(associateId: number, note: string[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
37
+ getEncryptionKeyAsync(webapi_options?:base.WebApiRequestOptions) : Promise< string >;
38
+ getAssociateListAsync(associateIds: number[]) : Promise< carriers.Associate[] >;
39
+ getAssociatesByGroupAsync(request: carriers.Associate_GetAssociatesByGroupRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] >;
40
+ getAssociatesByGroupAsync(groupId: number, type: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] >;
41
+ logOffWindowsUsersAsync(request: carriers.Associate_LogOffWindowsUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
42
+ logOffWindowsUsersAsync(associateIds: number[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
43
+ } // interface IAssociateAgent
44
+
45
+
46
+
47
+
48
+ /**
49
+ * Associate utilities, notes, not user admininstration
50
+ */
51
+ export class AssociateAgent extends base.WebApiBase implements IAssociateAgent {
52
+ constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
53
+ constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
54
+ constructor(baseUrl: string, resourceManager:any);
55
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
56
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
57
+ constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
58
+ constructor(options: base.WebApiOptions);
59
+
60
+ constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
61
+ langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
62
+ langOrResourceOrRM?:string|base.ResourceParsing|any,
63
+ cultureCode?: string,
64
+ ) {
65
+ const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
66
+ options.basePath = "v1/Agents/Associate/";
67
+ super(options);
68
+ }
69
+
70
+
71
+ /**
72
+ * Gets a Associate object.
73
+ * @param associateId - The primary key.
74
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
75
+ * @returns A single Associate
76
+ */
77
+ public async getAssociateAsync(associateId: number, options?:base.WebApiRequestOptions) : Promise< carriers.Associate > {
78
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
79
+ base.WebApiBase.SetPending(options);
80
+ return new Promise< carriers.Associate >(async (resolve, reject) => {
81
+ try {
82
+ const response = await this._axios.post("GetAssociate?associateId=" + associateId, null, config);
83
+ base.WebApiBase.SetCompleted(options, response);
84
+ const res = converters.Create_Associate_From( response.data );
85
+ resolve(res);
86
+ }
87
+ catch( err ) {
88
+ base.WebApiBase.HandleError(options, config, err);
89
+ reject(err);
90
+ }
91
+ });
92
+ }
93
+
94
+
95
+ private async _getAssociateByPersonIdAsync(request: carriers.Associate_GetAssociateByPersonIdRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Associate > {
96
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
97
+ base.WebApiBase.SetPending(options);
98
+ return new Promise< carriers.Associate >(async (resolve, reject) => {
99
+ try {
100
+ config.baseURL = this._options.baseUrl;
101
+ const response = await this._axios.post("GetAssociateByPersonId", request , config);
102
+ base.WebApiBase.SetCompleted(options, response);
103
+ const res : carriers.Associate = converters.Create_Associate_From( response.data );
104
+ resolve(res);
105
+ }
106
+ catch( err ) {
107
+ base.WebApiBase.HandleError(options, config, err);
108
+ reject(err);
109
+ }
110
+ });
111
+ }
112
+
113
+
114
+
115
+ /**
116
+ * Returns the associate that belongs to this person if the person is an associate.
117
+ * @param request - PersonId
118
+ * @returns Associate if person is associate
119
+ */
120
+ public async getAssociateByPersonIdAsync(request: carriers.Associate_GetAssociateByPersonIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate >;
121
+
122
+ /**
123
+ * Returns the associate that belongs to this person if the person is an associate.
124
+ * @param personId - The person id
125
+ * @returns Associate if person is associate
126
+ */
127
+ public async getAssociateByPersonIdAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate >;
128
+
129
+ public async getAssociateByPersonIdAsync(personId:number|carriers.Associate_GetAssociateByPersonIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate > {
130
+ let _request : carriers.Associate_GetAssociateByPersonIdRequest = null;
131
+ let _options : base.WebApiRequestOptions = null;
132
+ const first : any = personId;
133
+ if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' ) )
134
+ {
135
+ _request = personId as carriers.Associate_GetAssociateByPersonIdRequest;
136
+ _options = webapi_options as base.WebApiRequestOptions;
137
+ }
138
+ else
139
+ {
140
+ _request = {
141
+ personId: personId as number,
142
+ };
143
+ _options = webapi_options;
144
+ }
145
+ return this._getAssociateByPersonIdAsync( _request, _options );
146
+ }
147
+
148
+
149
+ private async _getNoteAsync(request: carriers.Associate_GetNoteRequest, options?:base.WebApiRequestOptions) : Promise< string[] > {
150
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
151
+ base.WebApiBase.SetPending(options);
152
+ return new Promise< string[] >(async (resolve, reject) => {
153
+ try {
154
+ config.baseURL = this._options.baseUrl;
155
+ const response = await this._axios.post("GetNote", request , config);
156
+ base.WebApiBase.SetCompleted(options, response);
157
+ const res : string[] = response.data as string[];
158
+ resolve(res);
159
+ }
160
+ catch( err ) {
161
+ base.WebApiBase.HandleError(options, config, err);
162
+ reject(err);
163
+ }
164
+ });
165
+ }
166
+
167
+
168
+
169
+ /**
170
+ * Returns an array of strings(notepad pages).
171
+ * @param request - AssociateId
172
+ * @returns Returns an array of strings(notepad pages).
173
+ */
174
+ public async getNoteAsync(request: carriers.Associate_GetNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string[] >;
175
+
176
+ /**
177
+ * Returns an array of strings(notepad pages).
178
+ * @param associateId - The associate id
179
+ * @returns Returns an array of strings(notepad pages).
180
+ */
181
+ public async getNoteAsync(associateId: number, webapi_options?:base.WebApiRequestOptions) : Promise< string[] >;
182
+
183
+ public async getNoteAsync(associateId:number|carriers.Associate_GetNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string[] > {
184
+ let _request : carriers.Associate_GetNoteRequest = null;
185
+ let _options : base.WebApiRequestOptions = null;
186
+ const first : any = associateId;
187
+ if( typeof( first ) === "object" && first && ( typeof(first.associateId)!='undefined' ) )
188
+ {
189
+ _request = associateId as carriers.Associate_GetNoteRequest;
190
+ _options = webapi_options as base.WebApiRequestOptions;
191
+ }
192
+ else
193
+ {
194
+ _request = {
195
+ associateId: associateId as number,
196
+ };
197
+ _options = webapi_options;
198
+ }
199
+ return this._getNoteAsync( _request, _options );
200
+ }
201
+
202
+
203
+ private async _saveNoteAsync(request: carriers.Associate_SaveNoteRequest, options?:base.WebApiRequestOptions) : Promise< void > {
204
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
205
+ base.WebApiBase.SetPending(options);
206
+ return new Promise< void >(async (resolve, reject) => {
207
+ try {
208
+ config.baseURL = this._options.baseUrl;
209
+ const response = await this._axios.post("SaveNote", request , config);
210
+ base.WebApiBase.SetCompleted(options, response);
211
+ const res = response.data;
212
+ resolve(res);
213
+ }
214
+ catch( err ) {
215
+ base.WebApiBase.HandleError(options, config, err);
216
+ reject(err);
217
+ }
218
+ });
219
+ }
220
+
221
+
222
+
223
+ /**
224
+ * Saves an array of strings(notepad pages).
225
+ * @param request - AssociateId, Note
226
+ * @returns
227
+ */
228
+ public async saveNoteAsync(request: carriers.Associate_SaveNoteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
229
+
230
+ /**
231
+ * Saves an array of strings(notepad pages).
232
+ * @param associateId - The associate id
233
+ * @param note - The array of strings(notepad pages).
234
+ * @returns
235
+ */
236
+ public async saveNoteAsync(associateId: number, note: string[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
237
+
238
+ public async saveNoteAsync(associateId:number|carriers.Associate_SaveNoteRequest, note?:string[]|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
239
+ let _request : carriers.Associate_SaveNoteRequest = null;
240
+ let _options : base.WebApiRequestOptions = null;
241
+ const first : any = associateId;
242
+ if( typeof( first ) === "object" && first && ( typeof(first.associateId)!='undefined' || typeof(first.note)!='undefined' ) )
243
+ {
244
+ _request = associateId as carriers.Associate_SaveNoteRequest;
245
+ _options = note as base.WebApiRequestOptions;
246
+ }
247
+ else
248
+ {
249
+ _request = {
250
+ associateId: associateId as number,
251
+ note: note as string[],
252
+ };
253
+ _options = webapi_options;
254
+ }
255
+ return this._saveNoteAsync( _request, _options );
256
+ }
257
+
258
+
259
+ private async _getEncryptionKeyAsync( options?:base.WebApiRequestOptions) : Promise< string > {
260
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
261
+ base.WebApiBase.SetPending(options);
262
+ return new Promise< string >(async (resolve, reject) => {
263
+ try {
264
+ config.baseURL = this._options.baseUrl;
265
+ const response = await this._axios.post("GetEncryptionKey", undefined , config);
266
+ base.WebApiBase.SetCompleted(options, response);
267
+ const res : string = response.data as string;
268
+ resolve(res);
269
+ }
270
+ catch( err ) {
271
+ base.WebApiBase.HandleError(options, config, err);
272
+ reject(err);
273
+ }
274
+ });
275
+ }
276
+
277
+
278
+ /**
279
+ * Get unique key made from AssociateId and dbTag used for local storage encryption operations.
280
+ * @returns encryptionKey
281
+ */
282
+ public async getEncryptionKeyAsync(webapi_options?:base.WebApiRequestOptions) : Promise< string >
283
+ {
284
+ return this._getEncryptionKeyAsync(webapi_options);
285
+ }
286
+
287
+ /**
288
+ * Gets an array of Associate objects.
289
+ * @param associateIds - The primary keys.
290
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
291
+ * @returns An array of Associate
292
+ */
293
+ public async getAssociateListAsync(associateIds: number[], options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] > {
294
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
295
+ base.WebApiBase.SetPending(options);
296
+ return new Promise< carriers.Associate[] >(async (resolve, reject) => {
297
+ try {
298
+ const response = await this._axios.post("GetAssociateList", associateIds, config);
299
+ base.WebApiBase.SetCompleted(options, response);
300
+ const res = converters.Create_AssociateArray_From( response.data );
301
+ resolve(res);
302
+ }
303
+ catch( err ) {
304
+ base.WebApiBase.HandleError(options, config, err);
305
+ reject(err);
306
+ }
307
+ });
308
+ }
309
+
310
+
311
+ private async _getAssociatesByGroupAsync(request: carriers.Associate_GetAssociatesByGroupRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] > {
312
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
313
+ base.WebApiBase.SetPending(options);
314
+ return new Promise< carriers.Associate[] >(async (resolve, reject) => {
315
+ try {
316
+ config.baseURL = this._options.baseUrl;
317
+ const response = await this._axios.post("GetAssociatesByGroup", request , config);
318
+ base.WebApiBase.SetCompleted(options, response);
319
+ const res : carriers.Associate[] = converters.Create_AssociateArray_From( response.data );
320
+ resolve(res);
321
+ }
322
+ catch( err ) {
323
+ base.WebApiBase.HandleError(options, config, err);
324
+ reject(err);
325
+ }
326
+ });
327
+ }
328
+
329
+
330
+
331
+ /**
332
+ * Method that returns a array of associate , based on DiaryGroupType and groupId. The differernt types are, Userdefined, Usergroup and ResourceHeadings
333
+ * @param request - GroupId, Type
334
+ * @returns Array of associate
335
+ */
336
+ public async getAssociatesByGroupAsync(request: carriers.Associate_GetAssociatesByGroupRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] >;
337
+
338
+ /**
339
+ * Method that returns a array of associate , based on DiaryGroupType and groupId. The differernt types are, Userdefined, Usergroup and ResourceHeadings
340
+ * @param groupId - Id of the group
341
+ * @param type - The type of group. See DiaryGroupType
342
+ * @returns Array of associate
343
+ */
344
+ public async getAssociatesByGroupAsync(groupId: number, type: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] >;
345
+
346
+ public async getAssociatesByGroupAsync(groupId:number|carriers.Associate_GetAssociatesByGroupRequest, type?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Associate[] > {
347
+ let _request : carriers.Associate_GetAssociatesByGroupRequest = null;
348
+ let _options : base.WebApiRequestOptions = null;
349
+ const first : any = groupId;
350
+ if( typeof( first ) === "object" && first && ( typeof(first.groupId)!='undefined' || typeof(first.type)!='undefined' ) )
351
+ {
352
+ _request = groupId as carriers.Associate_GetAssociatesByGroupRequest;
353
+ _options = type as base.WebApiRequestOptions;
354
+ }
355
+ else
356
+ {
357
+ _request = {
358
+ groupId: groupId as number,
359
+ type: type as number,
360
+ };
361
+ _options = webapi_options;
362
+ }
363
+ return this._getAssociatesByGroupAsync( _request, _options );
364
+ }
365
+
366
+
367
+ private async _logOffWindowsUsersAsync(request: carriers.Associate_LogOffWindowsUsersRequest, options?:base.WebApiRequestOptions) : Promise< void > {
368
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
369
+ base.WebApiBase.SetPending(options);
370
+ return new Promise< void >(async (resolve, reject) => {
371
+ try {
372
+ config.baseURL = this._options.baseUrl;
373
+ const response = await this._axios.post("LogOffWindowsUsers", request , config);
374
+ base.WebApiBase.SetCompleted(options, response);
375
+ const res = response.data;
376
+ resolve(res);
377
+ }
378
+ catch( err ) {
379
+ base.WebApiBase.HandleError(options, config, err);
380
+ reject(err);
381
+ }
382
+ });
383
+ }
384
+
385
+
386
+
387
+ /**
388
+ * Method that logs off associates that are logged on to the win client
389
+ * @param request - AssociateIds
390
+ * @returns A void return
391
+ */
392
+ public async logOffWindowsUsersAsync(request: carriers.Associate_LogOffWindowsUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
393
+
394
+ /**
395
+ * Method that logs off associates that are logged on to the win client
396
+ * @param associateIds - The ids of the associates that shall be logged off
397
+ * @returns A void return
398
+ */
399
+ public async logOffWindowsUsersAsync(associateIds: number[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
400
+
401
+ public async logOffWindowsUsersAsync(associateIds:number[]|carriers.Associate_LogOffWindowsUsersRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
402
+ let _request : carriers.Associate_LogOffWindowsUsersRequest = null;
403
+ let _options : base.WebApiRequestOptions = null;
404
+ const first : any = associateIds;
405
+ if( typeof( first ) === "object" && first && ( typeof(first.associateIds)!='undefined' ) )
406
+ {
407
+ _request = associateIds as carriers.Associate_LogOffWindowsUsersRequest;
408
+ _options = webapi_options as base.WebApiRequestOptions;
409
+ }
410
+ else
411
+ {
412
+ _request = {
413
+ associateIds: associateIds as number[],
414
+ };
415
+ _options = webapi_options;
416
+ }
417
+ return this._logOffWindowsUsersAsync( _request, _options );
418
+ }
419
+
420
+ } // class v1AssociateAgentController
421
+
422
+