@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.
- package/LICENSE.md +15 -15
- package/README.md +184 -184
- package/__tests__/Appointment63-notz.json +1925 -1925
- package/__tests__/Appointment63-utctz.json +1925 -1925
- package/__tests__/Appointment63.json +1925 -1925
- package/__tests__/AppointmentTzTest.ts +115 -115
- package/__tests__/AxiosNockTest.ts +28 -28
- package/__tests__/ContactDefault.json +699 -699
- package/__tests__/ContactEntity.json +272 -272
- package/__tests__/ContactRestTest.ts +144 -144
- package/__tests__/ContactTest.ts +395 -395
- package/__tests__/ConvertersTest.ts +97 -97
- package/__tests__/DocumentTest.ts +101 -101
- package/__tests__/Person210-notz.json +1932 -1932
- package/__tests__/Person210-utctz.json +1932 -1932
- package/__tests__/Person210.json +1932 -1932
- package/__tests__/PersonImageData.nock +22 -22
- package/__tests__/PersonTest.ts +41 -41
- package/__tests__/PersonTzTest.ts +113 -113
- package/__tests__/RecurrenceInfo.json +55 -55
- package/__tests__/ResponseCallbackTest.ts +23 -23
- package/__tests__/TableRights.json +441 -441
- package/__tests__/WebapiTest.ts +264 -264
- package/__tests__/Webhook.json +16 -16
- package/__tests__/WebhookTest.ts +209 -209
- package/dist/cjs/Carriers.d.ts +367 -4
- package/dist/cjs/Carriers.d.ts.map +1 -1
- package/dist/cjs/Converters.d.ts +9 -0
- package/dist/cjs/Converters.d.ts.map +1 -1
- package/dist/cjs/Converters.js +185 -17
- package/dist/cjs/Converters.js.map +1 -1
- package/dist/cjs/DiagnosticsAgent.d.ts +38 -0
- package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
- package/dist/cjs/DiagnosticsAgent.js +91 -0
- package/dist/cjs/DiagnosticsAgent.js.map +1 -1
- package/dist/cjs/Enums.d.ts +18 -0
- package/dist/cjs/Enums.d.ts.map +1 -1
- package/dist/cjs/Enums.js +20 -1
- package/dist/cjs/Enums.js.map +1 -1
- package/dist/cjs/ListAgent.d.ts +71 -6
- package/dist/cjs/ListAgent.d.ts.map +1 -1
- package/dist/cjs/ListAgent.js +157 -0
- package/dist/cjs/ListAgent.js.map +1 -1
- package/dist/cjs/TicketAgent.d.ts +23 -0
- package/dist/cjs/TicketAgent.d.ts.map +1 -1
- package/dist/cjs/TicketAgent.js +65 -0
- package/dist/cjs/TicketAgent.js.map +1 -1
- package/dist/esm/Carriers.d.ts +367 -4
- package/dist/esm/Carriers.d.ts.map +1 -1
- package/dist/esm/Converters.d.ts +9 -0
- package/dist/esm/Converters.d.ts.map +1 -1
- package/dist/esm/Converters.js +159 -0
- package/dist/esm/Converters.js.map +1 -1
- package/dist/esm/DiagnosticsAgent.d.ts +38 -0
- package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
- package/dist/esm/DiagnosticsAgent.js +91 -0
- package/dist/esm/DiagnosticsAgent.js.map +1 -1
- package/dist/esm/Enums.d.ts +18 -0
- package/dist/esm/Enums.d.ts.map +1 -1
- package/dist/esm/Enums.js +19 -0
- package/dist/esm/Enums.js.map +1 -1
- package/dist/esm/ListAgent.d.ts +71 -6
- package/dist/esm/ListAgent.d.ts.map +1 -1
- package/dist/esm/ListAgent.js +157 -0
- package/dist/esm/ListAgent.js.map +1 -1
- package/dist/esm/TicketAgent.d.ts +23 -0
- package/dist/esm/TicketAgent.d.ts.map +1 -1
- package/dist/esm/TicketAgent.js +65 -0
- package/dist/esm/TicketAgent.js.map +1 -1
- package/examples-js/hello.js +12 -12
- package/examples-ts/hello.ts +8 -8
- package/package.json +93 -93
- package/scripts/postbuild.js +22 -22
- package/scripts/setVersion.js +44 -44
- package/src/AIAgent.ts +1992 -1992
- package/src/AppointmentAgent.ts +6263 -6263
- package/src/AppointmentRestApi.ts +225 -225
- package/src/ArchiveAgent.ts +1950 -1950
- package/src/AssociateAgent.ts +422 -422
- package/src/AxiosCacheHandler.ts +74 -74
- package/src/BLOBAgent.ts +2100 -2100
- package/src/Base64.ts +285 -285
- package/src/BatchAgent.ts +910 -910
- package/src/BulkUpdateAgent.ts +504 -504
- package/src/CRMScriptAgent.ts +1390 -1390
- package/src/Carriers.ts +52750 -52274
- package/src/ChatAgent.ts +1422 -1422
- package/src/ConfigurationAgent.ts +2228 -2228
- package/src/ContactAgent.ts +1756 -1756
- package/src/ContactRestApi.ts +237 -237
- package/src/Converters.ts +23271 -23090
- package/src/CustomerServiceAgent.ts +1799 -1799
- package/src/DashAgent.ts +1674 -1674
- package/src/DatabaseAgent.ts +120 -120
- package/src/DatabaseTableAgent.ts +534 -534
- package/src/Day_js.ts +41 -41
- package/src/DiagnosticsAgent.ts +1384 -1240
- package/src/DocumentAgent.ts +5079 -5079
- package/src/DocumentMigrationAgent.ts +524 -524
- package/src/DocumentRestApi.ts +259 -259
- package/src/EMailAgent.ts +5328 -5328
- package/src/Enums.ts +6936 -6916
- package/src/ErpSyncAgent.ts +2658 -2658
- package/src/FavouriteAgent.ts +720 -720
- package/src/FindAgent.ts +2330 -2330
- package/src/ForeignSystemAgent.ts +1710 -1710
- package/src/FreeTextAgent.ts +372 -372
- package/src/ImportAgent.ts +304 -304
- package/src/LicenseAgent.ts +1230 -1230
- package/src/ListAgent.ts +11451 -11237
- package/src/MDOAgent.ts +748 -748
- package/src/MarketingAgent.ts +890 -890
- package/src/MessagingAgent.ts +384 -384
- package/src/NavigatorAgent.ts +140 -140
- package/src/NumberAllocationAgent.ts +296 -296
- package/src/PersonAgent.ts +3287 -3287
- package/src/PersonRestApi.ts +241 -241
- package/src/PhoneListAgent.ts +458 -458
- package/src/PocketAgent.ts +780 -780
- package/src/PreferenceAgent.ts +1900 -1900
- package/src/PreviewsAgent.ts +116 -116
- package/src/ProjectAgent.ts +2391 -2391
- package/src/ProjectRestApi.ts +239 -239
- package/src/QuoteAgent.ts +5159 -5159
- package/src/RelationAgent.ts +220 -220
- package/src/ReportAgent.ts +154 -154
- package/src/ResourceAgent.ts +358 -358
- package/src/SaintAgent.ts +601 -601
- package/src/SaleAgent.ts +2034 -2034
- package/src/SaleRestApi.ts +233 -233
- package/src/SelectionAgent.ts +3195 -3195
- package/src/SentryAgent.ts +462 -462
- package/src/SoApiConstants.ts +8 -8
- package/src/TargetsAgent.ts +1104 -1104
- package/src/TicketAgent.ts +3708 -3638
- package/src/TimeZoneAgent.ts +528 -528
- package/src/TooltipsAgent.ts +116 -116
- package/src/UserAgent.ts +4856 -4856
- package/src/UserDefinedFieldInfoAgent.ts +1764 -1764
- package/src/ViewStateAgent.ts +858 -858
- package/src/WebApi.ts +872 -872
- package/src/WebApiBase.ts +565 -565
- package/src/WebhookAgent.ts +388 -388
- package/src/WorkflowAgent.ts +1338 -1338
- package/tsconfig.esm.json +8 -8
- package/tsconfig.jest.json +8 -8
- package/tsconfig.json +34 -34
package/src/DocumentRestApi.ts
CHANGED
|
@@ -1,259 +1,259 @@
|
|
|
1
|
-
// <auto-generated>
|
|
2
|
-
// SuperOffice Code Generator
|
|
3
|
-
// modelling\templates\servicestswebapi\tswebapirestentities.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: DocumentRestApi.ts
|
|
13
|
-
//
|
|
14
|
-
//----------------------------------------------------------------------------
|
|
15
|
-
// Copyright (C) SuperOffice AS
|
|
16
|
-
//----------------------------------------------------------------------------
|
|
17
|
-
|
|
18
|
-
import { AxiosRequestConfig, AxiosError } 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
|
-
*
|
|
28
|
-
* Collection of all services that works with Document data. This is services for the document information, not the physical document themselves. These are handled by the BLOB service methods.
|
|
29
|
-
*
|
|
30
|
-
* `api/v1/Document`
|
|
31
|
-
*/
|
|
32
|
-
export interface IDocumentRestApi {
|
|
33
|
-
|
|
34
|
-
getDefaultAsync(options?:base.WebApiGetRequestOptions): Promise< carriers.DocumentEntity >;
|
|
35
|
-
postAsync(entity: carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity >;
|
|
36
|
-
putByIdAsync(id:number, entity: carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity >;
|
|
37
|
-
patchByIdAsync(id:number, entity: base.WebApiPatchOperation[] | carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity >;
|
|
38
|
-
deleteByIdAsync(DocumentEntityId: number, options?:base.WebApiPutRequestOptions) : Promise<void>;
|
|
39
|
-
getByIdAsync(DocumentEntityId: number, options?:base.WebApiGetRequestOptions) : Promise< carriers.DocumentEntity >;
|
|
40
|
-
// GET {documentId}/Content Async( documentId ) = getDocumentStream
|
|
41
|
-
|
|
42
|
-
// GET {documentId}/SanitizedContent Async( documentId ) = getSanitizedDocumentStream
|
|
43
|
-
|
|
44
|
-
// POST {documentId}/Content Async( contactId personId appointmentId documentId saleId selectionId projectId customTags uiCulture ) = createNewPhysicalDocumentFromTemplateWithCustomTags2
|
|
45
|
-
|
|
46
|
-
// GET {documentId}/Url Async( documentId versionId writeableUrl ) = getDocumentUrl
|
|
47
|
-
|
|
48
|
-
// DELETE {documentId}/Content Async( documentId allowedReturnType ) = deletePhysicalDocument
|
|
49
|
-
|
|
50
|
-
// GET {documentId}/Lock Async( documentId ) = getCheckoutState
|
|
51
|
-
|
|
52
|
-
// POST {documentId}/Lock Async( documentId allowedReturnTypes ) = checkoutDocument
|
|
53
|
-
|
|
54
|
-
// PUT {documentId}/Lock Async( documentId allowedReturnTypes versionDescription versionExtraFields ) = checkinDocument
|
|
55
|
-
|
|
56
|
-
// DELETE {documentId}/Lock Async( documentId allowedReturnTypes ) = undoCheckoutDocument
|
|
57
|
-
|
|
58
|
-
// GET {documentId}/Version Async( documentId ) = getVersionList
|
|
59
|
-
|
|
60
|
-
// GET Plugin Async( ) = getPluginList
|
|
61
|
-
|
|
62
|
-
// GET Plugin/{pluginId} Async( pluginId ) = getPluginCapabilities
|
|
63
|
-
|
|
64
|
-
// GET {documentId}/Property Async( documentId requestedProperties ) = getDocumentProperties
|
|
65
|
-
|
|
66
|
-
// GET {documentId}/Command Async( documentId allowedReturnTypes ) = getDocumentCommands
|
|
67
|
-
|
|
68
|
-
// POST {documentId}/Command/{command} Async( documentId versionId allowedReturnTypes command additionalData ) = executeDocumentCommand
|
|
69
|
-
|
|
70
|
-
// PUT {documentId}/Content Async( documentId stream ) = setDocumentStreamFromId
|
|
71
|
-
|
|
72
|
-
// POST Validate Async( documentEntity ) = validateDocumentEntity
|
|
73
|
-
|
|
74
|
-
// GET {documentId}/Length Async( documentId versionId ) = getDocumentLength
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} // interface IDocumentRestApi
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
* Collection of all services that works with Document data. This is services for the document information, not the physical document themselves. These are handled by the BLOB service methods.
|
|
85
|
-
*
|
|
86
|
-
* `api/v1/Document`
|
|
87
|
-
*/
|
|
88
|
-
export class DocumentRestApi extends base.WebApiBase implements IDocumentRestApi {
|
|
89
|
-
constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
|
|
90
|
-
constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
|
|
91
|
-
constructor(baseUrl: string, resourceManager:any);
|
|
92
|
-
constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
|
|
93
|
-
constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
|
|
94
|
-
constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
|
|
95
|
-
constructor(options: base.WebApiOptions);
|
|
96
|
-
|
|
97
|
-
constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
|
|
98
|
-
langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
|
|
99
|
-
langOrResourceOrRM?:string|base.ResourceParsing|any,
|
|
100
|
-
cultureCode?: string,
|
|
101
|
-
) {
|
|
102
|
-
const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
|
|
103
|
-
options.basePath = "v1/Document/";
|
|
104
|
-
super(options);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* `GET /api/v1/Document/default`
|
|
110
|
-
* Set default values into a new DocumentEntity.
|
|
111
|
-
* NetServer calculates default values on the entity, which is required when creating/storing a new instance
|
|
112
|
-
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
113
|
-
* @returns A blank entity.
|
|
114
|
-
*/
|
|
115
|
-
public async getDefaultAsync(options?:base.WebApiGetRequestOptions): Promise< carriers.DocumentEntity > {
|
|
116
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
117
|
-
base.WebApiBase.SetPending(options);
|
|
118
|
-
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
119
|
-
try {
|
|
120
|
-
const response = await this._axios.get("default", config);
|
|
121
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
122
|
-
const res : carriers.DocumentEntity = converters.Create_DocumentEntity_From( response.data );
|
|
123
|
-
resolve(res);
|
|
124
|
-
}
|
|
125
|
-
catch( err ) {
|
|
126
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
127
|
-
reject(err);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* `POST /api/v1/Document/`
|
|
135
|
-
* Creates a new DocumentEntity
|
|
136
|
-
* @param newDocument - The DocumentEntity to be saved.
|
|
137
|
-
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
138
|
-
* @returns New DocumentEntity
|
|
139
|
-
*/
|
|
140
|
-
public async postAsync(newDocument: carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity > {
|
|
141
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
142
|
-
base.WebApiBase.SetPending(options);
|
|
143
|
-
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
144
|
-
try {
|
|
145
|
-
const response = await this._axios.post("", newDocument, config);
|
|
146
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
147
|
-
const res : carriers.DocumentEntity = converters.Create_DocumentEntity_From( response.data );
|
|
148
|
-
resolve(res);
|
|
149
|
-
}
|
|
150
|
-
catch( err ) {
|
|
151
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
152
|
-
reject(err);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* `PUT /api/v1/Document/123`
|
|
160
|
-
* Replace the existing DocumentEntity
|
|
161
|
-
* @param document - The DocumentEntity to be saved.
|
|
162
|
-
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
163
|
-
* @returns The updated DocumentEntity
|
|
164
|
-
*/
|
|
165
|
-
public async putByIdAsync(id:number, document: carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity > {
|
|
166
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
167
|
-
base.WebApiBase.SetPending(options);
|
|
168
|
-
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
169
|
-
try {
|
|
170
|
-
const response = await this._axios.put(id.toString(), document, config);
|
|
171
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
172
|
-
let res : carriers.DocumentEntity = null;
|
|
173
|
-
if( response.status != 304 )
|
|
174
|
-
res = converters.Create_DocumentEntity_From( response.data );
|
|
175
|
-
resolve(res);
|
|
176
|
-
}
|
|
177
|
-
catch( err ) {
|
|
178
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
179
|
-
reject(err);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* `PATCH /api/v1/Document/123`
|
|
186
|
-
* Updates an existing DocumentEntity
|
|
187
|
-
* @param document - The partial DocumentEntity containing updated values, or an array of RFC6902 PATCH operations.
|
|
188
|
-
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
189
|
-
* @returns The updated DocumentEntity
|
|
190
|
-
*/
|
|
191
|
-
public async patchByIdAsync(id:number, document: base.WebApiPatchOperation[] | carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity > {
|
|
192
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
193
|
-
base.WebApiBase.SetPending(options);
|
|
194
|
-
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
195
|
-
try {
|
|
196
|
-
const response = await this._axios.patch(id.toString(), document, config);
|
|
197
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
198
|
-
let res : carriers.DocumentEntity = null;
|
|
199
|
-
if( response.status != 304 )
|
|
200
|
-
res = converters.Create_DocumentEntity_From( response.data );
|
|
201
|
-
resolve(res);
|
|
202
|
-
}
|
|
203
|
-
catch( err ) {
|
|
204
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
205
|
-
reject(err);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* `DELETE /api/v1/Document/123`
|
|
211
|
-
* Deletes the DocumentEntity
|
|
212
|
-
* @param documentId - The id of the DocumentEntity to be deleted.
|
|
213
|
-
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
214
|
-
*/
|
|
215
|
-
public async deleteByIdAsync(documentId: number, options?:base.WebApiPutRequestOptions) : Promise<void> {
|
|
216
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
217
|
-
base.WebApiBase.SetPending(options);
|
|
218
|
-
return new Promise< void >(async (resolve, reject) => {
|
|
219
|
-
try {
|
|
220
|
-
const response = await this._axios.delete( documentId.toString(), config );
|
|
221
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
222
|
-
const res = response.data;
|
|
223
|
-
resolve(res);
|
|
224
|
-
}
|
|
225
|
-
catch( err ) {
|
|
226
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
227
|
-
reject(err);
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* `GET /api/v1/Document/123`
|
|
233
|
-
* Get an existing DocumentEntity
|
|
234
|
-
* @param documentId - The DocumentEntity to be get.
|
|
235
|
-
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
236
|
-
* @returns The DocumentEntity
|
|
237
|
-
*/
|
|
238
|
-
public async getByIdAsync( documentId: number, options?:base.WebApiGetRequestOptions) : Promise< carriers.DocumentEntity > {
|
|
239
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
240
|
-
base.WebApiBase.SetPending(options);
|
|
241
|
-
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
242
|
-
try {
|
|
243
|
-
const response = await this._axios.get( documentId.toString(), config);
|
|
244
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
245
|
-
let res : carriers.DocumentEntity = null;
|
|
246
|
-
if( response.status != 304 )
|
|
247
|
-
res = converters.Create_DocumentEntity_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
|
-
} // class DocumentRestApi
|
|
259
|
-
|
|
1
|
+
// <auto-generated>
|
|
2
|
+
// SuperOffice Code Generator
|
|
3
|
+
// modelling\templates\servicestswebapi\tswebapirestentities.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: DocumentRestApi.ts
|
|
13
|
+
//
|
|
14
|
+
//----------------------------------------------------------------------------
|
|
15
|
+
// Copyright (C) SuperOffice AS
|
|
16
|
+
//----------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
import { AxiosRequestConfig, AxiosError } 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
|
+
*
|
|
28
|
+
* Collection of all services that works with Document data. This is services for the document information, not the physical document themselves. These are handled by the BLOB service methods.
|
|
29
|
+
*
|
|
30
|
+
* `api/v1/Document`
|
|
31
|
+
*/
|
|
32
|
+
export interface IDocumentRestApi {
|
|
33
|
+
|
|
34
|
+
getDefaultAsync(options?:base.WebApiGetRequestOptions): Promise< carriers.DocumentEntity >;
|
|
35
|
+
postAsync(entity: carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity >;
|
|
36
|
+
putByIdAsync(id:number, entity: carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity >;
|
|
37
|
+
patchByIdAsync(id:number, entity: base.WebApiPatchOperation[] | carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity >;
|
|
38
|
+
deleteByIdAsync(DocumentEntityId: number, options?:base.WebApiPutRequestOptions) : Promise<void>;
|
|
39
|
+
getByIdAsync(DocumentEntityId: number, options?:base.WebApiGetRequestOptions) : Promise< carriers.DocumentEntity >;
|
|
40
|
+
// GET {documentId}/Content Async( documentId ) = getDocumentStream
|
|
41
|
+
|
|
42
|
+
// GET {documentId}/SanitizedContent Async( documentId ) = getSanitizedDocumentStream
|
|
43
|
+
|
|
44
|
+
// POST {documentId}/Content Async( contactId personId appointmentId documentId saleId selectionId projectId customTags uiCulture ) = createNewPhysicalDocumentFromTemplateWithCustomTags2
|
|
45
|
+
|
|
46
|
+
// GET {documentId}/Url Async( documentId versionId writeableUrl ) = getDocumentUrl
|
|
47
|
+
|
|
48
|
+
// DELETE {documentId}/Content Async( documentId allowedReturnType ) = deletePhysicalDocument
|
|
49
|
+
|
|
50
|
+
// GET {documentId}/Lock Async( documentId ) = getCheckoutState
|
|
51
|
+
|
|
52
|
+
// POST {documentId}/Lock Async( documentId allowedReturnTypes ) = checkoutDocument
|
|
53
|
+
|
|
54
|
+
// PUT {documentId}/Lock Async( documentId allowedReturnTypes versionDescription versionExtraFields ) = checkinDocument
|
|
55
|
+
|
|
56
|
+
// DELETE {documentId}/Lock Async( documentId allowedReturnTypes ) = undoCheckoutDocument
|
|
57
|
+
|
|
58
|
+
// GET {documentId}/Version Async( documentId ) = getVersionList
|
|
59
|
+
|
|
60
|
+
// GET Plugin Async( ) = getPluginList
|
|
61
|
+
|
|
62
|
+
// GET Plugin/{pluginId} Async( pluginId ) = getPluginCapabilities
|
|
63
|
+
|
|
64
|
+
// GET {documentId}/Property Async( documentId requestedProperties ) = getDocumentProperties
|
|
65
|
+
|
|
66
|
+
// GET {documentId}/Command Async( documentId allowedReturnTypes ) = getDocumentCommands
|
|
67
|
+
|
|
68
|
+
// POST {documentId}/Command/{command} Async( documentId versionId allowedReturnTypes command additionalData ) = executeDocumentCommand
|
|
69
|
+
|
|
70
|
+
// PUT {documentId}/Content Async( documentId stream ) = setDocumentStreamFromId
|
|
71
|
+
|
|
72
|
+
// POST Validate Async( documentEntity ) = validateDocumentEntity
|
|
73
|
+
|
|
74
|
+
// GET {documentId}/Length Async( documentId versionId ) = getDocumentLength
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
} // interface IDocumentRestApi
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* Collection of all services that works with Document data. This is services for the document information, not the physical document themselves. These are handled by the BLOB service methods.
|
|
85
|
+
*
|
|
86
|
+
* `api/v1/Document`
|
|
87
|
+
*/
|
|
88
|
+
export class DocumentRestApi extends base.WebApiBase implements IDocumentRestApi {
|
|
89
|
+
constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
|
|
90
|
+
constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
|
|
91
|
+
constructor(baseUrl: string, resourceManager:any);
|
|
92
|
+
constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
|
|
93
|
+
constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
|
|
94
|
+
constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
|
|
95
|
+
constructor(options: base.WebApiOptions);
|
|
96
|
+
|
|
97
|
+
constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
|
|
98
|
+
langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
|
|
99
|
+
langOrResourceOrRM?:string|base.ResourceParsing|any,
|
|
100
|
+
cultureCode?: string,
|
|
101
|
+
) {
|
|
102
|
+
const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
|
|
103
|
+
options.basePath = "v1/Document/";
|
|
104
|
+
super(options);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* `GET /api/v1/Document/default`
|
|
110
|
+
* Set default values into a new DocumentEntity.
|
|
111
|
+
* NetServer calculates default values on the entity, which is required when creating/storing a new instance
|
|
112
|
+
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
113
|
+
* @returns A blank entity.
|
|
114
|
+
*/
|
|
115
|
+
public async getDefaultAsync(options?:base.WebApiGetRequestOptions): Promise< carriers.DocumentEntity > {
|
|
116
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
117
|
+
base.WebApiBase.SetPending(options);
|
|
118
|
+
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
119
|
+
try {
|
|
120
|
+
const response = await this._axios.get("default", config);
|
|
121
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
122
|
+
const res : carriers.DocumentEntity = converters.Create_DocumentEntity_From( response.data );
|
|
123
|
+
resolve(res);
|
|
124
|
+
}
|
|
125
|
+
catch( err ) {
|
|
126
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
127
|
+
reject(err);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* `POST /api/v1/Document/`
|
|
135
|
+
* Creates a new DocumentEntity
|
|
136
|
+
* @param newDocument - The DocumentEntity to be saved.
|
|
137
|
+
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
138
|
+
* @returns New DocumentEntity
|
|
139
|
+
*/
|
|
140
|
+
public async postAsync(newDocument: carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity > {
|
|
141
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
142
|
+
base.WebApiBase.SetPending(options);
|
|
143
|
+
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
144
|
+
try {
|
|
145
|
+
const response = await this._axios.post("", newDocument, config);
|
|
146
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
147
|
+
const res : carriers.DocumentEntity = converters.Create_DocumentEntity_From( response.data );
|
|
148
|
+
resolve(res);
|
|
149
|
+
}
|
|
150
|
+
catch( err ) {
|
|
151
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
152
|
+
reject(err);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* `PUT /api/v1/Document/123`
|
|
160
|
+
* Replace the existing DocumentEntity
|
|
161
|
+
* @param document - The DocumentEntity to be saved.
|
|
162
|
+
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
163
|
+
* @returns The updated DocumentEntity
|
|
164
|
+
*/
|
|
165
|
+
public async putByIdAsync(id:number, document: carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity > {
|
|
166
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
167
|
+
base.WebApiBase.SetPending(options);
|
|
168
|
+
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
169
|
+
try {
|
|
170
|
+
const response = await this._axios.put(id.toString(), document, config);
|
|
171
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
172
|
+
let res : carriers.DocumentEntity = null;
|
|
173
|
+
if( response.status != 304 )
|
|
174
|
+
res = converters.Create_DocumentEntity_From( response.data );
|
|
175
|
+
resolve(res);
|
|
176
|
+
}
|
|
177
|
+
catch( err ) {
|
|
178
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
179
|
+
reject(err);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* `PATCH /api/v1/Document/123`
|
|
186
|
+
* Updates an existing DocumentEntity
|
|
187
|
+
* @param document - The partial DocumentEntity containing updated values, or an array of RFC6902 PATCH operations.
|
|
188
|
+
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
189
|
+
* @returns The updated DocumentEntity
|
|
190
|
+
*/
|
|
191
|
+
public async patchByIdAsync(id:number, document: base.WebApiPatchOperation[] | carriers.DocumentEntity, options?:base.WebApiPutRequestOptions) : Promise< carriers.DocumentEntity > {
|
|
192
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
193
|
+
base.WebApiBase.SetPending(options);
|
|
194
|
+
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
195
|
+
try {
|
|
196
|
+
const response = await this._axios.patch(id.toString(), document, config);
|
|
197
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
198
|
+
let res : carriers.DocumentEntity = null;
|
|
199
|
+
if( response.status != 304 )
|
|
200
|
+
res = converters.Create_DocumentEntity_From( response.data );
|
|
201
|
+
resolve(res);
|
|
202
|
+
}
|
|
203
|
+
catch( err ) {
|
|
204
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
205
|
+
reject(err);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* `DELETE /api/v1/Document/123`
|
|
211
|
+
* Deletes the DocumentEntity
|
|
212
|
+
* @param documentId - The id of the DocumentEntity to be deleted.
|
|
213
|
+
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
214
|
+
*/
|
|
215
|
+
public async deleteByIdAsync(documentId: number, options?:base.WebApiPutRequestOptions) : Promise<void> {
|
|
216
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
217
|
+
base.WebApiBase.SetPending(options);
|
|
218
|
+
return new Promise< void >(async (resolve, reject) => {
|
|
219
|
+
try {
|
|
220
|
+
const response = await this._axios.delete( documentId.toString(), config );
|
|
221
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
222
|
+
const res = response.data;
|
|
223
|
+
resolve(res);
|
|
224
|
+
}
|
|
225
|
+
catch( err ) {
|
|
226
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
227
|
+
reject(err);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* `GET /api/v1/Document/123`
|
|
233
|
+
* Get an existing DocumentEntity
|
|
234
|
+
* @param documentId - The DocumentEntity to be get.
|
|
235
|
+
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
236
|
+
* @returns The DocumentEntity
|
|
237
|
+
*/
|
|
238
|
+
public async getByIdAsync( documentId: number, options?:base.WebApiGetRequestOptions) : Promise< carriers.DocumentEntity > {
|
|
239
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
240
|
+
base.WebApiBase.SetPending(options);
|
|
241
|
+
return new Promise< carriers.DocumentEntity >(async (resolve, reject) => {
|
|
242
|
+
try {
|
|
243
|
+
const response = await this._axios.get( documentId.toString(), config);
|
|
244
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
245
|
+
let res : carriers.DocumentEntity = null;
|
|
246
|
+
if( response.status != 304 )
|
|
247
|
+
res = converters.Create_DocumentEntity_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
|
+
} // class DocumentRestApi
|
|
259
|
+
|