@superoffice/webapi 11.7.727 → 11.9.1204

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 (163) 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/AIAgent.d.ts +62 -0
  27. package/dist/cjs/AIAgent.d.ts.map +1 -1
  28. package/dist/cjs/AIAgent.js +149 -0
  29. package/dist/cjs/AIAgent.js.map +1 -1
  30. package/dist/cjs/Carriers.d.ts +640 -14
  31. package/dist/cjs/Carriers.d.ts.map +1 -1
  32. package/dist/cjs/Converters.d.ts +24 -0
  33. package/dist/cjs/Converters.d.ts.map +1 -1
  34. package/dist/cjs/Converters.js +388 -17
  35. package/dist/cjs/Converters.js.map +1 -1
  36. package/dist/cjs/DiagnosticsAgent.d.ts +38 -0
  37. package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
  38. package/dist/cjs/DiagnosticsAgent.js +91 -0
  39. package/dist/cjs/DiagnosticsAgent.js.map +1 -1
  40. package/dist/cjs/Enums.d.ts +77 -1
  41. package/dist/cjs/Enums.d.ts.map +1 -1
  42. package/dist/cjs/Enums.js +83 -4
  43. package/dist/cjs/Enums.js.map +1 -1
  44. package/dist/cjs/ListAgent.d.ts +71 -6
  45. package/dist/cjs/ListAgent.d.ts.map +1 -1
  46. package/dist/cjs/ListAgent.js +157 -0
  47. package/dist/cjs/ListAgent.js.map +1 -1
  48. package/dist/cjs/MarketingAgent.d.ts +68 -0
  49. package/dist/cjs/MarketingAgent.d.ts.map +1 -1
  50. package/dist/cjs/MarketingAgent.js +157 -0
  51. package/dist/cjs/MarketingAgent.js.map +1 -1
  52. package/dist/cjs/TicketAgent.d.ts +23 -0
  53. package/dist/cjs/TicketAgent.d.ts.map +1 -1
  54. package/dist/cjs/TicketAgent.js +65 -0
  55. package/dist/cjs/TicketAgent.js.map +1 -1
  56. package/dist/esm/AIAgent.d.ts +62 -0
  57. package/dist/esm/AIAgent.d.ts.map +1 -1
  58. package/dist/esm/AIAgent.js +150 -1
  59. package/dist/esm/AIAgent.js.map +1 -1
  60. package/dist/esm/Carriers.d.ts +640 -14
  61. package/dist/esm/Carriers.d.ts.map +1 -1
  62. package/dist/esm/Converters.d.ts +24 -0
  63. package/dist/esm/Converters.d.ts.map +1 -1
  64. package/dist/esm/Converters.js +346 -0
  65. package/dist/esm/Converters.js.map +1 -1
  66. package/dist/esm/DiagnosticsAgent.d.ts +38 -0
  67. package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
  68. package/dist/esm/DiagnosticsAgent.js +91 -0
  69. package/dist/esm/DiagnosticsAgent.js.map +1 -1
  70. package/dist/esm/Enums.d.ts +77 -1
  71. package/dist/esm/Enums.d.ts.map +1 -1
  72. package/dist/esm/Enums.js +79 -0
  73. package/dist/esm/Enums.js.map +1 -1
  74. package/dist/esm/ListAgent.d.ts +71 -6
  75. package/dist/esm/ListAgent.d.ts.map +1 -1
  76. package/dist/esm/ListAgent.js +157 -0
  77. package/dist/esm/ListAgent.js.map +1 -1
  78. package/dist/esm/MarketingAgent.d.ts +68 -0
  79. package/dist/esm/MarketingAgent.d.ts.map +1 -1
  80. package/dist/esm/MarketingAgent.js +157 -0
  81. package/dist/esm/MarketingAgent.js.map +1 -1
  82. package/dist/esm/TicketAgent.d.ts +23 -0
  83. package/dist/esm/TicketAgent.d.ts.map +1 -1
  84. package/dist/esm/TicketAgent.js +65 -0
  85. package/dist/esm/TicketAgent.js.map +1 -1
  86. package/examples-js/hello.js +12 -12
  87. package/examples-ts/hello.ts +8 -8
  88. package/package.json +93 -93
  89. package/scripts/postbuild.js +22 -22
  90. package/scripts/setVersion.js +44 -44
  91. package/src/AIAgent.ts +2239 -1992
  92. package/src/AppointmentAgent.ts +6263 -6263
  93. package/src/AppointmentRestApi.ts +225 -225
  94. package/src/ArchiveAgent.ts +1950 -1950
  95. package/src/AssociateAgent.ts +422 -422
  96. package/src/AxiosCacheHandler.ts +74 -74
  97. package/src/BLOBAgent.ts +2100 -2100
  98. package/src/Base64.ts +285 -285
  99. package/src/BatchAgent.ts +910 -910
  100. package/src/BulkUpdateAgent.ts +504 -504
  101. package/src/CRMScriptAgent.ts +1390 -1390
  102. package/src/Carriers.ts +53121 -52274
  103. package/src/ChatAgent.ts +1422 -1422
  104. package/src/ConfigurationAgent.ts +2228 -2228
  105. package/src/ContactAgent.ts +1756 -1756
  106. package/src/ContactRestApi.ts +237 -237
  107. package/src/Converters.ts +23496 -23090
  108. package/src/CustomerServiceAgent.ts +1799 -1799
  109. package/src/DashAgent.ts +1674 -1674
  110. package/src/DatabaseAgent.ts +120 -120
  111. package/src/DatabaseTableAgent.ts +534 -534
  112. package/src/Day_js.ts +41 -41
  113. package/src/DiagnosticsAgent.ts +1384 -1240
  114. package/src/DocumentAgent.ts +5079 -5079
  115. package/src/DocumentMigrationAgent.ts +524 -524
  116. package/src/DocumentRestApi.ts +259 -259
  117. package/src/EMailAgent.ts +5328 -5328
  118. package/src/Enums.ts +6998 -6916
  119. package/src/ErpSyncAgent.ts +2658 -2658
  120. package/src/FavouriteAgent.ts +720 -720
  121. package/src/FindAgent.ts +2330 -2330
  122. package/src/ForeignSystemAgent.ts +1710 -1710
  123. package/src/FreeTextAgent.ts +372 -372
  124. package/src/ImportAgent.ts +304 -304
  125. package/src/LicenseAgent.ts +1230 -1230
  126. package/src/ListAgent.ts +11451 -11237
  127. package/src/MDOAgent.ts +748 -748
  128. package/src/MarketingAgent.ts +1146 -890
  129. package/src/MessagingAgent.ts +384 -384
  130. package/src/NavigatorAgent.ts +140 -140
  131. package/src/NumberAllocationAgent.ts +296 -296
  132. package/src/PersonAgent.ts +3287 -3287
  133. package/src/PersonRestApi.ts +241 -241
  134. package/src/PhoneListAgent.ts +458 -458
  135. package/src/PocketAgent.ts +780 -780
  136. package/src/PreferenceAgent.ts +1900 -1900
  137. package/src/PreviewsAgent.ts +116 -116
  138. package/src/ProjectAgent.ts +2391 -2391
  139. package/src/ProjectRestApi.ts +239 -239
  140. package/src/QuoteAgent.ts +5159 -5159
  141. package/src/RelationAgent.ts +220 -220
  142. package/src/ReportAgent.ts +154 -154
  143. package/src/ResourceAgent.ts +358 -358
  144. package/src/SaintAgent.ts +601 -601
  145. package/src/SaleAgent.ts +2034 -2034
  146. package/src/SaleRestApi.ts +233 -233
  147. package/src/SelectionAgent.ts +3195 -3195
  148. package/src/SentryAgent.ts +462 -462
  149. package/src/SoApiConstants.ts +8 -8
  150. package/src/TargetsAgent.ts +1104 -1104
  151. package/src/TicketAgent.ts +3708 -3638
  152. package/src/TimeZoneAgent.ts +528 -528
  153. package/src/TooltipsAgent.ts +116 -116
  154. package/src/UserAgent.ts +4856 -4856
  155. package/src/UserDefinedFieldInfoAgent.ts +1764 -1764
  156. package/src/ViewStateAgent.ts +858 -858
  157. package/src/WebApi.ts +872 -872
  158. package/src/WebApiBase.ts +565 -565
  159. package/src/WebhookAgent.ts +388 -388
  160. package/src/WorkflowAgent.ts +1338 -1338
  161. package/tsconfig.esm.json +8 -8
  162. package/tsconfig.jest.json +8 -8
  163. package/tsconfig.json +34 -34
@@ -1,524 +1,524 @@
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/DocumentMigrationAgent.ts
13
- //
14
- //----------------------------------------------------------------------------
15
- // Copyright (C) SuperOffice AS
16
- //----------------------------------------------------------------------------
17
-
18
- import { AxiosRequestConfig } from 'axios';
19
- import { Duration } from 'dayjs/plugin/duration';
20
- import * as enums from './Enums';
21
- import * as base from './WebApiBase';
22
- import * as carriers from './Carriers';
23
- import * as converters from './Converters';
24
- import { FromBase64ToString, ToBase64 } from './Base64';
25
-
26
- /**
27
- * Agent used to support migrating documents between different document-plugins, as single documents or batches.
28
- *
29
- * **Online Restricted:** This agent is not available in Online by default. Access must be requested specifically when app is registered. Intended for SuperOffice-internal apps.
30
- */
31
- export interface IDocumentMigrationAgent {
32
- createDefaultDocumentMigrationItemListAsync(): Promise< carriers.DocumentMigrationItemList >;
33
- createDefaultDocumentTemplateMigrationListAsync(): Promise< carriers.DocumentTemplateMigrationList >;
34
- getForAllDocumentsAsync(request: carriers.DocumentMigration_GetForAllDocumentsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
35
- getForAllDocumentsAsync(documentPluginId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
36
- getForDateRangeAsync(request: carriers.DocumentMigration_GetForDateRangeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
37
- getForDateRangeAsync(documentPluginId: number, minDate: Date, maxDate: Date, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
38
- getForSelectionAsync(request: carriers.DocumentMigration_GetForSelectionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
39
- getForSelectionAsync(documentPluginId: number, selectionId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
40
- migrateDocumentToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
41
- migrateDocumentToNewDocPluginAsync(documentId: number, documentPluginId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
42
- hasDocumentsToMigrateAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
43
- getNumberOfConfidentialDocumentsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >;
44
- getForTemplatesAsync(request: carriers.DocumentMigration_GetForTemplatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList >;
45
- getForTemplatesAsync(targetDocumentPluginId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList >;
46
- migrateTemplateToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
47
- migrateTemplateToNewDocPluginAsync(documentTemplateId: number, targetDocumentPluginId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
48
- } // interface IDocumentMigrationAgent
49
-
50
-
51
-
52
-
53
- /**
54
- * Agent used to support migrating documents between different document-plugins, as single documents or batches.
55
- */
56
- export class DocumentMigrationAgent extends base.WebApiBase implements IDocumentMigrationAgent {
57
- constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
58
- constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
59
- constructor(baseUrl: string, resourceManager:any);
60
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
61
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
62
- constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
63
- constructor(options: base.WebApiOptions);
64
-
65
- constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
66
- langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
67
- langOrResourceOrRM?:string|base.ResourceParsing|any,
68
- cultureCode?: string,
69
- ) {
70
- const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
71
- options.basePath = "v1/Agents/DocumentMigration/";
72
- super(options);
73
- }
74
-
75
-
76
-
77
- /**
78
- * Set default values into a new DocumentMigrationItemList.
79
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
80
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
81
- * @returns A blank entity.
82
- */
83
- public async createDefaultDocumentMigrationItemListAsync(options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
84
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
85
- base.WebApiBase.SetPending(options);
86
- return new Promise< carriers.DocumentMigrationItemList >(async (resolve, reject) => {
87
- try {
88
- const response = await this._axios.post("CreateDefaultDocumentMigrationItemList", null, config);
89
- base.WebApiBase.SetCompleted(options, response);
90
- const res : carriers.DocumentMigrationItemList = converters.Create_DocumentMigrationItemList_From( response.data );
91
- resolve(res);
92
- }
93
- catch( err ) {
94
- base.WebApiBase.HandleError(options, config, err);
95
- reject(err);
96
- }
97
- });
98
- }
99
-
100
- /**
101
- * Set default values into a new DocumentTemplateMigrationList.
102
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
103
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
104
- * @returns A blank entity.
105
- */
106
- public async createDefaultDocumentTemplateMigrationListAsync(options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList > {
107
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
108
- base.WebApiBase.SetPending(options);
109
- return new Promise< carriers.DocumentTemplateMigrationList >(async (resolve, reject) => {
110
- try {
111
- const response = await this._axios.post("CreateDefaultDocumentTemplateMigrationList", null, config);
112
- base.WebApiBase.SetCompleted(options, response);
113
- const res : carriers.DocumentTemplateMigrationList = converters.Create_DocumentTemplateMigrationList_From( response.data );
114
- resolve(res);
115
- }
116
- catch( err ) {
117
- base.WebApiBase.HandleError(options, config, err);
118
- reject(err);
119
- }
120
- });
121
- }
122
-
123
- private async _getForAllDocumentsAsync(request: carriers.DocumentMigration_GetForAllDocumentsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
124
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
125
- base.WebApiBase.SetPending(options);
126
- return new Promise< carriers.DocumentMigrationItemList >(async (resolve, reject) => {
127
- try {
128
- config.baseURL = this._options.baseUrl;
129
- const response = await this._axios.post("GetForAllDocuments", request , config);
130
- base.WebApiBase.SetCompleted(options, response);
131
- const res : carriers.DocumentMigrationItemList = converters.Create_DocumentMigrationItemList_From( response.data );
132
- resolve(res);
133
- }
134
- catch( err ) {
135
- base.WebApiBase.HandleError(options, config, err);
136
- reject(err);
137
- }
138
- });
139
- }
140
-
141
-
142
-
143
- /**
144
- * Gets a migration summary for all documents stored in CRM. Warning: Expensive!
145
- * @param request - DocumentPluginId, IncludeEmails
146
- * @returns Never null.
147
- */
148
- public async getForAllDocumentsAsync(request: carriers.DocumentMigration_GetForAllDocumentsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
149
-
150
- /**
151
- * Gets a migration summary for all documents stored in CRM. Warning: Expensive!
152
- * @param documentPluginId - The ID of the document-plugin to migrate to.
153
- * @param includeEmails - True if documents to migrate should include emails.
154
- * @returns Never null.
155
- */
156
- public async getForAllDocumentsAsync(documentPluginId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
157
-
158
- public async getForAllDocumentsAsync(documentPluginId:number|carriers.DocumentMigration_GetForAllDocumentsRequest, includeEmails?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
159
- let _request : carriers.DocumentMigration_GetForAllDocumentsRequest = null;
160
- let _options : base.WebApiRequestOptions = null;
161
- const first : any = documentPluginId;
162
- if( typeof( first ) === "object" && first && ( typeof(first.documentPluginId)!='undefined' || typeof(first.includeEmails)!='undefined' ) )
163
- {
164
- _request = documentPluginId as carriers.DocumentMigration_GetForAllDocumentsRequest;
165
- _options = includeEmails as base.WebApiRequestOptions;
166
- }
167
- else
168
- {
169
- _request = {
170
- documentPluginId: documentPluginId as number,
171
- includeEmails: includeEmails as boolean,
172
- };
173
- _options = webapi_options;
174
- }
175
- return this._getForAllDocumentsAsync( _request, _options );
176
- }
177
-
178
-
179
- private async _getForDateRangeAsync(request: carriers.DocumentMigration_GetForDateRangeRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
180
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
181
- base.WebApiBase.SetPending(options);
182
- return new Promise< carriers.DocumentMigrationItemList >(async (resolve, reject) => {
183
- try {
184
- config.baseURL = this._options.baseUrl;
185
- const response = await this._axios.post("GetForDateRange", request , config);
186
- base.WebApiBase.SetCompleted(options, response);
187
- const res : carriers.DocumentMigrationItemList = converters.Create_DocumentMigrationItemList_From( response.data );
188
- resolve(res);
189
- }
190
- catch( err ) {
191
- base.WebApiBase.HandleError(options, config, err);
192
- reject(err);
193
- }
194
- });
195
- }
196
-
197
-
198
-
199
- /**
200
- * Gets a migration summary for documents in the provided date-rage
201
- * @param request - DocumentPluginId, MinDate, MaxDate, IncludeEmails
202
- * @returns Never null.
203
- */
204
- public async getForDateRangeAsync(request: carriers.DocumentMigration_GetForDateRangeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
205
-
206
- /**
207
- * Gets a migration summary for documents in the provided date-rage
208
- * @param documentPluginId - The ID of the document-plugin to migrate to.
209
- * @param minDate - Inclusive mininmum.
210
- * @param maxDate - Inclusive maximum.
211
- * @param includeEmails - True if documents to migrate should include emails.
212
- * @returns Never null.
213
- */
214
- public async getForDateRangeAsync(documentPluginId: number, minDate: Date, maxDate: Date, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
215
-
216
- public async getForDateRangeAsync(documentPluginId:number|carriers.DocumentMigration_GetForDateRangeRequest, minDate?:Date|base.WebApiRequestOptions, maxDate?:Date, includeEmails?:boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
217
- let _request : carriers.DocumentMigration_GetForDateRangeRequest = null;
218
- let _options : base.WebApiRequestOptions = null;
219
- const first : any = documentPluginId;
220
- if( typeof( first ) === "object" && first && ( typeof(first.documentPluginId)!='undefined' || typeof(first.minDate)!='undefined' || typeof(first.maxDate)!='undefined' || typeof(first.includeEmails)!='undefined' ) )
221
- {
222
- _request = documentPluginId as carriers.DocumentMigration_GetForDateRangeRequest;
223
- _options = minDate as base.WebApiRequestOptions;
224
- }
225
- else
226
- {
227
- _request = {
228
- documentPluginId: documentPluginId as number,
229
- minDate: minDate as Date,
230
- maxDate: maxDate as Date,
231
- includeEmails: includeEmails as boolean,
232
- };
233
- _options = webapi_options;
234
- }
235
- return this._getForDateRangeAsync( _request, _options );
236
- }
237
-
238
-
239
- private async _getForSelectionAsync(request: carriers.DocumentMigration_GetForSelectionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
240
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
241
- base.WebApiBase.SetPending(options);
242
- return new Promise< carriers.DocumentMigrationItemList >(async (resolve, reject) => {
243
- try {
244
- config.baseURL = this._options.baseUrl;
245
- const response = await this._axios.post("GetForSelection", request , config);
246
- base.WebApiBase.SetCompleted(options, response);
247
- const res : carriers.DocumentMigrationItemList = converters.Create_DocumentMigrationItemList_From( response.data );
248
- resolve(res);
249
- }
250
- catch( err ) {
251
- base.WebApiBase.HandleError(options, config, err);
252
- reject(err);
253
- }
254
- });
255
- }
256
-
257
-
258
-
259
- /**
260
- * Gets a migration summary for documents in the provided selection
261
- * @param request - DocumentPluginId, SelectionId, IncludeEmails
262
- * @returns Never null.
263
- */
264
- public async getForSelectionAsync(request: carriers.DocumentMigration_GetForSelectionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
265
-
266
- /**
267
- * Gets a migration summary for documents in the provided selection
268
- * @param documentPluginId - The ID of the document-plugin to migrate to.
269
- * @param selectionId - ID of the selection used to create the DocumentMigrationSummary instance.
270
- * @param includeEmails - True if documents to migrate should include emails.
271
- * @returns Never null.
272
- */
273
- public async getForSelectionAsync(documentPluginId: number, selectionId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
274
-
275
- public async getForSelectionAsync(documentPluginId:number|carriers.DocumentMigration_GetForSelectionRequest, selectionId?:number|base.WebApiRequestOptions, includeEmails?:boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
276
- let _request : carriers.DocumentMigration_GetForSelectionRequest = null;
277
- let _options : base.WebApiRequestOptions = null;
278
- const first : any = documentPluginId;
279
- if( typeof( first ) === "object" && first && ( typeof(first.documentPluginId)!='undefined' || typeof(first.selectionId)!='undefined' || typeof(first.includeEmails)!='undefined' ) )
280
- {
281
- _request = documentPluginId as carriers.DocumentMigration_GetForSelectionRequest;
282
- _options = selectionId as base.WebApiRequestOptions;
283
- }
284
- else
285
- {
286
- _request = {
287
- documentPluginId: documentPluginId as number,
288
- selectionId: selectionId as number,
289
- includeEmails: includeEmails as boolean,
290
- };
291
- _options = webapi_options;
292
- }
293
- return this._getForSelectionAsync( _request, _options );
294
- }
295
-
296
-
297
- private async _migrateDocumentToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest, options?:base.WebApiRequestOptions) : Promise< void > {
298
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
299
- base.WebApiBase.SetPending(options);
300
- return new Promise< void >(async (resolve, reject) => {
301
- try {
302
- config.baseURL = this._options.baseUrl;
303
- const response = await this._axios.post("MigrateDocumentToNewDocPlugin", request , config);
304
- base.WebApiBase.SetCompleted(options, response);
305
- const res = response.data;
306
- resolve(res);
307
- }
308
- catch( err ) {
309
- base.WebApiBase.HandleError(options, config, err);
310
- reject(err);
311
- }
312
- });
313
- }
314
-
315
-
316
-
317
- /**
318
- * Migrates the document with the provided id to the specified document-plugin.
319
- * @param request - DocumentId, DocumentPluginId
320
- * @returns This method has no return value
321
- */
322
- public async migrateDocumentToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
323
-
324
- /**
325
- * Migrates the document with the provided id to the specified document-plugin.
326
- * @param documentId - The ID of the document to migrate.
327
- * @param documentPluginId - The ID of the document-plugin to migrate to.
328
- * @returns This method has no return value
329
- */
330
- public async migrateDocumentToNewDocPluginAsync(documentId: number, documentPluginId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
331
-
332
- public async migrateDocumentToNewDocPluginAsync(documentId:number|carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest, documentPluginId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
333
- let _request : carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest = null;
334
- let _options : base.WebApiRequestOptions = null;
335
- const first : any = documentId;
336
- if( typeof( first ) === "object" && first && ( typeof(first.documentId)!='undefined' || typeof(first.documentPluginId)!='undefined' ) )
337
- {
338
- _request = documentId as carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest;
339
- _options = documentPluginId as base.WebApiRequestOptions;
340
- }
341
- else
342
- {
343
- _request = {
344
- documentId: documentId as number,
345
- documentPluginId: documentPluginId as number,
346
- };
347
- _options = webapi_options;
348
- }
349
- return this._migrateDocumentToNewDocPluginAsync( _request, _options );
350
- }
351
-
352
-
353
- private async _hasDocumentsToMigrateAsync( options?:base.WebApiRequestOptions) : Promise< boolean > {
354
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
355
- base.WebApiBase.SetPending(options);
356
- return new Promise< boolean >(async (resolve, reject) => {
357
- try {
358
- config.baseURL = this._options.baseUrl;
359
- const response = await this._axios.post("HasDocumentsToMigrate", undefined , config);
360
- base.WebApiBase.SetCompleted(options, response);
361
- const res : boolean = response.data as boolean;
362
- resolve(res);
363
- }
364
- catch( err ) {
365
- base.WebApiBase.HandleError(options, config, err);
366
- reject(err);
367
- }
368
- });
369
- }
370
-
371
-
372
- /**
373
- * Checks if there are any documents in the current database stored using a non-default document-plugin, and which can be migrated.
374
- * @returns True if there are documents available to migrate.
375
- */
376
- public async hasDocumentsToMigrateAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >
377
- {
378
- return this._hasDocumentsToMigrateAsync(webapi_options);
379
- }
380
-
381
-
382
- private async _getNumberOfConfidentialDocumentsAsync( options?:base.WebApiRequestOptions) : Promise< number > {
383
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
384
- base.WebApiBase.SetPending(options);
385
- return new Promise< number >(async (resolve, reject) => {
386
- try {
387
- config.baseURL = this._options.baseUrl;
388
- const response = await this._axios.post("GetNumberOfConfidentialDocuments", undefined , config);
389
- base.WebApiBase.SetCompleted(options, response);
390
- const res : number = response.data as number;
391
- resolve(res);
392
- }
393
- catch( err ) {
394
- base.WebApiBase.HandleError(options, config, err);
395
- reject(err);
396
- }
397
- });
398
- }
399
-
400
-
401
- /**
402
- * Gets the total number of documents that is not visible to everyone
403
- * @returns Number of confidential documents.
404
- */
405
- public async getNumberOfConfidentialDocumentsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >
406
- {
407
- return this._getNumberOfConfidentialDocumentsAsync(webapi_options);
408
- }
409
-
410
-
411
- private async _getForTemplatesAsync(request: carriers.DocumentMigration_GetForTemplatesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList > {
412
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
413
- base.WebApiBase.SetPending(options);
414
- return new Promise< carriers.DocumentTemplateMigrationList >(async (resolve, reject) => {
415
- try {
416
- config.baseURL = this._options.baseUrl;
417
- const response = await this._axios.post("GetForTemplates", request , config);
418
- base.WebApiBase.SetCompleted(options, response);
419
- const res : carriers.DocumentTemplateMigrationList = converters.Create_DocumentTemplateMigrationList_From( response.data );
420
- resolve(res);
421
- }
422
- catch( err ) {
423
- base.WebApiBase.HandleError(options, config, err);
424
- reject(err);
425
- }
426
- });
427
- }
428
-
429
-
430
-
431
- /**
432
- * Gets a migration summary for all templates stored in CRM.
433
- * @param request - TargetDocumentPluginId, IncludeEmails
434
- * @returns Never null.
435
- */
436
- public async getForTemplatesAsync(request: carriers.DocumentMigration_GetForTemplatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList >;
437
-
438
- /**
439
- * Gets a migration summary for all templates stored in CRM.
440
- * @param targetDocumentPluginId - The ID of the document-plugin to migrate to.
441
- * @param includeEmails - True if templates to migrate should include emails.
442
- * @returns Never null.
443
- */
444
- public async getForTemplatesAsync(targetDocumentPluginId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList >;
445
-
446
- public async getForTemplatesAsync(targetDocumentPluginId:number|carriers.DocumentMigration_GetForTemplatesRequest, includeEmails?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList > {
447
- let _request : carriers.DocumentMigration_GetForTemplatesRequest = null;
448
- let _options : base.WebApiRequestOptions = null;
449
- const first : any = targetDocumentPluginId;
450
- if( typeof( first ) === "object" && first && ( typeof(first.targetDocumentPluginId)!='undefined' || typeof(first.includeEmails)!='undefined' ) )
451
- {
452
- _request = targetDocumentPluginId as carriers.DocumentMigration_GetForTemplatesRequest;
453
- _options = includeEmails as base.WebApiRequestOptions;
454
- }
455
- else
456
- {
457
- _request = {
458
- targetDocumentPluginId: targetDocumentPluginId as number,
459
- includeEmails: includeEmails as boolean,
460
- };
461
- _options = webapi_options;
462
- }
463
- return this._getForTemplatesAsync( _request, _options );
464
- }
465
-
466
-
467
- private async _migrateTemplateToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest, options?:base.WebApiRequestOptions) : Promise< void > {
468
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
469
- base.WebApiBase.SetPending(options);
470
- return new Promise< void >(async (resolve, reject) => {
471
- try {
472
- config.baseURL = this._options.baseUrl;
473
- const response = await this._axios.post("MigrateTemplateToNewDocPlugin", request , config);
474
- base.WebApiBase.SetCompleted(options, response);
475
- const res = response.data;
476
- resolve(res);
477
- }
478
- catch( err ) {
479
- base.WebApiBase.HandleError(options, config, err);
480
- reject(err);
481
- }
482
- });
483
- }
484
-
485
-
486
-
487
- /**
488
- * Migrates the template with the provided id to the specified document-plugin.
489
- * @param request - DocumentTemplateId, TargetDocumentPluginId
490
- * @returns This method has no return value
491
- */
492
- public async migrateTemplateToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
493
-
494
- /**
495
- * Migrates the template with the provided id to the specified document-plugin.
496
- * @param documentTemplateId - The ID of the document-template to migrate.
497
- * @param targetDocumentPluginId - The ID of the document-plugin to migrate to.
498
- * @returns This method has no return value
499
- */
500
- public async migrateTemplateToNewDocPluginAsync(documentTemplateId: number, targetDocumentPluginId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
501
-
502
- public async migrateTemplateToNewDocPluginAsync(documentTemplateId:number|carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest, targetDocumentPluginId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
503
- let _request : carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest = null;
504
- let _options : base.WebApiRequestOptions = null;
505
- const first : any = documentTemplateId;
506
- if( typeof( first ) === "object" && first && ( typeof(first.documentTemplateId)!='undefined' || typeof(first.targetDocumentPluginId)!='undefined' ) )
507
- {
508
- _request = documentTemplateId as carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest;
509
- _options = targetDocumentPluginId as base.WebApiRequestOptions;
510
- }
511
- else
512
- {
513
- _request = {
514
- documentTemplateId: documentTemplateId as number,
515
- targetDocumentPluginId: targetDocumentPluginId as number,
516
- };
517
- _options = webapi_options;
518
- }
519
- return this._migrateTemplateToNewDocPluginAsync( _request, _options );
520
- }
521
-
522
- } // class v1DocumentMigrationAgentController
523
-
524
-
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/DocumentMigrationAgent.ts
13
+ //
14
+ //----------------------------------------------------------------------------
15
+ // Copyright (C) SuperOffice AS
16
+ //----------------------------------------------------------------------------
17
+
18
+ import { AxiosRequestConfig } from 'axios';
19
+ import { Duration } from 'dayjs/plugin/duration';
20
+ import * as enums from './Enums';
21
+ import * as base from './WebApiBase';
22
+ import * as carriers from './Carriers';
23
+ import * as converters from './Converters';
24
+ import { FromBase64ToString, ToBase64 } from './Base64';
25
+
26
+ /**
27
+ * Agent used to support migrating documents between different document-plugins, as single documents or batches.
28
+ *
29
+ * **Online Restricted:** This agent is not available in Online by default. Access must be requested specifically when app is registered. Intended for SuperOffice-internal apps.
30
+ */
31
+ export interface IDocumentMigrationAgent {
32
+ createDefaultDocumentMigrationItemListAsync(): Promise< carriers.DocumentMigrationItemList >;
33
+ createDefaultDocumentTemplateMigrationListAsync(): Promise< carriers.DocumentTemplateMigrationList >;
34
+ getForAllDocumentsAsync(request: carriers.DocumentMigration_GetForAllDocumentsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
35
+ getForAllDocumentsAsync(documentPluginId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
36
+ getForDateRangeAsync(request: carriers.DocumentMigration_GetForDateRangeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
37
+ getForDateRangeAsync(documentPluginId: number, minDate: Date, maxDate: Date, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
38
+ getForSelectionAsync(request: carriers.DocumentMigration_GetForSelectionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
39
+ getForSelectionAsync(documentPluginId: number, selectionId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
40
+ migrateDocumentToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
41
+ migrateDocumentToNewDocPluginAsync(documentId: number, documentPluginId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
42
+ hasDocumentsToMigrateAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
43
+ getNumberOfConfidentialDocumentsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >;
44
+ getForTemplatesAsync(request: carriers.DocumentMigration_GetForTemplatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList >;
45
+ getForTemplatesAsync(targetDocumentPluginId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList >;
46
+ migrateTemplateToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
47
+ migrateTemplateToNewDocPluginAsync(documentTemplateId: number, targetDocumentPluginId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
48
+ } // interface IDocumentMigrationAgent
49
+
50
+
51
+
52
+
53
+ /**
54
+ * Agent used to support migrating documents between different document-plugins, as single documents or batches.
55
+ */
56
+ export class DocumentMigrationAgent extends base.WebApiBase implements IDocumentMigrationAgent {
57
+ constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
58
+ constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
59
+ constructor(baseUrl: string, resourceManager:any);
60
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
61
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
62
+ constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
63
+ constructor(options: base.WebApiOptions);
64
+
65
+ constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
66
+ langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
67
+ langOrResourceOrRM?:string|base.ResourceParsing|any,
68
+ cultureCode?: string,
69
+ ) {
70
+ const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
71
+ options.basePath = "v1/Agents/DocumentMigration/";
72
+ super(options);
73
+ }
74
+
75
+
76
+
77
+ /**
78
+ * Set default values into a new DocumentMigrationItemList.
79
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
80
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
81
+ * @returns A blank entity.
82
+ */
83
+ public async createDefaultDocumentMigrationItemListAsync(options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
84
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
85
+ base.WebApiBase.SetPending(options);
86
+ return new Promise< carriers.DocumentMigrationItemList >(async (resolve, reject) => {
87
+ try {
88
+ const response = await this._axios.post("CreateDefaultDocumentMigrationItemList", null, config);
89
+ base.WebApiBase.SetCompleted(options, response);
90
+ const res : carriers.DocumentMigrationItemList = converters.Create_DocumentMigrationItemList_From( response.data );
91
+ resolve(res);
92
+ }
93
+ catch( err ) {
94
+ base.WebApiBase.HandleError(options, config, err);
95
+ reject(err);
96
+ }
97
+ });
98
+ }
99
+
100
+ /**
101
+ * Set default values into a new DocumentTemplateMigrationList.
102
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
103
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
104
+ * @returns A blank entity.
105
+ */
106
+ public async createDefaultDocumentTemplateMigrationListAsync(options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList > {
107
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
108
+ base.WebApiBase.SetPending(options);
109
+ return new Promise< carriers.DocumentTemplateMigrationList >(async (resolve, reject) => {
110
+ try {
111
+ const response = await this._axios.post("CreateDefaultDocumentTemplateMigrationList", null, config);
112
+ base.WebApiBase.SetCompleted(options, response);
113
+ const res : carriers.DocumentTemplateMigrationList = converters.Create_DocumentTemplateMigrationList_From( response.data );
114
+ resolve(res);
115
+ }
116
+ catch( err ) {
117
+ base.WebApiBase.HandleError(options, config, err);
118
+ reject(err);
119
+ }
120
+ });
121
+ }
122
+
123
+ private async _getForAllDocumentsAsync(request: carriers.DocumentMigration_GetForAllDocumentsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
124
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
125
+ base.WebApiBase.SetPending(options);
126
+ return new Promise< carriers.DocumentMigrationItemList >(async (resolve, reject) => {
127
+ try {
128
+ config.baseURL = this._options.baseUrl;
129
+ const response = await this._axios.post("GetForAllDocuments", request , config);
130
+ base.WebApiBase.SetCompleted(options, response);
131
+ const res : carriers.DocumentMigrationItemList = converters.Create_DocumentMigrationItemList_From( response.data );
132
+ resolve(res);
133
+ }
134
+ catch( err ) {
135
+ base.WebApiBase.HandleError(options, config, err);
136
+ reject(err);
137
+ }
138
+ });
139
+ }
140
+
141
+
142
+
143
+ /**
144
+ * Gets a migration summary for all documents stored in CRM. Warning: Expensive!
145
+ * @param request - DocumentPluginId, IncludeEmails
146
+ * @returns Never null.
147
+ */
148
+ public async getForAllDocumentsAsync(request: carriers.DocumentMigration_GetForAllDocumentsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
149
+
150
+ /**
151
+ * Gets a migration summary for all documents stored in CRM. Warning: Expensive!
152
+ * @param documentPluginId - The ID of the document-plugin to migrate to.
153
+ * @param includeEmails - True if documents to migrate should include emails.
154
+ * @returns Never null.
155
+ */
156
+ public async getForAllDocumentsAsync(documentPluginId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
157
+
158
+ public async getForAllDocumentsAsync(documentPluginId:number|carriers.DocumentMigration_GetForAllDocumentsRequest, includeEmails?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
159
+ let _request : carriers.DocumentMigration_GetForAllDocumentsRequest = null;
160
+ let _options : base.WebApiRequestOptions = null;
161
+ const first : any = documentPluginId;
162
+ if( typeof( first ) === "object" && first && ( typeof(first.documentPluginId)!='undefined' || typeof(first.includeEmails)!='undefined' ) )
163
+ {
164
+ _request = documentPluginId as carriers.DocumentMigration_GetForAllDocumentsRequest;
165
+ _options = includeEmails as base.WebApiRequestOptions;
166
+ }
167
+ else
168
+ {
169
+ _request = {
170
+ documentPluginId: documentPluginId as number,
171
+ includeEmails: includeEmails as boolean,
172
+ };
173
+ _options = webapi_options;
174
+ }
175
+ return this._getForAllDocumentsAsync( _request, _options );
176
+ }
177
+
178
+
179
+ private async _getForDateRangeAsync(request: carriers.DocumentMigration_GetForDateRangeRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
180
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
181
+ base.WebApiBase.SetPending(options);
182
+ return new Promise< carriers.DocumentMigrationItemList >(async (resolve, reject) => {
183
+ try {
184
+ config.baseURL = this._options.baseUrl;
185
+ const response = await this._axios.post("GetForDateRange", request , config);
186
+ base.WebApiBase.SetCompleted(options, response);
187
+ const res : carriers.DocumentMigrationItemList = converters.Create_DocumentMigrationItemList_From( response.data );
188
+ resolve(res);
189
+ }
190
+ catch( err ) {
191
+ base.WebApiBase.HandleError(options, config, err);
192
+ reject(err);
193
+ }
194
+ });
195
+ }
196
+
197
+
198
+
199
+ /**
200
+ * Gets a migration summary for documents in the provided date-rage
201
+ * @param request - DocumentPluginId, MinDate, MaxDate, IncludeEmails
202
+ * @returns Never null.
203
+ */
204
+ public async getForDateRangeAsync(request: carriers.DocumentMigration_GetForDateRangeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
205
+
206
+ /**
207
+ * Gets a migration summary for documents in the provided date-rage
208
+ * @param documentPluginId - The ID of the document-plugin to migrate to.
209
+ * @param minDate - Inclusive mininmum.
210
+ * @param maxDate - Inclusive maximum.
211
+ * @param includeEmails - True if documents to migrate should include emails.
212
+ * @returns Never null.
213
+ */
214
+ public async getForDateRangeAsync(documentPluginId: number, minDate: Date, maxDate: Date, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
215
+
216
+ public async getForDateRangeAsync(documentPluginId:number|carriers.DocumentMigration_GetForDateRangeRequest, minDate?:Date|base.WebApiRequestOptions, maxDate?:Date, includeEmails?:boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
217
+ let _request : carriers.DocumentMigration_GetForDateRangeRequest = null;
218
+ let _options : base.WebApiRequestOptions = null;
219
+ const first : any = documentPluginId;
220
+ if( typeof( first ) === "object" && first && ( typeof(first.documentPluginId)!='undefined' || typeof(first.minDate)!='undefined' || typeof(first.maxDate)!='undefined' || typeof(first.includeEmails)!='undefined' ) )
221
+ {
222
+ _request = documentPluginId as carriers.DocumentMigration_GetForDateRangeRequest;
223
+ _options = minDate as base.WebApiRequestOptions;
224
+ }
225
+ else
226
+ {
227
+ _request = {
228
+ documentPluginId: documentPluginId as number,
229
+ minDate: minDate as Date,
230
+ maxDate: maxDate as Date,
231
+ includeEmails: includeEmails as boolean,
232
+ };
233
+ _options = webapi_options;
234
+ }
235
+ return this._getForDateRangeAsync( _request, _options );
236
+ }
237
+
238
+
239
+ private async _getForSelectionAsync(request: carriers.DocumentMigration_GetForSelectionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
240
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
241
+ base.WebApiBase.SetPending(options);
242
+ return new Promise< carriers.DocumentMigrationItemList >(async (resolve, reject) => {
243
+ try {
244
+ config.baseURL = this._options.baseUrl;
245
+ const response = await this._axios.post("GetForSelection", request , config);
246
+ base.WebApiBase.SetCompleted(options, response);
247
+ const res : carriers.DocumentMigrationItemList = converters.Create_DocumentMigrationItemList_From( response.data );
248
+ resolve(res);
249
+ }
250
+ catch( err ) {
251
+ base.WebApiBase.HandleError(options, config, err);
252
+ reject(err);
253
+ }
254
+ });
255
+ }
256
+
257
+
258
+
259
+ /**
260
+ * Gets a migration summary for documents in the provided selection
261
+ * @param request - DocumentPluginId, SelectionId, IncludeEmails
262
+ * @returns Never null.
263
+ */
264
+ public async getForSelectionAsync(request: carriers.DocumentMigration_GetForSelectionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
265
+
266
+ /**
267
+ * Gets a migration summary for documents in the provided selection
268
+ * @param documentPluginId - The ID of the document-plugin to migrate to.
269
+ * @param selectionId - ID of the selection used to create the DocumentMigrationSummary instance.
270
+ * @param includeEmails - True if documents to migrate should include emails.
271
+ * @returns Never null.
272
+ */
273
+ public async getForSelectionAsync(documentPluginId: number, selectionId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList >;
274
+
275
+ public async getForSelectionAsync(documentPluginId:number|carriers.DocumentMigration_GetForSelectionRequest, selectionId?:number|base.WebApiRequestOptions, includeEmails?:boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentMigrationItemList > {
276
+ let _request : carriers.DocumentMigration_GetForSelectionRequest = null;
277
+ let _options : base.WebApiRequestOptions = null;
278
+ const first : any = documentPluginId;
279
+ if( typeof( first ) === "object" && first && ( typeof(first.documentPluginId)!='undefined' || typeof(first.selectionId)!='undefined' || typeof(first.includeEmails)!='undefined' ) )
280
+ {
281
+ _request = documentPluginId as carriers.DocumentMigration_GetForSelectionRequest;
282
+ _options = selectionId as base.WebApiRequestOptions;
283
+ }
284
+ else
285
+ {
286
+ _request = {
287
+ documentPluginId: documentPluginId as number,
288
+ selectionId: selectionId as number,
289
+ includeEmails: includeEmails as boolean,
290
+ };
291
+ _options = webapi_options;
292
+ }
293
+ return this._getForSelectionAsync( _request, _options );
294
+ }
295
+
296
+
297
+ private async _migrateDocumentToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest, options?:base.WebApiRequestOptions) : Promise< void > {
298
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
299
+ base.WebApiBase.SetPending(options);
300
+ return new Promise< void >(async (resolve, reject) => {
301
+ try {
302
+ config.baseURL = this._options.baseUrl;
303
+ const response = await this._axios.post("MigrateDocumentToNewDocPlugin", request , config);
304
+ base.WebApiBase.SetCompleted(options, response);
305
+ const res = response.data;
306
+ resolve(res);
307
+ }
308
+ catch( err ) {
309
+ base.WebApiBase.HandleError(options, config, err);
310
+ reject(err);
311
+ }
312
+ });
313
+ }
314
+
315
+
316
+
317
+ /**
318
+ * Migrates the document with the provided id to the specified document-plugin.
319
+ * @param request - DocumentId, DocumentPluginId
320
+ * @returns This method has no return value
321
+ */
322
+ public async migrateDocumentToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
323
+
324
+ /**
325
+ * Migrates the document with the provided id to the specified document-plugin.
326
+ * @param documentId - The ID of the document to migrate.
327
+ * @param documentPluginId - The ID of the document-plugin to migrate to.
328
+ * @returns This method has no return value
329
+ */
330
+ public async migrateDocumentToNewDocPluginAsync(documentId: number, documentPluginId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
331
+
332
+ public async migrateDocumentToNewDocPluginAsync(documentId:number|carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest, documentPluginId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
333
+ let _request : carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest = null;
334
+ let _options : base.WebApiRequestOptions = null;
335
+ const first : any = documentId;
336
+ if( typeof( first ) === "object" && first && ( typeof(first.documentId)!='undefined' || typeof(first.documentPluginId)!='undefined' ) )
337
+ {
338
+ _request = documentId as carriers.DocumentMigration_MigrateDocumentToNewDocPluginRequest;
339
+ _options = documentPluginId as base.WebApiRequestOptions;
340
+ }
341
+ else
342
+ {
343
+ _request = {
344
+ documentId: documentId as number,
345
+ documentPluginId: documentPluginId as number,
346
+ };
347
+ _options = webapi_options;
348
+ }
349
+ return this._migrateDocumentToNewDocPluginAsync( _request, _options );
350
+ }
351
+
352
+
353
+ private async _hasDocumentsToMigrateAsync( options?:base.WebApiRequestOptions) : Promise< boolean > {
354
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
355
+ base.WebApiBase.SetPending(options);
356
+ return new Promise< boolean >(async (resolve, reject) => {
357
+ try {
358
+ config.baseURL = this._options.baseUrl;
359
+ const response = await this._axios.post("HasDocumentsToMigrate", undefined , config);
360
+ base.WebApiBase.SetCompleted(options, response);
361
+ const res : boolean = response.data as boolean;
362
+ resolve(res);
363
+ }
364
+ catch( err ) {
365
+ base.WebApiBase.HandleError(options, config, err);
366
+ reject(err);
367
+ }
368
+ });
369
+ }
370
+
371
+
372
+ /**
373
+ * Checks if there are any documents in the current database stored using a non-default document-plugin, and which can be migrated.
374
+ * @returns True if there are documents available to migrate.
375
+ */
376
+ public async hasDocumentsToMigrateAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >
377
+ {
378
+ return this._hasDocumentsToMigrateAsync(webapi_options);
379
+ }
380
+
381
+
382
+ private async _getNumberOfConfidentialDocumentsAsync( options?:base.WebApiRequestOptions) : Promise< number > {
383
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
384
+ base.WebApiBase.SetPending(options);
385
+ return new Promise< number >(async (resolve, reject) => {
386
+ try {
387
+ config.baseURL = this._options.baseUrl;
388
+ const response = await this._axios.post("GetNumberOfConfidentialDocuments", undefined , config);
389
+ base.WebApiBase.SetCompleted(options, response);
390
+ const res : number = response.data as number;
391
+ resolve(res);
392
+ }
393
+ catch( err ) {
394
+ base.WebApiBase.HandleError(options, config, err);
395
+ reject(err);
396
+ }
397
+ });
398
+ }
399
+
400
+
401
+ /**
402
+ * Gets the total number of documents that is not visible to everyone
403
+ * @returns Number of confidential documents.
404
+ */
405
+ public async getNumberOfConfidentialDocumentsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< number >
406
+ {
407
+ return this._getNumberOfConfidentialDocumentsAsync(webapi_options);
408
+ }
409
+
410
+
411
+ private async _getForTemplatesAsync(request: carriers.DocumentMigration_GetForTemplatesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList > {
412
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
413
+ base.WebApiBase.SetPending(options);
414
+ return new Promise< carriers.DocumentTemplateMigrationList >(async (resolve, reject) => {
415
+ try {
416
+ config.baseURL = this._options.baseUrl;
417
+ const response = await this._axios.post("GetForTemplates", request , config);
418
+ base.WebApiBase.SetCompleted(options, response);
419
+ const res : carriers.DocumentTemplateMigrationList = converters.Create_DocumentTemplateMigrationList_From( response.data );
420
+ resolve(res);
421
+ }
422
+ catch( err ) {
423
+ base.WebApiBase.HandleError(options, config, err);
424
+ reject(err);
425
+ }
426
+ });
427
+ }
428
+
429
+
430
+
431
+ /**
432
+ * Gets a migration summary for all templates stored in CRM.
433
+ * @param request - TargetDocumentPluginId, IncludeEmails
434
+ * @returns Never null.
435
+ */
436
+ public async getForTemplatesAsync(request: carriers.DocumentMigration_GetForTemplatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList >;
437
+
438
+ /**
439
+ * Gets a migration summary for all templates stored in CRM.
440
+ * @param targetDocumentPluginId - The ID of the document-plugin to migrate to.
441
+ * @param includeEmails - True if templates to migrate should include emails.
442
+ * @returns Never null.
443
+ */
444
+ public async getForTemplatesAsync(targetDocumentPluginId: number, includeEmails: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList >;
445
+
446
+ public async getForTemplatesAsync(targetDocumentPluginId:number|carriers.DocumentMigration_GetForTemplatesRequest, includeEmails?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DocumentTemplateMigrationList > {
447
+ let _request : carriers.DocumentMigration_GetForTemplatesRequest = null;
448
+ let _options : base.WebApiRequestOptions = null;
449
+ const first : any = targetDocumentPluginId;
450
+ if( typeof( first ) === "object" && first && ( typeof(first.targetDocumentPluginId)!='undefined' || typeof(first.includeEmails)!='undefined' ) )
451
+ {
452
+ _request = targetDocumentPluginId as carriers.DocumentMigration_GetForTemplatesRequest;
453
+ _options = includeEmails as base.WebApiRequestOptions;
454
+ }
455
+ else
456
+ {
457
+ _request = {
458
+ targetDocumentPluginId: targetDocumentPluginId as number,
459
+ includeEmails: includeEmails as boolean,
460
+ };
461
+ _options = webapi_options;
462
+ }
463
+ return this._getForTemplatesAsync( _request, _options );
464
+ }
465
+
466
+
467
+ private async _migrateTemplateToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest, options?:base.WebApiRequestOptions) : Promise< void > {
468
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
469
+ base.WebApiBase.SetPending(options);
470
+ return new Promise< void >(async (resolve, reject) => {
471
+ try {
472
+ config.baseURL = this._options.baseUrl;
473
+ const response = await this._axios.post("MigrateTemplateToNewDocPlugin", request , config);
474
+ base.WebApiBase.SetCompleted(options, response);
475
+ const res = response.data;
476
+ resolve(res);
477
+ }
478
+ catch( err ) {
479
+ base.WebApiBase.HandleError(options, config, err);
480
+ reject(err);
481
+ }
482
+ });
483
+ }
484
+
485
+
486
+
487
+ /**
488
+ * Migrates the template with the provided id to the specified document-plugin.
489
+ * @param request - DocumentTemplateId, TargetDocumentPluginId
490
+ * @returns This method has no return value
491
+ */
492
+ public async migrateTemplateToNewDocPluginAsync(request: carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
493
+
494
+ /**
495
+ * Migrates the template with the provided id to the specified document-plugin.
496
+ * @param documentTemplateId - The ID of the document-template to migrate.
497
+ * @param targetDocumentPluginId - The ID of the document-plugin to migrate to.
498
+ * @returns This method has no return value
499
+ */
500
+ public async migrateTemplateToNewDocPluginAsync(documentTemplateId: number, targetDocumentPluginId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
501
+
502
+ public async migrateTemplateToNewDocPluginAsync(documentTemplateId:number|carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest, targetDocumentPluginId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
503
+ let _request : carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest = null;
504
+ let _options : base.WebApiRequestOptions = null;
505
+ const first : any = documentTemplateId;
506
+ if( typeof( first ) === "object" && first && ( typeof(first.documentTemplateId)!='undefined' || typeof(first.targetDocumentPluginId)!='undefined' ) )
507
+ {
508
+ _request = documentTemplateId as carriers.DocumentMigration_MigrateTemplateToNewDocPluginRequest;
509
+ _options = targetDocumentPluginId as base.WebApiRequestOptions;
510
+ }
511
+ else
512
+ {
513
+ _request = {
514
+ documentTemplateId: documentTemplateId as number,
515
+ targetDocumentPluginId: targetDocumentPluginId as number,
516
+ };
517
+ _options = webapi_options;
518
+ }
519
+ return this._migrateTemplateToNewDocPluginAsync( _request, _options );
520
+ }
521
+
522
+ } // class v1DocumentMigrationAgentController
523
+
524
+