@superoffice/webapi 11.7.727 → 11.8.788

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/LICENSE.md +15 -15
  2. package/README.md +184 -184
  3. package/__tests__/Appointment63-notz.json +1925 -1925
  4. package/__tests__/Appointment63-utctz.json +1925 -1925
  5. package/__tests__/Appointment63.json +1925 -1925
  6. package/__tests__/AppointmentTzTest.ts +115 -115
  7. package/__tests__/AxiosNockTest.ts +28 -28
  8. package/__tests__/ContactDefault.json +699 -699
  9. package/__tests__/ContactEntity.json +272 -272
  10. package/__tests__/ContactRestTest.ts +144 -144
  11. package/__tests__/ContactTest.ts +395 -395
  12. package/__tests__/ConvertersTest.ts +97 -97
  13. package/__tests__/DocumentTest.ts +101 -101
  14. package/__tests__/Person210-notz.json +1932 -1932
  15. package/__tests__/Person210-utctz.json +1932 -1932
  16. package/__tests__/Person210.json +1932 -1932
  17. package/__tests__/PersonImageData.nock +22 -22
  18. package/__tests__/PersonTest.ts +41 -41
  19. package/__tests__/PersonTzTest.ts +113 -113
  20. package/__tests__/RecurrenceInfo.json +55 -55
  21. package/__tests__/ResponseCallbackTest.ts +23 -23
  22. package/__tests__/TableRights.json +441 -441
  23. package/__tests__/WebapiTest.ts +264 -264
  24. package/__tests__/Webhook.json +16 -16
  25. package/__tests__/WebhookTest.ts +209 -209
  26. package/dist/cjs/Carriers.d.ts +367 -4
  27. package/dist/cjs/Carriers.d.ts.map +1 -1
  28. package/dist/cjs/Converters.d.ts +9 -0
  29. package/dist/cjs/Converters.d.ts.map +1 -1
  30. package/dist/cjs/Converters.js +185 -17
  31. package/dist/cjs/Converters.js.map +1 -1
  32. package/dist/cjs/DiagnosticsAgent.d.ts +38 -0
  33. package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
  34. package/dist/cjs/DiagnosticsAgent.js +91 -0
  35. package/dist/cjs/DiagnosticsAgent.js.map +1 -1
  36. package/dist/cjs/Enums.d.ts +18 -0
  37. package/dist/cjs/Enums.d.ts.map +1 -1
  38. package/dist/cjs/Enums.js +20 -1
  39. package/dist/cjs/Enums.js.map +1 -1
  40. package/dist/cjs/ListAgent.d.ts +71 -6
  41. package/dist/cjs/ListAgent.d.ts.map +1 -1
  42. package/dist/cjs/ListAgent.js +157 -0
  43. package/dist/cjs/ListAgent.js.map +1 -1
  44. package/dist/cjs/TicketAgent.d.ts +23 -0
  45. package/dist/cjs/TicketAgent.d.ts.map +1 -1
  46. package/dist/cjs/TicketAgent.js +65 -0
  47. package/dist/cjs/TicketAgent.js.map +1 -1
  48. package/dist/esm/Carriers.d.ts +367 -4
  49. package/dist/esm/Carriers.d.ts.map +1 -1
  50. package/dist/esm/Converters.d.ts +9 -0
  51. package/dist/esm/Converters.d.ts.map +1 -1
  52. package/dist/esm/Converters.js +159 -0
  53. package/dist/esm/Converters.js.map +1 -1
  54. package/dist/esm/DiagnosticsAgent.d.ts +38 -0
  55. package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
  56. package/dist/esm/DiagnosticsAgent.js +91 -0
  57. package/dist/esm/DiagnosticsAgent.js.map +1 -1
  58. package/dist/esm/Enums.d.ts +18 -0
  59. package/dist/esm/Enums.d.ts.map +1 -1
  60. package/dist/esm/Enums.js +19 -0
  61. package/dist/esm/Enums.js.map +1 -1
  62. package/dist/esm/ListAgent.d.ts +71 -6
  63. package/dist/esm/ListAgent.d.ts.map +1 -1
  64. package/dist/esm/ListAgent.js +157 -0
  65. package/dist/esm/ListAgent.js.map +1 -1
  66. package/dist/esm/TicketAgent.d.ts +23 -0
  67. package/dist/esm/TicketAgent.d.ts.map +1 -1
  68. package/dist/esm/TicketAgent.js +65 -0
  69. package/dist/esm/TicketAgent.js.map +1 -1
  70. package/examples-js/hello.js +12 -12
  71. package/examples-ts/hello.ts +8 -8
  72. package/package.json +93 -93
  73. package/scripts/postbuild.js +22 -22
  74. package/scripts/setVersion.js +44 -44
  75. package/src/AIAgent.ts +1992 -1992
  76. package/src/AppointmentAgent.ts +6263 -6263
  77. package/src/AppointmentRestApi.ts +225 -225
  78. package/src/ArchiveAgent.ts +1950 -1950
  79. package/src/AssociateAgent.ts +422 -422
  80. package/src/AxiosCacheHandler.ts +74 -74
  81. package/src/BLOBAgent.ts +2100 -2100
  82. package/src/Base64.ts +285 -285
  83. package/src/BatchAgent.ts +910 -910
  84. package/src/BulkUpdateAgent.ts +504 -504
  85. package/src/CRMScriptAgent.ts +1390 -1390
  86. package/src/Carriers.ts +52750 -52274
  87. package/src/ChatAgent.ts +1422 -1422
  88. package/src/ConfigurationAgent.ts +2228 -2228
  89. package/src/ContactAgent.ts +1756 -1756
  90. package/src/ContactRestApi.ts +237 -237
  91. package/src/Converters.ts +23271 -23090
  92. package/src/CustomerServiceAgent.ts +1799 -1799
  93. package/src/DashAgent.ts +1674 -1674
  94. package/src/DatabaseAgent.ts +120 -120
  95. package/src/DatabaseTableAgent.ts +534 -534
  96. package/src/Day_js.ts +41 -41
  97. package/src/DiagnosticsAgent.ts +1384 -1240
  98. package/src/DocumentAgent.ts +5079 -5079
  99. package/src/DocumentMigrationAgent.ts +524 -524
  100. package/src/DocumentRestApi.ts +259 -259
  101. package/src/EMailAgent.ts +5328 -5328
  102. package/src/Enums.ts +6936 -6916
  103. package/src/ErpSyncAgent.ts +2658 -2658
  104. package/src/FavouriteAgent.ts +720 -720
  105. package/src/FindAgent.ts +2330 -2330
  106. package/src/ForeignSystemAgent.ts +1710 -1710
  107. package/src/FreeTextAgent.ts +372 -372
  108. package/src/ImportAgent.ts +304 -304
  109. package/src/LicenseAgent.ts +1230 -1230
  110. package/src/ListAgent.ts +11451 -11237
  111. package/src/MDOAgent.ts +748 -748
  112. package/src/MarketingAgent.ts +890 -890
  113. package/src/MessagingAgent.ts +384 -384
  114. package/src/NavigatorAgent.ts +140 -140
  115. package/src/NumberAllocationAgent.ts +296 -296
  116. package/src/PersonAgent.ts +3287 -3287
  117. package/src/PersonRestApi.ts +241 -241
  118. package/src/PhoneListAgent.ts +458 -458
  119. package/src/PocketAgent.ts +780 -780
  120. package/src/PreferenceAgent.ts +1900 -1900
  121. package/src/PreviewsAgent.ts +116 -116
  122. package/src/ProjectAgent.ts +2391 -2391
  123. package/src/ProjectRestApi.ts +239 -239
  124. package/src/QuoteAgent.ts +5159 -5159
  125. package/src/RelationAgent.ts +220 -220
  126. package/src/ReportAgent.ts +154 -154
  127. package/src/ResourceAgent.ts +358 -358
  128. package/src/SaintAgent.ts +601 -601
  129. package/src/SaleAgent.ts +2034 -2034
  130. package/src/SaleRestApi.ts +233 -233
  131. package/src/SelectionAgent.ts +3195 -3195
  132. package/src/SentryAgent.ts +462 -462
  133. package/src/SoApiConstants.ts +8 -8
  134. package/src/TargetsAgent.ts +1104 -1104
  135. package/src/TicketAgent.ts +3708 -3638
  136. package/src/TimeZoneAgent.ts +528 -528
  137. package/src/TooltipsAgent.ts +116 -116
  138. package/src/UserAgent.ts +4856 -4856
  139. package/src/UserDefinedFieldInfoAgent.ts +1764 -1764
  140. package/src/ViewStateAgent.ts +858 -858
  141. package/src/WebApi.ts +872 -872
  142. package/src/WebApiBase.ts +565 -565
  143. package/src/WebhookAgent.ts +388 -388
  144. package/src/WorkflowAgent.ts +1338 -1338
  145. package/tsconfig.esm.json +8 -8
  146. package/tsconfig.jest.json +8 -8
  147. package/tsconfig.json +34 -34
package/src/BLOBAgent.ts CHANGED
@@ -1,2100 +1,2100 @@
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/BLOBAgent.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
- * Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.
28
- */
29
- export interface IBLOBAgent {
30
- createDefaultBlobEntityAsync(): Promise< carriers.BlobEntity >;
31
- saveBlobEntityAsync(entity: carriers.BlobEntity) : Promise< carriers.BlobEntity >;
32
- deleteBlobEntityAsync(BlobEntityId: number) : Promise<void>;
33
- getBlobEntityAsync(blobEntityId: number) : Promise< carriers.BlobEntity >;
34
- setBlobStreamAsync(request: carriers.BLOB_SetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
35
- setBlobStreamAsync(blobEntityId: number, stream: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
36
- getBlobStreamAsync(request: carriers.BLOB_GetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
37
- getBlobStreamAsync(blobEntityId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
38
- getProjectImageAsync(request: carriers.BLOB_GetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
39
- getProjectImageAsync(projectId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
40
- getPersonImageAsync(request: carriers.BLOB_GetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
41
- getPersonImageAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
42
- setProjectImageAsync(request: carriers.BLOB_SetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
43
- setProjectImageAsync(projectId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
44
- setPersonImageAsync(request: carriers.BLOB_SetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
45
- setPersonImageAsync(personId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
46
- changeProjectImageAsync(request: carriers.BLOB_ChangeProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
47
- changeProjectImageAsync(projectId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
48
- saveProjectImageAsync(request: carriers.BLOB_SaveProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
49
- saveProjectImageAsync(description: string, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
50
- getBlobEntityOnProjectAsync(request: carriers.BLOB_GetBlobEntityOnProjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
51
- getBlobEntityOnProjectAsync(projectId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
52
- getBlobEntityOnPersonAsync(request: carriers.BLOB_GetBlobEntityOnPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
53
- getBlobEntityOnPersonAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
54
- getBlobEntityOnCountryAsync(request: carriers.BLOB_GetBlobEntityOnCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
55
- getBlobEntityOnCountryAsync(countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
56
- getBlobEntityOnProductAsync(request: carriers.BLOB_GetBlobEntityOnProductRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
57
- getBlobEntityOnProductAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
58
- changePersonImageAsync(request: carriers.BLOB_ChangePersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
59
- changePersonImageAsync(personId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
60
- saveImageStreamAsync(request: carriers.BLOB_SaveImageStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
61
- saveImageStreamAsync(type: enums.BlobLinkType, image: ArrayBuffer|string, description: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
62
- getProductImageAsync(request: carriers.BLOB_GetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
63
- getProductImageAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
64
- setProductImageAsync(request: carriers.BLOB_SetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
65
- setProductImageAsync(productId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
66
- getProductThumbnailAsync(request: carriers.BLOB_GetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
67
- getProductThumbnailAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
68
- setProductThumbnailAsync(request: carriers.BLOB_SetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
69
- setProductThumbnailAsync(productId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
70
- changeProductImageAsync(request: carriers.BLOB_ChangeProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
71
- changeProductImageAsync(productId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
72
- getQuoteLineImageAsync(request: carriers.BLOB_GetQuoteLineImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
73
- getQuoteLineImageAsync(quoteLineId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
74
- getPersonImageWithSizeAsync(request: carriers.BLOB_GetPersonImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
75
- getPersonImageWithSizeAsync(personId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
76
- getProjectImageWithSizeAsync(request: carriers.BLOB_GetProjectImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
77
- getProjectImageWithSizeAsync(projectId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
78
- getChatImageWithSizeAsync(request: carriers.BLOB_GetChatImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
79
- getChatImageWithSizeAsync(chatTopicId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
80
- getContactImageAsync(request: carriers.BLOB_GetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
81
- getContactImageAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
82
- setContactImageAsync(request: carriers.BLOB_SetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
83
- setContactImageAsync(contactId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
84
- changeContactImageAsync(request: carriers.BLOB_ChangeContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
85
- changeContactImageAsync(contactId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
86
- getBlobEntityOnContactAsync(request: carriers.BLOB_GetBlobEntityOnContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
87
- getBlobEntityOnContactAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
88
- getContactImageWithSizeAsync(request: carriers.BLOB_GetContactImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
89
- getContactImageWithSizeAsync(contactId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
90
- getOutputFromBatchAsync(request: carriers.BLOB_GetOutputFromBatchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
91
- getOutputFromBatchAsync(batchTaskId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
92
- cleanupBatchTaskAsync(request: carriers.BLOB_CleanupBatchTaskRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
93
- cleanupBatchTaskAsync(batchTaskId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
94
- } // interface IBLOBAgent
95
-
96
-
97
-
98
-
99
- /**
100
- * Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.
101
- */
102
- export class BLOBAgent extends base.WebApiBase implements IBLOBAgent {
103
- constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
104
- constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
105
- constructor(baseUrl: string, resourceManager:any);
106
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
107
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
108
- constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
109
- constructor(options: base.WebApiOptions);
110
-
111
- constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
112
- langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
113
- langOrResourceOrRM?:string|base.ResourceParsing|any,
114
- cultureCode?: string,
115
- ) {
116
- const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
117
- options.basePath = "v1/Agents/BLOB/";
118
- super(options);
119
- }
120
-
121
-
122
-
123
- /**
124
- * Set default values into a new BlobEntity.
125
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
126
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
127
- * @returns A blank entity.
128
- */
129
- public async createDefaultBlobEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
130
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
131
- base.WebApiBase.SetPending(options);
132
- return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
133
- try {
134
- const response = await this._axios.post("CreateDefaultBlobEntity", null, config);
135
- base.WebApiBase.SetCompleted(options, response);
136
- const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
137
- resolve(res);
138
- }
139
- catch( err ) {
140
- base.WebApiBase.HandleError(options, config, err);
141
- reject(err);
142
- }
143
- });
144
- }
145
- /**
146
- * Replace the existing BlobEntity or creates a new BlobEntity if the id parameter is empty
147
- * @param entity - The BlobEntity to be saved.
148
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
149
- * @returns New or updated BlobEntity
150
- */
151
- public async saveBlobEntityAsync(entity: carriers.BlobEntity, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
152
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
153
- base.WebApiBase.SetPending(options);
154
- return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
155
- try {
156
- const response = await this._axios.post("SaveBlobEntity", entity, config);
157
- base.WebApiBase.SetCompleted(options, response);
158
- const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
159
- resolve(res);
160
- }
161
- catch( err ) {
162
- base.WebApiBase.HandleError(options, config, err);
163
- reject(err);
164
- }
165
- });
166
- }
167
-
168
- /**
169
- * Deletes the BlobEntity
170
- * @param BlobEntityId - The id of the BlobEntity to be deleted.
171
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
172
- */
173
- public async deleteBlobEntityAsync(BlobEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
174
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
175
- base.WebApiBase.SetPending(options);
176
- return new Promise< void >(async (resolve, reject) => {
177
- try {
178
- const response = await this._axios.post("DeleteBlobEntity?BlobEntityId=" + BlobEntityId, null, config );
179
- base.WebApiBase.SetCompleted(options, response);
180
- const res = response.data;
181
- resolve(res);
182
- }
183
- catch( err ) {
184
- base.WebApiBase.HandleError(options, config, err);
185
- reject(err);
186
- }
187
- });
188
- }
189
- /**
190
- * Gets a BlobEntity object.
191
- * @param blobEntityId - The primary key.
192
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
193
- * @returns A single BlobEntity
194
- */
195
- public async getBlobEntityAsync(blobEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
196
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
197
- base.WebApiBase.SetPending(options);
198
- return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
199
- try {
200
- const response = await this._axios.post("GetBlobEntity?blobEntityId=" + blobEntityId, null, config);
201
- base.WebApiBase.SetCompleted(options, response);
202
- const res = converters.Create_BlobEntity_From( response.data );
203
- resolve(res);
204
- }
205
- catch( err ) {
206
- base.WebApiBase.HandleError(options, config, err);
207
- reject(err);
208
- }
209
- });
210
- }
211
-
212
-
213
- private async _setBlobStreamAsync(request: carriers.BLOB_SetBlobStreamRequest, options?:base.WebApiRequestOptions) : Promise< void > {
214
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
215
- base.WebApiBase.SetPending(options);
216
- return new Promise< void >(async (resolve, reject) => {
217
- try {
218
- config.baseURL = this._options.baseUrl;
219
- const response = await this._axios.post("SetBlobStream", request , config);
220
- base.WebApiBase.SetCompleted(options, response);
221
- const res = response.data;
222
- resolve(res);
223
- }
224
- catch( err ) {
225
- base.WebApiBase.HandleError(options, config, err);
226
- reject(err);
227
- }
228
- });
229
- }
230
-
231
-
232
-
233
- /**
234
- * Store a binary object from it&apos;s stream
235
- * @param request - BlobEntityId, Stream
236
- * @returns
237
- */
238
- public async setBlobStreamAsync(request: carriers.BLOB_SetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
239
-
240
- /**
241
- * Store a binary object from it&apos;s stream
242
- * @param blobEntityId - Id of the BLOB entity object that the binary data should be stored to.
243
- * @param stream - The binary object as a Stream
244
- * @returns
245
- */
246
- public async setBlobStreamAsync(blobEntityId: number, stream: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
247
-
248
- public async setBlobStreamAsync(blobEntityId:number|carriers.BLOB_SetBlobStreamRequest, stream?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
249
- let _request : carriers.BLOB_SetBlobStreamRequest = null;
250
- let _options : base.WebApiRequestOptions = null;
251
- const first : any = blobEntityId;
252
- if( typeof( first ) === "object" && first && ( typeof(first.blobEntityId)!='undefined' || typeof(first.stream)!='undefined' ) )
253
- {
254
- _request = blobEntityId as carriers.BLOB_SetBlobStreamRequest;
255
- _options = stream as base.WebApiRequestOptions;
256
- }
257
- else
258
- {
259
- _request = {
260
- blobEntityId: blobEntityId as number,
261
- stream: stream as ArrayBuffer|string,
262
- };
263
- _options = webapi_options;
264
- }
265
- _request.stream = ToBase64(_request.stream);
266
- return this._setBlobStreamAsync( _request, _options );
267
- }
268
-
269
-
270
- private async _getBlobStreamAsync(request: carriers.BLOB_GetBlobStreamRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
271
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
272
- base.WebApiBase.SetPending(options);
273
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
274
- try {
275
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
276
- config.responseType = "arraybuffer";
277
- config.headers = config.headers || {};
278
- config.headers["Accept"] = "application/octet-stream";
279
- }
280
- config.baseURL = this._options.baseUrl;
281
- const response = await this._axios.post("GetBlobStream", request , config);
282
- base.WebApiBase.SetCompleted(options, response);
283
- let res : ArrayBuffer | string = null;
284
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
285
- {
286
- res = response.data as string;
287
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
288
- {
289
- res = FromBase64ToString(res);
290
- }
291
- }
292
- else
293
- {
294
- res = response.data as ArrayBuffer;
295
- }
296
-
297
- resolve(res);
298
- }
299
- catch( err ) {
300
- base.WebApiBase.HandleError(options, config, err);
301
- reject(err);
302
- }
303
- });
304
- }
305
-
306
-
307
-
308
- /**
309
- * Get the binary object as a stream
310
- * @param request - BlobEntityId
311
- * @returns The binary object as a Stream
312
- */
313
- public async getBlobStreamAsync(request: carriers.BLOB_GetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
314
-
315
- /**
316
- * Get the binary object as a stream
317
- * @param blobEntityId - The ID of the BLOB entity object that refers to the binary data
318
- * @returns The binary object as a Stream
319
- */
320
- public async getBlobStreamAsync(blobEntityId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
321
-
322
- public async getBlobStreamAsync(blobEntityId:number|carriers.BLOB_GetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
323
- let _request : carriers.BLOB_GetBlobStreamRequest = null;
324
- let _options : base.WebApiRequestOptions = null;
325
- const first : any = blobEntityId;
326
- if( typeof( first ) === "object" && first && ( typeof(first.blobEntityId)!='undefined' ) )
327
- {
328
- _request = blobEntityId as carriers.BLOB_GetBlobStreamRequest;
329
- _options = webapi_options as base.WebApiRequestOptions;
330
- }
331
- else
332
- {
333
- _request = {
334
- blobEntityId: blobEntityId as number,
335
- };
336
- _options = webapi_options;
337
- }
338
- return this._getBlobStreamAsync( _request, _options );
339
- }
340
-
341
-
342
- private async _getProjectImageAsync(request: carriers.BLOB_GetProjectImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
343
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
344
- base.WebApiBase.SetPending(options);
345
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
346
- try {
347
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
348
- config.responseType = "arraybuffer";
349
- config.headers = config.headers || {};
350
- config.headers["Accept"] = "application/octet-stream";
351
- }
352
- config.baseURL = this._options.baseUrl;
353
- const response = await this._axios.post("GetProjectImage", request , config);
354
- base.WebApiBase.SetCompleted(options, response);
355
- let res : ArrayBuffer | string = null;
356
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
357
- {
358
- res = response.data as string;
359
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
360
- {
361
- res = FromBase64ToString(res);
362
- }
363
- }
364
- else
365
- {
366
- res = response.data as ArrayBuffer;
367
- }
368
-
369
- resolve(res);
370
- }
371
- catch( err ) {
372
- base.WebApiBase.HandleError(options, config, err);
373
- reject(err);
374
- }
375
- });
376
- }
377
-
378
-
379
-
380
- /**
381
- * Returns the project image that is displayed in the CRM application.
382
- * @param request - ProjectId
383
- * @returns The project image.
384
- */
385
- public async getProjectImageAsync(request: carriers.BLOB_GetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
386
-
387
- /**
388
- * Returns the project image that is displayed in the CRM application.
389
- * @param projectId - The project id of the project the image belongs to.
390
- * @returns The project image.
391
- */
392
- public async getProjectImageAsync(projectId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
393
-
394
- public async getProjectImageAsync(projectId:number|carriers.BLOB_GetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
395
- let _request : carriers.BLOB_GetProjectImageRequest = null;
396
- let _options : base.WebApiRequestOptions = null;
397
- const first : any = projectId;
398
- if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' ) )
399
- {
400
- _request = projectId as carriers.BLOB_GetProjectImageRequest;
401
- _options = webapi_options as base.WebApiRequestOptions;
402
- }
403
- else
404
- {
405
- _request = {
406
- projectId: projectId as number,
407
- };
408
- _options = webapi_options;
409
- }
410
- return this._getProjectImageAsync( _request, _options );
411
- }
412
-
413
-
414
- private async _getPersonImageAsync(request: carriers.BLOB_GetPersonImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
415
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
416
- base.WebApiBase.SetPending(options);
417
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
418
- try {
419
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
420
- config.responseType = "arraybuffer";
421
- config.headers = config.headers || {};
422
- config.headers["Accept"] = "application/octet-stream";
423
- }
424
- config.baseURL = this._options.baseUrl;
425
- const response = await this._axios.post("GetPersonImage", request , config);
426
- base.WebApiBase.SetCompleted(options, response);
427
- let res : ArrayBuffer | string = null;
428
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
429
- {
430
- res = response.data as string;
431
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
432
- {
433
- res = FromBase64ToString(res);
434
- }
435
- }
436
- else
437
- {
438
- res = response.data as ArrayBuffer;
439
- }
440
-
441
- resolve(res);
442
- }
443
- catch( err ) {
444
- base.WebApiBase.HandleError(options, config, err);
445
- reject(err);
446
- }
447
- });
448
- }
449
-
450
-
451
-
452
- /**
453
- * Returns the person image that is displayed in the CRM application.
454
- * @param request - PersonId
455
- * @returns The person image.
456
- */
457
- public async getPersonImageAsync(request: carriers.BLOB_GetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
458
-
459
- /**
460
- * Returns the person image that is displayed in the CRM application.
461
- * @param personId - The person id of the person the image belongs to.
462
- * @returns The person image.
463
- */
464
- public async getPersonImageAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
465
-
466
- public async getPersonImageAsync(personId:number|carriers.BLOB_GetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
467
- let _request : carriers.BLOB_GetPersonImageRequest = null;
468
- let _options : base.WebApiRequestOptions = null;
469
- const first : any = personId;
470
- if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' ) )
471
- {
472
- _request = personId as carriers.BLOB_GetPersonImageRequest;
473
- _options = webapi_options as base.WebApiRequestOptions;
474
- }
475
- else
476
- {
477
- _request = {
478
- personId: personId as number,
479
- };
480
- _options = webapi_options;
481
- }
482
- return this._getPersonImageAsync( _request, _options );
483
- }
484
-
485
-
486
- private async _setProjectImageAsync(request: carriers.BLOB_SetProjectImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
487
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
488
- base.WebApiBase.SetPending(options);
489
- return new Promise< void >(async (resolve, reject) => {
490
- try {
491
- config.baseURL = this._options.baseUrl;
492
- const response = await this._axios.post("SetProjectImage", request , config);
493
- base.WebApiBase.SetCompleted(options, response);
494
- const res = response.data;
495
- resolve(res);
496
- }
497
- catch( err ) {
498
- base.WebApiBase.HandleError(options, config, err);
499
- reject(err);
500
- }
501
- });
502
- }
503
-
504
-
505
-
506
- /**
507
- * Stores the project image that is displayed in the CRM application.
508
- * @param request - ProjectId, Image
509
- * @returns
510
- */
511
- public async setProjectImageAsync(request: carriers.BLOB_SetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
512
-
513
- /**
514
- * Stores the project image that is displayed in the CRM application.
515
- * @param projectId - The project id of the project the image belongs to.
516
- * @param image - The project image.
517
- * @returns
518
- */
519
- public async setProjectImageAsync(projectId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
520
-
521
- public async setProjectImageAsync(projectId:number|carriers.BLOB_SetProjectImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
522
- let _request : carriers.BLOB_SetProjectImageRequest = null;
523
- let _options : base.WebApiRequestOptions = null;
524
- const first : any = projectId;
525
- if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' || typeof(first.image)!='undefined' ) )
526
- {
527
- _request = projectId as carriers.BLOB_SetProjectImageRequest;
528
- _options = image as base.WebApiRequestOptions;
529
- }
530
- else
531
- {
532
- _request = {
533
- projectId: projectId as number,
534
- image: image as ArrayBuffer|string,
535
- };
536
- _options = webapi_options;
537
- }
538
- _request.image = ToBase64(_request.image);
539
- return this._setProjectImageAsync( _request, _options );
540
- }
541
-
542
-
543
- private async _setPersonImageAsync(request: carriers.BLOB_SetPersonImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
544
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
545
- base.WebApiBase.SetPending(options);
546
- return new Promise< void >(async (resolve, reject) => {
547
- try {
548
- config.baseURL = this._options.baseUrl;
549
- const response = await this._axios.post("SetPersonImage", request , config);
550
- base.WebApiBase.SetCompleted(options, response);
551
- const res = response.data;
552
- resolve(res);
553
- }
554
- catch( err ) {
555
- base.WebApiBase.HandleError(options, config, err);
556
- reject(err);
557
- }
558
- });
559
- }
560
-
561
-
562
-
563
- /**
564
- * Stores the person image that is displayed in the CRM application.
565
- * @param request - PersonId, Image
566
- * @returns
567
- */
568
- public async setPersonImageAsync(request: carriers.BLOB_SetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
569
-
570
- /**
571
- * Stores the person image that is displayed in the CRM application.
572
- * @param personId - The person id of the person the image belongs to.
573
- * @param image - The person image.
574
- * @returns
575
- */
576
- public async setPersonImageAsync(personId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
577
-
578
- public async setPersonImageAsync(personId:number|carriers.BLOB_SetPersonImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
579
- let _request : carriers.BLOB_SetPersonImageRequest = null;
580
- let _options : base.WebApiRequestOptions = null;
581
- const first : any = personId;
582
- if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' || typeof(first.image)!='undefined' ) )
583
- {
584
- _request = personId as carriers.BLOB_SetPersonImageRequest;
585
- _options = image as base.WebApiRequestOptions;
586
- }
587
- else
588
- {
589
- _request = {
590
- personId: personId as number,
591
- image: image as ArrayBuffer|string,
592
- };
593
- _options = webapi_options;
594
- }
595
- _request.image = ToBase64(_request.image);
596
- return this._setPersonImageAsync( _request, _options );
597
- }
598
-
599
-
600
- private async _changeProjectImageAsync(request: carriers.BLOB_ChangeProjectImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
601
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
602
- base.WebApiBase.SetPending(options);
603
- return new Promise< void >(async (resolve, reject) => {
604
- try {
605
- config.baseURL = this._options.baseUrl;
606
- const response = await this._axios.post("ChangeProjectImage", request , config);
607
- base.WebApiBase.SetCompleted(options, response);
608
- const res = response.data;
609
- resolve(res);
610
- }
611
- catch( err ) {
612
- base.WebApiBase.HandleError(options, config, err);
613
- reject(err);
614
- }
615
- });
616
- }
617
-
618
-
619
-
620
- /**
621
- * Changes the project image link. If the Binary object id is 0, any image link is removed from the project.
622
- * @param request - ProjectId, BlobId
623
- * @returns
624
- */
625
- public async changeProjectImageAsync(request: carriers.BLOB_ChangeProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
626
-
627
- /**
628
- * Changes the project image link. If the Binary object id is 0, any image link is removed from the project.
629
- * @param projectId - The project the image is linked to
630
- * @param blobId - The Binary object id. If the Binary object id is 0, any image link is removed from the project.
631
- * @returns
632
- */
633
- public async changeProjectImageAsync(projectId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
634
-
635
- public async changeProjectImageAsync(projectId:number|carriers.BLOB_ChangeProjectImageRequest, blobId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
636
- let _request : carriers.BLOB_ChangeProjectImageRequest = null;
637
- let _options : base.WebApiRequestOptions = null;
638
- const first : any = projectId;
639
- if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' || typeof(first.blobId)!='undefined' ) )
640
- {
641
- _request = projectId as carriers.BLOB_ChangeProjectImageRequest;
642
- _options = blobId as base.WebApiRequestOptions;
643
- }
644
- else
645
- {
646
- _request = {
647
- projectId: projectId as number,
648
- blobId: blobId as number,
649
- };
650
- _options = webapi_options;
651
- }
652
- return this._changeProjectImageAsync( _request, _options );
653
- }
654
-
655
-
656
- private async _saveProjectImageAsync(request: carriers.BLOB_SaveProjectImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
657
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
658
- base.WebApiBase.SetPending(options);
659
- return new Promise< void >(async (resolve, reject) => {
660
- try {
661
- config.baseURL = this._options.baseUrl;
662
- const response = await this._axios.post("SaveProjectImage", request , config);
663
- base.WebApiBase.SetCompleted(options, response);
664
- const res = response.data;
665
- resolve(res);
666
- }
667
- catch( err ) {
668
- base.WebApiBase.HandleError(options, config, err);
669
- reject(err);
670
- }
671
- });
672
- }
673
-
674
-
675
-
676
- /**
677
- * Saves a project image that is displayed in the CRM application&apos;s project image selection dialog to the database.
678
- * @param request - Description, Image
679
- * @returns
680
- */
681
- public async saveProjectImageAsync(request: carriers.BLOB_SaveProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
682
-
683
- /**
684
- * Saves a project image that is displayed in the CRM application&apos;s project image selection dialog to the database.
685
- * @param description - Image description. Should be image name (e.g. winter.jpg) for project images.
686
- * @param image - The project image.
687
- * @returns
688
- */
689
- public async saveProjectImageAsync(description: string, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
690
-
691
- public async saveProjectImageAsync(description:string|carriers.BLOB_SaveProjectImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
692
- let _request : carriers.BLOB_SaveProjectImageRequest = null;
693
- let _options : base.WebApiRequestOptions = null;
694
- const first : any = description;
695
- if( typeof( first ) === "object" && first && ( typeof(first.description)!='undefined' || typeof(first.image)!='undefined' ) )
696
- {
697
- _request = description as carriers.BLOB_SaveProjectImageRequest;
698
- _options = image as base.WebApiRequestOptions;
699
- }
700
- else
701
- {
702
- _request = {
703
- description: description as string,
704
- image: image as ArrayBuffer|string,
705
- };
706
- _options = webapi_options;
707
- }
708
- _request.image = ToBase64(_request.image);
709
- return this._saveProjectImageAsync( _request, _options );
710
- }
711
-
712
-
713
- private async _getBlobEntityOnProjectAsync(request: carriers.BLOB_GetBlobEntityOnProjectRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
714
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
715
- base.WebApiBase.SetPending(options);
716
- return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
717
- try {
718
- config.baseURL = this._options.baseUrl;
719
- const response = await this._axios.post("GetBlobEntityOnProject", request , config);
720
- base.WebApiBase.SetCompleted(options, response);
721
- const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
722
- resolve(res);
723
- }
724
- catch( err ) {
725
- base.WebApiBase.HandleError(options, config, err);
726
- reject(err);
727
- }
728
- });
729
- }
730
-
731
-
732
-
733
- /**
734
- * Gets the blob entity that represents the project image binary object.
735
- * @param request - ProjectId
736
- * @returns BlobEntity object
737
- */
738
- public async getBlobEntityOnProjectAsync(request: carriers.BLOB_GetBlobEntityOnProjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
739
-
740
- /**
741
- * Gets the blob entity that represents the project image binary object.
742
- * @param projectId - The project id
743
- * @returns BlobEntity object
744
- */
745
- public async getBlobEntityOnProjectAsync(projectId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
746
-
747
- public async getBlobEntityOnProjectAsync(projectId:number|carriers.BLOB_GetBlobEntityOnProjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
748
- let _request : carriers.BLOB_GetBlobEntityOnProjectRequest = null;
749
- let _options : base.WebApiRequestOptions = null;
750
- const first : any = projectId;
751
- if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' ) )
752
- {
753
- _request = projectId as carriers.BLOB_GetBlobEntityOnProjectRequest;
754
- _options = webapi_options as base.WebApiRequestOptions;
755
- }
756
- else
757
- {
758
- _request = {
759
- projectId: projectId as number,
760
- };
761
- _options = webapi_options;
762
- }
763
- return this._getBlobEntityOnProjectAsync( _request, _options );
764
- }
765
-
766
-
767
- private async _getBlobEntityOnPersonAsync(request: carriers.BLOB_GetBlobEntityOnPersonRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
768
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
769
- base.WebApiBase.SetPending(options);
770
- return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
771
- try {
772
- config.baseURL = this._options.baseUrl;
773
- const response = await this._axios.post("GetBlobEntityOnPerson", request , config);
774
- base.WebApiBase.SetCompleted(options, response);
775
- const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
776
- resolve(res);
777
- }
778
- catch( err ) {
779
- base.WebApiBase.HandleError(options, config, err);
780
- reject(err);
781
- }
782
- });
783
- }
784
-
785
-
786
-
787
- /**
788
- * Gets the blob entity that represents the person image binary object.
789
- * @param request - PersonId
790
- * @returns BlobEntity object
791
- */
792
- public async getBlobEntityOnPersonAsync(request: carriers.BLOB_GetBlobEntityOnPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
793
-
794
- /**
795
- * Gets the blob entity that represents the person image binary object.
796
- * @param personId - The person id
797
- * @returns BlobEntity object
798
- */
799
- public async getBlobEntityOnPersonAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
800
-
801
- public async getBlobEntityOnPersonAsync(personId:number|carriers.BLOB_GetBlobEntityOnPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
802
- let _request : carriers.BLOB_GetBlobEntityOnPersonRequest = null;
803
- let _options : base.WebApiRequestOptions = null;
804
- const first : any = personId;
805
- if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' ) )
806
- {
807
- _request = personId as carriers.BLOB_GetBlobEntityOnPersonRequest;
808
- _options = webapi_options as base.WebApiRequestOptions;
809
- }
810
- else
811
- {
812
- _request = {
813
- personId: personId as number,
814
- };
815
- _options = webapi_options;
816
- }
817
- return this._getBlobEntityOnPersonAsync( _request, _options );
818
- }
819
-
820
-
821
- private async _getBlobEntityOnCountryAsync(request: carriers.BLOB_GetBlobEntityOnCountryRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
822
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
823
- base.WebApiBase.SetPending(options);
824
- return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
825
- try {
826
- config.baseURL = this._options.baseUrl;
827
- const response = await this._axios.post("GetBlobEntityOnCountry", request , config);
828
- base.WebApiBase.SetCompleted(options, response);
829
- const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
830
- resolve(res);
831
- }
832
- catch( err ) {
833
- base.WebApiBase.HandleError(options, config, err);
834
- reject(err);
835
- }
836
- });
837
- }
838
-
839
-
840
-
841
- /**
842
- * Gets the blob entity that represents the country flag binary object.
843
- * @param request - CountryId
844
- * @returns BlobEntity object
845
- */
846
- public async getBlobEntityOnCountryAsync(request: carriers.BLOB_GetBlobEntityOnCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
847
-
848
- /**
849
- * Gets the blob entity that represents the country flag binary object.
850
- * @param countryId - The country id
851
- * @returns BlobEntity object
852
- */
853
- public async getBlobEntityOnCountryAsync(countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
854
-
855
- public async getBlobEntityOnCountryAsync(countryId:number|carriers.BLOB_GetBlobEntityOnCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
856
- let _request : carriers.BLOB_GetBlobEntityOnCountryRequest = null;
857
- let _options : base.WebApiRequestOptions = null;
858
- const first : any = countryId;
859
- if( typeof( first ) === "object" && first && ( typeof(first.countryId)!='undefined' ) )
860
- {
861
- _request = countryId as carriers.BLOB_GetBlobEntityOnCountryRequest;
862
- _options = webapi_options as base.WebApiRequestOptions;
863
- }
864
- else
865
- {
866
- _request = {
867
- countryId: countryId as number,
868
- };
869
- _options = webapi_options;
870
- }
871
- return this._getBlobEntityOnCountryAsync( _request, _options );
872
- }
873
-
874
-
875
- private async _getBlobEntityOnProductAsync(request: carriers.BLOB_GetBlobEntityOnProductRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
876
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
877
- base.WebApiBase.SetPending(options);
878
- return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
879
- try {
880
- config.baseURL = this._options.baseUrl;
881
- const response = await this._axios.post("GetBlobEntityOnProduct", request , config);
882
- base.WebApiBase.SetCompleted(options, response);
883
- const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
884
- resolve(res);
885
- }
886
- catch( err ) {
887
- base.WebApiBase.HandleError(options, config, err);
888
- reject(err);
889
- }
890
- });
891
- }
892
-
893
-
894
-
895
- /**
896
- * Gets the blob entity that represents the product image binary object.
897
- * @param request - ProductId
898
- * @returns BlobEntity object
899
- */
900
- public async getBlobEntityOnProductAsync(request: carriers.BLOB_GetBlobEntityOnProductRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
901
-
902
- /**
903
- * Gets the blob entity that represents the product image binary object.
904
- * @param productId - The product id
905
- * @returns BlobEntity object
906
- */
907
- public async getBlobEntityOnProductAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
908
-
909
- public async getBlobEntityOnProductAsync(productId:number|carriers.BLOB_GetBlobEntityOnProductRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
910
- let _request : carriers.BLOB_GetBlobEntityOnProductRequest = null;
911
- let _options : base.WebApiRequestOptions = null;
912
- const first : any = productId;
913
- if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' ) )
914
- {
915
- _request = productId as carriers.BLOB_GetBlobEntityOnProductRequest;
916
- _options = webapi_options as base.WebApiRequestOptions;
917
- }
918
- else
919
- {
920
- _request = {
921
- productId: productId as number,
922
- };
923
- _options = webapi_options;
924
- }
925
- return this._getBlobEntityOnProductAsync( _request, _options );
926
- }
927
-
928
-
929
- private async _changePersonImageAsync(request: carriers.BLOB_ChangePersonImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
930
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
931
- base.WebApiBase.SetPending(options);
932
- return new Promise< void >(async (resolve, reject) => {
933
- try {
934
- config.baseURL = this._options.baseUrl;
935
- const response = await this._axios.post("ChangePersonImage", request , config);
936
- base.WebApiBase.SetCompleted(options, response);
937
- const res = response.data;
938
- resolve(res);
939
- }
940
- catch( err ) {
941
- base.WebApiBase.HandleError(options, config, err);
942
- reject(err);
943
- }
944
- });
945
- }
946
-
947
-
948
-
949
- /**
950
- *
951
- * @param request - PersonId, BlobId
952
- * @returns
953
- */
954
- public async changePersonImageAsync(request: carriers.BLOB_ChangePersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
955
-
956
- /**
957
- *
958
- * @param personId - The person the image is linked to
959
- * @param blobId - The Binary object id. If the Binary object id is 0, any image link is removed from the person.
960
- * @returns
961
- */
962
- public async changePersonImageAsync(personId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
963
-
964
- public async changePersonImageAsync(personId:number|carriers.BLOB_ChangePersonImageRequest, blobId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
965
- let _request : carriers.BLOB_ChangePersonImageRequest = null;
966
- let _options : base.WebApiRequestOptions = null;
967
- const first : any = personId;
968
- if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' || typeof(first.blobId)!='undefined' ) )
969
- {
970
- _request = personId as carriers.BLOB_ChangePersonImageRequest;
971
- _options = blobId as base.WebApiRequestOptions;
972
- }
973
- else
974
- {
975
- _request = {
976
- personId: personId as number,
977
- blobId: blobId as number,
978
- };
979
- _options = webapi_options;
980
- }
981
- return this._changePersonImageAsync( _request, _options );
982
- }
983
-
984
-
985
- private async _saveImageStreamAsync(request: carriers.BLOB_SaveImageStreamRequest, options?:base.WebApiRequestOptions) : Promise< number > {
986
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
987
- base.WebApiBase.SetPending(options);
988
- return new Promise< number >(async (resolve, reject) => {
989
- try {
990
- config.baseURL = this._options.baseUrl;
991
- const response = await this._axios.post("SaveImageStream", request , config);
992
- base.WebApiBase.SetCompleted(options, response);
993
- const res : number = response.data as number;
994
- resolve(res);
995
- }
996
- catch( err ) {
997
- base.WebApiBase.HandleError(options, config, err);
998
- reject(err);
999
- }
1000
- });
1001
- }
1002
-
1003
-
1004
-
1005
- /**
1006
- * Stores an image in the database without linking it to a project or a person. It is possible to ChangePersonImage or ChangeProjectImage to attach image later.
1007
- * @param request - Type, Image, Description
1008
- * @returns The blob id.
1009
- */
1010
- public async saveImageStreamAsync(request: carriers.BLOB_SaveImageStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1011
-
1012
- /**
1013
- * Stores an image in the database without linking it to a project or a person. It is possible to ChangePersonImage or ChangeProjectImage to attach image later.
1014
- * @param type - The type of the image.
1015
- * @param image - Image to store.
1016
- * @param description - Image description.
1017
- * @returns The blob id.
1018
- */
1019
- public async saveImageStreamAsync(type: enums.BlobLinkType, image: ArrayBuffer|string, description: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1020
-
1021
- public async saveImageStreamAsync(type:enums.BlobLinkType|carriers.BLOB_SaveImageStreamRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, description?:string, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
1022
- let _request : carriers.BLOB_SaveImageStreamRequest = null;
1023
- let _options : base.WebApiRequestOptions = null;
1024
- const first : any = type;
1025
- if( typeof( first ) === "object" && first && ( typeof(first.type)!='undefined' || typeof(first.image)!='undefined' || typeof(first.description)!='undefined' ) )
1026
- {
1027
- _request = type as carriers.BLOB_SaveImageStreamRequest;
1028
- _options = image as base.WebApiRequestOptions;
1029
- }
1030
- else
1031
- {
1032
- _request = {
1033
- type: type as enums.BlobLinkType,
1034
- image: image as ArrayBuffer|string,
1035
- description: description as string,
1036
- };
1037
- _options = webapi_options;
1038
- }
1039
- _request.image = ToBase64(_request.image);
1040
- return this._saveImageStreamAsync( _request, _options );
1041
- }
1042
-
1043
-
1044
- private async _getProductImageAsync(request: carriers.BLOB_GetProductImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1045
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1046
- base.WebApiBase.SetPending(options);
1047
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1048
- try {
1049
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1050
- config.responseType = "arraybuffer";
1051
- config.headers = config.headers || {};
1052
- config.headers["Accept"] = "application/octet-stream";
1053
- }
1054
- config.baseURL = this._options.baseUrl;
1055
- const response = await this._axios.post("GetProductImage", request , config);
1056
- base.WebApiBase.SetCompleted(options, response);
1057
- let res : ArrayBuffer | string = null;
1058
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1059
- {
1060
- res = response.data as string;
1061
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
1062
- {
1063
- res = FromBase64ToString(res);
1064
- }
1065
- }
1066
- else
1067
- {
1068
- res = response.data as ArrayBuffer;
1069
- }
1070
-
1071
- resolve(res);
1072
- }
1073
- catch( err ) {
1074
- base.WebApiBase.HandleError(options, config, err);
1075
- reject(err);
1076
- }
1077
- });
1078
- }
1079
-
1080
-
1081
-
1082
- /**
1083
- * Returns the product image (rank=1) that is displayed in the CRM application.
1084
- * @param request - ProductId
1085
- * @returns The product image.
1086
- */
1087
- public async getProductImageAsync(request: carriers.BLOB_GetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1088
-
1089
- /**
1090
- * Returns the product image (rank=1) that is displayed in the CRM application.
1091
- * @param productId - The product id of the product the image belongs to.
1092
- * @returns The product image.
1093
- */
1094
- public async getProductImageAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1095
-
1096
- public async getProductImageAsync(productId:number|carriers.BLOB_GetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1097
- let _request : carriers.BLOB_GetProductImageRequest = null;
1098
- let _options : base.WebApiRequestOptions = null;
1099
- const first : any = productId;
1100
- if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' ) )
1101
- {
1102
- _request = productId as carriers.BLOB_GetProductImageRequest;
1103
- _options = webapi_options as base.WebApiRequestOptions;
1104
- }
1105
- else
1106
- {
1107
- _request = {
1108
- productId: productId as number,
1109
- };
1110
- _options = webapi_options;
1111
- }
1112
- return this._getProductImageAsync( _request, _options );
1113
- }
1114
-
1115
-
1116
- private async _setProductImageAsync(request: carriers.BLOB_SetProductImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1117
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1118
- base.WebApiBase.SetPending(options);
1119
- return new Promise< void >(async (resolve, reject) => {
1120
- try {
1121
- config.baseURL = this._options.baseUrl;
1122
- const response = await this._axios.post("SetProductImage", request , config);
1123
- base.WebApiBase.SetCompleted(options, response);
1124
- const res = response.data;
1125
- resolve(res);
1126
- }
1127
- catch( err ) {
1128
- base.WebApiBase.HandleError(options, config, err);
1129
- reject(err);
1130
- }
1131
- });
1132
- }
1133
-
1134
-
1135
-
1136
- /**
1137
- * Stores the product image that is displayed in the CRM application. The image is scaled down to max 1000x1000. This method operates only the main (rank=1) image; future extensions may support multiple images. A thumbnail of size 75x75 is also automatically set.
1138
- * @param request - ProductId, Image
1139
- * @returns
1140
- */
1141
- public async setProductImageAsync(request: carriers.BLOB_SetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1142
-
1143
- /**
1144
- * Stores the product image that is displayed in the CRM application. The image is scaled down to max 1000x1000. This method operates only the main (rank=1) image; future extensions may support multiple images. A thumbnail of size 75x75 is also automatically set.
1145
- * @param productId - The product id of the product the image belongs to.
1146
- * @param image - The product image, scaled down to no more than 1000x1000.
1147
- * @returns
1148
- */
1149
- public async setProductImageAsync(productId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1150
-
1151
- public async setProductImageAsync(productId:number|carriers.BLOB_SetProductImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1152
- let _request : carriers.BLOB_SetProductImageRequest = null;
1153
- let _options : base.WebApiRequestOptions = null;
1154
- const first : any = productId;
1155
- if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' || typeof(first.image)!='undefined' ) )
1156
- {
1157
- _request = productId as carriers.BLOB_SetProductImageRequest;
1158
- _options = image as base.WebApiRequestOptions;
1159
- }
1160
- else
1161
- {
1162
- _request = {
1163
- productId: productId as number,
1164
- image: image as ArrayBuffer|string,
1165
- };
1166
- _options = webapi_options;
1167
- }
1168
- _request.image = ToBase64(_request.image);
1169
- return this._setProductImageAsync( _request, _options );
1170
- }
1171
-
1172
-
1173
- private async _getProductThumbnailAsync(request: carriers.BLOB_GetProductThumbnailRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1174
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1175
- base.WebApiBase.SetPending(options);
1176
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1177
- try {
1178
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1179
- config.responseType = "arraybuffer";
1180
- config.headers = config.headers || {};
1181
- config.headers["Accept"] = "application/octet-stream";
1182
- }
1183
- config.baseURL = this._options.baseUrl;
1184
- const response = await this._axios.post("GetProductThumbnail", request , config);
1185
- base.WebApiBase.SetCompleted(options, response);
1186
- let res : ArrayBuffer | string = null;
1187
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1188
- {
1189
- res = response.data as string;
1190
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
1191
- {
1192
- res = FromBase64ToString(res);
1193
- }
1194
- }
1195
- else
1196
- {
1197
- res = response.data as ArrayBuffer;
1198
- }
1199
-
1200
- resolve(res);
1201
- }
1202
- catch( err ) {
1203
- base.WebApiBase.HandleError(options, config, err);
1204
- reject(err);
1205
- }
1206
- });
1207
- }
1208
-
1209
-
1210
-
1211
- /**
1212
- * Returns the product thumbnail that is displayed in the CRM application.
1213
- * @param request - ProductId
1214
- * @returns The product thumbnail.
1215
- */
1216
- public async getProductThumbnailAsync(request: carriers.BLOB_GetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1217
-
1218
- /**
1219
- * Returns the product thumbnail that is displayed in the CRM application.
1220
- * @param productId - The product id of the product the thumbnail belongs to.
1221
- * @returns The product thumbnail.
1222
- */
1223
- public async getProductThumbnailAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1224
-
1225
- public async getProductThumbnailAsync(productId:number|carriers.BLOB_GetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1226
- let _request : carriers.BLOB_GetProductThumbnailRequest = null;
1227
- let _options : base.WebApiRequestOptions = null;
1228
- const first : any = productId;
1229
- if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' ) )
1230
- {
1231
- _request = productId as carriers.BLOB_GetProductThumbnailRequest;
1232
- _options = webapi_options as base.WebApiRequestOptions;
1233
- }
1234
- else
1235
- {
1236
- _request = {
1237
- productId: productId as number,
1238
- };
1239
- _options = webapi_options;
1240
- }
1241
- return this._getProductThumbnailAsync( _request, _options );
1242
- }
1243
-
1244
-
1245
- private async _setProductThumbnailAsync(request: carriers.BLOB_SetProductThumbnailRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1246
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1247
- base.WebApiBase.SetPending(options);
1248
- return new Promise< void >(async (resolve, reject) => {
1249
- try {
1250
- config.baseURL = this._options.baseUrl;
1251
- const response = await this._axios.post("SetProductThumbnail", request , config);
1252
- base.WebApiBase.SetCompleted(options, response);
1253
- const res = response.data;
1254
- resolve(res);
1255
- }
1256
- catch( err ) {
1257
- base.WebApiBase.HandleError(options, config, err);
1258
- reject(err);
1259
- }
1260
- });
1261
- }
1262
-
1263
-
1264
-
1265
- /**
1266
- * Stores the product thumbnail that is displayed in the CRM application. The image is scaled down to max 200x200 pixels.
1267
- * @param request - ProductId, Image
1268
- * @returns
1269
- */
1270
- public async setProductThumbnailAsync(request: carriers.BLOB_SetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1271
-
1272
- /**
1273
- * Stores the product thumbnail that is displayed in the CRM application. The image is scaled down to max 200x200 pixels.
1274
- * @param productId - The product id of the product the image belongs to.
1275
- * @param image - The product thumbnail, scaled down to no more than 200x200.
1276
- * @returns
1277
- */
1278
- public async setProductThumbnailAsync(productId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1279
-
1280
- public async setProductThumbnailAsync(productId:number|carriers.BLOB_SetProductThumbnailRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1281
- let _request : carriers.BLOB_SetProductThumbnailRequest = null;
1282
- let _options : base.WebApiRequestOptions = null;
1283
- const first : any = productId;
1284
- if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' || typeof(first.image)!='undefined' ) )
1285
- {
1286
- _request = productId as carriers.BLOB_SetProductThumbnailRequest;
1287
- _options = image as base.WebApiRequestOptions;
1288
- }
1289
- else
1290
- {
1291
- _request = {
1292
- productId: productId as number,
1293
- image: image as ArrayBuffer|string,
1294
- };
1295
- _options = webapi_options;
1296
- }
1297
- _request.image = ToBase64(_request.image);
1298
- return this._setProductThumbnailAsync( _request, _options );
1299
- }
1300
-
1301
-
1302
- private async _changeProductImageAsync(request: carriers.BLOB_ChangeProductImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1303
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1304
- base.WebApiBase.SetPending(options);
1305
- return new Promise< void >(async (resolve, reject) => {
1306
- try {
1307
- config.baseURL = this._options.baseUrl;
1308
- const response = await this._axios.post("ChangeProductImage", request , config);
1309
- base.WebApiBase.SetCompleted(options, response);
1310
- const res = response.data;
1311
- resolve(res);
1312
- }
1313
- catch( err ) {
1314
- base.WebApiBase.HandleError(options, config, err);
1315
- reject(err);
1316
- }
1317
- });
1318
- }
1319
-
1320
-
1321
-
1322
- /**
1323
- *
1324
- * @param request - ProductId, BlobId
1325
- * @returns
1326
- */
1327
- public async changeProductImageAsync(request: carriers.BLOB_ChangeProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1328
-
1329
- /**
1330
- *
1331
- * @param productId - The product the image is linked to
1332
- * @param blobId - The Binary object id. If the Binary object id is 0, any image link is removed from the product.
1333
- * @returns
1334
- */
1335
- public async changeProductImageAsync(productId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1336
-
1337
- public async changeProductImageAsync(productId:number|carriers.BLOB_ChangeProductImageRequest, blobId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1338
- let _request : carriers.BLOB_ChangeProductImageRequest = null;
1339
- let _options : base.WebApiRequestOptions = null;
1340
- const first : any = productId;
1341
- if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' || typeof(first.blobId)!='undefined' ) )
1342
- {
1343
- _request = productId as carriers.BLOB_ChangeProductImageRequest;
1344
- _options = blobId as base.WebApiRequestOptions;
1345
- }
1346
- else
1347
- {
1348
- _request = {
1349
- productId: productId as number,
1350
- blobId: blobId as number,
1351
- };
1352
- _options = webapi_options;
1353
- }
1354
- return this._changeProductImageAsync( _request, _options );
1355
- }
1356
-
1357
-
1358
- private async _getQuoteLineImageAsync(request: carriers.BLOB_GetQuoteLineImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1359
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1360
- base.WebApiBase.SetPending(options);
1361
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1362
- try {
1363
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1364
- config.responseType = "arraybuffer";
1365
- config.headers = config.headers || {};
1366
- config.headers["Accept"] = "application/octet-stream";
1367
- }
1368
- config.baseURL = this._options.baseUrl;
1369
- const response = await this._axios.post("GetQuoteLineImage", request , config);
1370
- base.WebApiBase.SetCompleted(options, response);
1371
- let res : ArrayBuffer | string = null;
1372
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1373
- {
1374
- res = response.data as string;
1375
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
1376
- {
1377
- res = FromBase64ToString(res);
1378
- }
1379
- }
1380
- else
1381
- {
1382
- res = response.data as ArrayBuffer;
1383
- }
1384
-
1385
- resolve(res);
1386
- }
1387
- catch( err ) {
1388
- base.WebApiBase.HandleError(options, config, err);
1389
- reject(err);
1390
- }
1391
- });
1392
- }
1393
-
1394
-
1395
-
1396
- /**
1397
- * Returns the quoteline image (rank=1) that is displayed in the CRM application.
1398
- * @param request - QuoteLineId
1399
- * @returns The quote line image.
1400
- */
1401
- public async getQuoteLineImageAsync(request: carriers.BLOB_GetQuoteLineImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1402
-
1403
- /**
1404
- * Returns the quoteline image (rank=1) that is displayed in the CRM application.
1405
- * @param quoteLineId - The product id of the quoteline the image belongs to.
1406
- * @returns The quote line image.
1407
- */
1408
- public async getQuoteLineImageAsync(quoteLineId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1409
-
1410
- public async getQuoteLineImageAsync(quoteLineId:number|carriers.BLOB_GetQuoteLineImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1411
- let _request : carriers.BLOB_GetQuoteLineImageRequest = null;
1412
- let _options : base.WebApiRequestOptions = null;
1413
- const first : any = quoteLineId;
1414
- if( typeof( first ) === "object" && first && ( typeof(first.quoteLineId)!='undefined' ) )
1415
- {
1416
- _request = quoteLineId as carriers.BLOB_GetQuoteLineImageRequest;
1417
- _options = webapi_options as base.WebApiRequestOptions;
1418
- }
1419
- else
1420
- {
1421
- _request = {
1422
- quoteLineId: quoteLineId as number,
1423
- };
1424
- _options = webapi_options;
1425
- }
1426
- return this._getQuoteLineImageAsync( _request, _options );
1427
- }
1428
-
1429
-
1430
- private async _getPersonImageWithSizeAsync(request: carriers.BLOB_GetPersonImageWithSizeRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1431
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1432
- base.WebApiBase.SetPending(options);
1433
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1434
- try {
1435
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1436
- config.responseType = "arraybuffer";
1437
- config.headers = config.headers || {};
1438
- config.headers["Accept"] = "application/octet-stream";
1439
- }
1440
- config.baseURL = this._options.baseUrl;
1441
- const response = await this._axios.post("GetPersonImageWithSize", request , config);
1442
- base.WebApiBase.SetCompleted(options, response);
1443
- let res : ArrayBuffer | string = null;
1444
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1445
- {
1446
- res = response.data as string;
1447
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
1448
- {
1449
- res = FromBase64ToString(res);
1450
- }
1451
- }
1452
- else
1453
- {
1454
- res = response.data as ArrayBuffer;
1455
- }
1456
-
1457
- resolve(res);
1458
- }
1459
- catch( err ) {
1460
- base.WebApiBase.HandleError(options, config, err);
1461
- reject(err);
1462
- }
1463
- });
1464
- }
1465
-
1466
-
1467
-
1468
- /**
1469
- * Returns the person image that is displayed in the CRM application with a specified maximum size.
1470
- * @param request - PersonId, Width, Height
1471
- * @returns The person image.
1472
- */
1473
- public async getPersonImageWithSizeAsync(request: carriers.BLOB_GetPersonImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1474
-
1475
- /**
1476
- * Returns the person image that is displayed in the CRM application with a specified maximum size.
1477
- * @param personId - The person id of the person the image belongs to.
1478
- * @param width - The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1479
- * @param height - The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1480
- * @returns The person image.
1481
- */
1482
- public async getPersonImageWithSizeAsync(personId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1483
-
1484
- public async getPersonImageWithSizeAsync(personId:number|carriers.BLOB_GetPersonImageWithSizeRequest, width?:number|base.WebApiRequestOptions, height?:number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1485
- let _request : carriers.BLOB_GetPersonImageWithSizeRequest = null;
1486
- let _options : base.WebApiRequestOptions = null;
1487
- const first : any = personId;
1488
- if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' || typeof(first.width)!='undefined' || typeof(first.height)!='undefined' ) )
1489
- {
1490
- _request = personId as carriers.BLOB_GetPersonImageWithSizeRequest;
1491
- _options = width as base.WebApiRequestOptions;
1492
- }
1493
- else
1494
- {
1495
- _request = {
1496
- personId: personId as number,
1497
- width: width as number,
1498
- height: height as number,
1499
- };
1500
- _options = webapi_options;
1501
- }
1502
- return this._getPersonImageWithSizeAsync( _request, _options );
1503
- }
1504
-
1505
-
1506
- private async _getProjectImageWithSizeAsync(request: carriers.BLOB_GetProjectImageWithSizeRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1507
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1508
- base.WebApiBase.SetPending(options);
1509
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1510
- try {
1511
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1512
- config.responseType = "arraybuffer";
1513
- config.headers = config.headers || {};
1514
- config.headers["Accept"] = "application/octet-stream";
1515
- }
1516
- config.baseURL = this._options.baseUrl;
1517
- const response = await this._axios.post("GetProjectImageWithSize", request , config);
1518
- base.WebApiBase.SetCompleted(options, response);
1519
- let res : ArrayBuffer | string = null;
1520
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1521
- {
1522
- res = response.data as string;
1523
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
1524
- {
1525
- res = FromBase64ToString(res);
1526
- }
1527
- }
1528
- else
1529
- {
1530
- res = response.data as ArrayBuffer;
1531
- }
1532
-
1533
- resolve(res);
1534
- }
1535
- catch( err ) {
1536
- base.WebApiBase.HandleError(options, config, err);
1537
- reject(err);
1538
- }
1539
- });
1540
- }
1541
-
1542
-
1543
-
1544
- /**
1545
- * Returns the project image that is displayed in the CRM application with a specified maximum size.
1546
- * @param request - ProjectId, Width, Height
1547
- * @returns The project image.
1548
- */
1549
- public async getProjectImageWithSizeAsync(request: carriers.BLOB_GetProjectImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1550
-
1551
- /**
1552
- * Returns the project image that is displayed in the CRM application with a specified maximum size.
1553
- * @param projectId - The project id of the project the image belongs to.
1554
- * @param width - The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1555
- * @param height - The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1556
- * @returns The project image.
1557
- */
1558
- public async getProjectImageWithSizeAsync(projectId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1559
-
1560
- public async getProjectImageWithSizeAsync(projectId:number|carriers.BLOB_GetProjectImageWithSizeRequest, width?:number|base.WebApiRequestOptions, height?:number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1561
- let _request : carriers.BLOB_GetProjectImageWithSizeRequest = null;
1562
- let _options : base.WebApiRequestOptions = null;
1563
- const first : any = projectId;
1564
- if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' || typeof(first.width)!='undefined' || typeof(first.height)!='undefined' ) )
1565
- {
1566
- _request = projectId as carriers.BLOB_GetProjectImageWithSizeRequest;
1567
- _options = width as base.WebApiRequestOptions;
1568
- }
1569
- else
1570
- {
1571
- _request = {
1572
- projectId: projectId as number,
1573
- width: width as number,
1574
- height: height as number,
1575
- };
1576
- _options = webapi_options;
1577
- }
1578
- return this._getProjectImageWithSizeAsync( _request, _options );
1579
- }
1580
-
1581
-
1582
- private async _getChatImageWithSizeAsync(request: carriers.BLOB_GetChatImageWithSizeRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1583
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1584
- base.WebApiBase.SetPending(options);
1585
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1586
- try {
1587
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1588
- config.responseType = "arraybuffer";
1589
- config.headers = config.headers || {};
1590
- config.headers["Accept"] = "application/octet-stream";
1591
- }
1592
- config.baseURL = this._options.baseUrl;
1593
- const response = await this._axios.post("GetChatImageWithSize", request , config);
1594
- base.WebApiBase.SetCompleted(options, response);
1595
- let res : ArrayBuffer | string = null;
1596
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1597
- {
1598
- res = response.data as string;
1599
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
1600
- {
1601
- res = FromBase64ToString(res);
1602
- }
1603
- }
1604
- else
1605
- {
1606
- res = response.data as ArrayBuffer;
1607
- }
1608
-
1609
- resolve(res);
1610
- }
1611
- catch( err ) {
1612
- base.WebApiBase.HandleError(options, config, err);
1613
- reject(err);
1614
- }
1615
- });
1616
- }
1617
-
1618
-
1619
-
1620
- /**
1621
- * Returns the chat image that is displayed in chat with a specified maximum size.
1622
- * @param request - ChatTopicId, Width, Height
1623
- * @returns The chat image.
1624
- */
1625
- public async getChatImageWithSizeAsync(request: carriers.BLOB_GetChatImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1626
-
1627
- /**
1628
- * Returns the chat image that is displayed in chat with a specified maximum size.
1629
- * @param chatTopicId - The project id of the project the image belongs to.
1630
- * @param width - The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1631
- * @param height - The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1632
- * @returns The chat image.
1633
- */
1634
- public async getChatImageWithSizeAsync(chatTopicId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1635
-
1636
- public async getChatImageWithSizeAsync(chatTopicId:number|carriers.BLOB_GetChatImageWithSizeRequest, width?:number|base.WebApiRequestOptions, height?:number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1637
- let _request : carriers.BLOB_GetChatImageWithSizeRequest = null;
1638
- let _options : base.WebApiRequestOptions = null;
1639
- const first : any = chatTopicId;
1640
- if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.width)!='undefined' || typeof(first.height)!='undefined' ) )
1641
- {
1642
- _request = chatTopicId as carriers.BLOB_GetChatImageWithSizeRequest;
1643
- _options = width as base.WebApiRequestOptions;
1644
- }
1645
- else
1646
- {
1647
- _request = {
1648
- chatTopicId: chatTopicId as number,
1649
- width: width as number,
1650
- height: height as number,
1651
- };
1652
- _options = webapi_options;
1653
- }
1654
- return this._getChatImageWithSizeAsync( _request, _options );
1655
- }
1656
-
1657
-
1658
- private async _getContactImageAsync(request: carriers.BLOB_GetContactImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1659
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1660
- base.WebApiBase.SetPending(options);
1661
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1662
- try {
1663
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1664
- config.responseType = "arraybuffer";
1665
- config.headers = config.headers || {};
1666
- config.headers["Accept"] = "application/octet-stream";
1667
- }
1668
- config.baseURL = this._options.baseUrl;
1669
- const response = await this._axios.post("GetContactImage", request , config);
1670
- base.WebApiBase.SetCompleted(options, response);
1671
- let res : ArrayBuffer | string = null;
1672
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1673
- {
1674
- res = response.data as string;
1675
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
1676
- {
1677
- res = FromBase64ToString(res);
1678
- }
1679
- }
1680
- else
1681
- {
1682
- res = response.data as ArrayBuffer;
1683
- }
1684
-
1685
- resolve(res);
1686
- }
1687
- catch( err ) {
1688
- base.WebApiBase.HandleError(options, config, err);
1689
- reject(err);
1690
- }
1691
- });
1692
- }
1693
-
1694
-
1695
-
1696
- /**
1697
- * Returns the contact image that is displayed in the CRM application.
1698
- * @param request - ContactId
1699
- * @returns The contact image.
1700
- */
1701
- public async getContactImageAsync(request: carriers.BLOB_GetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1702
-
1703
- /**
1704
- * Returns the contact image that is displayed in the CRM application.
1705
- * @param contactId - The contact id of the contact the image belongs to.
1706
- * @returns The contact image.
1707
- */
1708
- public async getContactImageAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1709
-
1710
- public async getContactImageAsync(contactId:number|carriers.BLOB_GetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1711
- let _request : carriers.BLOB_GetContactImageRequest = null;
1712
- let _options : base.WebApiRequestOptions = null;
1713
- const first : any = contactId;
1714
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
1715
- {
1716
- _request = contactId as carriers.BLOB_GetContactImageRequest;
1717
- _options = webapi_options as base.WebApiRequestOptions;
1718
- }
1719
- else
1720
- {
1721
- _request = {
1722
- contactId: contactId as number,
1723
- };
1724
- _options = webapi_options;
1725
- }
1726
- return this._getContactImageAsync( _request, _options );
1727
- }
1728
-
1729
-
1730
- private async _setContactImageAsync(request: carriers.BLOB_SetContactImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1731
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1732
- base.WebApiBase.SetPending(options);
1733
- return new Promise< void >(async (resolve, reject) => {
1734
- try {
1735
- config.baseURL = this._options.baseUrl;
1736
- const response = await this._axios.post("SetContactImage", request , config);
1737
- base.WebApiBase.SetCompleted(options, response);
1738
- const res = response.data;
1739
- resolve(res);
1740
- }
1741
- catch( err ) {
1742
- base.WebApiBase.HandleError(options, config, err);
1743
- reject(err);
1744
- }
1745
- });
1746
- }
1747
-
1748
-
1749
-
1750
- /**
1751
- * Stores the contact image that is displayed in the CRM application.
1752
- * @param request - ContactId, Image
1753
- * @returns
1754
- */
1755
- public async setContactImageAsync(request: carriers.BLOB_SetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1756
-
1757
- /**
1758
- * Stores the contact image that is displayed in the CRM application.
1759
- * @param contactId - The contact id of the contact the image belongs to.
1760
- * @param image - The contact image.
1761
- * @returns
1762
- */
1763
- public async setContactImageAsync(contactId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1764
-
1765
- public async setContactImageAsync(contactId:number|carriers.BLOB_SetContactImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1766
- let _request : carriers.BLOB_SetContactImageRequest = null;
1767
- let _options : base.WebApiRequestOptions = null;
1768
- const first : any = contactId;
1769
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.image)!='undefined' ) )
1770
- {
1771
- _request = contactId as carriers.BLOB_SetContactImageRequest;
1772
- _options = image as base.WebApiRequestOptions;
1773
- }
1774
- else
1775
- {
1776
- _request = {
1777
- contactId: contactId as number,
1778
- image: image as ArrayBuffer|string,
1779
- };
1780
- _options = webapi_options;
1781
- }
1782
- _request.image = ToBase64(_request.image);
1783
- return this._setContactImageAsync( _request, _options );
1784
- }
1785
-
1786
-
1787
- private async _changeContactImageAsync(request: carriers.BLOB_ChangeContactImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1788
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1789
- base.WebApiBase.SetPending(options);
1790
- return new Promise< void >(async (resolve, reject) => {
1791
- try {
1792
- config.baseURL = this._options.baseUrl;
1793
- const response = await this._axios.post("ChangeContactImage", request , config);
1794
- base.WebApiBase.SetCompleted(options, response);
1795
- const res = response.data;
1796
- resolve(res);
1797
- }
1798
- catch( err ) {
1799
- base.WebApiBase.HandleError(options, config, err);
1800
- reject(err);
1801
- }
1802
- });
1803
- }
1804
-
1805
-
1806
-
1807
- /**
1808
- * Changes the contact image link. If the Binary object id is 0, any image link is removed from the contact.
1809
- * @param request - ContactId, BlobId
1810
- * @returns
1811
- */
1812
- public async changeContactImageAsync(request: carriers.BLOB_ChangeContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1813
-
1814
- /**
1815
- * Changes the contact image link. If the Binary object id is 0, any image link is removed from the contact.
1816
- * @param contactId - The Contact the image is linked to
1817
- * @param blobId - The Binary object id. If the Binary object id is 0, any image link is removed from the Contact.
1818
- * @returns
1819
- */
1820
- public async changeContactImageAsync(contactId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1821
-
1822
- public async changeContactImageAsync(contactId:number|carriers.BLOB_ChangeContactImageRequest, blobId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1823
- let _request : carriers.BLOB_ChangeContactImageRequest = null;
1824
- let _options : base.WebApiRequestOptions = null;
1825
- const first : any = contactId;
1826
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.blobId)!='undefined' ) )
1827
- {
1828
- _request = contactId as carriers.BLOB_ChangeContactImageRequest;
1829
- _options = blobId as base.WebApiRequestOptions;
1830
- }
1831
- else
1832
- {
1833
- _request = {
1834
- contactId: contactId as number,
1835
- blobId: blobId as number,
1836
- };
1837
- _options = webapi_options;
1838
- }
1839
- return this._changeContactImageAsync( _request, _options );
1840
- }
1841
-
1842
-
1843
- private async _getBlobEntityOnContactAsync(request: carriers.BLOB_GetBlobEntityOnContactRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
1844
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1845
- base.WebApiBase.SetPending(options);
1846
- return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
1847
- try {
1848
- config.baseURL = this._options.baseUrl;
1849
- const response = await this._axios.post("GetBlobEntityOnContact", request , config);
1850
- base.WebApiBase.SetCompleted(options, response);
1851
- const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
1852
- resolve(res);
1853
- }
1854
- catch( err ) {
1855
- base.WebApiBase.HandleError(options, config, err);
1856
- reject(err);
1857
- }
1858
- });
1859
- }
1860
-
1861
-
1862
-
1863
- /**
1864
- * Gets the blob entity that represents the contact image binary object.
1865
- * @param request - ContactId
1866
- * @returns BlobEntity object
1867
- */
1868
- public async getBlobEntityOnContactAsync(request: carriers.BLOB_GetBlobEntityOnContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
1869
-
1870
- /**
1871
- * Gets the blob entity that represents the contact image binary object.
1872
- * @param contactId - The Contact id
1873
- * @returns BlobEntity object
1874
- */
1875
- public async getBlobEntityOnContactAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
1876
-
1877
- public async getBlobEntityOnContactAsync(contactId:number|carriers.BLOB_GetBlobEntityOnContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
1878
- let _request : carriers.BLOB_GetBlobEntityOnContactRequest = null;
1879
- let _options : base.WebApiRequestOptions = null;
1880
- const first : any = contactId;
1881
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
1882
- {
1883
- _request = contactId as carriers.BLOB_GetBlobEntityOnContactRequest;
1884
- _options = webapi_options as base.WebApiRequestOptions;
1885
- }
1886
- else
1887
- {
1888
- _request = {
1889
- contactId: contactId as number,
1890
- };
1891
- _options = webapi_options;
1892
- }
1893
- return this._getBlobEntityOnContactAsync( _request, _options );
1894
- }
1895
-
1896
-
1897
- private async _getContactImageWithSizeAsync(request: carriers.BLOB_GetContactImageWithSizeRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1898
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1899
- base.WebApiBase.SetPending(options);
1900
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1901
- try {
1902
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1903
- config.responseType = "arraybuffer";
1904
- config.headers = config.headers || {};
1905
- config.headers["Accept"] = "application/octet-stream";
1906
- }
1907
- config.baseURL = this._options.baseUrl;
1908
- const response = await this._axios.post("GetContactImageWithSize", request , config);
1909
- base.WebApiBase.SetCompleted(options, response);
1910
- let res : ArrayBuffer | string = null;
1911
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1912
- {
1913
- res = response.data as string;
1914
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
1915
- {
1916
- res = FromBase64ToString(res);
1917
- }
1918
- }
1919
- else
1920
- {
1921
- res = response.data as ArrayBuffer;
1922
- }
1923
-
1924
- resolve(res);
1925
- }
1926
- catch( err ) {
1927
- base.WebApiBase.HandleError(options, config, err);
1928
- reject(err);
1929
- }
1930
- });
1931
- }
1932
-
1933
-
1934
-
1935
- /**
1936
- * Returns the contact image that is displayed in the CRM application with a specified maximum size.
1937
- * @param request - ContactId, Width, Height
1938
- * @returns The contact image.
1939
- */
1940
- public async getContactImageWithSizeAsync(request: carriers.BLOB_GetContactImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1941
-
1942
- /**
1943
- * Returns the contact image that is displayed in the CRM application with a specified maximum size.
1944
- * @param contactId - The contact id of the Contact the image belongs to.
1945
- * @param width - The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1946
- * @param height - The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1947
- * @returns The contact image.
1948
- */
1949
- public async getContactImageWithSizeAsync(contactId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1950
-
1951
- public async getContactImageWithSizeAsync(contactId:number|carriers.BLOB_GetContactImageWithSizeRequest, width?:number|base.WebApiRequestOptions, height?:number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1952
- let _request : carriers.BLOB_GetContactImageWithSizeRequest = null;
1953
- let _options : base.WebApiRequestOptions = null;
1954
- const first : any = contactId;
1955
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.width)!='undefined' || typeof(first.height)!='undefined' ) )
1956
- {
1957
- _request = contactId as carriers.BLOB_GetContactImageWithSizeRequest;
1958
- _options = width as base.WebApiRequestOptions;
1959
- }
1960
- else
1961
- {
1962
- _request = {
1963
- contactId: contactId as number,
1964
- width: width as number,
1965
- height: height as number,
1966
- };
1967
- _options = webapi_options;
1968
- }
1969
- return this._getContactImageWithSizeAsync( _request, _options );
1970
- }
1971
-
1972
-
1973
- private async _getOutputFromBatchAsync(request: carriers.BLOB_GetOutputFromBatchRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1974
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1975
- base.WebApiBase.SetPending(options);
1976
- return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1977
- try {
1978
- if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1979
- config.responseType = "arraybuffer";
1980
- config.headers = config.headers || {};
1981
- config.headers["Accept"] = "application/octet-stream";
1982
- }
1983
- config.baseURL = this._options.baseUrl;
1984
- const response = await this._axios.post("GetOutputFromBatch", request , config);
1985
- base.WebApiBase.SetCompleted(options, response);
1986
- let res : ArrayBuffer | string = null;
1987
- if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1988
- {
1989
- res = response.data as string;
1990
- if( options.returnBlobAs == base.ReturnBlobType.AsString )
1991
- {
1992
- res = FromBase64ToString(res);
1993
- }
1994
- }
1995
- else
1996
- {
1997
- res = response.data as ArrayBuffer;
1998
- }
1999
-
2000
- resolve(res);
2001
- }
2002
- catch( err ) {
2003
- base.WebApiBase.HandleError(options, config, err);
2004
- reject(err);
2005
- }
2006
- });
2007
- }
2008
-
2009
-
2010
-
2011
- /**
2012
- * Get the output of a batchtask as a stream
2013
- * @param request - BatchTaskId
2014
- * @returns The binary object as a Stream.
2015
- */
2016
- public async getOutputFromBatchAsync(request: carriers.BLOB_GetOutputFromBatchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
2017
-
2018
- /**
2019
- * Get the output of a batchtask as a stream
2020
- * @param batchTaskId - The ID of the batchtask that created the output data
2021
- * @returns The binary object as a Stream.
2022
- */
2023
- public async getOutputFromBatchAsync(batchTaskId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
2024
-
2025
- public async getOutputFromBatchAsync(batchTaskId:number|carriers.BLOB_GetOutputFromBatchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
2026
- let _request : carriers.BLOB_GetOutputFromBatchRequest = null;
2027
- let _options : base.WebApiRequestOptions = null;
2028
- const first : any = batchTaskId;
2029
- if( typeof( first ) === "object" && first && ( typeof(first.batchTaskId)!='undefined' ) )
2030
- {
2031
- _request = batchTaskId as carriers.BLOB_GetOutputFromBatchRequest;
2032
- _options = webapi_options as base.WebApiRequestOptions;
2033
- }
2034
- else
2035
- {
2036
- _request = {
2037
- batchTaskId: batchTaskId as number,
2038
- };
2039
- _options = webapi_options;
2040
- }
2041
- return this._getOutputFromBatchAsync( _request, _options );
2042
- }
2043
-
2044
-
2045
- private async _cleanupBatchTaskAsync(request: carriers.BLOB_CleanupBatchTaskRequest, options?:base.WebApiRequestOptions) : Promise< void > {
2046
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
2047
- base.WebApiBase.SetPending(options);
2048
- return new Promise< void >(async (resolve, reject) => {
2049
- try {
2050
- config.baseURL = this._options.baseUrl;
2051
- const response = await this._axios.post("CleanupBatchTask", request , config);
2052
- base.WebApiBase.SetCompleted(options, response);
2053
- const res = response.data;
2054
- resolve(res);
2055
- }
2056
- catch( err ) {
2057
- base.WebApiBase.HandleError(options, config, err);
2058
- reject(err);
2059
- }
2060
- });
2061
- }
2062
-
2063
-
2064
-
2065
- /**
2066
- * Removes the binary objects linked to the batch task, the links themselves and the batch task.
2067
- * @param request - BatchTaskId
2068
- * @returns
2069
- */
2070
- public async cleanupBatchTaskAsync(request: carriers.BLOB_CleanupBatchTaskRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
2071
-
2072
- /**
2073
- * Removes the binary objects linked to the batch task, the links themselves and the batch task.
2074
- * @param batchTaskId - The ID of the batchtask that created the output data
2075
- * @returns
2076
- */
2077
- public async cleanupBatchTaskAsync(batchTaskId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
2078
-
2079
- public async cleanupBatchTaskAsync(batchTaskId:number|carriers.BLOB_CleanupBatchTaskRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
2080
- let _request : carriers.BLOB_CleanupBatchTaskRequest = null;
2081
- let _options : base.WebApiRequestOptions = null;
2082
- const first : any = batchTaskId;
2083
- if( typeof( first ) === "object" && first && ( typeof(first.batchTaskId)!='undefined' ) )
2084
- {
2085
- _request = batchTaskId as carriers.BLOB_CleanupBatchTaskRequest;
2086
- _options = webapi_options as base.WebApiRequestOptions;
2087
- }
2088
- else
2089
- {
2090
- _request = {
2091
- batchTaskId: batchTaskId as number,
2092
- };
2093
- _options = webapi_options;
2094
- }
2095
- return this._cleanupBatchTaskAsync( _request, _options );
2096
- }
2097
-
2098
- } // class v1BLOBAgentController
2099
-
2100
-
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/BLOBAgent.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
+ * Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.
28
+ */
29
+ export interface IBLOBAgent {
30
+ createDefaultBlobEntityAsync(): Promise< carriers.BlobEntity >;
31
+ saveBlobEntityAsync(entity: carriers.BlobEntity) : Promise< carriers.BlobEntity >;
32
+ deleteBlobEntityAsync(BlobEntityId: number) : Promise<void>;
33
+ getBlobEntityAsync(blobEntityId: number) : Promise< carriers.BlobEntity >;
34
+ setBlobStreamAsync(request: carriers.BLOB_SetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
35
+ setBlobStreamAsync(blobEntityId: number, stream: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
36
+ getBlobStreamAsync(request: carriers.BLOB_GetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
37
+ getBlobStreamAsync(blobEntityId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
38
+ getProjectImageAsync(request: carriers.BLOB_GetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
39
+ getProjectImageAsync(projectId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
40
+ getPersonImageAsync(request: carriers.BLOB_GetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
41
+ getPersonImageAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
42
+ setProjectImageAsync(request: carriers.BLOB_SetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
43
+ setProjectImageAsync(projectId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
44
+ setPersonImageAsync(request: carriers.BLOB_SetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
45
+ setPersonImageAsync(personId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
46
+ changeProjectImageAsync(request: carriers.BLOB_ChangeProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
47
+ changeProjectImageAsync(projectId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
48
+ saveProjectImageAsync(request: carriers.BLOB_SaveProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
49
+ saveProjectImageAsync(description: string, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
50
+ getBlobEntityOnProjectAsync(request: carriers.BLOB_GetBlobEntityOnProjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
51
+ getBlobEntityOnProjectAsync(projectId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
52
+ getBlobEntityOnPersonAsync(request: carriers.BLOB_GetBlobEntityOnPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
53
+ getBlobEntityOnPersonAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
54
+ getBlobEntityOnCountryAsync(request: carriers.BLOB_GetBlobEntityOnCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
55
+ getBlobEntityOnCountryAsync(countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
56
+ getBlobEntityOnProductAsync(request: carriers.BLOB_GetBlobEntityOnProductRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
57
+ getBlobEntityOnProductAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
58
+ changePersonImageAsync(request: carriers.BLOB_ChangePersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
59
+ changePersonImageAsync(personId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
60
+ saveImageStreamAsync(request: carriers.BLOB_SaveImageStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
61
+ saveImageStreamAsync(type: enums.BlobLinkType, image: ArrayBuffer|string, description: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
62
+ getProductImageAsync(request: carriers.BLOB_GetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
63
+ getProductImageAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
64
+ setProductImageAsync(request: carriers.BLOB_SetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
65
+ setProductImageAsync(productId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
66
+ getProductThumbnailAsync(request: carriers.BLOB_GetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
67
+ getProductThumbnailAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
68
+ setProductThumbnailAsync(request: carriers.BLOB_SetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
69
+ setProductThumbnailAsync(productId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
70
+ changeProductImageAsync(request: carriers.BLOB_ChangeProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
71
+ changeProductImageAsync(productId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
72
+ getQuoteLineImageAsync(request: carriers.BLOB_GetQuoteLineImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
73
+ getQuoteLineImageAsync(quoteLineId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
74
+ getPersonImageWithSizeAsync(request: carriers.BLOB_GetPersonImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
75
+ getPersonImageWithSizeAsync(personId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
76
+ getProjectImageWithSizeAsync(request: carriers.BLOB_GetProjectImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
77
+ getProjectImageWithSizeAsync(projectId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
78
+ getChatImageWithSizeAsync(request: carriers.BLOB_GetChatImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
79
+ getChatImageWithSizeAsync(chatTopicId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
80
+ getContactImageAsync(request: carriers.BLOB_GetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
81
+ getContactImageAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
82
+ setContactImageAsync(request: carriers.BLOB_SetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
83
+ setContactImageAsync(contactId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
84
+ changeContactImageAsync(request: carriers.BLOB_ChangeContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
85
+ changeContactImageAsync(contactId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
86
+ getBlobEntityOnContactAsync(request: carriers.BLOB_GetBlobEntityOnContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
87
+ getBlobEntityOnContactAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
88
+ getContactImageWithSizeAsync(request: carriers.BLOB_GetContactImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
89
+ getContactImageWithSizeAsync(contactId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
90
+ getOutputFromBatchAsync(request: carriers.BLOB_GetOutputFromBatchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
91
+ getOutputFromBatchAsync(batchTaskId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
92
+ cleanupBatchTaskAsync(request: carriers.BLOB_CleanupBatchTaskRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
93
+ cleanupBatchTaskAsync(batchTaskId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
94
+ } // interface IBLOBAgent
95
+
96
+
97
+
98
+
99
+ /**
100
+ * Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.
101
+ */
102
+ export class BLOBAgent extends base.WebApiBase implements IBLOBAgent {
103
+ constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
104
+ constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
105
+ constructor(baseUrl: string, resourceManager:any);
106
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
107
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
108
+ constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
109
+ constructor(options: base.WebApiOptions);
110
+
111
+ constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
112
+ langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
113
+ langOrResourceOrRM?:string|base.ResourceParsing|any,
114
+ cultureCode?: string,
115
+ ) {
116
+ const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
117
+ options.basePath = "v1/Agents/BLOB/";
118
+ super(options);
119
+ }
120
+
121
+
122
+
123
+ /**
124
+ * Set default values into a new BlobEntity.
125
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
126
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
127
+ * @returns A blank entity.
128
+ */
129
+ public async createDefaultBlobEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
130
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
131
+ base.WebApiBase.SetPending(options);
132
+ return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
133
+ try {
134
+ const response = await this._axios.post("CreateDefaultBlobEntity", null, config);
135
+ base.WebApiBase.SetCompleted(options, response);
136
+ const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
137
+ resolve(res);
138
+ }
139
+ catch( err ) {
140
+ base.WebApiBase.HandleError(options, config, err);
141
+ reject(err);
142
+ }
143
+ });
144
+ }
145
+ /**
146
+ * Replace the existing BlobEntity or creates a new BlobEntity if the id parameter is empty
147
+ * @param entity - The BlobEntity to be saved.
148
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
149
+ * @returns New or updated BlobEntity
150
+ */
151
+ public async saveBlobEntityAsync(entity: carriers.BlobEntity, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
152
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
153
+ base.WebApiBase.SetPending(options);
154
+ return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
155
+ try {
156
+ const response = await this._axios.post("SaveBlobEntity", entity, config);
157
+ base.WebApiBase.SetCompleted(options, response);
158
+ const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
159
+ resolve(res);
160
+ }
161
+ catch( err ) {
162
+ base.WebApiBase.HandleError(options, config, err);
163
+ reject(err);
164
+ }
165
+ });
166
+ }
167
+
168
+ /**
169
+ * Deletes the BlobEntity
170
+ * @param BlobEntityId - The id of the BlobEntity to be deleted.
171
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
172
+ */
173
+ public async deleteBlobEntityAsync(BlobEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
174
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
175
+ base.WebApiBase.SetPending(options);
176
+ return new Promise< void >(async (resolve, reject) => {
177
+ try {
178
+ const response = await this._axios.post("DeleteBlobEntity?BlobEntityId=" + BlobEntityId, null, config );
179
+ base.WebApiBase.SetCompleted(options, response);
180
+ const res = response.data;
181
+ resolve(res);
182
+ }
183
+ catch( err ) {
184
+ base.WebApiBase.HandleError(options, config, err);
185
+ reject(err);
186
+ }
187
+ });
188
+ }
189
+ /**
190
+ * Gets a BlobEntity object.
191
+ * @param blobEntityId - The primary key.
192
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
193
+ * @returns A single BlobEntity
194
+ */
195
+ public async getBlobEntityAsync(blobEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
196
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
197
+ base.WebApiBase.SetPending(options);
198
+ return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
199
+ try {
200
+ const response = await this._axios.post("GetBlobEntity?blobEntityId=" + blobEntityId, null, config);
201
+ base.WebApiBase.SetCompleted(options, response);
202
+ const res = converters.Create_BlobEntity_From( response.data );
203
+ resolve(res);
204
+ }
205
+ catch( err ) {
206
+ base.WebApiBase.HandleError(options, config, err);
207
+ reject(err);
208
+ }
209
+ });
210
+ }
211
+
212
+
213
+ private async _setBlobStreamAsync(request: carriers.BLOB_SetBlobStreamRequest, options?:base.WebApiRequestOptions) : Promise< void > {
214
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
215
+ base.WebApiBase.SetPending(options);
216
+ return new Promise< void >(async (resolve, reject) => {
217
+ try {
218
+ config.baseURL = this._options.baseUrl;
219
+ const response = await this._axios.post("SetBlobStream", request , config);
220
+ base.WebApiBase.SetCompleted(options, response);
221
+ const res = response.data;
222
+ resolve(res);
223
+ }
224
+ catch( err ) {
225
+ base.WebApiBase.HandleError(options, config, err);
226
+ reject(err);
227
+ }
228
+ });
229
+ }
230
+
231
+
232
+
233
+ /**
234
+ * Store a binary object from it&apos;s stream
235
+ * @param request - BlobEntityId, Stream
236
+ * @returns
237
+ */
238
+ public async setBlobStreamAsync(request: carriers.BLOB_SetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
239
+
240
+ /**
241
+ * Store a binary object from it&apos;s stream
242
+ * @param blobEntityId - Id of the BLOB entity object that the binary data should be stored to.
243
+ * @param stream - The binary object as a Stream
244
+ * @returns
245
+ */
246
+ public async setBlobStreamAsync(blobEntityId: number, stream: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
247
+
248
+ public async setBlobStreamAsync(blobEntityId:number|carriers.BLOB_SetBlobStreamRequest, stream?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
249
+ let _request : carriers.BLOB_SetBlobStreamRequest = null;
250
+ let _options : base.WebApiRequestOptions = null;
251
+ const first : any = blobEntityId;
252
+ if( typeof( first ) === "object" && first && ( typeof(first.blobEntityId)!='undefined' || typeof(first.stream)!='undefined' ) )
253
+ {
254
+ _request = blobEntityId as carriers.BLOB_SetBlobStreamRequest;
255
+ _options = stream as base.WebApiRequestOptions;
256
+ }
257
+ else
258
+ {
259
+ _request = {
260
+ blobEntityId: blobEntityId as number,
261
+ stream: stream as ArrayBuffer|string,
262
+ };
263
+ _options = webapi_options;
264
+ }
265
+ _request.stream = ToBase64(_request.stream);
266
+ return this._setBlobStreamAsync( _request, _options );
267
+ }
268
+
269
+
270
+ private async _getBlobStreamAsync(request: carriers.BLOB_GetBlobStreamRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
271
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
272
+ base.WebApiBase.SetPending(options);
273
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
274
+ try {
275
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
276
+ config.responseType = "arraybuffer";
277
+ config.headers = config.headers || {};
278
+ config.headers["Accept"] = "application/octet-stream";
279
+ }
280
+ config.baseURL = this._options.baseUrl;
281
+ const response = await this._axios.post("GetBlobStream", request , config);
282
+ base.WebApiBase.SetCompleted(options, response);
283
+ let res : ArrayBuffer | string = null;
284
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
285
+ {
286
+ res = response.data as string;
287
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
288
+ {
289
+ res = FromBase64ToString(res);
290
+ }
291
+ }
292
+ else
293
+ {
294
+ res = response.data as ArrayBuffer;
295
+ }
296
+
297
+ resolve(res);
298
+ }
299
+ catch( err ) {
300
+ base.WebApiBase.HandleError(options, config, err);
301
+ reject(err);
302
+ }
303
+ });
304
+ }
305
+
306
+
307
+
308
+ /**
309
+ * Get the binary object as a stream
310
+ * @param request - BlobEntityId
311
+ * @returns The binary object as a Stream
312
+ */
313
+ public async getBlobStreamAsync(request: carriers.BLOB_GetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
314
+
315
+ /**
316
+ * Get the binary object as a stream
317
+ * @param blobEntityId - The ID of the BLOB entity object that refers to the binary data
318
+ * @returns The binary object as a Stream
319
+ */
320
+ public async getBlobStreamAsync(blobEntityId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
321
+
322
+ public async getBlobStreamAsync(blobEntityId:number|carriers.BLOB_GetBlobStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
323
+ let _request : carriers.BLOB_GetBlobStreamRequest = null;
324
+ let _options : base.WebApiRequestOptions = null;
325
+ const first : any = blobEntityId;
326
+ if( typeof( first ) === "object" && first && ( typeof(first.blobEntityId)!='undefined' ) )
327
+ {
328
+ _request = blobEntityId as carriers.BLOB_GetBlobStreamRequest;
329
+ _options = webapi_options as base.WebApiRequestOptions;
330
+ }
331
+ else
332
+ {
333
+ _request = {
334
+ blobEntityId: blobEntityId as number,
335
+ };
336
+ _options = webapi_options;
337
+ }
338
+ return this._getBlobStreamAsync( _request, _options );
339
+ }
340
+
341
+
342
+ private async _getProjectImageAsync(request: carriers.BLOB_GetProjectImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
343
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
344
+ base.WebApiBase.SetPending(options);
345
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
346
+ try {
347
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
348
+ config.responseType = "arraybuffer";
349
+ config.headers = config.headers || {};
350
+ config.headers["Accept"] = "application/octet-stream";
351
+ }
352
+ config.baseURL = this._options.baseUrl;
353
+ const response = await this._axios.post("GetProjectImage", request , config);
354
+ base.WebApiBase.SetCompleted(options, response);
355
+ let res : ArrayBuffer | string = null;
356
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
357
+ {
358
+ res = response.data as string;
359
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
360
+ {
361
+ res = FromBase64ToString(res);
362
+ }
363
+ }
364
+ else
365
+ {
366
+ res = response.data as ArrayBuffer;
367
+ }
368
+
369
+ resolve(res);
370
+ }
371
+ catch( err ) {
372
+ base.WebApiBase.HandleError(options, config, err);
373
+ reject(err);
374
+ }
375
+ });
376
+ }
377
+
378
+
379
+
380
+ /**
381
+ * Returns the project image that is displayed in the CRM application.
382
+ * @param request - ProjectId
383
+ * @returns The project image.
384
+ */
385
+ public async getProjectImageAsync(request: carriers.BLOB_GetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
386
+
387
+ /**
388
+ * Returns the project image that is displayed in the CRM application.
389
+ * @param projectId - The project id of the project the image belongs to.
390
+ * @returns The project image.
391
+ */
392
+ public async getProjectImageAsync(projectId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
393
+
394
+ public async getProjectImageAsync(projectId:number|carriers.BLOB_GetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
395
+ let _request : carriers.BLOB_GetProjectImageRequest = null;
396
+ let _options : base.WebApiRequestOptions = null;
397
+ const first : any = projectId;
398
+ if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' ) )
399
+ {
400
+ _request = projectId as carriers.BLOB_GetProjectImageRequest;
401
+ _options = webapi_options as base.WebApiRequestOptions;
402
+ }
403
+ else
404
+ {
405
+ _request = {
406
+ projectId: projectId as number,
407
+ };
408
+ _options = webapi_options;
409
+ }
410
+ return this._getProjectImageAsync( _request, _options );
411
+ }
412
+
413
+
414
+ private async _getPersonImageAsync(request: carriers.BLOB_GetPersonImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
415
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
416
+ base.WebApiBase.SetPending(options);
417
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
418
+ try {
419
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
420
+ config.responseType = "arraybuffer";
421
+ config.headers = config.headers || {};
422
+ config.headers["Accept"] = "application/octet-stream";
423
+ }
424
+ config.baseURL = this._options.baseUrl;
425
+ const response = await this._axios.post("GetPersonImage", request , config);
426
+ base.WebApiBase.SetCompleted(options, response);
427
+ let res : ArrayBuffer | string = null;
428
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
429
+ {
430
+ res = response.data as string;
431
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
432
+ {
433
+ res = FromBase64ToString(res);
434
+ }
435
+ }
436
+ else
437
+ {
438
+ res = response.data as ArrayBuffer;
439
+ }
440
+
441
+ resolve(res);
442
+ }
443
+ catch( err ) {
444
+ base.WebApiBase.HandleError(options, config, err);
445
+ reject(err);
446
+ }
447
+ });
448
+ }
449
+
450
+
451
+
452
+ /**
453
+ * Returns the person image that is displayed in the CRM application.
454
+ * @param request - PersonId
455
+ * @returns The person image.
456
+ */
457
+ public async getPersonImageAsync(request: carriers.BLOB_GetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
458
+
459
+ /**
460
+ * Returns the person image that is displayed in the CRM application.
461
+ * @param personId - The person id of the person the image belongs to.
462
+ * @returns The person image.
463
+ */
464
+ public async getPersonImageAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
465
+
466
+ public async getPersonImageAsync(personId:number|carriers.BLOB_GetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
467
+ let _request : carriers.BLOB_GetPersonImageRequest = null;
468
+ let _options : base.WebApiRequestOptions = null;
469
+ const first : any = personId;
470
+ if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' ) )
471
+ {
472
+ _request = personId as carriers.BLOB_GetPersonImageRequest;
473
+ _options = webapi_options as base.WebApiRequestOptions;
474
+ }
475
+ else
476
+ {
477
+ _request = {
478
+ personId: personId as number,
479
+ };
480
+ _options = webapi_options;
481
+ }
482
+ return this._getPersonImageAsync( _request, _options );
483
+ }
484
+
485
+
486
+ private async _setProjectImageAsync(request: carriers.BLOB_SetProjectImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
487
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
488
+ base.WebApiBase.SetPending(options);
489
+ return new Promise< void >(async (resolve, reject) => {
490
+ try {
491
+ config.baseURL = this._options.baseUrl;
492
+ const response = await this._axios.post("SetProjectImage", request , config);
493
+ base.WebApiBase.SetCompleted(options, response);
494
+ const res = response.data;
495
+ resolve(res);
496
+ }
497
+ catch( err ) {
498
+ base.WebApiBase.HandleError(options, config, err);
499
+ reject(err);
500
+ }
501
+ });
502
+ }
503
+
504
+
505
+
506
+ /**
507
+ * Stores the project image that is displayed in the CRM application.
508
+ * @param request - ProjectId, Image
509
+ * @returns
510
+ */
511
+ public async setProjectImageAsync(request: carriers.BLOB_SetProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
512
+
513
+ /**
514
+ * Stores the project image that is displayed in the CRM application.
515
+ * @param projectId - The project id of the project the image belongs to.
516
+ * @param image - The project image.
517
+ * @returns
518
+ */
519
+ public async setProjectImageAsync(projectId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
520
+
521
+ public async setProjectImageAsync(projectId:number|carriers.BLOB_SetProjectImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
522
+ let _request : carriers.BLOB_SetProjectImageRequest = null;
523
+ let _options : base.WebApiRequestOptions = null;
524
+ const first : any = projectId;
525
+ if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' || typeof(first.image)!='undefined' ) )
526
+ {
527
+ _request = projectId as carriers.BLOB_SetProjectImageRequest;
528
+ _options = image as base.WebApiRequestOptions;
529
+ }
530
+ else
531
+ {
532
+ _request = {
533
+ projectId: projectId as number,
534
+ image: image as ArrayBuffer|string,
535
+ };
536
+ _options = webapi_options;
537
+ }
538
+ _request.image = ToBase64(_request.image);
539
+ return this._setProjectImageAsync( _request, _options );
540
+ }
541
+
542
+
543
+ private async _setPersonImageAsync(request: carriers.BLOB_SetPersonImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
544
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
545
+ base.WebApiBase.SetPending(options);
546
+ return new Promise< void >(async (resolve, reject) => {
547
+ try {
548
+ config.baseURL = this._options.baseUrl;
549
+ const response = await this._axios.post("SetPersonImage", request , config);
550
+ base.WebApiBase.SetCompleted(options, response);
551
+ const res = response.data;
552
+ resolve(res);
553
+ }
554
+ catch( err ) {
555
+ base.WebApiBase.HandleError(options, config, err);
556
+ reject(err);
557
+ }
558
+ });
559
+ }
560
+
561
+
562
+
563
+ /**
564
+ * Stores the person image that is displayed in the CRM application.
565
+ * @param request - PersonId, Image
566
+ * @returns
567
+ */
568
+ public async setPersonImageAsync(request: carriers.BLOB_SetPersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
569
+
570
+ /**
571
+ * Stores the person image that is displayed in the CRM application.
572
+ * @param personId - The person id of the person the image belongs to.
573
+ * @param image - The person image.
574
+ * @returns
575
+ */
576
+ public async setPersonImageAsync(personId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
577
+
578
+ public async setPersonImageAsync(personId:number|carriers.BLOB_SetPersonImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
579
+ let _request : carriers.BLOB_SetPersonImageRequest = null;
580
+ let _options : base.WebApiRequestOptions = null;
581
+ const first : any = personId;
582
+ if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' || typeof(first.image)!='undefined' ) )
583
+ {
584
+ _request = personId as carriers.BLOB_SetPersonImageRequest;
585
+ _options = image as base.WebApiRequestOptions;
586
+ }
587
+ else
588
+ {
589
+ _request = {
590
+ personId: personId as number,
591
+ image: image as ArrayBuffer|string,
592
+ };
593
+ _options = webapi_options;
594
+ }
595
+ _request.image = ToBase64(_request.image);
596
+ return this._setPersonImageAsync( _request, _options );
597
+ }
598
+
599
+
600
+ private async _changeProjectImageAsync(request: carriers.BLOB_ChangeProjectImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
601
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
602
+ base.WebApiBase.SetPending(options);
603
+ return new Promise< void >(async (resolve, reject) => {
604
+ try {
605
+ config.baseURL = this._options.baseUrl;
606
+ const response = await this._axios.post("ChangeProjectImage", request , config);
607
+ base.WebApiBase.SetCompleted(options, response);
608
+ const res = response.data;
609
+ resolve(res);
610
+ }
611
+ catch( err ) {
612
+ base.WebApiBase.HandleError(options, config, err);
613
+ reject(err);
614
+ }
615
+ });
616
+ }
617
+
618
+
619
+
620
+ /**
621
+ * Changes the project image link. If the Binary object id is 0, any image link is removed from the project.
622
+ * @param request - ProjectId, BlobId
623
+ * @returns
624
+ */
625
+ public async changeProjectImageAsync(request: carriers.BLOB_ChangeProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
626
+
627
+ /**
628
+ * Changes the project image link. If the Binary object id is 0, any image link is removed from the project.
629
+ * @param projectId - The project the image is linked to
630
+ * @param blobId - The Binary object id. If the Binary object id is 0, any image link is removed from the project.
631
+ * @returns
632
+ */
633
+ public async changeProjectImageAsync(projectId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
634
+
635
+ public async changeProjectImageAsync(projectId:number|carriers.BLOB_ChangeProjectImageRequest, blobId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
636
+ let _request : carriers.BLOB_ChangeProjectImageRequest = null;
637
+ let _options : base.WebApiRequestOptions = null;
638
+ const first : any = projectId;
639
+ if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' || typeof(first.blobId)!='undefined' ) )
640
+ {
641
+ _request = projectId as carriers.BLOB_ChangeProjectImageRequest;
642
+ _options = blobId as base.WebApiRequestOptions;
643
+ }
644
+ else
645
+ {
646
+ _request = {
647
+ projectId: projectId as number,
648
+ blobId: blobId as number,
649
+ };
650
+ _options = webapi_options;
651
+ }
652
+ return this._changeProjectImageAsync( _request, _options );
653
+ }
654
+
655
+
656
+ private async _saveProjectImageAsync(request: carriers.BLOB_SaveProjectImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
657
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
658
+ base.WebApiBase.SetPending(options);
659
+ return new Promise< void >(async (resolve, reject) => {
660
+ try {
661
+ config.baseURL = this._options.baseUrl;
662
+ const response = await this._axios.post("SaveProjectImage", request , config);
663
+ base.WebApiBase.SetCompleted(options, response);
664
+ const res = response.data;
665
+ resolve(res);
666
+ }
667
+ catch( err ) {
668
+ base.WebApiBase.HandleError(options, config, err);
669
+ reject(err);
670
+ }
671
+ });
672
+ }
673
+
674
+
675
+
676
+ /**
677
+ * Saves a project image that is displayed in the CRM application&apos;s project image selection dialog to the database.
678
+ * @param request - Description, Image
679
+ * @returns
680
+ */
681
+ public async saveProjectImageAsync(request: carriers.BLOB_SaveProjectImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
682
+
683
+ /**
684
+ * Saves a project image that is displayed in the CRM application&apos;s project image selection dialog to the database.
685
+ * @param description - Image description. Should be image name (e.g. winter.jpg) for project images.
686
+ * @param image - The project image.
687
+ * @returns
688
+ */
689
+ public async saveProjectImageAsync(description: string, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
690
+
691
+ public async saveProjectImageAsync(description:string|carriers.BLOB_SaveProjectImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
692
+ let _request : carriers.BLOB_SaveProjectImageRequest = null;
693
+ let _options : base.WebApiRequestOptions = null;
694
+ const first : any = description;
695
+ if( typeof( first ) === "object" && first && ( typeof(first.description)!='undefined' || typeof(first.image)!='undefined' ) )
696
+ {
697
+ _request = description as carriers.BLOB_SaveProjectImageRequest;
698
+ _options = image as base.WebApiRequestOptions;
699
+ }
700
+ else
701
+ {
702
+ _request = {
703
+ description: description as string,
704
+ image: image as ArrayBuffer|string,
705
+ };
706
+ _options = webapi_options;
707
+ }
708
+ _request.image = ToBase64(_request.image);
709
+ return this._saveProjectImageAsync( _request, _options );
710
+ }
711
+
712
+
713
+ private async _getBlobEntityOnProjectAsync(request: carriers.BLOB_GetBlobEntityOnProjectRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
714
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
715
+ base.WebApiBase.SetPending(options);
716
+ return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
717
+ try {
718
+ config.baseURL = this._options.baseUrl;
719
+ const response = await this._axios.post("GetBlobEntityOnProject", request , config);
720
+ base.WebApiBase.SetCompleted(options, response);
721
+ const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
722
+ resolve(res);
723
+ }
724
+ catch( err ) {
725
+ base.WebApiBase.HandleError(options, config, err);
726
+ reject(err);
727
+ }
728
+ });
729
+ }
730
+
731
+
732
+
733
+ /**
734
+ * Gets the blob entity that represents the project image binary object.
735
+ * @param request - ProjectId
736
+ * @returns BlobEntity object
737
+ */
738
+ public async getBlobEntityOnProjectAsync(request: carriers.BLOB_GetBlobEntityOnProjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
739
+
740
+ /**
741
+ * Gets the blob entity that represents the project image binary object.
742
+ * @param projectId - The project id
743
+ * @returns BlobEntity object
744
+ */
745
+ public async getBlobEntityOnProjectAsync(projectId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
746
+
747
+ public async getBlobEntityOnProjectAsync(projectId:number|carriers.BLOB_GetBlobEntityOnProjectRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
748
+ let _request : carriers.BLOB_GetBlobEntityOnProjectRequest = null;
749
+ let _options : base.WebApiRequestOptions = null;
750
+ const first : any = projectId;
751
+ if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' ) )
752
+ {
753
+ _request = projectId as carriers.BLOB_GetBlobEntityOnProjectRequest;
754
+ _options = webapi_options as base.WebApiRequestOptions;
755
+ }
756
+ else
757
+ {
758
+ _request = {
759
+ projectId: projectId as number,
760
+ };
761
+ _options = webapi_options;
762
+ }
763
+ return this._getBlobEntityOnProjectAsync( _request, _options );
764
+ }
765
+
766
+
767
+ private async _getBlobEntityOnPersonAsync(request: carriers.BLOB_GetBlobEntityOnPersonRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
768
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
769
+ base.WebApiBase.SetPending(options);
770
+ return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
771
+ try {
772
+ config.baseURL = this._options.baseUrl;
773
+ const response = await this._axios.post("GetBlobEntityOnPerson", request , config);
774
+ base.WebApiBase.SetCompleted(options, response);
775
+ const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
776
+ resolve(res);
777
+ }
778
+ catch( err ) {
779
+ base.WebApiBase.HandleError(options, config, err);
780
+ reject(err);
781
+ }
782
+ });
783
+ }
784
+
785
+
786
+
787
+ /**
788
+ * Gets the blob entity that represents the person image binary object.
789
+ * @param request - PersonId
790
+ * @returns BlobEntity object
791
+ */
792
+ public async getBlobEntityOnPersonAsync(request: carriers.BLOB_GetBlobEntityOnPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
793
+
794
+ /**
795
+ * Gets the blob entity that represents the person image binary object.
796
+ * @param personId - The person id
797
+ * @returns BlobEntity object
798
+ */
799
+ public async getBlobEntityOnPersonAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
800
+
801
+ public async getBlobEntityOnPersonAsync(personId:number|carriers.BLOB_GetBlobEntityOnPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
802
+ let _request : carriers.BLOB_GetBlobEntityOnPersonRequest = null;
803
+ let _options : base.WebApiRequestOptions = null;
804
+ const first : any = personId;
805
+ if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' ) )
806
+ {
807
+ _request = personId as carriers.BLOB_GetBlobEntityOnPersonRequest;
808
+ _options = webapi_options as base.WebApiRequestOptions;
809
+ }
810
+ else
811
+ {
812
+ _request = {
813
+ personId: personId as number,
814
+ };
815
+ _options = webapi_options;
816
+ }
817
+ return this._getBlobEntityOnPersonAsync( _request, _options );
818
+ }
819
+
820
+
821
+ private async _getBlobEntityOnCountryAsync(request: carriers.BLOB_GetBlobEntityOnCountryRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
822
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
823
+ base.WebApiBase.SetPending(options);
824
+ return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
825
+ try {
826
+ config.baseURL = this._options.baseUrl;
827
+ const response = await this._axios.post("GetBlobEntityOnCountry", request , config);
828
+ base.WebApiBase.SetCompleted(options, response);
829
+ const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
830
+ resolve(res);
831
+ }
832
+ catch( err ) {
833
+ base.WebApiBase.HandleError(options, config, err);
834
+ reject(err);
835
+ }
836
+ });
837
+ }
838
+
839
+
840
+
841
+ /**
842
+ * Gets the blob entity that represents the country flag binary object.
843
+ * @param request - CountryId
844
+ * @returns BlobEntity object
845
+ */
846
+ public async getBlobEntityOnCountryAsync(request: carriers.BLOB_GetBlobEntityOnCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
847
+
848
+ /**
849
+ * Gets the blob entity that represents the country flag binary object.
850
+ * @param countryId - The country id
851
+ * @returns BlobEntity object
852
+ */
853
+ public async getBlobEntityOnCountryAsync(countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
854
+
855
+ public async getBlobEntityOnCountryAsync(countryId:number|carriers.BLOB_GetBlobEntityOnCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
856
+ let _request : carriers.BLOB_GetBlobEntityOnCountryRequest = null;
857
+ let _options : base.WebApiRequestOptions = null;
858
+ const first : any = countryId;
859
+ if( typeof( first ) === "object" && first && ( typeof(first.countryId)!='undefined' ) )
860
+ {
861
+ _request = countryId as carriers.BLOB_GetBlobEntityOnCountryRequest;
862
+ _options = webapi_options as base.WebApiRequestOptions;
863
+ }
864
+ else
865
+ {
866
+ _request = {
867
+ countryId: countryId as number,
868
+ };
869
+ _options = webapi_options;
870
+ }
871
+ return this._getBlobEntityOnCountryAsync( _request, _options );
872
+ }
873
+
874
+
875
+ private async _getBlobEntityOnProductAsync(request: carriers.BLOB_GetBlobEntityOnProductRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
876
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
877
+ base.WebApiBase.SetPending(options);
878
+ return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
879
+ try {
880
+ config.baseURL = this._options.baseUrl;
881
+ const response = await this._axios.post("GetBlobEntityOnProduct", request , config);
882
+ base.WebApiBase.SetCompleted(options, response);
883
+ const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
884
+ resolve(res);
885
+ }
886
+ catch( err ) {
887
+ base.WebApiBase.HandleError(options, config, err);
888
+ reject(err);
889
+ }
890
+ });
891
+ }
892
+
893
+
894
+
895
+ /**
896
+ * Gets the blob entity that represents the product image binary object.
897
+ * @param request - ProductId
898
+ * @returns BlobEntity object
899
+ */
900
+ public async getBlobEntityOnProductAsync(request: carriers.BLOB_GetBlobEntityOnProductRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
901
+
902
+ /**
903
+ * Gets the blob entity that represents the product image binary object.
904
+ * @param productId - The product id
905
+ * @returns BlobEntity object
906
+ */
907
+ public async getBlobEntityOnProductAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
908
+
909
+ public async getBlobEntityOnProductAsync(productId:number|carriers.BLOB_GetBlobEntityOnProductRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
910
+ let _request : carriers.BLOB_GetBlobEntityOnProductRequest = null;
911
+ let _options : base.WebApiRequestOptions = null;
912
+ const first : any = productId;
913
+ if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' ) )
914
+ {
915
+ _request = productId as carriers.BLOB_GetBlobEntityOnProductRequest;
916
+ _options = webapi_options as base.WebApiRequestOptions;
917
+ }
918
+ else
919
+ {
920
+ _request = {
921
+ productId: productId as number,
922
+ };
923
+ _options = webapi_options;
924
+ }
925
+ return this._getBlobEntityOnProductAsync( _request, _options );
926
+ }
927
+
928
+
929
+ private async _changePersonImageAsync(request: carriers.BLOB_ChangePersonImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
930
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
931
+ base.WebApiBase.SetPending(options);
932
+ return new Promise< void >(async (resolve, reject) => {
933
+ try {
934
+ config.baseURL = this._options.baseUrl;
935
+ const response = await this._axios.post("ChangePersonImage", request , config);
936
+ base.WebApiBase.SetCompleted(options, response);
937
+ const res = response.data;
938
+ resolve(res);
939
+ }
940
+ catch( err ) {
941
+ base.WebApiBase.HandleError(options, config, err);
942
+ reject(err);
943
+ }
944
+ });
945
+ }
946
+
947
+
948
+
949
+ /**
950
+ *
951
+ * @param request - PersonId, BlobId
952
+ * @returns
953
+ */
954
+ public async changePersonImageAsync(request: carriers.BLOB_ChangePersonImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
955
+
956
+ /**
957
+ *
958
+ * @param personId - The person the image is linked to
959
+ * @param blobId - The Binary object id. If the Binary object id is 0, any image link is removed from the person.
960
+ * @returns
961
+ */
962
+ public async changePersonImageAsync(personId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
963
+
964
+ public async changePersonImageAsync(personId:number|carriers.BLOB_ChangePersonImageRequest, blobId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
965
+ let _request : carriers.BLOB_ChangePersonImageRequest = null;
966
+ let _options : base.WebApiRequestOptions = null;
967
+ const first : any = personId;
968
+ if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' || typeof(first.blobId)!='undefined' ) )
969
+ {
970
+ _request = personId as carriers.BLOB_ChangePersonImageRequest;
971
+ _options = blobId as base.WebApiRequestOptions;
972
+ }
973
+ else
974
+ {
975
+ _request = {
976
+ personId: personId as number,
977
+ blobId: blobId as number,
978
+ };
979
+ _options = webapi_options;
980
+ }
981
+ return this._changePersonImageAsync( _request, _options );
982
+ }
983
+
984
+
985
+ private async _saveImageStreamAsync(request: carriers.BLOB_SaveImageStreamRequest, options?:base.WebApiRequestOptions) : Promise< number > {
986
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
987
+ base.WebApiBase.SetPending(options);
988
+ return new Promise< number >(async (resolve, reject) => {
989
+ try {
990
+ config.baseURL = this._options.baseUrl;
991
+ const response = await this._axios.post("SaveImageStream", request , config);
992
+ base.WebApiBase.SetCompleted(options, response);
993
+ const res : number = response.data as number;
994
+ resolve(res);
995
+ }
996
+ catch( err ) {
997
+ base.WebApiBase.HandleError(options, config, err);
998
+ reject(err);
999
+ }
1000
+ });
1001
+ }
1002
+
1003
+
1004
+
1005
+ /**
1006
+ * Stores an image in the database without linking it to a project or a person. It is possible to ChangePersonImage or ChangeProjectImage to attach image later.
1007
+ * @param request - Type, Image, Description
1008
+ * @returns The blob id.
1009
+ */
1010
+ public async saveImageStreamAsync(request: carriers.BLOB_SaveImageStreamRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1011
+
1012
+ /**
1013
+ * Stores an image in the database without linking it to a project or a person. It is possible to ChangePersonImage or ChangeProjectImage to attach image later.
1014
+ * @param type - The type of the image.
1015
+ * @param image - Image to store.
1016
+ * @param description - Image description.
1017
+ * @returns The blob id.
1018
+ */
1019
+ public async saveImageStreamAsync(type: enums.BlobLinkType, image: ArrayBuffer|string, description: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1020
+
1021
+ public async saveImageStreamAsync(type:enums.BlobLinkType|carriers.BLOB_SaveImageStreamRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, description?:string, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
1022
+ let _request : carriers.BLOB_SaveImageStreamRequest = null;
1023
+ let _options : base.WebApiRequestOptions = null;
1024
+ const first : any = type;
1025
+ if( typeof( first ) === "object" && first && ( typeof(first.type)!='undefined' || typeof(first.image)!='undefined' || typeof(first.description)!='undefined' ) )
1026
+ {
1027
+ _request = type as carriers.BLOB_SaveImageStreamRequest;
1028
+ _options = image as base.WebApiRequestOptions;
1029
+ }
1030
+ else
1031
+ {
1032
+ _request = {
1033
+ type: type as enums.BlobLinkType,
1034
+ image: image as ArrayBuffer|string,
1035
+ description: description as string,
1036
+ };
1037
+ _options = webapi_options;
1038
+ }
1039
+ _request.image = ToBase64(_request.image);
1040
+ return this._saveImageStreamAsync( _request, _options );
1041
+ }
1042
+
1043
+
1044
+ private async _getProductImageAsync(request: carriers.BLOB_GetProductImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1045
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1046
+ base.WebApiBase.SetPending(options);
1047
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1048
+ try {
1049
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1050
+ config.responseType = "arraybuffer";
1051
+ config.headers = config.headers || {};
1052
+ config.headers["Accept"] = "application/octet-stream";
1053
+ }
1054
+ config.baseURL = this._options.baseUrl;
1055
+ const response = await this._axios.post("GetProductImage", request , config);
1056
+ base.WebApiBase.SetCompleted(options, response);
1057
+ let res : ArrayBuffer | string = null;
1058
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1059
+ {
1060
+ res = response.data as string;
1061
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
1062
+ {
1063
+ res = FromBase64ToString(res);
1064
+ }
1065
+ }
1066
+ else
1067
+ {
1068
+ res = response.data as ArrayBuffer;
1069
+ }
1070
+
1071
+ resolve(res);
1072
+ }
1073
+ catch( err ) {
1074
+ base.WebApiBase.HandleError(options, config, err);
1075
+ reject(err);
1076
+ }
1077
+ });
1078
+ }
1079
+
1080
+
1081
+
1082
+ /**
1083
+ * Returns the product image (rank=1) that is displayed in the CRM application.
1084
+ * @param request - ProductId
1085
+ * @returns The product image.
1086
+ */
1087
+ public async getProductImageAsync(request: carriers.BLOB_GetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1088
+
1089
+ /**
1090
+ * Returns the product image (rank=1) that is displayed in the CRM application.
1091
+ * @param productId - The product id of the product the image belongs to.
1092
+ * @returns The product image.
1093
+ */
1094
+ public async getProductImageAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1095
+
1096
+ public async getProductImageAsync(productId:number|carriers.BLOB_GetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1097
+ let _request : carriers.BLOB_GetProductImageRequest = null;
1098
+ let _options : base.WebApiRequestOptions = null;
1099
+ const first : any = productId;
1100
+ if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' ) )
1101
+ {
1102
+ _request = productId as carriers.BLOB_GetProductImageRequest;
1103
+ _options = webapi_options as base.WebApiRequestOptions;
1104
+ }
1105
+ else
1106
+ {
1107
+ _request = {
1108
+ productId: productId as number,
1109
+ };
1110
+ _options = webapi_options;
1111
+ }
1112
+ return this._getProductImageAsync( _request, _options );
1113
+ }
1114
+
1115
+
1116
+ private async _setProductImageAsync(request: carriers.BLOB_SetProductImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1117
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1118
+ base.WebApiBase.SetPending(options);
1119
+ return new Promise< void >(async (resolve, reject) => {
1120
+ try {
1121
+ config.baseURL = this._options.baseUrl;
1122
+ const response = await this._axios.post("SetProductImage", request , config);
1123
+ base.WebApiBase.SetCompleted(options, response);
1124
+ const res = response.data;
1125
+ resolve(res);
1126
+ }
1127
+ catch( err ) {
1128
+ base.WebApiBase.HandleError(options, config, err);
1129
+ reject(err);
1130
+ }
1131
+ });
1132
+ }
1133
+
1134
+
1135
+
1136
+ /**
1137
+ * Stores the product image that is displayed in the CRM application. The image is scaled down to max 1000x1000. This method operates only the main (rank=1) image; future extensions may support multiple images. A thumbnail of size 75x75 is also automatically set.
1138
+ * @param request - ProductId, Image
1139
+ * @returns
1140
+ */
1141
+ public async setProductImageAsync(request: carriers.BLOB_SetProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1142
+
1143
+ /**
1144
+ * Stores the product image that is displayed in the CRM application. The image is scaled down to max 1000x1000. This method operates only the main (rank=1) image; future extensions may support multiple images. A thumbnail of size 75x75 is also automatically set.
1145
+ * @param productId - The product id of the product the image belongs to.
1146
+ * @param image - The product image, scaled down to no more than 1000x1000.
1147
+ * @returns
1148
+ */
1149
+ public async setProductImageAsync(productId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1150
+
1151
+ public async setProductImageAsync(productId:number|carriers.BLOB_SetProductImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1152
+ let _request : carriers.BLOB_SetProductImageRequest = null;
1153
+ let _options : base.WebApiRequestOptions = null;
1154
+ const first : any = productId;
1155
+ if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' || typeof(first.image)!='undefined' ) )
1156
+ {
1157
+ _request = productId as carriers.BLOB_SetProductImageRequest;
1158
+ _options = image as base.WebApiRequestOptions;
1159
+ }
1160
+ else
1161
+ {
1162
+ _request = {
1163
+ productId: productId as number,
1164
+ image: image as ArrayBuffer|string,
1165
+ };
1166
+ _options = webapi_options;
1167
+ }
1168
+ _request.image = ToBase64(_request.image);
1169
+ return this._setProductImageAsync( _request, _options );
1170
+ }
1171
+
1172
+
1173
+ private async _getProductThumbnailAsync(request: carriers.BLOB_GetProductThumbnailRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1174
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1175
+ base.WebApiBase.SetPending(options);
1176
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1177
+ try {
1178
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1179
+ config.responseType = "arraybuffer";
1180
+ config.headers = config.headers || {};
1181
+ config.headers["Accept"] = "application/octet-stream";
1182
+ }
1183
+ config.baseURL = this._options.baseUrl;
1184
+ const response = await this._axios.post("GetProductThumbnail", request , config);
1185
+ base.WebApiBase.SetCompleted(options, response);
1186
+ let res : ArrayBuffer | string = null;
1187
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1188
+ {
1189
+ res = response.data as string;
1190
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
1191
+ {
1192
+ res = FromBase64ToString(res);
1193
+ }
1194
+ }
1195
+ else
1196
+ {
1197
+ res = response.data as ArrayBuffer;
1198
+ }
1199
+
1200
+ resolve(res);
1201
+ }
1202
+ catch( err ) {
1203
+ base.WebApiBase.HandleError(options, config, err);
1204
+ reject(err);
1205
+ }
1206
+ });
1207
+ }
1208
+
1209
+
1210
+
1211
+ /**
1212
+ * Returns the product thumbnail that is displayed in the CRM application.
1213
+ * @param request - ProductId
1214
+ * @returns The product thumbnail.
1215
+ */
1216
+ public async getProductThumbnailAsync(request: carriers.BLOB_GetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1217
+
1218
+ /**
1219
+ * Returns the product thumbnail that is displayed in the CRM application.
1220
+ * @param productId - The product id of the product the thumbnail belongs to.
1221
+ * @returns The product thumbnail.
1222
+ */
1223
+ public async getProductThumbnailAsync(productId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1224
+
1225
+ public async getProductThumbnailAsync(productId:number|carriers.BLOB_GetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1226
+ let _request : carriers.BLOB_GetProductThumbnailRequest = null;
1227
+ let _options : base.WebApiRequestOptions = null;
1228
+ const first : any = productId;
1229
+ if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' ) )
1230
+ {
1231
+ _request = productId as carriers.BLOB_GetProductThumbnailRequest;
1232
+ _options = webapi_options as base.WebApiRequestOptions;
1233
+ }
1234
+ else
1235
+ {
1236
+ _request = {
1237
+ productId: productId as number,
1238
+ };
1239
+ _options = webapi_options;
1240
+ }
1241
+ return this._getProductThumbnailAsync( _request, _options );
1242
+ }
1243
+
1244
+
1245
+ private async _setProductThumbnailAsync(request: carriers.BLOB_SetProductThumbnailRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1246
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1247
+ base.WebApiBase.SetPending(options);
1248
+ return new Promise< void >(async (resolve, reject) => {
1249
+ try {
1250
+ config.baseURL = this._options.baseUrl;
1251
+ const response = await this._axios.post("SetProductThumbnail", request , config);
1252
+ base.WebApiBase.SetCompleted(options, response);
1253
+ const res = response.data;
1254
+ resolve(res);
1255
+ }
1256
+ catch( err ) {
1257
+ base.WebApiBase.HandleError(options, config, err);
1258
+ reject(err);
1259
+ }
1260
+ });
1261
+ }
1262
+
1263
+
1264
+
1265
+ /**
1266
+ * Stores the product thumbnail that is displayed in the CRM application. The image is scaled down to max 200x200 pixels.
1267
+ * @param request - ProductId, Image
1268
+ * @returns
1269
+ */
1270
+ public async setProductThumbnailAsync(request: carriers.BLOB_SetProductThumbnailRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1271
+
1272
+ /**
1273
+ * Stores the product thumbnail that is displayed in the CRM application. The image is scaled down to max 200x200 pixels.
1274
+ * @param productId - The product id of the product the image belongs to.
1275
+ * @param image - The product thumbnail, scaled down to no more than 200x200.
1276
+ * @returns
1277
+ */
1278
+ public async setProductThumbnailAsync(productId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1279
+
1280
+ public async setProductThumbnailAsync(productId:number|carriers.BLOB_SetProductThumbnailRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1281
+ let _request : carriers.BLOB_SetProductThumbnailRequest = null;
1282
+ let _options : base.WebApiRequestOptions = null;
1283
+ const first : any = productId;
1284
+ if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' || typeof(first.image)!='undefined' ) )
1285
+ {
1286
+ _request = productId as carriers.BLOB_SetProductThumbnailRequest;
1287
+ _options = image as base.WebApiRequestOptions;
1288
+ }
1289
+ else
1290
+ {
1291
+ _request = {
1292
+ productId: productId as number,
1293
+ image: image as ArrayBuffer|string,
1294
+ };
1295
+ _options = webapi_options;
1296
+ }
1297
+ _request.image = ToBase64(_request.image);
1298
+ return this._setProductThumbnailAsync( _request, _options );
1299
+ }
1300
+
1301
+
1302
+ private async _changeProductImageAsync(request: carriers.BLOB_ChangeProductImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1303
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1304
+ base.WebApiBase.SetPending(options);
1305
+ return new Promise< void >(async (resolve, reject) => {
1306
+ try {
1307
+ config.baseURL = this._options.baseUrl;
1308
+ const response = await this._axios.post("ChangeProductImage", request , config);
1309
+ base.WebApiBase.SetCompleted(options, response);
1310
+ const res = response.data;
1311
+ resolve(res);
1312
+ }
1313
+ catch( err ) {
1314
+ base.WebApiBase.HandleError(options, config, err);
1315
+ reject(err);
1316
+ }
1317
+ });
1318
+ }
1319
+
1320
+
1321
+
1322
+ /**
1323
+ *
1324
+ * @param request - ProductId, BlobId
1325
+ * @returns
1326
+ */
1327
+ public async changeProductImageAsync(request: carriers.BLOB_ChangeProductImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1328
+
1329
+ /**
1330
+ *
1331
+ * @param productId - The product the image is linked to
1332
+ * @param blobId - The Binary object id. If the Binary object id is 0, any image link is removed from the product.
1333
+ * @returns
1334
+ */
1335
+ public async changeProductImageAsync(productId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1336
+
1337
+ public async changeProductImageAsync(productId:number|carriers.BLOB_ChangeProductImageRequest, blobId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1338
+ let _request : carriers.BLOB_ChangeProductImageRequest = null;
1339
+ let _options : base.WebApiRequestOptions = null;
1340
+ const first : any = productId;
1341
+ if( typeof( first ) === "object" && first && ( typeof(first.productId)!='undefined' || typeof(first.blobId)!='undefined' ) )
1342
+ {
1343
+ _request = productId as carriers.BLOB_ChangeProductImageRequest;
1344
+ _options = blobId as base.WebApiRequestOptions;
1345
+ }
1346
+ else
1347
+ {
1348
+ _request = {
1349
+ productId: productId as number,
1350
+ blobId: blobId as number,
1351
+ };
1352
+ _options = webapi_options;
1353
+ }
1354
+ return this._changeProductImageAsync( _request, _options );
1355
+ }
1356
+
1357
+
1358
+ private async _getQuoteLineImageAsync(request: carriers.BLOB_GetQuoteLineImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1359
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1360
+ base.WebApiBase.SetPending(options);
1361
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1362
+ try {
1363
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1364
+ config.responseType = "arraybuffer";
1365
+ config.headers = config.headers || {};
1366
+ config.headers["Accept"] = "application/octet-stream";
1367
+ }
1368
+ config.baseURL = this._options.baseUrl;
1369
+ const response = await this._axios.post("GetQuoteLineImage", request , config);
1370
+ base.WebApiBase.SetCompleted(options, response);
1371
+ let res : ArrayBuffer | string = null;
1372
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1373
+ {
1374
+ res = response.data as string;
1375
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
1376
+ {
1377
+ res = FromBase64ToString(res);
1378
+ }
1379
+ }
1380
+ else
1381
+ {
1382
+ res = response.data as ArrayBuffer;
1383
+ }
1384
+
1385
+ resolve(res);
1386
+ }
1387
+ catch( err ) {
1388
+ base.WebApiBase.HandleError(options, config, err);
1389
+ reject(err);
1390
+ }
1391
+ });
1392
+ }
1393
+
1394
+
1395
+
1396
+ /**
1397
+ * Returns the quoteline image (rank=1) that is displayed in the CRM application.
1398
+ * @param request - QuoteLineId
1399
+ * @returns The quote line image.
1400
+ */
1401
+ public async getQuoteLineImageAsync(request: carriers.BLOB_GetQuoteLineImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1402
+
1403
+ /**
1404
+ * Returns the quoteline image (rank=1) that is displayed in the CRM application.
1405
+ * @param quoteLineId - The product id of the quoteline the image belongs to.
1406
+ * @returns The quote line image.
1407
+ */
1408
+ public async getQuoteLineImageAsync(quoteLineId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1409
+
1410
+ public async getQuoteLineImageAsync(quoteLineId:number|carriers.BLOB_GetQuoteLineImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1411
+ let _request : carriers.BLOB_GetQuoteLineImageRequest = null;
1412
+ let _options : base.WebApiRequestOptions = null;
1413
+ const first : any = quoteLineId;
1414
+ if( typeof( first ) === "object" && first && ( typeof(first.quoteLineId)!='undefined' ) )
1415
+ {
1416
+ _request = quoteLineId as carriers.BLOB_GetQuoteLineImageRequest;
1417
+ _options = webapi_options as base.WebApiRequestOptions;
1418
+ }
1419
+ else
1420
+ {
1421
+ _request = {
1422
+ quoteLineId: quoteLineId as number,
1423
+ };
1424
+ _options = webapi_options;
1425
+ }
1426
+ return this._getQuoteLineImageAsync( _request, _options );
1427
+ }
1428
+
1429
+
1430
+ private async _getPersonImageWithSizeAsync(request: carriers.BLOB_GetPersonImageWithSizeRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1431
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1432
+ base.WebApiBase.SetPending(options);
1433
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1434
+ try {
1435
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1436
+ config.responseType = "arraybuffer";
1437
+ config.headers = config.headers || {};
1438
+ config.headers["Accept"] = "application/octet-stream";
1439
+ }
1440
+ config.baseURL = this._options.baseUrl;
1441
+ const response = await this._axios.post("GetPersonImageWithSize", request , config);
1442
+ base.WebApiBase.SetCompleted(options, response);
1443
+ let res : ArrayBuffer | string = null;
1444
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1445
+ {
1446
+ res = response.data as string;
1447
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
1448
+ {
1449
+ res = FromBase64ToString(res);
1450
+ }
1451
+ }
1452
+ else
1453
+ {
1454
+ res = response.data as ArrayBuffer;
1455
+ }
1456
+
1457
+ resolve(res);
1458
+ }
1459
+ catch( err ) {
1460
+ base.WebApiBase.HandleError(options, config, err);
1461
+ reject(err);
1462
+ }
1463
+ });
1464
+ }
1465
+
1466
+
1467
+
1468
+ /**
1469
+ * Returns the person image that is displayed in the CRM application with a specified maximum size.
1470
+ * @param request - PersonId, Width, Height
1471
+ * @returns The person image.
1472
+ */
1473
+ public async getPersonImageWithSizeAsync(request: carriers.BLOB_GetPersonImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1474
+
1475
+ /**
1476
+ * Returns the person image that is displayed in the CRM application with a specified maximum size.
1477
+ * @param personId - The person id of the person the image belongs to.
1478
+ * @param width - The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1479
+ * @param height - The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1480
+ * @returns The person image.
1481
+ */
1482
+ public async getPersonImageWithSizeAsync(personId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1483
+
1484
+ public async getPersonImageWithSizeAsync(personId:number|carriers.BLOB_GetPersonImageWithSizeRequest, width?:number|base.WebApiRequestOptions, height?:number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1485
+ let _request : carriers.BLOB_GetPersonImageWithSizeRequest = null;
1486
+ let _options : base.WebApiRequestOptions = null;
1487
+ const first : any = personId;
1488
+ if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' || typeof(first.width)!='undefined' || typeof(first.height)!='undefined' ) )
1489
+ {
1490
+ _request = personId as carriers.BLOB_GetPersonImageWithSizeRequest;
1491
+ _options = width as base.WebApiRequestOptions;
1492
+ }
1493
+ else
1494
+ {
1495
+ _request = {
1496
+ personId: personId as number,
1497
+ width: width as number,
1498
+ height: height as number,
1499
+ };
1500
+ _options = webapi_options;
1501
+ }
1502
+ return this._getPersonImageWithSizeAsync( _request, _options );
1503
+ }
1504
+
1505
+
1506
+ private async _getProjectImageWithSizeAsync(request: carriers.BLOB_GetProjectImageWithSizeRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1507
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1508
+ base.WebApiBase.SetPending(options);
1509
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1510
+ try {
1511
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1512
+ config.responseType = "arraybuffer";
1513
+ config.headers = config.headers || {};
1514
+ config.headers["Accept"] = "application/octet-stream";
1515
+ }
1516
+ config.baseURL = this._options.baseUrl;
1517
+ const response = await this._axios.post("GetProjectImageWithSize", request , config);
1518
+ base.WebApiBase.SetCompleted(options, response);
1519
+ let res : ArrayBuffer | string = null;
1520
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1521
+ {
1522
+ res = response.data as string;
1523
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
1524
+ {
1525
+ res = FromBase64ToString(res);
1526
+ }
1527
+ }
1528
+ else
1529
+ {
1530
+ res = response.data as ArrayBuffer;
1531
+ }
1532
+
1533
+ resolve(res);
1534
+ }
1535
+ catch( err ) {
1536
+ base.WebApiBase.HandleError(options, config, err);
1537
+ reject(err);
1538
+ }
1539
+ });
1540
+ }
1541
+
1542
+
1543
+
1544
+ /**
1545
+ * Returns the project image that is displayed in the CRM application with a specified maximum size.
1546
+ * @param request - ProjectId, Width, Height
1547
+ * @returns The project image.
1548
+ */
1549
+ public async getProjectImageWithSizeAsync(request: carriers.BLOB_GetProjectImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1550
+
1551
+ /**
1552
+ * Returns the project image that is displayed in the CRM application with a specified maximum size.
1553
+ * @param projectId - The project id of the project the image belongs to.
1554
+ * @param width - The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1555
+ * @param height - The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1556
+ * @returns The project image.
1557
+ */
1558
+ public async getProjectImageWithSizeAsync(projectId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1559
+
1560
+ public async getProjectImageWithSizeAsync(projectId:number|carriers.BLOB_GetProjectImageWithSizeRequest, width?:number|base.WebApiRequestOptions, height?:number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1561
+ let _request : carriers.BLOB_GetProjectImageWithSizeRequest = null;
1562
+ let _options : base.WebApiRequestOptions = null;
1563
+ const first : any = projectId;
1564
+ if( typeof( first ) === "object" && first && ( typeof(first.projectId)!='undefined' || typeof(first.width)!='undefined' || typeof(first.height)!='undefined' ) )
1565
+ {
1566
+ _request = projectId as carriers.BLOB_GetProjectImageWithSizeRequest;
1567
+ _options = width as base.WebApiRequestOptions;
1568
+ }
1569
+ else
1570
+ {
1571
+ _request = {
1572
+ projectId: projectId as number,
1573
+ width: width as number,
1574
+ height: height as number,
1575
+ };
1576
+ _options = webapi_options;
1577
+ }
1578
+ return this._getProjectImageWithSizeAsync( _request, _options );
1579
+ }
1580
+
1581
+
1582
+ private async _getChatImageWithSizeAsync(request: carriers.BLOB_GetChatImageWithSizeRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1583
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1584
+ base.WebApiBase.SetPending(options);
1585
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1586
+ try {
1587
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1588
+ config.responseType = "arraybuffer";
1589
+ config.headers = config.headers || {};
1590
+ config.headers["Accept"] = "application/octet-stream";
1591
+ }
1592
+ config.baseURL = this._options.baseUrl;
1593
+ const response = await this._axios.post("GetChatImageWithSize", request , config);
1594
+ base.WebApiBase.SetCompleted(options, response);
1595
+ let res : ArrayBuffer | string = null;
1596
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1597
+ {
1598
+ res = response.data as string;
1599
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
1600
+ {
1601
+ res = FromBase64ToString(res);
1602
+ }
1603
+ }
1604
+ else
1605
+ {
1606
+ res = response.data as ArrayBuffer;
1607
+ }
1608
+
1609
+ resolve(res);
1610
+ }
1611
+ catch( err ) {
1612
+ base.WebApiBase.HandleError(options, config, err);
1613
+ reject(err);
1614
+ }
1615
+ });
1616
+ }
1617
+
1618
+
1619
+
1620
+ /**
1621
+ * Returns the chat image that is displayed in chat with a specified maximum size.
1622
+ * @param request - ChatTopicId, Width, Height
1623
+ * @returns The chat image.
1624
+ */
1625
+ public async getChatImageWithSizeAsync(request: carriers.BLOB_GetChatImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1626
+
1627
+ /**
1628
+ * Returns the chat image that is displayed in chat with a specified maximum size.
1629
+ * @param chatTopicId - The project id of the project the image belongs to.
1630
+ * @param width - The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1631
+ * @param height - The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1632
+ * @returns The chat image.
1633
+ */
1634
+ public async getChatImageWithSizeAsync(chatTopicId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1635
+
1636
+ public async getChatImageWithSizeAsync(chatTopicId:number|carriers.BLOB_GetChatImageWithSizeRequest, width?:number|base.WebApiRequestOptions, height?:number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1637
+ let _request : carriers.BLOB_GetChatImageWithSizeRequest = null;
1638
+ let _options : base.WebApiRequestOptions = null;
1639
+ const first : any = chatTopicId;
1640
+ if( typeof( first ) === "object" && first && ( typeof(first.chatTopicId)!='undefined' || typeof(first.width)!='undefined' || typeof(first.height)!='undefined' ) )
1641
+ {
1642
+ _request = chatTopicId as carriers.BLOB_GetChatImageWithSizeRequest;
1643
+ _options = width as base.WebApiRequestOptions;
1644
+ }
1645
+ else
1646
+ {
1647
+ _request = {
1648
+ chatTopicId: chatTopicId as number,
1649
+ width: width as number,
1650
+ height: height as number,
1651
+ };
1652
+ _options = webapi_options;
1653
+ }
1654
+ return this._getChatImageWithSizeAsync( _request, _options );
1655
+ }
1656
+
1657
+
1658
+ private async _getContactImageAsync(request: carriers.BLOB_GetContactImageRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1659
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1660
+ base.WebApiBase.SetPending(options);
1661
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1662
+ try {
1663
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1664
+ config.responseType = "arraybuffer";
1665
+ config.headers = config.headers || {};
1666
+ config.headers["Accept"] = "application/octet-stream";
1667
+ }
1668
+ config.baseURL = this._options.baseUrl;
1669
+ const response = await this._axios.post("GetContactImage", request , config);
1670
+ base.WebApiBase.SetCompleted(options, response);
1671
+ let res : ArrayBuffer | string = null;
1672
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1673
+ {
1674
+ res = response.data as string;
1675
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
1676
+ {
1677
+ res = FromBase64ToString(res);
1678
+ }
1679
+ }
1680
+ else
1681
+ {
1682
+ res = response.data as ArrayBuffer;
1683
+ }
1684
+
1685
+ resolve(res);
1686
+ }
1687
+ catch( err ) {
1688
+ base.WebApiBase.HandleError(options, config, err);
1689
+ reject(err);
1690
+ }
1691
+ });
1692
+ }
1693
+
1694
+
1695
+
1696
+ /**
1697
+ * Returns the contact image that is displayed in the CRM application.
1698
+ * @param request - ContactId
1699
+ * @returns The contact image.
1700
+ */
1701
+ public async getContactImageAsync(request: carriers.BLOB_GetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1702
+
1703
+ /**
1704
+ * Returns the contact image that is displayed in the CRM application.
1705
+ * @param contactId - The contact id of the contact the image belongs to.
1706
+ * @returns The contact image.
1707
+ */
1708
+ public async getContactImageAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1709
+
1710
+ public async getContactImageAsync(contactId:number|carriers.BLOB_GetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1711
+ let _request : carriers.BLOB_GetContactImageRequest = null;
1712
+ let _options : base.WebApiRequestOptions = null;
1713
+ const first : any = contactId;
1714
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
1715
+ {
1716
+ _request = contactId as carriers.BLOB_GetContactImageRequest;
1717
+ _options = webapi_options as base.WebApiRequestOptions;
1718
+ }
1719
+ else
1720
+ {
1721
+ _request = {
1722
+ contactId: contactId as number,
1723
+ };
1724
+ _options = webapi_options;
1725
+ }
1726
+ return this._getContactImageAsync( _request, _options );
1727
+ }
1728
+
1729
+
1730
+ private async _setContactImageAsync(request: carriers.BLOB_SetContactImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1731
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1732
+ base.WebApiBase.SetPending(options);
1733
+ return new Promise< void >(async (resolve, reject) => {
1734
+ try {
1735
+ config.baseURL = this._options.baseUrl;
1736
+ const response = await this._axios.post("SetContactImage", request , config);
1737
+ base.WebApiBase.SetCompleted(options, response);
1738
+ const res = response.data;
1739
+ resolve(res);
1740
+ }
1741
+ catch( err ) {
1742
+ base.WebApiBase.HandleError(options, config, err);
1743
+ reject(err);
1744
+ }
1745
+ });
1746
+ }
1747
+
1748
+
1749
+
1750
+ /**
1751
+ * Stores the contact image that is displayed in the CRM application.
1752
+ * @param request - ContactId, Image
1753
+ * @returns
1754
+ */
1755
+ public async setContactImageAsync(request: carriers.BLOB_SetContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1756
+
1757
+ /**
1758
+ * Stores the contact image that is displayed in the CRM application.
1759
+ * @param contactId - The contact id of the contact the image belongs to.
1760
+ * @param image - The contact image.
1761
+ * @returns
1762
+ */
1763
+ public async setContactImageAsync(contactId: number, image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1764
+
1765
+ public async setContactImageAsync(contactId:number|carriers.BLOB_SetContactImageRequest, image?:ArrayBuffer|string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1766
+ let _request : carriers.BLOB_SetContactImageRequest = null;
1767
+ let _options : base.WebApiRequestOptions = null;
1768
+ const first : any = contactId;
1769
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.image)!='undefined' ) )
1770
+ {
1771
+ _request = contactId as carriers.BLOB_SetContactImageRequest;
1772
+ _options = image as base.WebApiRequestOptions;
1773
+ }
1774
+ else
1775
+ {
1776
+ _request = {
1777
+ contactId: contactId as number,
1778
+ image: image as ArrayBuffer|string,
1779
+ };
1780
+ _options = webapi_options;
1781
+ }
1782
+ _request.image = ToBase64(_request.image);
1783
+ return this._setContactImageAsync( _request, _options );
1784
+ }
1785
+
1786
+
1787
+ private async _changeContactImageAsync(request: carriers.BLOB_ChangeContactImageRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1788
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1789
+ base.WebApiBase.SetPending(options);
1790
+ return new Promise< void >(async (resolve, reject) => {
1791
+ try {
1792
+ config.baseURL = this._options.baseUrl;
1793
+ const response = await this._axios.post("ChangeContactImage", request , config);
1794
+ base.WebApiBase.SetCompleted(options, response);
1795
+ const res = response.data;
1796
+ resolve(res);
1797
+ }
1798
+ catch( err ) {
1799
+ base.WebApiBase.HandleError(options, config, err);
1800
+ reject(err);
1801
+ }
1802
+ });
1803
+ }
1804
+
1805
+
1806
+
1807
+ /**
1808
+ * Changes the contact image link. If the Binary object id is 0, any image link is removed from the contact.
1809
+ * @param request - ContactId, BlobId
1810
+ * @returns
1811
+ */
1812
+ public async changeContactImageAsync(request: carriers.BLOB_ChangeContactImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1813
+
1814
+ /**
1815
+ * Changes the contact image link. If the Binary object id is 0, any image link is removed from the contact.
1816
+ * @param contactId - The Contact the image is linked to
1817
+ * @param blobId - The Binary object id. If the Binary object id is 0, any image link is removed from the Contact.
1818
+ * @returns
1819
+ */
1820
+ public async changeContactImageAsync(contactId: number, blobId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1821
+
1822
+ public async changeContactImageAsync(contactId:number|carriers.BLOB_ChangeContactImageRequest, blobId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1823
+ let _request : carriers.BLOB_ChangeContactImageRequest = null;
1824
+ let _options : base.WebApiRequestOptions = null;
1825
+ const first : any = contactId;
1826
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.blobId)!='undefined' ) )
1827
+ {
1828
+ _request = contactId as carriers.BLOB_ChangeContactImageRequest;
1829
+ _options = blobId as base.WebApiRequestOptions;
1830
+ }
1831
+ else
1832
+ {
1833
+ _request = {
1834
+ contactId: contactId as number,
1835
+ blobId: blobId as number,
1836
+ };
1837
+ _options = webapi_options;
1838
+ }
1839
+ return this._changeContactImageAsync( _request, _options );
1840
+ }
1841
+
1842
+
1843
+ private async _getBlobEntityOnContactAsync(request: carriers.BLOB_GetBlobEntityOnContactRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
1844
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1845
+ base.WebApiBase.SetPending(options);
1846
+ return new Promise< carriers.BlobEntity >(async (resolve, reject) => {
1847
+ try {
1848
+ config.baseURL = this._options.baseUrl;
1849
+ const response = await this._axios.post("GetBlobEntityOnContact", request , config);
1850
+ base.WebApiBase.SetCompleted(options, response);
1851
+ const res : carriers.BlobEntity = converters.Create_BlobEntity_From( response.data );
1852
+ resolve(res);
1853
+ }
1854
+ catch( err ) {
1855
+ base.WebApiBase.HandleError(options, config, err);
1856
+ reject(err);
1857
+ }
1858
+ });
1859
+ }
1860
+
1861
+
1862
+
1863
+ /**
1864
+ * Gets the blob entity that represents the contact image binary object.
1865
+ * @param request - ContactId
1866
+ * @returns BlobEntity object
1867
+ */
1868
+ public async getBlobEntityOnContactAsync(request: carriers.BLOB_GetBlobEntityOnContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
1869
+
1870
+ /**
1871
+ * Gets the blob entity that represents the contact image binary object.
1872
+ * @param contactId - The Contact id
1873
+ * @returns BlobEntity object
1874
+ */
1875
+ public async getBlobEntityOnContactAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity >;
1876
+
1877
+ public async getBlobEntityOnContactAsync(contactId:number|carriers.BLOB_GetBlobEntityOnContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BlobEntity > {
1878
+ let _request : carriers.BLOB_GetBlobEntityOnContactRequest = null;
1879
+ let _options : base.WebApiRequestOptions = null;
1880
+ const first : any = contactId;
1881
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
1882
+ {
1883
+ _request = contactId as carriers.BLOB_GetBlobEntityOnContactRequest;
1884
+ _options = webapi_options as base.WebApiRequestOptions;
1885
+ }
1886
+ else
1887
+ {
1888
+ _request = {
1889
+ contactId: contactId as number,
1890
+ };
1891
+ _options = webapi_options;
1892
+ }
1893
+ return this._getBlobEntityOnContactAsync( _request, _options );
1894
+ }
1895
+
1896
+
1897
+ private async _getContactImageWithSizeAsync(request: carriers.BLOB_GetContactImageWithSizeRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1898
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1899
+ base.WebApiBase.SetPending(options);
1900
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1901
+ try {
1902
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1903
+ config.responseType = "arraybuffer";
1904
+ config.headers = config.headers || {};
1905
+ config.headers["Accept"] = "application/octet-stream";
1906
+ }
1907
+ config.baseURL = this._options.baseUrl;
1908
+ const response = await this._axios.post("GetContactImageWithSize", request , config);
1909
+ base.WebApiBase.SetCompleted(options, response);
1910
+ let res : ArrayBuffer | string = null;
1911
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1912
+ {
1913
+ res = response.data as string;
1914
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
1915
+ {
1916
+ res = FromBase64ToString(res);
1917
+ }
1918
+ }
1919
+ else
1920
+ {
1921
+ res = response.data as ArrayBuffer;
1922
+ }
1923
+
1924
+ resolve(res);
1925
+ }
1926
+ catch( err ) {
1927
+ base.WebApiBase.HandleError(options, config, err);
1928
+ reject(err);
1929
+ }
1930
+ });
1931
+ }
1932
+
1933
+
1934
+
1935
+ /**
1936
+ * Returns the contact image that is displayed in the CRM application with a specified maximum size.
1937
+ * @param request - ContactId, Width, Height
1938
+ * @returns The contact image.
1939
+ */
1940
+ public async getContactImageWithSizeAsync(request: carriers.BLOB_GetContactImageWithSizeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1941
+
1942
+ /**
1943
+ * Returns the contact image that is displayed in the CRM application with a specified maximum size.
1944
+ * @param contactId - The contact id of the Contact the image belongs to.
1945
+ * @param width - The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1946
+ * @param height - The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
1947
+ * @returns The contact image.
1948
+ */
1949
+ public async getContactImageWithSizeAsync(contactId: number, width: number, height: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
1950
+
1951
+ public async getContactImageWithSizeAsync(contactId:number|carriers.BLOB_GetContactImageWithSizeRequest, width?:number|base.WebApiRequestOptions, height?:number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1952
+ let _request : carriers.BLOB_GetContactImageWithSizeRequest = null;
1953
+ let _options : base.WebApiRequestOptions = null;
1954
+ const first : any = contactId;
1955
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.width)!='undefined' || typeof(first.height)!='undefined' ) )
1956
+ {
1957
+ _request = contactId as carriers.BLOB_GetContactImageWithSizeRequest;
1958
+ _options = width as base.WebApiRequestOptions;
1959
+ }
1960
+ else
1961
+ {
1962
+ _request = {
1963
+ contactId: contactId as number,
1964
+ width: width as number,
1965
+ height: height as number,
1966
+ };
1967
+ _options = webapi_options;
1968
+ }
1969
+ return this._getContactImageWithSizeAsync( _request, _options );
1970
+ }
1971
+
1972
+
1973
+ private async _getOutputFromBatchAsync(request: carriers.BLOB_GetOutputFromBatchRequest, options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
1974
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options) || {};
1975
+ base.WebApiBase.SetPending(options);
1976
+ return new Promise< ArrayBuffer|string >(async (resolve, reject) => {
1977
+ try {
1978
+ if( ! options || options.returnBlobAs == base.ReturnBlobType.AsArrayBuffer ) {
1979
+ config.responseType = "arraybuffer";
1980
+ config.headers = config.headers || {};
1981
+ config.headers["Accept"] = "application/octet-stream";
1982
+ }
1983
+ config.baseURL = this._options.baseUrl;
1984
+ const response = await this._axios.post("GetOutputFromBatch", request , config);
1985
+ base.WebApiBase.SetCompleted(options, response);
1986
+ let res : ArrayBuffer | string = null;
1987
+ if( options && options.returnBlobAs != base.ReturnBlobType.AsArrayBuffer )
1988
+ {
1989
+ res = response.data as string;
1990
+ if( options.returnBlobAs == base.ReturnBlobType.AsString )
1991
+ {
1992
+ res = FromBase64ToString(res);
1993
+ }
1994
+ }
1995
+ else
1996
+ {
1997
+ res = response.data as ArrayBuffer;
1998
+ }
1999
+
2000
+ resolve(res);
2001
+ }
2002
+ catch( err ) {
2003
+ base.WebApiBase.HandleError(options, config, err);
2004
+ reject(err);
2005
+ }
2006
+ });
2007
+ }
2008
+
2009
+
2010
+
2011
+ /**
2012
+ * Get the output of a batchtask as a stream
2013
+ * @param request - BatchTaskId
2014
+ * @returns The binary object as a Stream.
2015
+ */
2016
+ public async getOutputFromBatchAsync(request: carriers.BLOB_GetOutputFromBatchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
2017
+
2018
+ /**
2019
+ * Get the output of a batchtask as a stream
2020
+ * @param batchTaskId - The ID of the batchtask that created the output data
2021
+ * @returns The binary object as a Stream.
2022
+ */
2023
+ public async getOutputFromBatchAsync(batchTaskId: number, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string >;
2024
+
2025
+ public async getOutputFromBatchAsync(batchTaskId:number|carriers.BLOB_GetOutputFromBatchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< ArrayBuffer|string > {
2026
+ let _request : carriers.BLOB_GetOutputFromBatchRequest = null;
2027
+ let _options : base.WebApiRequestOptions = null;
2028
+ const first : any = batchTaskId;
2029
+ if( typeof( first ) === "object" && first && ( typeof(first.batchTaskId)!='undefined' ) )
2030
+ {
2031
+ _request = batchTaskId as carriers.BLOB_GetOutputFromBatchRequest;
2032
+ _options = webapi_options as base.WebApiRequestOptions;
2033
+ }
2034
+ else
2035
+ {
2036
+ _request = {
2037
+ batchTaskId: batchTaskId as number,
2038
+ };
2039
+ _options = webapi_options;
2040
+ }
2041
+ return this._getOutputFromBatchAsync( _request, _options );
2042
+ }
2043
+
2044
+
2045
+ private async _cleanupBatchTaskAsync(request: carriers.BLOB_CleanupBatchTaskRequest, options?:base.WebApiRequestOptions) : Promise< void > {
2046
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
2047
+ base.WebApiBase.SetPending(options);
2048
+ return new Promise< void >(async (resolve, reject) => {
2049
+ try {
2050
+ config.baseURL = this._options.baseUrl;
2051
+ const response = await this._axios.post("CleanupBatchTask", request , config);
2052
+ base.WebApiBase.SetCompleted(options, response);
2053
+ const res = response.data;
2054
+ resolve(res);
2055
+ }
2056
+ catch( err ) {
2057
+ base.WebApiBase.HandleError(options, config, err);
2058
+ reject(err);
2059
+ }
2060
+ });
2061
+ }
2062
+
2063
+
2064
+
2065
+ /**
2066
+ * Removes the binary objects linked to the batch task, the links themselves and the batch task.
2067
+ * @param request - BatchTaskId
2068
+ * @returns
2069
+ */
2070
+ public async cleanupBatchTaskAsync(request: carriers.BLOB_CleanupBatchTaskRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
2071
+
2072
+ /**
2073
+ * Removes the binary objects linked to the batch task, the links themselves and the batch task.
2074
+ * @param batchTaskId - The ID of the batchtask that created the output data
2075
+ * @returns
2076
+ */
2077
+ public async cleanupBatchTaskAsync(batchTaskId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
2078
+
2079
+ public async cleanupBatchTaskAsync(batchTaskId:number|carriers.BLOB_CleanupBatchTaskRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
2080
+ let _request : carriers.BLOB_CleanupBatchTaskRequest = null;
2081
+ let _options : base.WebApiRequestOptions = null;
2082
+ const first : any = batchTaskId;
2083
+ if( typeof( first ) === "object" && first && ( typeof(first.batchTaskId)!='undefined' ) )
2084
+ {
2085
+ _request = batchTaskId as carriers.BLOB_CleanupBatchTaskRequest;
2086
+ _options = webapi_options as base.WebApiRequestOptions;
2087
+ }
2088
+ else
2089
+ {
2090
+ _request = {
2091
+ batchTaskId: batchTaskId as number,
2092
+ };
2093
+ _options = webapi_options;
2094
+ }
2095
+ return this._cleanupBatchTaskAsync( _request, _options );
2096
+ }
2097
+
2098
+ } // class v1BLOBAgentController
2099
+
2100
+