@superoffice/webapi 12.0.342 → 12.2.2072

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 (81) hide show
  1. package/dist/cjs/Carriers.d.ts +486 -5
  2. package/dist/cjs/Carriers.d.ts.map +1 -1
  3. package/dist/cjs/Converters.d.ts +21 -0
  4. package/dist/cjs/Converters.d.ts.map +1 -1
  5. package/dist/cjs/Converters.js +320 -4
  6. package/dist/cjs/Converters.js.map +1 -1
  7. package/dist/cjs/CustomObjectAgent.d.ts +137 -0
  8. package/dist/cjs/CustomObjectAgent.d.ts.map +1 -0
  9. package/dist/cjs/CustomObjectAgent.js +294 -0
  10. package/dist/cjs/CustomObjectAgent.js.map +1 -0
  11. package/dist/cjs/CustomerServiceAgent.d.ts +4 -3
  12. package/dist/cjs/CustomerServiceAgent.d.ts.map +1 -1
  13. package/dist/cjs/CustomerServiceAgent.js +3 -2
  14. package/dist/cjs/CustomerServiceAgent.js.map +1 -1
  15. package/dist/cjs/EMailAgent.d.ts +16 -0
  16. package/dist/cjs/EMailAgent.d.ts.map +1 -1
  17. package/dist/cjs/EMailAgent.js +48 -0
  18. package/dist/cjs/EMailAgent.js.map +1 -1
  19. package/dist/cjs/Enums.d.ts +92 -1
  20. package/dist/cjs/Enums.d.ts.map +1 -1
  21. package/dist/cjs/Enums.js +97 -2
  22. package/dist/cjs/Enums.js.map +1 -1
  23. package/dist/cjs/ListAgent.d.ts +7 -0
  24. package/dist/cjs/ListAgent.d.ts.map +1 -1
  25. package/dist/cjs/ListAgent.js +24 -0
  26. package/dist/cjs/ListAgent.js.map +1 -1
  27. package/dist/cjs/NewsFeedAgent.d.ts +141 -0
  28. package/dist/cjs/NewsFeedAgent.d.ts.map +1 -0
  29. package/dist/cjs/NewsFeedAgent.js +292 -0
  30. package/dist/cjs/NewsFeedAgent.js.map +1 -0
  31. package/dist/cjs/ProjectAgent.d.ts +3 -3
  32. package/dist/cjs/WebApi.d.ts +12 -0
  33. package/dist/cjs/WebApi.d.ts.map +1 -1
  34. package/dist/cjs/WebApi.js +19 -1
  35. package/dist/cjs/WebApi.js.map +1 -1
  36. package/dist/esm/Carriers.d.ts +486 -5
  37. package/dist/esm/Carriers.d.ts.map +1 -1
  38. package/dist/esm/Converters.d.ts +21 -0
  39. package/dist/esm/Converters.d.ts.map +1 -1
  40. package/dist/esm/Converters.js +294 -0
  41. package/dist/esm/Converters.js.map +1 -1
  42. package/dist/esm/CustomObjectAgent.d.ts +137 -0
  43. package/dist/esm/CustomObjectAgent.d.ts.map +1 -0
  44. package/dist/esm/CustomObjectAgent.js +289 -0
  45. package/dist/esm/CustomObjectAgent.js.map +1 -0
  46. package/dist/esm/CustomerServiceAgent.d.ts +4 -3
  47. package/dist/esm/CustomerServiceAgent.d.ts.map +1 -1
  48. package/dist/esm/CustomerServiceAgent.js +3 -2
  49. package/dist/esm/CustomerServiceAgent.js.map +1 -1
  50. package/dist/esm/EMailAgent.d.ts +16 -0
  51. package/dist/esm/EMailAgent.d.ts.map +1 -1
  52. package/dist/esm/EMailAgent.js +48 -0
  53. package/dist/esm/EMailAgent.js.map +1 -1
  54. package/dist/esm/Enums.d.ts +92 -1
  55. package/dist/esm/Enums.d.ts.map +1 -1
  56. package/dist/esm/Enums.js +96 -1
  57. package/dist/esm/Enums.js.map +1 -1
  58. package/dist/esm/ListAgent.d.ts +7 -0
  59. package/dist/esm/ListAgent.d.ts.map +1 -1
  60. package/dist/esm/ListAgent.js +24 -0
  61. package/dist/esm/ListAgent.js.map +1 -1
  62. package/dist/esm/NewsFeedAgent.d.ts +141 -0
  63. package/dist/esm/NewsFeedAgent.d.ts.map +1 -0
  64. package/dist/esm/NewsFeedAgent.js +287 -0
  65. package/dist/esm/NewsFeedAgent.js.map +1 -0
  66. package/dist/esm/ProjectAgent.d.ts +3 -3
  67. package/dist/esm/WebApi.d.ts +12 -0
  68. package/dist/esm/WebApi.d.ts.map +1 -1
  69. package/dist/esm/WebApi.js +18 -0
  70. package/dist/esm/WebApi.js.map +1 -1
  71. package/package.json +4 -4
  72. package/src/Carriers.ts +666 -5
  73. package/src/Converters.ts +354 -0
  74. package/src/CustomObjectAgent.ts +489 -0
  75. package/src/CustomerServiceAgent.ts +7 -5
  76. package/src/EMailAgent.ts +76 -0
  77. package/src/Enums.ts +100 -1
  78. package/src/ListAgent.ts +30 -0
  79. package/src/NewsFeedAgent.ts +481 -0
  80. package/src/ProjectAgent.ts +3 -3
  81. package/src/WebApi.ts +24 -0
@@ -0,0 +1,489 @@
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/CustomObjectAgent.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 for working with Custom Objects (extra tables): read schema and full CRUD over rows. Purpose-built replacement for using DatabaseTableAgent against custom objects.
28
+ */
29
+ export interface ICustomObjectAgent {
30
+ createDefaultCustomObjectDefinitionAsync(): Promise< carriers.CustomObjectDefinition >;
31
+ createDefaultCustomObjectAsync(request: carriers.CustomObject_CreateDefaultCustomObjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
32
+ createDefaultCustomObjectAsync(definitionName: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
33
+ getCustomObjectAsync(request: carriers.CustomObject_GetCustomObjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
34
+ getCustomObjectAsync(definitionName: string, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
35
+ saveCustomObjectAsync(request: carriers.CustomObject_SaveCustomObjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
36
+ saveCustomObjectAsync(definitionName: string, row: carriers.CustomObject, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
37
+ deleteCustomObjectAsync(request: carriers.CustomObject_DeleteCustomObjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
38
+ deleteCustomObjectAsync(definitionName: string, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
39
+ getCustomObjectDefinitionAsync(request: carriers.CustomObject_GetCustomObjectDefinitionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectDefinition >;
40
+ getCustomObjectDefinitionAsync(definitionName: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectDefinition >;
41
+ hasScreenChooserAsync(request: carriers.CustomObject_HasScreenChooserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
42
+ hasScreenChooserAsync(definitionName: string, edit: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
43
+ getCustomObjectsMetadataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectMetadata[] >;
44
+ getCustomObjectsIconsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
45
+ } // interface ICustomObjectAgent
46
+
47
+
48
+
49
+
50
+ /**
51
+ * Agent for working with Custom Objects (extra tables): read schema and full CRUD over rows. Purpose-built replacement for using DatabaseTableAgent against custom objects.
52
+ */
53
+ export class CustomObjectAgent extends base.WebApiBase implements ICustomObjectAgent {
54
+ constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
55
+ constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
56
+ constructor(baseUrl: string, resourceManager:any);
57
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
58
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
59
+ constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
60
+ constructor(options: base.WebApiOptions);
61
+
62
+ constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
63
+ langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
64
+ langOrResourceOrRM?:string|base.ResourceParsing|any,
65
+ cultureCode?: string,
66
+ ) {
67
+ const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
68
+ options.basePath = "v1/Agents/CustomObject/";
69
+ super(options);
70
+ }
71
+
72
+
73
+
74
+
75
+ /**
76
+ * Set default values into a new CustomObjectDefinition.
77
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
78
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
79
+ * @returns A blank entity.
80
+ */
81
+ public async createDefaultCustomObjectDefinitionAsync(options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectDefinition > {
82
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
83
+ base.WebApiBase.SetPending(options);
84
+ return new Promise< carriers.CustomObjectDefinition >(async (resolve, reject) => {
85
+ try {
86
+ const response = await this._axios.post("CreateDefaultCustomObjectDefinition", null, config);
87
+ base.WebApiBase.SetCompleted(options, response);
88
+ const res : carriers.CustomObjectDefinition = converters.Create_CustomObjectDefinition_From( response.data );
89
+ resolve(res);
90
+ }
91
+ catch( err ) {
92
+ base.WebApiBase.HandleError(options, config, err);
93
+ reject(err);
94
+ }
95
+ });
96
+ }
97
+
98
+ private async _createDefaultCustomObjectAsync(request: carriers.CustomObject_CreateDefaultCustomObjectRequest, options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject > {
99
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
100
+ base.WebApiBase.SetPending(options);
101
+ return new Promise< carriers.CustomObject >(async (resolve, reject) => {
102
+ try {
103
+ config.baseURL = this._options.baseUrl;
104
+ const response = await this._axios.post("CreateDefaultCustomObject", request , config);
105
+ base.WebApiBase.SetCompleted(options, response);
106
+ const res : carriers.CustomObject = converters.Create_CustomObject_From( response.data );
107
+ resolve(res);
108
+ }
109
+ catch( err ) {
110
+ base.WebApiBase.HandleError(options, config, err);
111
+ reject(err);
112
+ }
113
+ });
114
+ }
115
+
116
+
117
+
118
+ /**
119
+ * Returns a new Custom Object row pre-populated with the default values declared by the Custom Object Definition. The row is not yet persisted.
120
+ * @param request - DefinitionName
121
+ * @returns A new Custom Object row pre-populated with default values. Not yet persisted.
122
+ */
123
+ public async createDefaultCustomObjectAsync(request: carriers.CustomObject_CreateDefaultCustomObjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
124
+
125
+ /**
126
+ * Returns a new Custom Object row pre-populated with the default values declared by the Custom Object Definition. The row is not yet persisted.
127
+ * @param definitionName - Database table name of the Custom Object Definition, e.g. 'y_equipment'.
128
+ * @returns A new Custom Object row pre-populated with default values. Not yet persisted.
129
+ */
130
+ public async createDefaultCustomObjectAsync(definitionName: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
131
+
132
+ public async createDefaultCustomObjectAsync(definitionName:string|carriers.CustomObject_CreateDefaultCustomObjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject > {
133
+ let _request : carriers.CustomObject_CreateDefaultCustomObjectRequest = null;
134
+ let _options : base.WebApiRequestOptions = null;
135
+ const first : any = definitionName;
136
+ if( typeof( first ) === "object" && first && ( typeof(first.definitionName)!='undefined' ) )
137
+ {
138
+ _request = definitionName as carriers.CustomObject_CreateDefaultCustomObjectRequest;
139
+ _options = webapi_options as base.WebApiRequestOptions;
140
+ }
141
+ else
142
+ {
143
+ _request = {
144
+ definitionName: definitionName as string,
145
+ };
146
+ _options = webapi_options;
147
+ }
148
+ return this._createDefaultCustomObjectAsync( _request, _options );
149
+ }
150
+
151
+
152
+ private async _getCustomObjectAsync(request: carriers.CustomObject_GetCustomObjectRequest, options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject > {
153
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
154
+ base.WebApiBase.SetPending(options);
155
+ return new Promise< carriers.CustomObject >(async (resolve, reject) => {
156
+ try {
157
+ config.baseURL = this._options.baseUrl;
158
+ const response = await this._axios.post("GetCustomObject", request , config);
159
+ base.WebApiBase.SetCompleted(options, response);
160
+ const res : carriers.CustomObject = converters.Create_CustomObject_From( response.data );
161
+ resolve(res);
162
+ }
163
+ catch( err ) {
164
+ base.WebApiBase.HandleError(options, config, err);
165
+ reject(err);
166
+ }
167
+ });
168
+ }
169
+
170
+
171
+
172
+ /**
173
+ * Returns a single Custom Object row by definition name and primary key.
174
+ * @param request - DefinitionName, Id
175
+ * @returns The Custom Object row, or null if no row with that id exists.
176
+ */
177
+ public async getCustomObjectAsync(request: carriers.CustomObject_GetCustomObjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
178
+
179
+ /**
180
+ * Returns a single Custom Object row by definition name and primary key.
181
+ * @param definitionName - Database table name of the Custom Object Definition, e.g. 'y_equipment'.
182
+ * @param id - Primary key of the row to fetch.
183
+ * @returns The Custom Object row, or null if no row with that id exists.
184
+ */
185
+ public async getCustomObjectAsync(definitionName: string, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
186
+
187
+ public async getCustomObjectAsync(definitionName:string|carriers.CustomObject_GetCustomObjectRequest, id?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject > {
188
+ let _request : carriers.CustomObject_GetCustomObjectRequest = null;
189
+ let _options : base.WebApiRequestOptions = null;
190
+ const first : any = definitionName;
191
+ if( typeof( first ) === "object" && first && ( typeof(first.definitionName)!='undefined' || typeof(first.id)!='undefined' ) )
192
+ {
193
+ _request = definitionName as carriers.CustomObject_GetCustomObjectRequest;
194
+ _options = id as base.WebApiRequestOptions;
195
+ }
196
+ else
197
+ {
198
+ _request = {
199
+ definitionName: definitionName as string,
200
+ id: id as number,
201
+ };
202
+ _options = webapi_options;
203
+ }
204
+ return this._getCustomObjectAsync( _request, _options );
205
+ }
206
+
207
+
208
+ private async _saveCustomObjectAsync(request: carriers.CustomObject_SaveCustomObjectRequest, options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject > {
209
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
210
+ base.WebApiBase.SetPending(options);
211
+ return new Promise< carriers.CustomObject >(async (resolve, reject) => {
212
+ try {
213
+ config.baseURL = this._options.baseUrl;
214
+ const response = await this._axios.post("SaveCustomObject", request , config);
215
+ base.WebApiBase.SetCompleted(options, response);
216
+ const res : carriers.CustomObject = converters.Create_CustomObject_From( response.data );
217
+ resolve(res);
218
+ }
219
+ catch( err ) {
220
+ base.WebApiBase.HandleError(options, config, err);
221
+ reject(err);
222
+ }
223
+ });
224
+ }
225
+
226
+
227
+
228
+ /**
229
+ * Saves a Custom Object row. If the row has a primary key set it will be updated, otherwise a new row is inserted.
230
+ * @param request - DefinitionName, Row
231
+ * @returns The saved Custom Object row, with any server-assigned values (e.g. primary key) filled in.
232
+ */
233
+ public async saveCustomObjectAsync(request: carriers.CustomObject_SaveCustomObjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
234
+
235
+ /**
236
+ * Saves a Custom Object row. If the row has a primary key set it will be updated, otherwise a new row is inserted.
237
+ * @param definitionName - Database table name of the Custom Object Definition, e.g. 'y_equipment'.
238
+ * @param row - The Custom Object row to save.
239
+ * @returns The saved Custom Object row, with any server-assigned values (e.g. primary key) filled in.
240
+ */
241
+ public async saveCustomObjectAsync(definitionName: string, row: carriers.CustomObject, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject >;
242
+
243
+ public async saveCustomObjectAsync(definitionName:string|carriers.CustomObject_SaveCustomObjectRequest, row?:carriers.CustomObject|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObject > {
244
+ let _request : carriers.CustomObject_SaveCustomObjectRequest = null;
245
+ let _options : base.WebApiRequestOptions = null;
246
+ const first : any = definitionName;
247
+ if( typeof( first ) === "object" && first && ( typeof(first.definitionName)!='undefined' || typeof(first.row)!='undefined' ) )
248
+ {
249
+ _request = definitionName as carriers.CustomObject_SaveCustomObjectRequest;
250
+ _options = row as base.WebApiRequestOptions;
251
+ }
252
+ else
253
+ {
254
+ _request = {
255
+ definitionName: definitionName as string,
256
+ row: row as carriers.CustomObject,
257
+ };
258
+ _options = webapi_options;
259
+ }
260
+ return this._saveCustomObjectAsync( _request, _options );
261
+ }
262
+
263
+
264
+ private async _deleteCustomObjectAsync(request: carriers.CustomObject_DeleteCustomObjectRequest, options?:base.WebApiRequestOptions) : Promise< void > {
265
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
266
+ base.WebApiBase.SetPending(options);
267
+ return new Promise< void >(async (resolve, reject) => {
268
+ try {
269
+ config.baseURL = this._options.baseUrl;
270
+ const response = await this._axios.post("DeleteCustomObject", request , config);
271
+ base.WebApiBase.SetCompleted(options, response);
272
+ const res = response.data;
273
+ resolve(res);
274
+ }
275
+ catch( err ) {
276
+ base.WebApiBase.HandleError(options, config, err);
277
+ reject(err);
278
+ }
279
+ });
280
+ }
281
+
282
+
283
+
284
+ /**
285
+ * Deletes a single Custom Object row by primary key.
286
+ * @param request - DefinitionName, Id
287
+ * @returns This method has no return value
288
+ */
289
+ public async deleteCustomObjectAsync(request: carriers.CustomObject_DeleteCustomObjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
290
+
291
+ /**
292
+ * Deletes a single Custom Object row by primary key.
293
+ * @param definitionName - Database table name of the Custom Object Definition, e.g. 'y_equipment'.
294
+ * @param id - Primary key of the row to delete.
295
+ * @returns This method has no return value
296
+ */
297
+ public async deleteCustomObjectAsync(definitionName: string, id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
298
+
299
+ public async deleteCustomObjectAsync(definitionName:string|carriers.CustomObject_DeleteCustomObjectRequest, id?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
300
+ let _request : carriers.CustomObject_DeleteCustomObjectRequest = null;
301
+ let _options : base.WebApiRequestOptions = null;
302
+ const first : any = definitionName;
303
+ if( typeof( first ) === "object" && first && ( typeof(first.definitionName)!='undefined' || typeof(first.id)!='undefined' ) )
304
+ {
305
+ _request = definitionName as carriers.CustomObject_DeleteCustomObjectRequest;
306
+ _options = id as base.WebApiRequestOptions;
307
+ }
308
+ else
309
+ {
310
+ _request = {
311
+ definitionName: definitionName as string,
312
+ id: id as number,
313
+ };
314
+ _options = webapi_options;
315
+ }
316
+ return this._deleteCustomObjectAsync( _request, _options );
317
+ }
318
+
319
+
320
+ private async _getCustomObjectDefinitionAsync(request: carriers.CustomObject_GetCustomObjectDefinitionRequest, options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectDefinition > {
321
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
322
+ base.WebApiBase.SetPending(options);
323
+ return new Promise< carriers.CustomObjectDefinition >(async (resolve, reject) => {
324
+ try {
325
+ config.baseURL = this._options.baseUrl;
326
+ const response = await this._axios.post("GetCustomObjectDefinition", request , config);
327
+ base.WebApiBase.SetCompleted(options, response);
328
+ const res : carriers.CustomObjectDefinition = converters.Create_CustomObjectDefinition_From( response.data );
329
+ resolve(res);
330
+ }
331
+ catch( err ) {
332
+ base.WebApiBase.HandleError(options, config, err);
333
+ reject(err);
334
+ }
335
+ });
336
+ }
337
+
338
+
339
+
340
+ /**
341
+ * Returns the schema (table + field definitions) for a Custom Object Definition by its database table name.
342
+ * @param request - DefinitionName
343
+ * @returns The Custom Object Definition, or null if no definition with that name exists.
344
+ */
345
+ public async getCustomObjectDefinitionAsync(request: carriers.CustomObject_GetCustomObjectDefinitionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectDefinition >;
346
+
347
+ /**
348
+ * Returns the schema (table + field definitions) for a Custom Object Definition by its database table name.
349
+ * @param definitionName - Database table name of the Custom Object Definition, e.g. 'y_equipment'.
350
+ * @returns The Custom Object Definition, or null if no definition with that name exists.
351
+ */
352
+ public async getCustomObjectDefinitionAsync(definitionName: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectDefinition >;
353
+
354
+ public async getCustomObjectDefinitionAsync(definitionName:string|carriers.CustomObject_GetCustomObjectDefinitionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectDefinition > {
355
+ let _request : carriers.CustomObject_GetCustomObjectDefinitionRequest = null;
356
+ let _options : base.WebApiRequestOptions = null;
357
+ const first : any = definitionName;
358
+ if( typeof( first ) === "object" && first && ( typeof(first.definitionName)!='undefined' ) )
359
+ {
360
+ _request = definitionName as carriers.CustomObject_GetCustomObjectDefinitionRequest;
361
+ _options = webapi_options as base.WebApiRequestOptions;
362
+ }
363
+ else
364
+ {
365
+ _request = {
366
+ definitionName: definitionName as string,
367
+ };
368
+ _options = webapi_options;
369
+ }
370
+ return this._getCustomObjectDefinitionAsync( _request, _options );
371
+ }
372
+
373
+
374
+ private async _hasScreenChooserAsync(request: carriers.CustomObject_HasScreenChooserRequest, options?:base.WebApiRequestOptions) : Promise< boolean > {
375
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
376
+ base.WebApiBase.SetPending(options);
377
+ return new Promise< boolean >(async (resolve, reject) => {
378
+ try {
379
+ config.baseURL = this._options.baseUrl;
380
+ const response = await this._axios.post("HasScreenChooser", request , config);
381
+ base.WebApiBase.SetCompleted(options, response);
382
+ const res : boolean = response.data as boolean;
383
+ resolve(res);
384
+ }
385
+ catch( err ) {
386
+ base.WebApiBase.HandleError(options, config, err);
387
+ reject(err);
388
+ }
389
+ });
390
+ }
391
+
392
+
393
+
394
+ /**
395
+ * Returns true if a screen chooser is configured for the given Custom Object Definition and mode.
396
+ * @param request - DefinitionName, Edit
397
+ * @returns True if a screen chooser (view or edit) is configured for this Custom Object.
398
+ */
399
+ public async hasScreenChooserAsync(request: carriers.CustomObject_HasScreenChooserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
400
+
401
+ /**
402
+ * Returns true if a screen chooser is configured for the given Custom Object Definition and mode.
403
+ * @param definitionName - Database table name of the Custom Object Definition.
404
+ * @param edit - True to check for a custom edit screen; false to check for a custom view screen.
405
+ * @returns True if a screen chooser (view or edit) is configured for this Custom Object.
406
+ */
407
+ public async hasScreenChooserAsync(definitionName: string, edit: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
408
+
409
+ public async hasScreenChooserAsync(definitionName:string|carriers.CustomObject_HasScreenChooserRequest, edit?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< boolean > {
410
+ let _request : carriers.CustomObject_HasScreenChooserRequest = null;
411
+ let _options : base.WebApiRequestOptions = null;
412
+ const first : any = definitionName;
413
+ if( typeof( first ) === "object" && first && ( typeof(first.definitionName)!='undefined' || typeof(first.edit)!='undefined' ) )
414
+ {
415
+ _request = definitionName as carriers.CustomObject_HasScreenChooserRequest;
416
+ _options = edit as base.WebApiRequestOptions;
417
+ }
418
+ else
419
+ {
420
+ _request = {
421
+ definitionName: definitionName as string,
422
+ edit: edit as boolean,
423
+ };
424
+ _options = webapi_options;
425
+ }
426
+ return this._hasScreenChooserAsync( _request, _options );
427
+ }
428
+
429
+
430
+ private async _getCustomObjectsMetadataAsync( options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectMetadata[] > {
431
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
432
+ base.WebApiBase.SetPending(options);
433
+ return new Promise< carriers.CustomObjectMetadata[] >(async (resolve, reject) => {
434
+ try {
435
+ config.baseURL = this._options.baseUrl;
436
+ const response = await this._axios.post("GetCustomObjectsMetadata", undefined , config);
437
+ base.WebApiBase.SetCompleted(options, response);
438
+ const res : carriers.CustomObjectMetadata[] = converters.Create_CustomObjectMetadataArray_From( response.data );
439
+ resolve(res);
440
+ }
441
+ catch( err ) {
442
+ base.WebApiBase.HandleError(options, config, err);
443
+ reject(err);
444
+ }
445
+ });
446
+ }
447
+
448
+
449
+ /**
450
+ * Returns bootstrap metadata for all Custom Object tables.
451
+ * @returns Metadata for all custom object tables.
452
+ */
453
+ public async getCustomObjectsMetadataAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CustomObjectMetadata[] >
454
+ {
455
+ return this._getCustomObjectsMetadataAsync(webapi_options);
456
+ }
457
+
458
+
459
+ private async _getCustomObjectsIconsAsync( options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
460
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
461
+ base.WebApiBase.SetPending(options);
462
+ return new Promise< carriers.StringDictionary >(async (resolve, reject) => {
463
+ try {
464
+ config.baseURL = this._options.baseUrl;
465
+ const response = await this._axios.post("GetCustomObjectsIcons", undefined , config);
466
+ base.WebApiBase.SetCompleted(options, response);
467
+ const res : carriers.StringDictionary = converters.Create_StringDictionary_From( response.data );
468
+ resolve(res);
469
+ }
470
+ catch( err ) {
471
+ base.WebApiBase.HandleError(options, config, err);
472
+ reject(err);
473
+ }
474
+ });
475
+ }
476
+
477
+
478
+ /**
479
+ * Returns SVG icon data for all Custom Object tables, keyed by table name.
480
+ * @returns Map of table name to SVG icon data URI.
481
+ */
482
+ public async getCustomObjectsIconsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >
483
+ {
484
+ return this._getCustomObjectsIconsAsync(webapi_options);
485
+ }
486
+
487
+ } // class v1CustomObjectAgentController
488
+
489
+
@@ -84,7 +84,7 @@ export interface ICustomerServiceAgent {
84
84
  saveSystemTemplateSettingsAsync(request: carriers.CustomerService_SaveSystemTemplateSettingsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.SystemTemplateSettings >;
85
85
  saveSystemTemplateSettingsAsync(systemTemplateSettings: carriers.SystemTemplateSettings, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.SystemTemplateSettings >;
86
86
  createTicketFromMailDataAsync(request: carriers.CustomerService_CreateTicketFromMailDataRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo >;
87
- createTicketFromMailDataAsync(mailboxId: number, data: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo >;
87
+ createTicketFromMailDataAsync(mailboxId: number, data: string, personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo >;
88
88
  addMessageFromMailDataAsync(request: carriers.CustomerService_AddMessageFromMailDataRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo >;
89
89
  addMessageFromMailDataAsync(ticketId: number, data: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo >;
90
90
  findTicketsByTitleOrIdAsync(request: carriers.CustomerService_FindTicketsByTitleOrIdRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo[] >;
@@ -1649,7 +1649,7 @@ export class CustomerServiceAgent extends base.WebApiBase implements ICustomerSe
1649
1649
 
1650
1650
  /**
1651
1651
  * This method create a new ticket in the same way as importMail would import an email. It accepts RFC822 formatted data
1652
- * @param request - MailboxId, Data
1652
+ * @param request - MailboxId, Data, PersonId
1653
1653
  * @returns An object containing some meta data for the created ticket
1654
1654
  */
1655
1655
  public async createTicketFromMailDataAsync(request: carriers.CustomerService_CreateTicketFromMailDataRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo >;
@@ -1658,15 +1658,16 @@ export class CustomerServiceAgent extends base.WebApiBase implements ICustomerSe
1658
1658
  * This method create a new ticket in the same way as importMail would import an email. It accepts RFC822 formatted data
1659
1659
  * @param mailboxId - The id of the Service mailbox
1660
1660
  * @param data - RFC822 formatted data to import as a ticket
1661
+ * @param personId - Optional. If greater than 0, the new ticket is attached to this person as the primary customer and the email's From header is not used to resolve the customer; the supplied person must exist and not be retired or the call throws a validation error. If 0 (default), the customer is resolved from the email as before.
1661
1662
  * @returns An object containing some meta data for the created ticket
1662
1663
  */
1663
- public async createTicketFromMailDataAsync(mailboxId: number, data: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo >;
1664
+ public async createTicketFromMailDataAsync(mailboxId: number, data: string, personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo >;
1664
1665
 
1665
- public async createTicketFromMailDataAsync(mailboxId:number|carriers.CustomerService_CreateTicketFromMailDataRequest, data?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo > {
1666
+ public async createTicketFromMailDataAsync(mailboxId:number|carriers.CustomerService_CreateTicketFromMailDataRequest, data?:string|base.WebApiRequestOptions, personId?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.TicketInfo > {
1666
1667
  let _request : carriers.CustomerService_CreateTicketFromMailDataRequest = null;
1667
1668
  let _options : base.WebApiRequestOptions = null;
1668
1669
  const first : any = mailboxId;
1669
- if( typeof( first ) === "object" && first && ( typeof(first.mailboxId)!='undefined' || typeof(first.data)!='undefined' ) )
1670
+ if( typeof( first ) === "object" && first && ( typeof(first.mailboxId)!='undefined' || typeof(first.data)!='undefined' || typeof(first.personId)!='undefined' ) )
1670
1671
  {
1671
1672
  _request = mailboxId as carriers.CustomerService_CreateTicketFromMailDataRequest;
1672
1673
  _options = data as base.WebApiRequestOptions;
@@ -1676,6 +1677,7 @@ export class CustomerServiceAgent extends base.WebApiBase implements ICustomerSe
1676
1677
  _request = {
1677
1678
  mailboxId: mailboxId as number,
1678
1679
  data: data as string,
1680
+ personId: personId as number,
1679
1681
  };
1680
1682
  _options = webapi_options;
1681
1683
  }
package/src/EMailAgent.ts CHANGED
@@ -145,6 +145,8 @@ export interface IEMailAgent {
145
145
  deleteExtendedAsync(connectionInfoExtended: carriers.EMailConnectionInfoExtended, messageIds: string[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
146
146
  relayMessageAsync(request: carriers.EMail_RelayMessageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
147
147
  relayMessageAsync(connectionInfoExtended: carriers.EMailConnectionInfoExtended, rfc822: string, from: string, recipients: string[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
148
+ getEMailAsEmlStreamAsync(request: carriers.EMail_GetEMailAsEmlStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
149
+ getEMailAsEmlStreamAsync(emailItemId: number, includeAttachments: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
148
150
  getEMailAsync(request: carriers.EMail_GetEMailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.EMailEntity >;
149
151
  getEMailAsync(id: number, includeAttachments: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.EMailEntity >;
150
152
  getUnsanitizedEMailAsync(request: carriers.EMail_GetUnsanitizedEMailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.EMailEntity >;
@@ -3476,6 +3478,80 @@ export class EMailAgent extends base.WebApiBase implements IEMailAgent {
3476
3478
  }
3477
3479
 
3478
3480
 
3481
+ private async _getEMailAsEmlStreamAsync(request: carriers.EMail_GetEMailAsEmlStreamRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
3482
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
3483
+ base.WebApiBase.SetPending(options);
3484
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
3485
+ try {
3486
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
3487
+ config.responseType = "arraybuffer";
3488
+ config.headers = config.headers || {};
3489
+ config.headers["Accept"] = "application/octet-stream";
3490
+ }
3491
+ config.baseURL = this._options.baseUrl;
3492
+ const response = await this._axios.post("GetEMailAsEmlStream", request , config);
3493
+ base.WebApiBase.SetCompleted(options, response);
3494
+ let res : ArrayBuffer | string = null;
3495
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
3496
+ {
3497
+ res = response.data as string;
3498
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
3499
+ {
3500
+ res = FromBase64ToString(res);
3501
+ }
3502
+ }
3503
+ else
3504
+ {
3505
+ res = response.data as ArrayBuffer;
3506
+ }
3507
+
3508
+ resolve(res);
3509
+ }
3510
+ catch( err ) {
3511
+ base.WebApiBase.HandleError(options, config, err);
3512
+ reject(err);
3513
+ }
3514
+ });
3515
+ }
3516
+
3517
+
3518
+
3519
+ /**
3520
+ * Get an inbox e-mail (by its EmailItemId) serialized as an Outlook-openable RFC822 (.eml) stream. Works for both IMAP and Graph/Exchange-Online mailboxes because it serializes the loaded entity instead of re-fetching the raw message by server id.
3521
+ * @param request - EmailItemId, IncludeAttachments
3522
+ * @returns Get an inbox e-mail (by its EmailItemId) serialized as an Outlook-openable RFC822 (.eml) stream
3523
+ */
3524
+ public async getEMailAsEmlStreamAsync(request: carriers.EMail_GetEMailAsEmlStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
3525
+
3526
+ /**
3527
+ * Get an inbox e-mail (by its EmailItemId) serialized as an Outlook-openable RFC822 (.eml) stream. Works for both IMAP and Graph/Exchange-Online mailboxes because it serializes the loaded entity instead of re-fetching the raw message by server id.
3528
+ * @param emailItemId - The EmailItemId of the e-mail to retrieve as stream
3529
+ * @param includeAttachments - Should attachments be included in the stream
3530
+ * @returns Get an inbox e-mail (by its EmailItemId) serialized as an Outlook-openable RFC822 (.eml) stream
3531
+ */
3532
+ public async getEMailAsEmlStreamAsync(emailItemId: number, includeAttachments: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
3533
+
3534
+ public async getEMailAsEmlStreamAsync(emailItemId:number|carriers.EMail_GetEMailAsEmlStreamRequest, includeAttachments?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
3535
+ let _request : carriers.EMail_GetEMailAsEmlStreamRequest = null;
3536
+ let _options : base.WebApiRequestOptions = null;
3537
+ const first : any = emailItemId;
3538
+ if( typeof( first ) === "object" && first && ( typeof(first.emailItemId)!='undefined' || typeof(first.includeAttachments)!='undefined' ) )
3539
+ {
3540
+ _request = emailItemId as carriers.EMail_GetEMailAsEmlStreamRequest;
3541
+ _options = includeAttachments as base.WebApiRequestOptions;
3542
+ }
3543
+ else
3544
+ {
3545
+ _request = {
3546
+ emailItemId: emailItemId as number,
3547
+ includeAttachments: includeAttachments as boolean,
3548
+ };
3549
+ _options = webapi_options;
3550
+ }
3551
+ return this._getEMailAsEmlStreamAsync( _request, _options );
3552
+ }
3553
+
3554
+
3479
3555
  private async _getEMailAsync(request: carriers.EMail_GetEMailRequest, options?:base.WebApiRequestOptions) : Promise< carriers.EMailEntity > {
3480
3556
  const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
3481
3557
  base.WebApiBase.SetPending(options);