From b7ac2de63b4335ea1970829c45775e5c44c6b69a Mon Sep 17 00:00:00 2001 From: samss084 <131480264+samss084@users.noreply.github.com> Date: Sun, 2 Feb 2025 13:02:43 -0700 Subject: [PATCH] Update accountingApi.ts --- src/gen/api/accountingApi.ts | 1063 +--------------------------------- 1 file changed, 13 insertions(+), 1050 deletions(-) diff --git a/src/gen/api/accountingApi.ts b/src/gen/api/accountingApi.ts index e5faf9e9e..88c26a797 100644 --- a/src/gen/api/accountingApi.ts +++ b/src/gen/api/accountingApi.ts @@ -12,8 +12,7 @@ import http = require('http'); import fs = require('fs'); - -/* tslint:disable:no-unused-locals */ +/* tslint:able uselocals */ import { Account } from '../model/accounting/account'; import { Accounts } from '../model/accounting/accounts'; import { Actions } from '../model/accounting/actions'; @@ -22,12 +21,12 @@ import { Allocations } from '../model/accounting/allocations'; import { Attachments } from '../model/accounting/attachments'; import { BankTransactions } from '../model/accounting/bankTransactions'; import { BankTransfers } from '../model/accounting/bankTransfers'; -import { BatchPaymentDelete } from '../model/accounting/batchPaymentDelete'; -import { BatchPaymentDeleteByUrlParam } from '../model/accounting/batchPaymentDeleteByUrlParam'; +import { BatchPayment } from '../model/accounting/batchPayment'; +import { BatchPaymByUrlParam } frm '../model/accounting/batchPaymentByUrlParam'; import { BatchPayments } from '../model/accounting/batchPayments'; import { BrandingThemes } from '../model/accounting/brandingThemes'; import { Budgets } from '../model/accounting/budgets'; -import { CISOrgSettings } from '../model/accounting/cISOrgSettings'; +import { CISettings } from '../model/accounting/cISettings'; import { CISSettings } from '../model/accounting/cISSettings'; import { ContactGroups } from '../model/accounting/contactGroups'; import { Contacts } from '../model/accounting/contacts'; @@ -49,7 +48,7 @@ import { OnlineInvoices } from '../model/accounting/onlineInvoices'; import { Organisations } from '../model/accounting/organisations'; import { Overpayments } from '../model/accounting/overpayments'; import { Payment } from '../model/accounting/payment'; -import { PaymentDelete } from '../model/accounting/paymentDelete'; +import { Payment } from '../model/accounting/payment; import { PaymentServices } from '../model/accounting/paymentServices'; import { Payments } from '../model/accounting/payments'; import { Prepayments } from '../model/accounting/prepayments'; @@ -58,9 +57,8 @@ import { Quotes } from '../model/accounting/quotes'; import { Receipts } from '../model/accounting/receipts'; import { RepeatingInvoices } from '../model/accounting/repeatingInvoices'; import { ReportWithRows } from '../model/accounting/reportWithRows'; -import { Reports } from '../model/accounting/reports'; -import { RequestEmpty } from '../model/accounting/requestEmpty'; -import { Setup } from '../model/accounting/setup'; +import { Reports } from '../model/accounting/repo; +import{ Setup } from '../model/accounting/setup'; import { TaxRates } from '../model/accounting/taxRates'; import { TrackingCategories } from '../model/accounting/trackingCategories'; import { TrackingCategory } from '../model/accounting/trackingCategory'; @@ -68,8 +66,8 @@ import { TrackingOption } from '../model/accounting/trackingOption'; import { TrackingOptions } from '../model/accounting/trackingOptions'; import { Users } from '../model/accounting/users'; -import { ObjectSerializer, Authentication, VoidAuth } from '../model/accounting/models'; -import { ApiError } from '../../model/ApiError'; +import { ObjectSerializer, Authentication, Auth } from '../model/accounting/models'; +import { ApFrom '../..i; import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'; import { Readable } from "stream"; import { OAuth } from '../model/accounting/models'; @@ -136,7 +134,7 @@ export class AccountingApi { * @summary Creates a new chart of accounts * @param xeroTenantId Xero identifier for Tenant * @param account Account object in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. + * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 charactes min */ public async createAccount (xeroTenantId: string, account: Account, idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: Accounts; }> { const localVarPath = this.basePath + '/Accounts'; @@ -213,8 +211,8 @@ export class AccountingApi { * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ + * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 characters min + . */ public async createAccountAttachmentByFileName (xeroTenantId: string, accountID: string, fileName: string, body: fs.ReadStream | Readable | Buffer , idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: Attachments; }> { const localVarPath = this.basePath + '/Accounts/{AccountID}/Attachments/{FileName}' .replace('{' + 'AccountID' + '}', encodeURIComponent(String(accountID))) @@ -18826,1039 +18824,4 @@ export class AccountingApi { } return new Promise<{ response: AxiosResponse; body: RepeatingInvoices; }>(async (resolve, reject) => { let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "RepeatingInvoices"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates a specific purchase order - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order - * @param purchaseOrders - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updatePurchaseOrder (xeroTenantId: string, purchaseOrderID: string, purchaseOrders: PurchaseOrders, idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: PurchaseOrders; }> { - const localVarPath = this.basePath + '/PurchaseOrders/{PurchaseOrderID}' - .replace('{' + 'PurchaseOrderID' + '}', encodeURIComponent(String(purchaseOrderID))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updatePurchaseOrder.'); - } - - // verify required parameter 'purchaseOrderID' is not null or undefined - if (purchaseOrderID === null || purchaseOrderID === undefined) { - throw new Error('Required parameter purchaseOrderID was null or undefined when calling updatePurchaseOrder.'); - } - - // verify required parameter 'purchaseOrders' is not null or undefined - if (purchaseOrders === null || purchaseOrders === undefined) { - throw new Error('Required parameter purchaseOrders was null or undefined when calling updatePurchaseOrder.'); - } - - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(purchaseOrders, "PurchaseOrders"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - return new Promise<{ response: AxiosResponse; body: PurchaseOrders; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "PurchaseOrders"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates a specific attachment for a specific purchase order by filename - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updatePurchaseOrderAttachmentByFileName (xeroTenantId: string, purchaseOrderID: string, fileName: string, body: fs.ReadStream | Readable | Buffer , idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: Attachments; }> { - const localVarPath = this.basePath + '/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}' - .replace('{' + 'PurchaseOrderID' + '}', encodeURIComponent(String(purchaseOrderID))) - .replace('{' + 'FileName' + '}', encodeURIComponent(String(fileName))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updatePurchaseOrderAttachmentByFileName.'); - } - - // verify required parameter 'purchaseOrderID' is not null or undefined - if (purchaseOrderID === null || purchaseOrderID === undefined) { - throw new Error('Required parameter purchaseOrderID was null or undefined when calling updatePurchaseOrderAttachmentByFileName.'); - } - - // verify required parameter 'fileName' is not null or undefined - if (fileName === null || fileName === undefined) { - throw new Error('Required parameter fileName was null or undefined when calling updatePurchaseOrderAttachmentByFileName.'); - } - - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updatePurchaseOrderAttachmentByFileName.'); - } - this.binaryHeaders = {'Accept': 'application/json'}; - (Object).assign(localVarHeaderParams, this.binaryHeaders); - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(body, "string"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - }).then(() => { - // Reads file stream as chunks so we can put it in body of request. - // This collects the whole file into memory, which is why we do it _after_ authentication. - return new Promise((resolve, reject) => { - let bodyStream; - bodyStream = Buffer.isBuffer(body) ? Readable.from(body) : body - const fileContents: any[] = []; - bodyStream.on('data', (chunk) => { - fileContents.push(chunk); - }); - bodyStream.on('end', () => { - resolve(fileContents); - }); - bodyStream.on('error', (err) => { - reject(err); - }) - }); - }).then((fileContents) => { - const file = Buffer.concat(fileContents); - localVarRequestOptions.data = file; - return new Promise<{ response: AxiosResponse; body: Attachments; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "Attachments"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates a specific quote - * @param xeroTenantId Xero identifier for Tenant - * @param quoteID Unique identifier for an Quote - * @param quotes - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updateQuote (xeroTenantId: string, quoteID: string, quotes: Quotes, idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: Quotes; }> { - const localVarPath = this.basePath + '/Quotes/{QuoteID}' - .replace('{' + 'QuoteID' + '}', encodeURIComponent(String(quoteID))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updateQuote.'); - } - - // verify required parameter 'quoteID' is not null or undefined - if (quoteID === null || quoteID === undefined) { - throw new Error('Required parameter quoteID was null or undefined when calling updateQuote.'); - } - - // verify required parameter 'quotes' is not null or undefined - if (quotes === null || quotes === undefined) { - throw new Error('Required parameter quotes was null or undefined when calling updateQuote.'); - } - - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(quotes, "Quotes"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - return new Promise<{ response: AxiosResponse; body: Quotes; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "Quotes"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates a specific attachment from a specific quote by filename - * @param xeroTenantId Xero identifier for Tenant - * @param quoteID Unique identifier for an Quote - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updateQuoteAttachmentByFileName (xeroTenantId: string, quoteID: string, fileName: string, body: fs.ReadStream | Readable | Buffer , idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: Attachments; }> { - const localVarPath = this.basePath + '/Quotes/{QuoteID}/Attachments/{FileName}' - .replace('{' + 'QuoteID' + '}', encodeURIComponent(String(quoteID))) - .replace('{' + 'FileName' + '}', encodeURIComponent(String(fileName))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updateQuoteAttachmentByFileName.'); - } - - // verify required parameter 'quoteID' is not null or undefined - if (quoteID === null || quoteID === undefined) { - throw new Error('Required parameter quoteID was null or undefined when calling updateQuoteAttachmentByFileName.'); - } - - // verify required parameter 'fileName' is not null or undefined - if (fileName === null || fileName === undefined) { - throw new Error('Required parameter fileName was null or undefined when calling updateQuoteAttachmentByFileName.'); - } - - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updateQuoteAttachmentByFileName.'); - } - this.binaryHeaders = {'Accept': 'application/json'}; - (Object).assign(localVarHeaderParams, this.binaryHeaders); - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(body, "string"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - }).then(() => { - // Reads file stream as chunks so we can put it in body of request. - // This collects the whole file into memory, which is why we do it _after_ authentication. - return new Promise((resolve, reject) => { - let bodyStream; - bodyStream = Buffer.isBuffer(body) ? Readable.from(body) : body - const fileContents: any[] = []; - bodyStream.on('data', (chunk) => { - fileContents.push(chunk); - }); - bodyStream.on('end', () => { - resolve(fileContents); - }); - bodyStream.on('error', (err) => { - reject(err); - }) - }); - }).then((fileContents) => { - const file = Buffer.concat(fileContents); - localVarRequestOptions.data = file; - return new Promise<{ response: AxiosResponse; body: Attachments; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "Attachments"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates a specific draft expense claim receipts - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param receipts - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updateReceipt (xeroTenantId: string, receiptID: string, receipts: Receipts, unitdp?: number, idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: Receipts; }> { - const localVarPath = this.basePath + '/Receipts/{ReceiptID}' - .replace('{' + 'ReceiptID' + '}', encodeURIComponent(String(receiptID))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updateReceipt.'); - } - - // verify required parameter 'receiptID' is not null or undefined - if (receiptID === null || receiptID === undefined) { - throw new Error('Required parameter receiptID was null or undefined when calling updateReceipt.'); - } - - // verify required parameter 'receipts' is not null or undefined - if (receipts === null || receipts === undefined) { - throw new Error('Required parameter receipts was null or undefined when calling updateReceipt.'); - } - - if (unitdp !== undefined) { - localVarQueryParameters['unitdp'] = ObjectSerializer.serialize(unitdp, "number"); - } - - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(receipts, "Receipts"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - return new Promise<{ response: AxiosResponse; body: Receipts; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "Receipts"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates a specific attachment on a specific expense claim receipts by file name - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updateReceiptAttachmentByFileName (xeroTenantId: string, receiptID: string, fileName: string, body: fs.ReadStream | Readable | Buffer , idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: Attachments; }> { - const localVarPath = this.basePath + '/Receipts/{ReceiptID}/Attachments/{FileName}' - .replace('{' + 'ReceiptID' + '}', encodeURIComponent(String(receiptID))) - .replace('{' + 'FileName' + '}', encodeURIComponent(String(fileName))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updateReceiptAttachmentByFileName.'); - } - - // verify required parameter 'receiptID' is not null or undefined - if (receiptID === null || receiptID === undefined) { - throw new Error('Required parameter receiptID was null or undefined when calling updateReceiptAttachmentByFileName.'); - } - - // verify required parameter 'fileName' is not null or undefined - if (fileName === null || fileName === undefined) { - throw new Error('Required parameter fileName was null or undefined when calling updateReceiptAttachmentByFileName.'); - } - - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updateReceiptAttachmentByFileName.'); - } - this.binaryHeaders = {'Accept': 'application/json'}; - (Object).assign(localVarHeaderParams, this.binaryHeaders); - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(body, "string"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - }).then(() => { - // Reads file stream as chunks so we can put it in body of request. - // This collects the whole file into memory, which is why we do it _after_ authentication. - return new Promise((resolve, reject) => { - let bodyStream; - bodyStream = Buffer.isBuffer(body) ? Readable.from(body) : body - const fileContents: any[] = []; - bodyStream.on('data', (chunk) => { - fileContents.push(chunk); - }); - bodyStream.on('end', () => { - resolve(fileContents); - }); - bodyStream.on('error', (err) => { - reject(err); - }) - }); - }).then((fileContents) => { - const file = Buffer.concat(fileContents); - localVarRequestOptions.data = file; - return new Promise<{ response: AxiosResponse; body: Attachments; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "Attachments"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Deletes a specific repeating invoice template - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param repeatingInvoices - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updateRepeatingInvoice (xeroTenantId: string, repeatingInvoiceID: string, repeatingInvoices: RepeatingInvoices, idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: RepeatingInvoices; }> { - const localVarPath = this.basePath + '/RepeatingInvoices/{RepeatingInvoiceID}' - .replace('{' + 'RepeatingInvoiceID' + '}', encodeURIComponent(String(repeatingInvoiceID))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updateRepeatingInvoice.'); - } - - // verify required parameter 'repeatingInvoiceID' is not null or undefined - if (repeatingInvoiceID === null || repeatingInvoiceID === undefined) { - throw new Error('Required parameter repeatingInvoiceID was null or undefined when calling updateRepeatingInvoice.'); - } - - // verify required parameter 'repeatingInvoices' is not null or undefined - if (repeatingInvoices === null || repeatingInvoices === undefined) { - throw new Error('Required parameter repeatingInvoices was null or undefined when calling updateRepeatingInvoice.'); - } - - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(repeatingInvoices, "RepeatingInvoices"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - return new Promise<{ response: AxiosResponse; body: RepeatingInvoices; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "RepeatingInvoices"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates a specific attachment from a specific repeating invoices by file name - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updateRepeatingInvoiceAttachmentByFileName (xeroTenantId: string, repeatingInvoiceID: string, fileName: string, body: fs.ReadStream | Readable | Buffer , idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: Attachments; }> { - const localVarPath = this.basePath + '/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}' - .replace('{' + 'RepeatingInvoiceID' + '}', encodeURIComponent(String(repeatingInvoiceID))) - .replace('{' + 'FileName' + '}', encodeURIComponent(String(fileName))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updateRepeatingInvoiceAttachmentByFileName.'); - } - - // verify required parameter 'repeatingInvoiceID' is not null or undefined - if (repeatingInvoiceID === null || repeatingInvoiceID === undefined) { - throw new Error('Required parameter repeatingInvoiceID was null or undefined when calling updateRepeatingInvoiceAttachmentByFileName.'); - } - - // verify required parameter 'fileName' is not null or undefined - if (fileName === null || fileName === undefined) { - throw new Error('Required parameter fileName was null or undefined when calling updateRepeatingInvoiceAttachmentByFileName.'); - } - - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updateRepeatingInvoiceAttachmentByFileName.'); - } - this.binaryHeaders = {'Accept': 'application/json'}; - (Object).assign(localVarHeaderParams, this.binaryHeaders); - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(body, "string"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - }).then(() => { - // Reads file stream as chunks so we can put it in body of request. - // This collects the whole file into memory, which is why we do it _after_ authentication. - return new Promise((resolve, reject) => { - let bodyStream; - bodyStream = Buffer.isBuffer(body) ? Readable.from(body) : body - const fileContents: any[] = []; - bodyStream.on('data', (chunk) => { - fileContents.push(chunk); - }); - bodyStream.on('end', () => { - resolve(fileContents); - }); - bodyStream.on('error', (err) => { - reject(err); - }) - }); - }).then((fileContents) => { - const file = Buffer.concat(fileContents); - localVarRequestOptions.data = file; - return new Promise<{ response: AxiosResponse; body: Attachments; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "Attachments"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates tax rates - * @param xeroTenantId Xero identifier for Tenant - * @param taxRates - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updateTaxRate (xeroTenantId: string, taxRates: TaxRates, idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: TaxRates; }> { - const localVarPath = this.basePath + '/TaxRates'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updateTaxRate.'); - } - - // verify required parameter 'taxRates' is not null or undefined - if (taxRates === null || taxRates === undefined) { - throw new Error('Required parameter taxRates was null or undefined when calling updateTaxRate.'); - } - - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(taxRates, "TaxRates"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - return new Promise<{ response: AxiosResponse; body: TaxRates; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "TaxRates"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates a specific tracking category - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingCategory - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updateTrackingCategory (xeroTenantId: string, trackingCategoryID: string, trackingCategory: TrackingCategory, idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: TrackingCategories; }> { - const localVarPath = this.basePath + '/TrackingCategories/{TrackingCategoryID}' - .replace('{' + 'TrackingCategoryID' + '}', encodeURIComponent(String(trackingCategoryID))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updateTrackingCategory.'); - } - - // verify required parameter 'trackingCategoryID' is not null or undefined - if (trackingCategoryID === null || trackingCategoryID === undefined) { - throw new Error('Required parameter trackingCategoryID was null or undefined when calling updateTrackingCategory.'); - } - - // verify required parameter 'trackingCategory' is not null or undefined - if (trackingCategory === null || trackingCategory === undefined) { - throw new Error('Required parameter trackingCategory was null or undefined when calling updateTrackingCategory.'); - } - - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(trackingCategory, "TrackingCategory"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - return new Promise<{ response: AxiosResponse; body: TrackingCategories; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "TrackingCategories"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } - /** - * - * @summary Updates a specific option for a specific tracking category - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingOptionID Unique identifier for a Tracking Option - * @param trackingOption - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max. - */ - public async updateTrackingOptions (xeroTenantId: string, trackingCategoryID: string, trackingOptionID: string, trackingOption: TrackingOption, idempotencyKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: AxiosResponse; body: TrackingOptions; }> { - const localVarPath = this.basePath + '/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}' - .replace('{' + 'TrackingCategoryID' + '}', encodeURIComponent(String(trackingCategoryID))) - .replace('{' + 'TrackingOptionID' + '}', encodeURIComponent(String(trackingOptionID))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - let acceptHeadersFromSpec = [ - "application/json" - ]; - const isBufferType = acceptHeadersFromSpec.includes("application/pdf")|| acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg"); - const responseTypeOption = isBufferType ? "arraybuffer" : "json"; - - // verify required parameter 'xeroTenantId' is not null or undefined - if (xeroTenantId === null || xeroTenantId === undefined) { - throw new Error('Required parameter xeroTenantId was null or undefined when calling updateTrackingOptions.'); - } - - // verify required parameter 'trackingCategoryID' is not null or undefined - if (trackingCategoryID === null || trackingCategoryID === undefined) { - throw new Error('Required parameter trackingCategoryID was null or undefined when calling updateTrackingOptions.'); - } - - // verify required parameter 'trackingOptionID' is not null or undefined - if (trackingOptionID === null || trackingOptionID === undefined) { - throw new Error('Required parameter trackingOptionID was null or undefined when calling updateTrackingOptions.'); - } - - // verify required parameter 'trackingOption' is not null or undefined - if (trackingOption === null || trackingOption === undefined) { - throw new Error('Required parameter trackingOption was null or undefined when calling updateTrackingOptions.'); - } - - localVarHeaderParams['xero-tenant-id'] = ObjectSerializer.serialize(xeroTenantId, "string"); - localVarHeaderParams['Idempotency-Key'] = ObjectSerializer.serialize(idempotencyKey, "string"); - localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join(); - (Object).assign(localVarHeaderParams, options.headers); - let localVarUseFormData = false; - - let localVarRequestOptions: AxiosRequestConfig = { - method: 'POST', - params: localVarQueryParameters, - headers: localVarHeaderParams, - url: localVarPath, - responseType: responseTypeOption, - data: ObjectSerializer.serialize(trackingOption, "TrackingOption"), - }; - - let authenticationPromise = Promise.resolve(); - authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions)); - - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - return authenticationPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'Content-Type': 'multipart/form-data' }; - } else { - localVarRequestOptions.data = localVarFormParams; - localVarRequestOptions.headers = { ...localVarRequestOptions.headers, 'content-type': 'application/x-www-form-urlencoded' }; - } - } - return new Promise<{ response: AxiosResponse; body: TrackingOptions; }>(async (resolve, reject) => { - let body = null - try { - const response = await axios(localVarRequestOptions) - body = ObjectSerializer.deserialize(response.data, "TrackingOptions"); - if (response.status && response.status >= 200 && response.status <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - catch(error) { - const errorResponse = new ApiError(error) - reject(JSON.stringify(errorResponse.generateError())) - } - }); - }); - } -} + \ No newline at end of file