xero-node 5.0.1 → 6.0.0

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 (44) hide show
  1. package/README.md +10 -10
  2. package/dist/gen/api/accountingApi.d.ts +40 -25
  3. package/dist/gen/api/accountingApi.js +186 -73
  4. package/dist/gen/api/accountingApi.js.map +1 -1
  5. package/dist/gen/api/appStoreApi.d.ts +1 -1
  6. package/dist/gen/api/appStoreApi.js +2 -2
  7. package/dist/gen/api/appStoreApi.js.map +1 -1
  8. package/dist/gen/api/assetApi.d.ts +1 -1
  9. package/dist/gen/api/assetApi.js +2 -2
  10. package/dist/gen/api/assetApi.js.map +1 -1
  11. package/dist/gen/api/bankfeedsApi.d.ts +1 -1
  12. package/dist/gen/api/bankfeedsApi.js +2 -2
  13. package/dist/gen/api/bankfeedsApi.js.map +1 -1
  14. package/dist/gen/api/filesApi.d.ts +5 -3
  15. package/dist/gen/api/filesApi.js +2 -2
  16. package/dist/gen/api/filesApi.js.map +1 -1
  17. package/dist/gen/api/financeApi.d.ts +1 -1
  18. package/dist/gen/api/financeApi.js +2 -2
  19. package/dist/gen/api/financeApi.js.map +1 -1
  20. package/dist/gen/api/payrollAUApi.d.ts +1 -1
  21. package/dist/gen/api/payrollAUApi.js +2 -2
  22. package/dist/gen/api/payrollAUApi.js.map +1 -1
  23. package/dist/gen/api/payrollNZApi.d.ts +1 -1
  24. package/dist/gen/api/payrollNZApi.js +2 -2
  25. package/dist/gen/api/payrollNZApi.js.map +1 -1
  26. package/dist/gen/api/payrollUKApi.d.ts +1 -1
  27. package/dist/gen/api/payrollUKApi.js +2 -2
  28. package/dist/gen/api/payrollUKApi.js.map +1 -1
  29. package/dist/gen/api/projectApi.d.ts +1 -1
  30. package/dist/gen/api/projectApi.js +2 -2
  31. package/dist/gen/api/projectApi.js.map +1 -1
  32. package/dist/gen/model/accounting/payment.d.ts +4 -0
  33. package/dist/gen/model/accounting/payment.js +5 -0
  34. package/dist/gen/model/accounting/payment.js.map +1 -1
  35. package/dist/gen/model/accounting/taxRate.d.ts +2 -1
  36. package/dist/gen/model/accounting/taxRate.js +1 -0
  37. package/dist/gen/model/accounting/taxRate.js.map +1 -1
  38. package/dist/gen/model/accounting/taxType.d.ts +4 -1
  39. package/dist/gen/model/accounting/taxType.js +3 -0
  40. package/dist/gen/model/accounting/taxType.js.map +1 -1
  41. package/dist/gen/model/payroll-au/allowanceType.d.ts +0 -1
  42. package/dist/gen/model/payroll-au/allowanceType.js +0 -1
  43. package/dist/gen/model/payroll-au/allowanceType.js.map +1 -1
  44. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  * Xero Accounting API
4
4
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
  *
6
- * The version of the OpenAPI document: 3.0.0
6
+ * The version of the OpenAPI document: 3.0.3
7
7
  * Contact: api@xero.com
8
8
  *
9
9
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -27,6 +27,7 @@ exports.AccountingApi = exports.AccountingApiApiKeys = void 0;
27
27
  const models_1 = require("../model/accounting/models");
28
28
  const ApiError_1 = require("../../model/ApiError");
29
29
  const axios_1 = __importDefault(require("axios"));
30
+ const stream_1 = require("stream");
30
31
  const models_2 = require("../model/accounting/models");
31
32
  let defaultBasePath = 'https://api.xero.com/api.xro/2.0';
32
33
  // ===============================================
@@ -38,7 +39,7 @@ var AccountingApiApiKeys;
38
39
  class AccountingApi {
39
40
  constructor(basePathOrUsername, password, basePath) {
40
41
  this._basePath = defaultBasePath;
41
- this.defaultHeaders = { 'user-agent': 'xero-node-5.0.1' };
42
+ this.defaultHeaders = { 'user-agent': 'xero-node-6.0.0' };
42
43
  this._useQuerystring = false;
43
44
  this.binaryHeaders = {};
44
45
  this.authentications = {
@@ -218,14 +219,16 @@ class AccountingApi {
218
219
  // Reads file stream as chunks so we can put it in body of request.
219
220
  // This collects the whole file into memory, which is why we do it _after_ authentication.
220
221
  return new Promise((resolve, reject) => {
222
+ let bodyStream;
223
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
221
224
  const fileContents = [];
222
- body.on('data', (chunk) => {
225
+ bodyStream.on('data', (chunk) => {
223
226
  fileContents.push(chunk);
224
227
  });
225
- body.on('end', () => {
228
+ bodyStream.on('end', () => {
226
229
  resolve(fileContents);
227
230
  });
228
- body.on('error', (err) => {
231
+ bodyStream.on('error', (err) => {
229
232
  reject(err);
230
233
  });
231
234
  });
@@ -328,14 +331,16 @@ class AccountingApi {
328
331
  // Reads file stream as chunks so we can put it in body of request.
329
332
  // This collects the whole file into memory, which is why we do it _after_ authentication.
330
333
  return new Promise((resolve, reject) => {
334
+ let bodyStream;
335
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
331
336
  const fileContents = [];
332
- body.on('data', (chunk) => {
337
+ bodyStream.on('data', (chunk) => {
333
338
  fileContents.push(chunk);
334
339
  });
335
- body.on('end', () => {
340
+ bodyStream.on('end', () => {
336
341
  resolve(fileContents);
337
342
  });
338
- body.on('error', (err) => {
343
+ bodyStream.on('error', (err) => {
339
344
  reject(err);
340
345
  });
341
346
  });
@@ -670,14 +675,16 @@ class AccountingApi {
670
675
  // Reads file stream as chunks so we can put it in body of request.
671
676
  // This collects the whole file into memory, which is why we do it _after_ authentication.
672
677
  return new Promise((resolve, reject) => {
678
+ let bodyStream;
679
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
673
680
  const fileContents = [];
674
- body.on('data', (chunk) => {
681
+ bodyStream.on('data', (chunk) => {
675
682
  fileContents.push(chunk);
676
683
  });
677
- body.on('end', () => {
684
+ bodyStream.on('end', () => {
678
685
  resolve(fileContents);
679
686
  });
680
- body.on('error', (err) => {
687
+ bodyStream.on('error', (err) => {
681
688
  reject(err);
682
689
  });
683
690
  });
@@ -1093,14 +1100,16 @@ class AccountingApi {
1093
1100
  // Reads file stream as chunks so we can put it in body of request.
1094
1101
  // This collects the whole file into memory, which is why we do it _after_ authentication.
1095
1102
  return new Promise((resolve, reject) => {
1103
+ let bodyStream;
1104
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
1096
1105
  const fileContents = [];
1097
- body.on('data', (chunk) => {
1106
+ bodyStream.on('data', (chunk) => {
1098
1107
  fileContents.push(chunk);
1099
1108
  });
1100
- body.on('end', () => {
1109
+ bodyStream.on('end', () => {
1101
1110
  resolve(fileContents);
1102
1111
  });
1103
- body.on('error', (err) => {
1112
+ bodyStream.on('error', (err) => {
1104
1113
  reject(err);
1105
1114
  });
1106
1115
  });
@@ -1598,14 +1607,16 @@ class AccountingApi {
1598
1607
  // Reads file stream as chunks so we can put it in body of request.
1599
1608
  // This collects the whole file into memory, which is why we do it _after_ authentication.
1600
1609
  return new Promise((resolve, reject) => {
1610
+ let bodyStream;
1611
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
1601
1612
  const fileContents = [];
1602
- body.on('data', (chunk) => {
1613
+ bodyStream.on('data', (chunk) => {
1603
1614
  fileContents.push(chunk);
1604
1615
  });
1605
- body.on('end', () => {
1616
+ bodyStream.on('end', () => {
1606
1617
  resolve(fileContents);
1607
1618
  });
1608
- body.on('error', (err) => {
1619
+ bodyStream.on('error', (err) => {
1609
1620
  reject(err);
1610
1621
  });
1611
1622
  });
@@ -2174,14 +2185,16 @@ class AccountingApi {
2174
2185
  // Reads file stream as chunks so we can put it in body of request.
2175
2186
  // This collects the whole file into memory, which is why we do it _after_ authentication.
2176
2187
  return new Promise((resolve, reject) => {
2188
+ let bodyStream;
2189
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
2177
2190
  const fileContents = [];
2178
- body.on('data', (chunk) => {
2191
+ bodyStream.on('data', (chunk) => {
2179
2192
  fileContents.push(chunk);
2180
2193
  });
2181
- body.on('end', () => {
2194
+ bodyStream.on('end', () => {
2182
2195
  resolve(fileContents);
2183
2196
  });
2184
- body.on('error', (err) => {
2197
+ bodyStream.on('error', (err) => {
2185
2198
  reject(err);
2186
2199
  });
2187
2200
  });
@@ -2677,14 +2690,16 @@ class AccountingApi {
2677
2690
  // Reads file stream as chunks so we can put it in body of request.
2678
2691
  // This collects the whole file into memory, which is why we do it _after_ authentication.
2679
2692
  return new Promise((resolve, reject) => {
2693
+ let bodyStream;
2694
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
2680
2695
  const fileContents = [];
2681
- body.on('data', (chunk) => {
2696
+ bodyStream.on('data', (chunk) => {
2682
2697
  fileContents.push(chunk);
2683
2698
  });
2684
- body.on('end', () => {
2699
+ bodyStream.on('end', () => {
2685
2700
  resolve(fileContents);
2686
2701
  });
2687
- body.on('error', (err) => {
2702
+ bodyStream.on('error', (err) => {
2688
2703
  reject(err);
2689
2704
  });
2690
2705
  });
@@ -3569,14 +3584,16 @@ class AccountingApi {
3569
3584
  // Reads file stream as chunks so we can put it in body of request.
3570
3585
  // This collects the whole file into memory, which is why we do it _after_ authentication.
3571
3586
  return new Promise((resolve, reject) => {
3587
+ let bodyStream;
3588
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
3572
3589
  const fileContents = [];
3573
- body.on('data', (chunk) => {
3590
+ bodyStream.on('data', (chunk) => {
3574
3591
  fileContents.push(chunk);
3575
3592
  });
3576
- body.on('end', () => {
3593
+ bodyStream.on('end', () => {
3577
3594
  resolve(fileContents);
3578
3595
  });
3579
- body.on('error', (err) => {
3596
+ bodyStream.on('error', (err) => {
3580
3597
  reject(err);
3581
3598
  });
3582
3599
  });
@@ -3835,14 +3852,16 @@ class AccountingApi {
3835
3852
  // Reads file stream as chunks so we can put it in body of request.
3836
3853
  // This collects the whole file into memory, which is why we do it _after_ authentication.
3837
3854
  return new Promise((resolve, reject) => {
3855
+ let bodyStream;
3856
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
3838
3857
  const fileContents = [];
3839
- body.on('data', (chunk) => {
3858
+ bodyStream.on('data', (chunk) => {
3840
3859
  fileContents.push(chunk);
3841
3860
  });
3842
- body.on('end', () => {
3861
+ bodyStream.on('end', () => {
3843
3862
  resolve(fileContents);
3844
3863
  });
3845
- body.on('error', (err) => {
3864
+ bodyStream.on('error', (err) => {
3846
3865
  reject(err);
3847
3866
  });
3848
3867
  });
@@ -4178,14 +4197,16 @@ class AccountingApi {
4178
4197
  // Reads file stream as chunks so we can put it in body of request.
4179
4198
  // This collects the whole file into memory, which is why we do it _after_ authentication.
4180
4199
  return new Promise((resolve, reject) => {
4200
+ let bodyStream;
4201
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
4181
4202
  const fileContents = [];
4182
- body.on('data', (chunk) => {
4203
+ bodyStream.on('data', (chunk) => {
4183
4204
  fileContents.push(chunk);
4184
4205
  });
4185
- body.on('end', () => {
4206
+ bodyStream.on('end', () => {
4186
4207
  resolve(fileContents);
4187
4208
  });
4188
- body.on('error', (err) => {
4209
+ bodyStream.on('error', (err) => {
4189
4210
  reject(err);
4190
4211
  });
4191
4212
  });
@@ -4367,14 +4388,16 @@ class AccountingApi {
4367
4388
  // Reads file stream as chunks so we can put it in body of request.
4368
4389
  // This collects the whole file into memory, which is why we do it _after_ authentication.
4369
4390
  return new Promise((resolve, reject) => {
4391
+ let bodyStream;
4392
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
4370
4393
  const fileContents = [];
4371
- body.on('data', (chunk) => {
4394
+ bodyStream.on('data', (chunk) => {
4372
4395
  fileContents.push(chunk);
4373
4396
  });
4374
- body.on('end', () => {
4397
+ bodyStream.on('end', () => {
4375
4398
  resolve(fileContents);
4376
4399
  });
4377
- body.on('error', (err) => {
4400
+ bodyStream.on('error', (err) => {
4378
4401
  reject(err);
4379
4402
  });
4380
4403
  });
@@ -15282,15 +15305,86 @@ class AccountingApi {
15282
15305
  });
15283
15306
  });
15284
15307
  }
15308
+ /**
15309
+ *
15310
+ * @summary Retrieves a specific tax rate according to given TaxType code
15311
+ * @param xeroTenantId Xero identifier for Tenant
15312
+ * @param taxType A valid TaxType code
15313
+ */
15314
+ getTaxRateByTaxType(xeroTenantId, taxType, options = { headers: {} }) {
15315
+ return __awaiter(this, void 0, void 0, function* () {
15316
+ const localVarPath = this.basePath + '/TaxRates/{TaxType}'
15317
+ .replace('{' + 'TaxType' + '}', encodeURIComponent(String(taxType)));
15318
+ let localVarQueryParameters = {};
15319
+ let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
15320
+ let localVarFormParams = {};
15321
+ let acceptHeadersFromSpec = [
15322
+ "application/json"
15323
+ ];
15324
+ const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
15325
+ const responseTypeOption = isBufferType ? "arraybuffer" : "json";
15326
+ // verify required parameter 'xeroTenantId' is not null or undefined
15327
+ if (xeroTenantId === null || xeroTenantId === undefined) {
15328
+ throw new Error('Required parameter xeroTenantId was null or undefined when calling getTaxRateByTaxType.');
15329
+ }
15330
+ // verify required parameter 'taxType' is not null or undefined
15331
+ if (taxType === null || taxType === undefined) {
15332
+ throw new Error('Required parameter taxType was null or undefined when calling getTaxRateByTaxType.');
15333
+ }
15334
+ localVarHeaderParams['xero-tenant-id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
15335
+ localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
15336
+ Object.assign(localVarHeaderParams, options.headers);
15337
+ let localVarUseFormData = false;
15338
+ let localVarRequestOptions = {
15339
+ method: 'GET',
15340
+ params: localVarQueryParameters,
15341
+ headers: localVarHeaderParams,
15342
+ url: localVarPath,
15343
+ responseType: responseTypeOption,
15344
+ data: {},
15345
+ };
15346
+ let authenticationPromise = Promise.resolve();
15347
+ authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
15348
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
15349
+ return authenticationPromise.then(() => {
15350
+ if (Object.keys(localVarFormParams).length) {
15351
+ if (localVarUseFormData) {
15352
+ localVarRequestOptions.data = localVarFormParams;
15353
+ localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
15354
+ }
15355
+ else {
15356
+ localVarRequestOptions.data = localVarFormParams;
15357
+ localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
15358
+ }
15359
+ }
15360
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
15361
+ let body = null;
15362
+ try {
15363
+ const response = yield (0, axios_1.default)(localVarRequestOptions);
15364
+ body = models_1.ObjectSerializer.deserialize(response.data, "TaxRates");
15365
+ if (response.status && response.status >= 200 && response.status <= 299) {
15366
+ resolve({ response: response, body: body });
15367
+ }
15368
+ else {
15369
+ reject({ response: response, body: body });
15370
+ }
15371
+ }
15372
+ catch (error) {
15373
+ const errorResponse = new ApiError_1.ApiError(error);
15374
+ reject(JSON.stringify(errorResponse.generateError()));
15375
+ }
15376
+ }));
15377
+ });
15378
+ });
15379
+ }
15285
15380
  /**
15286
15381
  *
15287
15382
  * @summary Retrieves tax rates
15288
15383
  * @param xeroTenantId Xero identifier for Tenant
15289
15384
  * @param where Filter by an any element
15290
15385
  * @param order Order by an any element
15291
- * @param taxType Filter by tax type
15292
15386
  */
15293
- getTaxRates(xeroTenantId, where, order, taxType, options = { headers: {} }) {
15387
+ getTaxRates(xeroTenantId, where, order, options = { headers: {} }) {
15294
15388
  return __awaiter(this, void 0, void 0, function* () {
15295
15389
  const localVarPath = this.basePath + '/TaxRates';
15296
15390
  let localVarQueryParameters = {};
@@ -15311,9 +15405,6 @@ class AccountingApi {
15311
15405
  if (order !== undefined) {
15312
15406
  localVarQueryParameters['order'] = models_1.ObjectSerializer.serialize(order, "string");
15313
15407
  }
15314
- if (taxType !== undefined) {
15315
- localVarQueryParameters['TaxType'] = models_1.ObjectSerializer.serialize(taxType, "string");
15316
- }
15317
15408
  localVarHeaderParams['xero-tenant-id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
15318
15409
  localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
15319
15410
  Object.assign(localVarHeaderParams, options.headers);
@@ -15881,14 +15972,16 @@ class AccountingApi {
15881
15972
  // Reads file stream as chunks so we can put it in body of request.
15882
15973
  // This collects the whole file into memory, which is why we do it _after_ authentication.
15883
15974
  return new Promise((resolve, reject) => {
15975
+ let bodyStream;
15976
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
15884
15977
  const fileContents = [];
15885
- body.on('data', (chunk) => {
15978
+ bodyStream.on('data', (chunk) => {
15886
15979
  fileContents.push(chunk);
15887
15980
  });
15888
- body.on('end', () => {
15981
+ bodyStream.on('end', () => {
15889
15982
  resolve(fileContents);
15890
15983
  });
15891
- body.on('error', (err) => {
15984
+ bodyStream.on('error', (err) => {
15892
15985
  reject(err);
15893
15986
  });
15894
15987
  });
@@ -16074,14 +16167,16 @@ class AccountingApi {
16074
16167
  // Reads file stream as chunks so we can put it in body of request.
16075
16168
  // This collects the whole file into memory, which is why we do it _after_ authentication.
16076
16169
  return new Promise((resolve, reject) => {
16170
+ let bodyStream;
16171
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
16077
16172
  const fileContents = [];
16078
- body.on('data', (chunk) => {
16173
+ bodyStream.on('data', (chunk) => {
16079
16174
  fileContents.push(chunk);
16080
16175
  });
16081
- body.on('end', () => {
16176
+ bodyStream.on('end', () => {
16082
16177
  resolve(fileContents);
16083
16178
  });
16084
- body.on('error', (err) => {
16179
+ bodyStream.on('error', (err) => {
16085
16180
  reject(err);
16086
16181
  });
16087
16182
  });
@@ -16183,14 +16278,16 @@ class AccountingApi {
16183
16278
  // Reads file stream as chunks so we can put it in body of request.
16184
16279
  // This collects the whole file into memory, which is why we do it _after_ authentication.
16185
16280
  return new Promise((resolve, reject) => {
16281
+ let bodyStream;
16282
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
16186
16283
  const fileContents = [];
16187
- body.on('data', (chunk) => {
16284
+ bodyStream.on('data', (chunk) => {
16188
16285
  fileContents.push(chunk);
16189
16286
  });
16190
- body.on('end', () => {
16287
+ bodyStream.on('end', () => {
16191
16288
  resolve(fileContents);
16192
16289
  });
16193
- body.on('error', (err) => {
16290
+ bodyStream.on('error', (err) => {
16194
16291
  reject(err);
16195
16292
  });
16196
16293
  });
@@ -16371,14 +16468,16 @@ class AccountingApi {
16371
16468
  // Reads file stream as chunks so we can put it in body of request.
16372
16469
  // This collects the whole file into memory, which is why we do it _after_ authentication.
16373
16470
  return new Promise((resolve, reject) => {
16471
+ let bodyStream;
16472
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
16374
16473
  const fileContents = [];
16375
- body.on('data', (chunk) => {
16474
+ bodyStream.on('data', (chunk) => {
16376
16475
  fileContents.push(chunk);
16377
16476
  });
16378
- body.on('end', () => {
16477
+ bodyStream.on('end', () => {
16379
16478
  resolve(fileContents);
16380
16479
  });
16381
- body.on('error', (err) => {
16480
+ bodyStream.on('error', (err) => {
16382
16481
  reject(err);
16383
16482
  });
16384
16483
  });
@@ -16643,14 +16742,16 @@ class AccountingApi {
16643
16742
  // Reads file stream as chunks so we can put it in body of request.
16644
16743
  // This collects the whole file into memory, which is why we do it _after_ authentication.
16645
16744
  return new Promise((resolve, reject) => {
16745
+ let bodyStream;
16746
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
16646
16747
  const fileContents = [];
16647
- body.on('data', (chunk) => {
16748
+ bodyStream.on('data', (chunk) => {
16648
16749
  fileContents.push(chunk);
16649
16750
  });
16650
- body.on('end', () => {
16751
+ bodyStream.on('end', () => {
16651
16752
  resolve(fileContents);
16652
16753
  });
16653
- body.on('error', (err) => {
16754
+ bodyStream.on('error', (err) => {
16654
16755
  reject(err);
16655
16756
  });
16656
16757
  });
@@ -16915,14 +17016,16 @@ class AccountingApi {
16915
17016
  // Reads file stream as chunks so we can put it in body of request.
16916
17017
  // This collects the whole file into memory, which is why we do it _after_ authentication.
16917
17018
  return new Promise((resolve, reject) => {
17019
+ let bodyStream;
17020
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
16918
17021
  const fileContents = [];
16919
- body.on('data', (chunk) => {
17022
+ bodyStream.on('data', (chunk) => {
16920
17023
  fileContents.push(chunk);
16921
17024
  });
16922
- body.on('end', () => {
17025
+ bodyStream.on('end', () => {
16923
17026
  resolve(fileContents);
16924
17027
  });
16925
- body.on('error', (err) => {
17028
+ bodyStream.on('error', (err) => {
16926
17029
  reject(err);
16927
17030
  });
16928
17031
  });
@@ -17266,14 +17369,16 @@ class AccountingApi {
17266
17369
  // Reads file stream as chunks so we can put it in body of request.
17267
17370
  // This collects the whole file into memory, which is why we do it _after_ authentication.
17268
17371
  return new Promise((resolve, reject) => {
17372
+ let bodyStream;
17373
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
17269
17374
  const fileContents = [];
17270
- body.on('data', (chunk) => {
17375
+ bodyStream.on('data', (chunk) => {
17271
17376
  fileContents.push(chunk);
17272
17377
  });
17273
- body.on('end', () => {
17378
+ bodyStream.on('end', () => {
17274
17379
  resolve(fileContents);
17275
17380
  });
17276
- body.on('error', (err) => {
17381
+ bodyStream.on('error', (err) => {
17277
17382
  reject(err);
17278
17383
  });
17279
17384
  });
@@ -18241,14 +18346,16 @@ class AccountingApi {
18241
18346
  // Reads file stream as chunks so we can put it in body of request.
18242
18347
  // This collects the whole file into memory, which is why we do it _after_ authentication.
18243
18348
  return new Promise((resolve, reject) => {
18349
+ let bodyStream;
18350
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
18244
18351
  const fileContents = [];
18245
- body.on('data', (chunk) => {
18352
+ bodyStream.on('data', (chunk) => {
18246
18353
  fileContents.push(chunk);
18247
18354
  });
18248
- body.on('end', () => {
18355
+ bodyStream.on('end', () => {
18249
18356
  resolve(fileContents);
18250
18357
  });
18251
- body.on('error', (err) => {
18358
+ bodyStream.on('error', (err) => {
18252
18359
  reject(err);
18253
18360
  });
18254
18361
  });
@@ -18430,14 +18537,16 @@ class AccountingApi {
18430
18537
  // Reads file stream as chunks so we can put it in body of request.
18431
18538
  // This collects the whole file into memory, which is why we do it _after_ authentication.
18432
18539
  return new Promise((resolve, reject) => {
18540
+ let bodyStream;
18541
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
18433
18542
  const fileContents = [];
18434
- body.on('data', (chunk) => {
18543
+ bodyStream.on('data', (chunk) => {
18435
18544
  fileContents.push(chunk);
18436
18545
  });
18437
- body.on('end', () => {
18546
+ bodyStream.on('end', () => {
18438
18547
  resolve(fileContents);
18439
18548
  });
18440
- body.on('error', (err) => {
18549
+ bodyStream.on('error', (err) => {
18441
18550
  reject(err);
18442
18551
  });
18443
18552
  });
@@ -18623,14 +18732,16 @@ class AccountingApi {
18623
18732
  // Reads file stream as chunks so we can put it in body of request.
18624
18733
  // This collects the whole file into memory, which is why we do it _after_ authentication.
18625
18734
  return new Promise((resolve, reject) => {
18735
+ let bodyStream;
18736
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
18626
18737
  const fileContents = [];
18627
- body.on('data', (chunk) => {
18738
+ bodyStream.on('data', (chunk) => {
18628
18739
  fileContents.push(chunk);
18629
18740
  });
18630
- body.on('end', () => {
18741
+ bodyStream.on('end', () => {
18631
18742
  resolve(fileContents);
18632
18743
  });
18633
- body.on('error', (err) => {
18744
+ bodyStream.on('error', (err) => {
18634
18745
  reject(err);
18635
18746
  });
18636
18747
  });
@@ -18812,14 +18923,16 @@ class AccountingApi {
18812
18923
  // Reads file stream as chunks so we can put it in body of request.
18813
18924
  // This collects the whole file into memory, which is why we do it _after_ authentication.
18814
18925
  return new Promise((resolve, reject) => {
18926
+ let bodyStream;
18927
+ bodyStream = Buffer.isBuffer(body) ? stream_1.Readable.from(body) : body;
18815
18928
  const fileContents = [];
18816
- body.on('data', (chunk) => {
18929
+ bodyStream.on('data', (chunk) => {
18817
18930
  fileContents.push(chunk);
18818
18931
  });
18819
- body.on('end', () => {
18932
+ bodyStream.on('end', () => {
18820
18933
  resolve(fileContents);
18821
18934
  });
18822
- body.on('error', (err) => {
18935
+ bodyStream.on('error', (err) => {
18823
18936
  reject(err);
18824
18937
  });
18825
18938
  });