UNPKG

xero-node

Version:

Xero NodeJS OAuth 2.0 client for xero-node

965 lines 103 kB
"use strict"; /** * Xero Payroll AU API * This is the Xero Payroll API for orgs in Australia region. * * The version of the OpenAPI document: 2.17.1 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.PayrollAuApi = exports.PayrollAuApiApiKeys = void 0; const localVarRequest = require("request"); const models_1 = require("../model/payroll-au/models"); const models_2 = require("../model/payroll-au/models"); let defaultBasePath = 'https://api.xero.com/payroll.xro/1.0'; // =============================================== // This file is autogenerated - Please do not edit // =============================================== var PayrollAuApiApiKeys; (function (PayrollAuApiApiKeys) { })(PayrollAuApiApiKeys = exports.PayrollAuApiApiKeys || (exports.PayrollAuApiApiKeys = {})); class PayrollAuApi { constructor(basePathOrUsername, password, basePath) { this._basePath = defaultBasePath; this.defaultHeaders = { 'user-agent': 'xero-node-4.16.0' }; this._useQuerystring = false; this.binaryHeaders = {}; this.authentications = { 'default': new models_1.VoidAuth(), 'OAuth2': new models_2.OAuth(), }; if (password) { if (basePath) { this.basePath = basePath; } } else { if (basePathOrUsername) { this.basePath = basePathOrUsername; } } } set useQuerystring(value) { this._useQuerystring = value; } set basePath(basePath) { this._basePath = basePath; } get basePath() { return this._basePath; } setDefaultAuthentication(auth) { this.authentications.default = auth; } setApiKey(key, value) { this.authentications[PayrollAuApiApiKeys[key]].apiKey = value; } set accessToken(token) { this.authentications.OAuth2.accessToken = token; } /** * * @summary Creates a payroll employee * @param xeroTenantId Xero identifier for Tenant * @param employee */ createEmployee(xeroTenantId, employee, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/Employees'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 createEmployee.'); } // verify required parameter 'employee' is not null or undefined if (employee === null || employee === undefined) { throw new Error('Required parameter employee was null or undefined when calling createEmployee.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(employee, "Array<Employee>") }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "Employees"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Creates a leave application * @param xeroTenantId Xero identifier for Tenant * @param leaveApplication */ createLeaveApplication(xeroTenantId, leaveApplication, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/LeaveApplications'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 createLeaveApplication.'); } // verify required parameter 'leaveApplication' is not null or undefined if (leaveApplication === null || leaveApplication === undefined) { throw new Error('Required parameter leaveApplication was null or undefined when calling createLeaveApplication.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(leaveApplication, "Array<LeaveApplication>") }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "LeaveApplications"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Creates a pay item * @param xeroTenantId Xero identifier for Tenant * @param payItem */ createPayItem(xeroTenantId, payItem, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/PayItems'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 createPayItem.'); } // verify required parameter 'payItem' is not null or undefined if (payItem === null || payItem === undefined) { throw new Error('Required parameter payItem was null or undefined when calling createPayItem.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(payItem, "PayItem") }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "PayItems"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Creates a pay run * @param xeroTenantId Xero identifier for Tenant * @param payRun */ createPayRun(xeroTenantId, payRun, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/PayRuns'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 createPayRun.'); } // verify required parameter 'payRun' is not null or undefined if (payRun === null || payRun === undefined) { throw new Error('Required parameter payRun was null or undefined when calling createPayRun.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(payRun, "Array<PayRun>") }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "PayRuns"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Creates a Payroll Calendar * @param xeroTenantId Xero identifier for Tenant * @param payrollCalendar */ createPayrollCalendar(xeroTenantId, payrollCalendar, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/PayrollCalendars'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 createPayrollCalendar.'); } // verify required parameter 'payrollCalendar' is not null or undefined if (payrollCalendar === null || payrollCalendar === undefined) { throw new Error('Required parameter payrollCalendar was null or undefined when calling createPayrollCalendar.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(payrollCalendar, "Array<PayrollCalendar>") }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "PayrollCalendars"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Creates a superfund * @param xeroTenantId Xero identifier for Tenant * @param superFund */ createSuperfund(xeroTenantId, superFund, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/Superfunds'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 createSuperfund.'); } // verify required parameter 'superFund' is not null or undefined if (superFund === null || superFund === undefined) { throw new Error('Required parameter superFund was null or undefined when calling createSuperfund.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(superFund, "Array<SuperFund>") }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "SuperFunds"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Creates a timesheet * @param xeroTenantId Xero identifier for Tenant * @param timesheet */ createTimesheet(xeroTenantId, timesheet, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/Timesheets'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 createTimesheet.'); } // verify required parameter 'timesheet' is not null or undefined if (timesheet === null || timesheet === undefined) { throw new Error('Required parameter timesheet was null or undefined when calling createTimesheet.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(timesheet, "Array<Timesheet>") }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "Timesheets"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Retrieves an employee\'s detail by unique employee id * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object */ getEmployee(xeroTenantId, employeeID, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/Employees/{EmployeeID}' .replace('{' + 'EmployeeID' + '}', encodeURIComponent(String(employeeID))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 getEmployee.'); } // verify required parameter 'employeeID' is not null or undefined if (employeeID === null || employeeID === undefined) { throw new Error('Required parameter employeeID was null or undefined when calling getEmployee.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "Employees"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Searches payroll employees * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @param page e.g. page&#x3D;1 – Up to 100 employees will be returned in a single API call */ getEmployees(xeroTenantId, ifModifiedSince, where, order, page, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/Employees'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 getEmployees.'); } if (where !== undefined) { localVarQueryParameters['where'] = models_1.ObjectSerializer.serialize(where, "string"); } if (order !== undefined) { localVarQueryParameters['order'] = models_1.ObjectSerializer.serialize(order, "string"); } if (page !== undefined) { localVarQueryParameters['page'] = models_1.ObjectSerializer.serialize(page, "number"); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); localVarHeaderParams['If-Modified-Since'] = models_1.ObjectSerializer.serialize(ifModifiedSince, "Date"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "Employees"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Retrieves a leave application by a unique leave application id * @param xeroTenantId Xero identifier for Tenant * @param leaveApplicationID Leave Application id for single object */ getLeaveApplication(xeroTenantId, leaveApplicationID, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/LeaveApplications/{LeaveApplicationID}' .replace('{' + 'LeaveApplicationID' + '}', encodeURIComponent(String(leaveApplicationID))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 getLeaveApplication.'); } // verify required parameter 'leaveApplicationID' is not null or undefined if (leaveApplicationID === null || leaveApplicationID === undefined) { throw new Error('Required parameter leaveApplicationID was null or undefined when calling getLeaveApplication.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "LeaveApplications"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Retrieves leave applications * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @param page e.g. page&#x3D;1 – Up to 100 objects will be returned in a single API call */ getLeaveApplications(xeroTenantId, ifModifiedSince, where, order, page, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/LeaveApplications'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 getLeaveApplications.'); } if (where !== undefined) { localVarQueryParameters['where'] = models_1.ObjectSerializer.serialize(where, "string"); } if (order !== undefined) { localVarQueryParameters['order'] = models_1.ObjectSerializer.serialize(order, "string"); } if (page !== undefined) { localVarQueryParameters['page'] = models_1.ObjectSerializer.serialize(page, "number"); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); localVarHeaderParams['If-Modified-Since'] = models_1.ObjectSerializer.serialize(ifModifiedSince, "Date"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "LeaveApplications"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Retrieves pay items * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @param page e.g. page&#x3D;1 – Up to 100 objects will be returned in a single API call */ getPayItems(xeroTenantId, ifModifiedSince, where, order, page, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/PayItems'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 getPayItems.'); } if (where !== undefined) { localVarQueryParameters['where'] = models_1.ObjectSerializer.serialize(where, "string"); } if (order !== undefined) { localVarQueryParameters['order'] = models_1.ObjectSerializer.serialize(order, "string"); } if (page !== undefined) { localVarQueryParameters['page'] = models_1.ObjectSerializer.serialize(page, "number"); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); localVarHeaderParams['If-Modified-Since'] = models_1.ObjectSerializer.serialize(ifModifiedSince, "Date"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "PayItems"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Retrieves a pay run by using a unique pay run id * @param xeroTenantId Xero identifier for Tenant * @param payRunID PayRun id for single object */ getPayRun(xeroTenantId, payRunID, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/PayRuns/{PayRunID}' .replace('{' + 'PayRunID' + '}', encodeURIComponent(String(payRunID))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 getPayRun.'); } // verify required parameter 'payRunID' is not null or undefined if (payRunID === null || payRunID === undefined) { throw new Error('Required parameter payRunID was null or undefined when calling getPayRun.'); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; 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.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "PayRuns"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }); }); } /** * * @summary Retrieves pay runs * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @param page e.g. page&#x3D;1 – Up to 100 PayRuns will be returned in a single API call */ getPayRuns(xeroTenantId, ifModifiedSince, where, order, page, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/PayRuns'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this.defaultHeaders); let localVarFormParams = {}; // 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 getPayRuns.'); } if (where !== undefined) { localVarQueryParameters['where'] = models_1.ObjectSerializer.serialize(where, "string"); } if (order !== undefined) { localVarQueryParameters['order'] = models_1.ObjectSerializer.serialize(order, "string"); } if (page !== undefined) { localVarQueryParameters['page'] = models_1.ObjectSerializer.serialize(page, "number"); } localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string"); localVarHeaderParams['If-Modified-Since'] = models_1.ObjectSerializer.serialize(ifModifiedSince, "Date"); Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; 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.formData = localVarFormParams; } else { localVar