xero-node 13.3.1 → 14.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.
- package/CODE_OF_CONDUCT.md +76 -76
- package/CONTRIBUTING.md +112 -112
- package/LICENSE +21 -21
- package/README.md +468 -468
- package/dist/gen/api/accountingApi.d.ts +3 -2
- package/dist/gen/api/accountingApi.js +8 -4
- package/dist/gen/api/accountingApi.js.map +1 -1
- package/dist/gen/api/appStoreApi.d.ts +1 -1
- package/dist/gen/api/appStoreApi.js +2 -2
- package/dist/gen/api/assetApi.d.ts +1 -1
- package/dist/gen/api/assetApi.js +2 -2
- package/dist/gen/api/bankfeedsApi.d.ts +1 -1
- package/dist/gen/api/bankfeedsApi.js +2 -2
- package/dist/gen/api/filesApi.d.ts +1 -1
- package/dist/gen/api/filesApi.js +2 -2
- package/dist/gen/api/financeApi.d.ts +1 -62
- package/dist/gen/api/financeApi.js +2 -286
- package/dist/gen/api/financeApi.js.map +1 -1
- package/dist/gen/api/payrollAUApi.d.ts +1 -1
- package/dist/gen/api/payrollAUApi.js +2 -2
- package/dist/gen/api/payrollAUV2Api.d.ts +178 -0
- package/dist/gen/api/payrollAUV2Api.js +776 -0
- package/dist/gen/api/payrollAUV2Api.js.map +1 -0
- package/dist/gen/api/payrollNZApi.d.ts +1 -1
- package/dist/gen/api/payrollNZApi.js +2 -2
- package/dist/gen/api/payrollUKApi.d.ts +1 -1
- package/dist/gen/api/payrollUKApi.js +2 -2
- package/dist/gen/api/projectApi.d.ts +1 -1
- package/dist/gen/api/projectApi.js +2 -2
- package/dist/gen/model/accounting/overpayment.d.ts +4 -0
- package/dist/gen/model/accounting/overpayment.js +5 -0
- package/dist/gen/model/accounting/overpayment.js.map +1 -1
- package/dist/gen/model/finance/models.d.ts +0 -10
- package/dist/gen/model/finance/models.js +0 -30
- package/dist/gen/model/finance/models.js.map +1 -1
- package/dist/gen/model/payroll-au/earningsRate.d.ts +4 -0
- package/dist/gen/model/payroll-au/earningsRate.js +5 -0
- package/dist/gen/model/payroll-au/earningsRate.js.map +1 -1
- package/dist/gen/model/payroll-au/employee.d.ts +0 -2
- package/dist/gen/model/payroll-au/employee.js +0 -5
- package/dist/gen/model/payroll-au/employee.js.map +1 -1
- package/dist/gen/model/payroll-au/leaveLine.d.ts +4 -0
- package/dist/gen/model/payroll-au/leaveLine.js +5 -0
- package/dist/gen/model/payroll-au/leaveLine.js.map +1 -1
- package/dist/gen/model/payroll-au/leaveType.d.ts +4 -0
- package/dist/gen/model/payroll-au/leaveType.js +5 -0
- package/dist/gen/model/payroll-au/leaveType.js.map +1 -1
- package/dist/gen/model/payroll-au/models.d.ts +1 -0
- package/dist/gen/model/payroll-au/models.js +3 -0
- package/dist/gen/model/payroll-au/models.js.map +1 -1
- package/dist/gen/model/{finance/userActivitiesResponse.d.ts → payroll-au/openingBalanceLeaveLine.d.ts} +5 -7
- package/dist/gen/model/payroll-au/openingBalanceLeaveLine.js +23 -0
- package/dist/gen/model/payroll-au/openingBalanceLeaveLine.js.map +1 -0
- package/dist/gen/model/payroll-au/openingBalances.d.ts +2 -2
- package/dist/gen/model/payroll-au/openingBalances.js +1 -1
- package/dist/gen/model/payroll-au/openingBalances.js.map +1 -1
- package/dist/gen/model/payroll-au/taxDeclaration.d.ts +4 -0
- package/dist/gen/model/payroll-au/taxDeclaration.js +5 -0
- package/dist/gen/model/payroll-au/taxDeclaration.js.map +1 -1
- package/dist/gen/model/{finance/lockHistoryModel.d.ts → payroll-au-v2/invalidField.d.ts} +5 -9
- package/dist/gen/model/payroll-au-v2/invalidField.js +23 -0
- package/dist/gen/model/payroll-au-v2/invalidField.js.map +1 -0
- package/dist/gen/model/payroll-au-v2/models.d.ts +42 -0
- package/dist/gen/model/payroll-au-v2/models.js +244 -0
- package/dist/gen/model/payroll-au-v2/models.js.map +1 -0
- package/dist/gen/model/payroll-au-v2/pagination.d.ts +17 -0
- package/dist/gen/model/payroll-au-v2/pagination.js +33 -0
- package/dist/gen/model/payroll-au-v2/pagination.js.map +1 -0
- package/dist/gen/model/payroll-au-v2/problem.d.ts +35 -0
- package/dist/gen/model/payroll-au-v2/problem.js +46 -0
- package/dist/gen/model/payroll-au-v2/problem.js.map +1 -0
- package/dist/gen/model/payroll-au-v2/timesheet.d.ts +54 -0
- package/dist/gen/model/payroll-au-v2/timesheet.js +66 -0
- package/dist/gen/model/payroll-au-v2/timesheet.js.map +1 -0
- package/dist/gen/model/payroll-au-v2/timesheetLine.d.ts +33 -0
- package/dist/gen/model/payroll-au-v2/timesheetLine.js +38 -0
- package/dist/gen/model/payroll-au-v2/timesheetLine.js.map +1 -0
- package/dist/gen/model/payroll-au-v2/timesheetLineObject.d.ts +19 -0
- package/dist/gen/model/payroll-au-v2/timesheetLineObject.js +28 -0
- package/dist/gen/model/payroll-au-v2/timesheetLineObject.js.map +1 -0
- package/dist/gen/model/payroll-au-v2/timesheetObject.d.ts +19 -0
- package/dist/gen/model/payroll-au-v2/timesheetObject.js +28 -0
- package/dist/gen/model/payroll-au-v2/timesheetObject.js.map +1 -0
- package/dist/gen/model/payroll-au-v2/timesheets.d.ts +19 -0
- package/dist/gen/model/payroll-au-v2/timesheets.js +28 -0
- package/dist/gen/model/payroll-au-v2/timesheets.js.map +1 -0
- package/dist/gen/model/payroll-nz/employeeLeaveSetup.d.ts +0 -8
- package/dist/gen/model/payroll-nz/employeeLeaveSetup.js +0 -10
- package/dist/gen/model/payroll-nz/employeeLeaveSetup.js.map +1 -1
- package/dist/gen/model/payroll-nz/employeeLeaveType.d.ts +1 -5
- package/dist/gen/model/payroll-nz/employeeLeaveType.js +1 -6
- package/dist/gen/model/payroll-nz/employeeLeaveType.js.map +1 -1
- package/package.json +2 -2
- package/dist/gen/model/finance/accountUsage.d.ts +0 -65
- package/dist/gen/model/finance/accountUsage.js +0 -78
- package/dist/gen/model/finance/accountUsage.js.map +0 -1
- package/dist/gen/model/finance/accountUsageResponse.d.ts +0 -27
- package/dist/gen/model/finance/accountUsageResponse.js +0 -33
- package/dist/gen/model/finance/accountUsageResponse.js.map +0 -1
- package/dist/gen/model/finance/historyRecordResponse.d.ts +0 -33
- package/dist/gen/model/finance/historyRecordResponse.js +0 -38
- package/dist/gen/model/finance/historyRecordResponse.js.map +0 -1
- package/dist/gen/model/finance/lockHistoryModel.js +0 -28
- package/dist/gen/model/finance/lockHistoryModel.js.map +0 -1
- package/dist/gen/model/finance/lockHistoryResponse.d.ts +0 -23
- package/dist/gen/model/finance/lockHistoryResponse.js +0 -28
- package/dist/gen/model/finance/lockHistoryResponse.js.map +0 -1
- package/dist/gen/model/finance/practiceResponse.d.ts +0 -33
- package/dist/gen/model/finance/practiceResponse.js +0 -38
- package/dist/gen/model/finance/practiceResponse.js.map +0 -1
- package/dist/gen/model/finance/reportHistoryModel.d.ts +0 -25
- package/dist/gen/model/finance/reportHistoryModel.js +0 -28
- package/dist/gen/model/finance/reportHistoryModel.js.map +0 -1
- package/dist/gen/model/finance/reportHistoryResponse.d.ts +0 -23
- package/dist/gen/model/finance/reportHistoryResponse.js +0 -28
- package/dist/gen/model/finance/reportHistoryResponse.js.map +0 -1
- package/dist/gen/model/finance/userActivitiesResponse.js +0 -28
- package/dist/gen/model/finance/userActivitiesResponse.js.map +0 -1
- package/dist/gen/model/finance/userResponse.d.ts +0 -57
- package/dist/gen/model/finance/userResponse.js +0 -73
- package/dist/gen/model/finance/userResponse.js.map +0 -1
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Xero Payroll AU API 2.0
|
|
4
|
+
* This is the Xero Payroll API 2.0 for orgs in Australia region.
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 11.1.0
|
|
7
|
+
* Contact: api@xero.com
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
+
* https://openapi-generator.tech
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.PayrollAuV2Api = exports.PayrollAuV2ApiApiKeys = void 0;
|
|
27
|
+
const models_1 = require("../model/payroll-au-v2/models");
|
|
28
|
+
const ApiError_1 = require("../../model/ApiError");
|
|
29
|
+
const axios_1 = __importDefault(require("axios"));
|
|
30
|
+
const models_2 = require("../model/payroll-au-v2/models");
|
|
31
|
+
let defaultBasePath = 'https://api.xero.com/payroll.xro/2.0';
|
|
32
|
+
// ===============================================
|
|
33
|
+
// This file is autogenerated - Please do not edit
|
|
34
|
+
// ===============================================
|
|
35
|
+
var PayrollAuV2ApiApiKeys;
|
|
36
|
+
(function (PayrollAuV2ApiApiKeys) {
|
|
37
|
+
})(PayrollAuV2ApiApiKeys || (exports.PayrollAuV2ApiApiKeys = PayrollAuV2ApiApiKeys = {}));
|
|
38
|
+
class PayrollAuV2Api {
|
|
39
|
+
constructor(basePathOrUsername, password, basePath) {
|
|
40
|
+
this._basePath = defaultBasePath;
|
|
41
|
+
this.defaultHeaders = { 'user-agent': 'xero-node-14.0.0' };
|
|
42
|
+
this._useQuerystring = false;
|
|
43
|
+
this.binaryHeaders = {};
|
|
44
|
+
this.authentications = {
|
|
45
|
+
'default': new models_1.VoidAuth(),
|
|
46
|
+
'OAuth2': new models_2.OAuth(),
|
|
47
|
+
};
|
|
48
|
+
if (password) {
|
|
49
|
+
if (basePath) {
|
|
50
|
+
this.basePath = basePath;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
if (basePathOrUsername) {
|
|
55
|
+
this.basePath = basePathOrUsername;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
set useQuerystring(value) {
|
|
60
|
+
this._useQuerystring = value;
|
|
61
|
+
}
|
|
62
|
+
set basePath(basePath) {
|
|
63
|
+
this._basePath = basePath;
|
|
64
|
+
}
|
|
65
|
+
get basePath() {
|
|
66
|
+
return this._basePath;
|
|
67
|
+
}
|
|
68
|
+
setDefaultAuthentication(auth) {
|
|
69
|
+
this.authentications.default = auth;
|
|
70
|
+
}
|
|
71
|
+
setApiKey(key, value) {
|
|
72
|
+
this.authentications[PayrollAuV2ApiApiKeys[key]].apiKey = value;
|
|
73
|
+
}
|
|
74
|
+
set accessToken(token) {
|
|
75
|
+
this.authentications.OAuth2.accessToken = token;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* @summary Approves a specific timesheet
|
|
80
|
+
* @param xeroTenantId Xero identifier for Tenant
|
|
81
|
+
* @param timesheetID Identifier for the timesheet
|
|
82
|
+
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
|
|
83
|
+
*/
|
|
84
|
+
approveTimesheet(xeroTenantId_1, timesheetID_1, idempotencyKey_1) {
|
|
85
|
+
return __awaiter(this, arguments, void 0, function* (xeroTenantId, timesheetID, idempotencyKey, options = { headers: {} }) {
|
|
86
|
+
const localVarPath = this.basePath + '/Timesheets/{TimesheetID}/Approve'
|
|
87
|
+
.replace('{' + 'TimesheetID' + '}', encodeURIComponent(String(timesheetID)));
|
|
88
|
+
let localVarQueryParameters = {};
|
|
89
|
+
let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
|
|
90
|
+
let localVarFormParams = {};
|
|
91
|
+
let acceptHeadersFromSpec = [
|
|
92
|
+
"application/json"
|
|
93
|
+
];
|
|
94
|
+
const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
|
|
95
|
+
const responseTypeOption = isBufferType ? "arraybuffer" : "json";
|
|
96
|
+
// verify required parameter 'xeroTenantId' is not null or undefined
|
|
97
|
+
if (xeroTenantId === null || xeroTenantId === undefined) {
|
|
98
|
+
throw new Error('Required parameter xeroTenantId was null or undefined when calling approveTimesheet.');
|
|
99
|
+
}
|
|
100
|
+
// verify required parameter 'timesheetID' is not null or undefined
|
|
101
|
+
if (timesheetID === null || timesheetID === undefined) {
|
|
102
|
+
throw new Error('Required parameter timesheetID was null or undefined when calling approveTimesheet.');
|
|
103
|
+
}
|
|
104
|
+
localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
|
|
105
|
+
localVarHeaderParams['Idempotency-Key'] = models_1.ObjectSerializer.serialize(idempotencyKey, "string");
|
|
106
|
+
localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
|
|
107
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
108
|
+
let localVarUseFormData = false;
|
|
109
|
+
let localVarRequestOptions = {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
params: localVarQueryParameters,
|
|
112
|
+
headers: localVarHeaderParams,
|
|
113
|
+
url: localVarPath,
|
|
114
|
+
responseType: responseTypeOption,
|
|
115
|
+
data: {},
|
|
116
|
+
};
|
|
117
|
+
let authenticationPromise = Promise.resolve();
|
|
118
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
|
|
119
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
120
|
+
return authenticationPromise.then(() => {
|
|
121
|
+
if (Object.keys(localVarFormParams).length) {
|
|
122
|
+
if (localVarUseFormData) {
|
|
123
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
124
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
128
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
let body = null;
|
|
133
|
+
try {
|
|
134
|
+
const response = yield (0, axios_1.default)(localVarRequestOptions);
|
|
135
|
+
body = models_1.ObjectSerializer.deserialize(response.data, "TimesheetObject");
|
|
136
|
+
if (response.status && response.status >= 200 && response.status <= 299) {
|
|
137
|
+
resolve({ response: response, body: body });
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
reject({ response: response, body: body });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
const errorResponse = new ApiError_1.ApiError(error);
|
|
145
|
+
reject(JSON.stringify(errorResponse.generateError()));
|
|
146
|
+
}
|
|
147
|
+
}));
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
*
|
|
153
|
+
* @summary Creates a new timesheet
|
|
154
|
+
* @param xeroTenantId Xero identifier for Tenant
|
|
155
|
+
* @param timesheet
|
|
156
|
+
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
|
|
157
|
+
*/
|
|
158
|
+
createTimesheet(xeroTenantId_1, timesheet_1, idempotencyKey_1) {
|
|
159
|
+
return __awaiter(this, arguments, void 0, function* (xeroTenantId, timesheet, idempotencyKey, options = { headers: {} }) {
|
|
160
|
+
const localVarPath = this.basePath + '/Timesheets';
|
|
161
|
+
let localVarQueryParameters = {};
|
|
162
|
+
let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
|
|
163
|
+
let localVarFormParams = {};
|
|
164
|
+
let acceptHeadersFromSpec = [
|
|
165
|
+
"application/json"
|
|
166
|
+
];
|
|
167
|
+
const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
|
|
168
|
+
const responseTypeOption = isBufferType ? "arraybuffer" : "json";
|
|
169
|
+
// verify required parameter 'xeroTenantId' is not null or undefined
|
|
170
|
+
if (xeroTenantId === null || xeroTenantId === undefined) {
|
|
171
|
+
throw new Error('Required parameter xeroTenantId was null or undefined when calling createTimesheet.');
|
|
172
|
+
}
|
|
173
|
+
// verify required parameter 'timesheet' is not null or undefined
|
|
174
|
+
if (timesheet === null || timesheet === undefined) {
|
|
175
|
+
throw new Error('Required parameter timesheet was null or undefined when calling createTimesheet.');
|
|
176
|
+
}
|
|
177
|
+
localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
|
|
178
|
+
localVarHeaderParams['Idempotency-Key'] = models_1.ObjectSerializer.serialize(idempotencyKey, "string");
|
|
179
|
+
localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
|
|
180
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
181
|
+
let localVarUseFormData = false;
|
|
182
|
+
let localVarRequestOptions = {
|
|
183
|
+
method: 'POST',
|
|
184
|
+
params: localVarQueryParameters,
|
|
185
|
+
headers: localVarHeaderParams,
|
|
186
|
+
url: localVarPath,
|
|
187
|
+
responseType: responseTypeOption,
|
|
188
|
+
data: models_1.ObjectSerializer.serialize(timesheet, "Timesheet"),
|
|
189
|
+
};
|
|
190
|
+
let authenticationPromise = Promise.resolve();
|
|
191
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
|
|
192
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
193
|
+
return authenticationPromise.then(() => {
|
|
194
|
+
if (Object.keys(localVarFormParams).length) {
|
|
195
|
+
if (localVarUseFormData) {
|
|
196
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
197
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
201
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
let body = null;
|
|
206
|
+
try {
|
|
207
|
+
const response = yield (0, axios_1.default)(localVarRequestOptions);
|
|
208
|
+
body = models_1.ObjectSerializer.deserialize(response.data, "TimesheetObject");
|
|
209
|
+
if (response.status && response.status >= 200 && response.status <= 299) {
|
|
210
|
+
resolve({ response: response, body: body });
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
reject({ response: response, body: body });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
const errorResponse = new ApiError_1.ApiError(error);
|
|
218
|
+
reject(JSON.stringify(errorResponse.generateError()));
|
|
219
|
+
}
|
|
220
|
+
}));
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
*
|
|
226
|
+
* @summary Creates a new timesheet line for a specific timesheet using a unique timesheet ID
|
|
227
|
+
* @param xeroTenantId Xero identifier for Tenant
|
|
228
|
+
* @param timesheetID Identifier for the timesheet
|
|
229
|
+
* @param timesheetLine
|
|
230
|
+
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
|
|
231
|
+
*/
|
|
232
|
+
createTimesheetLine(xeroTenantId_1, timesheetID_1, timesheetLine_1, idempotencyKey_1) {
|
|
233
|
+
return __awaiter(this, arguments, void 0, function* (xeroTenantId, timesheetID, timesheetLine, idempotencyKey, options = { headers: {} }) {
|
|
234
|
+
const localVarPath = this.basePath + '/Timesheets/{TimesheetID}/Lines'
|
|
235
|
+
.replace('{' + 'TimesheetID' + '}', encodeURIComponent(String(timesheetID)));
|
|
236
|
+
let localVarQueryParameters = {};
|
|
237
|
+
let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
|
|
238
|
+
let localVarFormParams = {};
|
|
239
|
+
let acceptHeadersFromSpec = [
|
|
240
|
+
"application/json"
|
|
241
|
+
];
|
|
242
|
+
const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
|
|
243
|
+
const responseTypeOption = isBufferType ? "arraybuffer" : "json";
|
|
244
|
+
// verify required parameter 'xeroTenantId' is not null or undefined
|
|
245
|
+
if (xeroTenantId === null || xeroTenantId === undefined) {
|
|
246
|
+
throw new Error('Required parameter xeroTenantId was null or undefined when calling createTimesheetLine.');
|
|
247
|
+
}
|
|
248
|
+
// verify required parameter 'timesheetID' is not null or undefined
|
|
249
|
+
if (timesheetID === null || timesheetID === undefined) {
|
|
250
|
+
throw new Error('Required parameter timesheetID was null or undefined when calling createTimesheetLine.');
|
|
251
|
+
}
|
|
252
|
+
// verify required parameter 'timesheetLine' is not null or undefined
|
|
253
|
+
if (timesheetLine === null || timesheetLine === undefined) {
|
|
254
|
+
throw new Error('Required parameter timesheetLine was null or undefined when calling createTimesheetLine.');
|
|
255
|
+
}
|
|
256
|
+
localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
|
|
257
|
+
localVarHeaderParams['Idempotency-Key'] = models_1.ObjectSerializer.serialize(idempotencyKey, "string");
|
|
258
|
+
localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
|
|
259
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
260
|
+
let localVarUseFormData = false;
|
|
261
|
+
let localVarRequestOptions = {
|
|
262
|
+
method: 'POST',
|
|
263
|
+
params: localVarQueryParameters,
|
|
264
|
+
headers: localVarHeaderParams,
|
|
265
|
+
url: localVarPath,
|
|
266
|
+
responseType: responseTypeOption,
|
|
267
|
+
data: models_1.ObjectSerializer.serialize(timesheetLine, "TimesheetLine"),
|
|
268
|
+
};
|
|
269
|
+
let authenticationPromise = Promise.resolve();
|
|
270
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
|
|
271
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
272
|
+
return authenticationPromise.then(() => {
|
|
273
|
+
if (Object.keys(localVarFormParams).length) {
|
|
274
|
+
if (localVarUseFormData) {
|
|
275
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
276
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
280
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
let body = null;
|
|
285
|
+
try {
|
|
286
|
+
const response = yield (0, axios_1.default)(localVarRequestOptions);
|
|
287
|
+
body = models_1.ObjectSerializer.deserialize(response.data, "TimesheetLineObject");
|
|
288
|
+
if (response.status && response.status >= 200 && response.status <= 299) {
|
|
289
|
+
resolve({ response: response, body: body });
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
reject({ response: response, body: body });
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
const errorResponse = new ApiError_1.ApiError(error);
|
|
297
|
+
reject(JSON.stringify(errorResponse.generateError()));
|
|
298
|
+
}
|
|
299
|
+
}));
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
*
|
|
305
|
+
* @summary Deletes a specific timesheet
|
|
306
|
+
* @param xeroTenantId Xero identifier for Tenant
|
|
307
|
+
* @param timesheetID Identifier for the timesheet
|
|
308
|
+
*/
|
|
309
|
+
deleteTimesheet(xeroTenantId_1, timesheetID_1) {
|
|
310
|
+
return __awaiter(this, arguments, void 0, function* (xeroTenantId, timesheetID, options = { headers: {} }) {
|
|
311
|
+
const localVarPath = this.basePath + '/Timesheets/{TimesheetID}'
|
|
312
|
+
.replace('{' + 'TimesheetID' + '}', encodeURIComponent(String(timesheetID)));
|
|
313
|
+
let localVarQueryParameters = {};
|
|
314
|
+
let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
|
|
315
|
+
let localVarFormParams = {};
|
|
316
|
+
let acceptHeadersFromSpec = [
|
|
317
|
+
"application/json"
|
|
318
|
+
];
|
|
319
|
+
const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
|
|
320
|
+
const responseTypeOption = isBufferType ? "arraybuffer" : "json";
|
|
321
|
+
// verify required parameter 'xeroTenantId' is not null or undefined
|
|
322
|
+
if (xeroTenantId === null || xeroTenantId === undefined) {
|
|
323
|
+
throw new Error('Required parameter xeroTenantId was null or undefined when calling deleteTimesheet.');
|
|
324
|
+
}
|
|
325
|
+
// verify required parameter 'timesheetID' is not null or undefined
|
|
326
|
+
if (timesheetID === null || timesheetID === undefined) {
|
|
327
|
+
throw new Error('Required parameter timesheetID was null or undefined when calling deleteTimesheet.');
|
|
328
|
+
}
|
|
329
|
+
localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
|
|
330
|
+
localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
|
|
331
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
332
|
+
let localVarUseFormData = false;
|
|
333
|
+
let localVarRequestOptions = {
|
|
334
|
+
method: 'DELETE',
|
|
335
|
+
params: localVarQueryParameters,
|
|
336
|
+
headers: localVarHeaderParams,
|
|
337
|
+
url: localVarPath,
|
|
338
|
+
responseType: responseTypeOption,
|
|
339
|
+
data: {},
|
|
340
|
+
};
|
|
341
|
+
let authenticationPromise = Promise.resolve();
|
|
342
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
|
|
343
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
344
|
+
return authenticationPromise.then(() => {
|
|
345
|
+
if (Object.keys(localVarFormParams).length) {
|
|
346
|
+
if (localVarUseFormData) {
|
|
347
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
348
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
352
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
356
|
+
let body = null;
|
|
357
|
+
try {
|
|
358
|
+
const response = yield (0, axios_1.default)(localVarRequestOptions);
|
|
359
|
+
body = models_1.ObjectSerializer.deserialize(response.data, "TimesheetLine");
|
|
360
|
+
if (response.status && response.status >= 200 && response.status <= 299) {
|
|
361
|
+
resolve({ response: response, body: body });
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
reject({ response: response, body: body });
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
const errorResponse = new ApiError_1.ApiError(error);
|
|
369
|
+
reject(JSON.stringify(errorResponse.generateError()));
|
|
370
|
+
}
|
|
371
|
+
}));
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
*
|
|
377
|
+
* @summary Deletes a specific timesheet line
|
|
378
|
+
* @param xeroTenantId Xero identifier for Tenant
|
|
379
|
+
* @param timesheetID Identifier for the timesheet
|
|
380
|
+
* @param timesheetLineID Identifier for the timesheet line
|
|
381
|
+
*/
|
|
382
|
+
deleteTimesheetLine(xeroTenantId_1, timesheetID_1, timesheetLineID_1) {
|
|
383
|
+
return __awaiter(this, arguments, void 0, function* (xeroTenantId, timesheetID, timesheetLineID, options = { headers: {} }) {
|
|
384
|
+
const localVarPath = this.basePath + '/Timesheets/{TimesheetID}/Lines/{TimesheetLineID}'
|
|
385
|
+
.replace('{' + 'TimesheetID' + '}', encodeURIComponent(String(timesheetID)))
|
|
386
|
+
.replace('{' + 'TimesheetLineID' + '}', encodeURIComponent(String(timesheetLineID)));
|
|
387
|
+
let localVarQueryParameters = {};
|
|
388
|
+
let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
|
|
389
|
+
let localVarFormParams = {};
|
|
390
|
+
let acceptHeadersFromSpec = [
|
|
391
|
+
"application/json"
|
|
392
|
+
];
|
|
393
|
+
const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
|
|
394
|
+
const responseTypeOption = isBufferType ? "arraybuffer" : "json";
|
|
395
|
+
// verify required parameter 'xeroTenantId' is not null or undefined
|
|
396
|
+
if (xeroTenantId === null || xeroTenantId === undefined) {
|
|
397
|
+
throw new Error('Required parameter xeroTenantId was null or undefined when calling deleteTimesheetLine.');
|
|
398
|
+
}
|
|
399
|
+
// verify required parameter 'timesheetID' is not null or undefined
|
|
400
|
+
if (timesheetID === null || timesheetID === undefined) {
|
|
401
|
+
throw new Error('Required parameter timesheetID was null or undefined when calling deleteTimesheetLine.');
|
|
402
|
+
}
|
|
403
|
+
// verify required parameter 'timesheetLineID' is not null or undefined
|
|
404
|
+
if (timesheetLineID === null || timesheetLineID === undefined) {
|
|
405
|
+
throw new Error('Required parameter timesheetLineID was null or undefined when calling deleteTimesheetLine.');
|
|
406
|
+
}
|
|
407
|
+
localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
|
|
408
|
+
localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
|
|
409
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
410
|
+
let localVarUseFormData = false;
|
|
411
|
+
let localVarRequestOptions = {
|
|
412
|
+
method: 'DELETE',
|
|
413
|
+
params: localVarQueryParameters,
|
|
414
|
+
headers: localVarHeaderParams,
|
|
415
|
+
url: localVarPath,
|
|
416
|
+
responseType: responseTypeOption,
|
|
417
|
+
data: {},
|
|
418
|
+
};
|
|
419
|
+
let authenticationPromise = Promise.resolve();
|
|
420
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
|
|
421
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
422
|
+
return authenticationPromise.then(() => {
|
|
423
|
+
if (Object.keys(localVarFormParams).length) {
|
|
424
|
+
if (localVarUseFormData) {
|
|
425
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
426
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
430
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
434
|
+
let body = null;
|
|
435
|
+
try {
|
|
436
|
+
const response = yield (0, axios_1.default)(localVarRequestOptions);
|
|
437
|
+
body = models_1.ObjectSerializer.deserialize(response.data, "TimesheetLine");
|
|
438
|
+
if (response.status && response.status >= 200 && response.status <= 299) {
|
|
439
|
+
resolve({ response: response, body: body });
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
reject({ response: response, body: body });
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
catch (error) {
|
|
446
|
+
const errorResponse = new ApiError_1.ApiError(error);
|
|
447
|
+
reject(JSON.stringify(errorResponse.generateError()));
|
|
448
|
+
}
|
|
449
|
+
}));
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
*
|
|
455
|
+
* @summary Retrieve a specific timesheet by using a unique timesheet ID
|
|
456
|
+
* @param xeroTenantId Xero identifier for Tenant
|
|
457
|
+
* @param timesheetID Identifier for the timesheet
|
|
458
|
+
*/
|
|
459
|
+
getTimesheet(xeroTenantId_1, timesheetID_1) {
|
|
460
|
+
return __awaiter(this, arguments, void 0, function* (xeroTenantId, timesheetID, options = { headers: {} }) {
|
|
461
|
+
const localVarPath = this.basePath + '/Timesheets/{TimesheetID}'
|
|
462
|
+
.replace('{' + 'TimesheetID' + '}', encodeURIComponent(String(timesheetID)));
|
|
463
|
+
let localVarQueryParameters = {};
|
|
464
|
+
let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
|
|
465
|
+
let localVarFormParams = {};
|
|
466
|
+
let acceptHeadersFromSpec = [
|
|
467
|
+
"application/json"
|
|
468
|
+
];
|
|
469
|
+
const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
|
|
470
|
+
const responseTypeOption = isBufferType ? "arraybuffer" : "json";
|
|
471
|
+
// verify required parameter 'xeroTenantId' is not null or undefined
|
|
472
|
+
if (xeroTenantId === null || xeroTenantId === undefined) {
|
|
473
|
+
throw new Error('Required parameter xeroTenantId was null or undefined when calling getTimesheet.');
|
|
474
|
+
}
|
|
475
|
+
// verify required parameter 'timesheetID' is not null or undefined
|
|
476
|
+
if (timesheetID === null || timesheetID === undefined) {
|
|
477
|
+
throw new Error('Required parameter timesheetID was null or undefined when calling getTimesheet.');
|
|
478
|
+
}
|
|
479
|
+
localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
|
|
480
|
+
localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
|
|
481
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
482
|
+
let localVarUseFormData = false;
|
|
483
|
+
let localVarRequestOptions = {
|
|
484
|
+
method: 'GET',
|
|
485
|
+
params: localVarQueryParameters,
|
|
486
|
+
headers: localVarHeaderParams,
|
|
487
|
+
url: localVarPath,
|
|
488
|
+
responseType: responseTypeOption,
|
|
489
|
+
data: {},
|
|
490
|
+
};
|
|
491
|
+
let authenticationPromise = Promise.resolve();
|
|
492
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
|
|
493
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
494
|
+
return authenticationPromise.then(() => {
|
|
495
|
+
if (Object.keys(localVarFormParams).length) {
|
|
496
|
+
if (localVarUseFormData) {
|
|
497
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
498
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
502
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
506
|
+
let body = null;
|
|
507
|
+
try {
|
|
508
|
+
const response = yield (0, axios_1.default)(localVarRequestOptions);
|
|
509
|
+
body = models_1.ObjectSerializer.deserialize(response.data, "TimesheetObject");
|
|
510
|
+
if (response.status && response.status >= 200 && response.status <= 299) {
|
|
511
|
+
resolve({ response: response, body: body });
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
reject({ response: response, body: body });
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
catch (error) {
|
|
518
|
+
const errorResponse = new ApiError_1.ApiError(error);
|
|
519
|
+
reject(JSON.stringify(errorResponse.generateError()));
|
|
520
|
+
}
|
|
521
|
+
}));
|
|
522
|
+
});
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
*
|
|
527
|
+
* @summary Retrieves timesheets
|
|
528
|
+
* @param xeroTenantId Xero identifier for Tenant
|
|
529
|
+
* @param page Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
|
|
530
|
+
* @param filter Filter by employeeId and/or payrollCalendarId
|
|
531
|
+
* @param status filter results by any timesheets with a matching timesheet status
|
|
532
|
+
* @param startDate filter results by any timesheets with a startDate on or after the provided date
|
|
533
|
+
* @param endDate filter results by any timesheets with a endDate on or before the provided date
|
|
534
|
+
* @param sort sort the order of timesheets returned. The default is based on the timesheets createdDate, sorted oldest to newest. Currently, the only other option is to reverse the order based on the timesheets startDate, sorted newest to oldest.
|
|
535
|
+
*/
|
|
536
|
+
getTimesheets(xeroTenantId_1, page_1, filter_1, status_1, startDate_1, endDate_1, sort_1) {
|
|
537
|
+
return __awaiter(this, arguments, void 0, function* (xeroTenantId, page, filter, status, startDate, endDate, sort, options = { headers: {} }) {
|
|
538
|
+
const localVarPath = this.basePath + '/Timesheets';
|
|
539
|
+
let localVarQueryParameters = {};
|
|
540
|
+
let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
|
|
541
|
+
let localVarFormParams = {};
|
|
542
|
+
let acceptHeadersFromSpec = [
|
|
543
|
+
"application/json"
|
|
544
|
+
];
|
|
545
|
+
const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
|
|
546
|
+
const responseTypeOption = isBufferType ? "arraybuffer" : "json";
|
|
547
|
+
// verify required parameter 'xeroTenantId' is not null or undefined
|
|
548
|
+
if (xeroTenantId === null || xeroTenantId === undefined) {
|
|
549
|
+
throw new Error('Required parameter xeroTenantId was null or undefined when calling getTimesheets.');
|
|
550
|
+
}
|
|
551
|
+
if (page !== undefined) {
|
|
552
|
+
localVarQueryParameters['page'] = models_1.ObjectSerializer.serialize(page, "number");
|
|
553
|
+
}
|
|
554
|
+
if (filter !== undefined) {
|
|
555
|
+
localVarQueryParameters['filter'] = models_1.ObjectSerializer.serialize(filter, "string");
|
|
556
|
+
}
|
|
557
|
+
if (status !== undefined) {
|
|
558
|
+
localVarQueryParameters['status'] = models_1.ObjectSerializer.serialize(status, "string");
|
|
559
|
+
}
|
|
560
|
+
if (startDate !== undefined) {
|
|
561
|
+
localVarQueryParameters['startDate'] = models_1.ObjectSerializer.serialize(startDate, "string");
|
|
562
|
+
}
|
|
563
|
+
if (endDate !== undefined) {
|
|
564
|
+
localVarQueryParameters['endDate'] = models_1.ObjectSerializer.serialize(endDate, "string");
|
|
565
|
+
}
|
|
566
|
+
if (sort !== undefined) {
|
|
567
|
+
localVarQueryParameters['sort'] = models_1.ObjectSerializer.serialize(sort, "string");
|
|
568
|
+
}
|
|
569
|
+
localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
|
|
570
|
+
localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
|
|
571
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
572
|
+
let localVarUseFormData = false;
|
|
573
|
+
let localVarRequestOptions = {
|
|
574
|
+
method: 'GET',
|
|
575
|
+
params: localVarQueryParameters,
|
|
576
|
+
headers: localVarHeaderParams,
|
|
577
|
+
url: localVarPath,
|
|
578
|
+
responseType: responseTypeOption,
|
|
579
|
+
data: {},
|
|
580
|
+
};
|
|
581
|
+
let authenticationPromise = Promise.resolve();
|
|
582
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
|
|
583
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
584
|
+
return authenticationPromise.then(() => {
|
|
585
|
+
if (Object.keys(localVarFormParams).length) {
|
|
586
|
+
if (localVarUseFormData) {
|
|
587
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
588
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
592
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
596
|
+
let body = null;
|
|
597
|
+
try {
|
|
598
|
+
const response = yield (0, axios_1.default)(localVarRequestOptions);
|
|
599
|
+
body = models_1.ObjectSerializer.deserialize(response.data, "Timesheets");
|
|
600
|
+
if (response.status && response.status >= 200 && response.status <= 299) {
|
|
601
|
+
resolve({ response: response, body: body });
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
reject({ response: response, body: body });
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
catch (error) {
|
|
608
|
+
const errorResponse = new ApiError_1.ApiError(error);
|
|
609
|
+
reject(JSON.stringify(errorResponse.generateError()));
|
|
610
|
+
}
|
|
611
|
+
}));
|
|
612
|
+
});
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
*
|
|
617
|
+
* @summary Reverts a specific timesheet to draft
|
|
618
|
+
* @param xeroTenantId Xero identifier for Tenant
|
|
619
|
+
* @param timesheetID Identifier for the timesheet
|
|
620
|
+
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
|
|
621
|
+
*/
|
|
622
|
+
revertTimesheet(xeroTenantId_1, timesheetID_1, idempotencyKey_1) {
|
|
623
|
+
return __awaiter(this, arguments, void 0, function* (xeroTenantId, timesheetID, idempotencyKey, options = { headers: {} }) {
|
|
624
|
+
const localVarPath = this.basePath + '/Timesheets/{TimesheetID}/RevertToDraft'
|
|
625
|
+
.replace('{' + 'TimesheetID' + '}', encodeURIComponent(String(timesheetID)));
|
|
626
|
+
let localVarQueryParameters = {};
|
|
627
|
+
let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
|
|
628
|
+
let localVarFormParams = {};
|
|
629
|
+
let acceptHeadersFromSpec = [
|
|
630
|
+
"application/json"
|
|
631
|
+
];
|
|
632
|
+
const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
|
|
633
|
+
const responseTypeOption = isBufferType ? "arraybuffer" : "json";
|
|
634
|
+
// verify required parameter 'xeroTenantId' is not null or undefined
|
|
635
|
+
if (xeroTenantId === null || xeroTenantId === undefined) {
|
|
636
|
+
throw new Error('Required parameter xeroTenantId was null or undefined when calling revertTimesheet.');
|
|
637
|
+
}
|
|
638
|
+
// verify required parameter 'timesheetID' is not null or undefined
|
|
639
|
+
if (timesheetID === null || timesheetID === undefined) {
|
|
640
|
+
throw new Error('Required parameter timesheetID was null or undefined when calling revertTimesheet.');
|
|
641
|
+
}
|
|
642
|
+
localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
|
|
643
|
+
localVarHeaderParams['Idempotency-Key'] = models_1.ObjectSerializer.serialize(idempotencyKey, "string");
|
|
644
|
+
localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
|
|
645
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
646
|
+
let localVarUseFormData = false;
|
|
647
|
+
let localVarRequestOptions = {
|
|
648
|
+
method: 'POST',
|
|
649
|
+
params: localVarQueryParameters,
|
|
650
|
+
headers: localVarHeaderParams,
|
|
651
|
+
url: localVarPath,
|
|
652
|
+
responseType: responseTypeOption,
|
|
653
|
+
data: {},
|
|
654
|
+
};
|
|
655
|
+
let authenticationPromise = Promise.resolve();
|
|
656
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
|
|
657
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
658
|
+
return authenticationPromise.then(() => {
|
|
659
|
+
if (Object.keys(localVarFormParams).length) {
|
|
660
|
+
if (localVarUseFormData) {
|
|
661
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
662
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
666
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
670
|
+
let body = null;
|
|
671
|
+
try {
|
|
672
|
+
const response = yield (0, axios_1.default)(localVarRequestOptions);
|
|
673
|
+
body = models_1.ObjectSerializer.deserialize(response.data, "TimesheetObject");
|
|
674
|
+
if (response.status && response.status >= 200 && response.status <= 299) {
|
|
675
|
+
resolve({ response: response, body: body });
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
reject({ response: response, body: body });
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
catch (error) {
|
|
682
|
+
const errorResponse = new ApiError_1.ApiError(error);
|
|
683
|
+
reject(JSON.stringify(errorResponse.generateError()));
|
|
684
|
+
}
|
|
685
|
+
}));
|
|
686
|
+
});
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
*
|
|
691
|
+
* @summary Updates a specific timesheet line for a specific timesheet
|
|
692
|
+
* @param xeroTenantId Xero identifier for Tenant
|
|
693
|
+
* @param timesheetID Identifier for the timesheet
|
|
694
|
+
* @param timesheetLineID Identifier for the timesheet line
|
|
695
|
+
* @param timesheetLine
|
|
696
|
+
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
|
|
697
|
+
*/
|
|
698
|
+
updateTimesheetLine(xeroTenantId_1, timesheetID_1, timesheetLineID_1, timesheetLine_1, idempotencyKey_1) {
|
|
699
|
+
return __awaiter(this, arguments, void 0, function* (xeroTenantId, timesheetID, timesheetLineID, timesheetLine, idempotencyKey, options = { headers: {} }) {
|
|
700
|
+
const localVarPath = this.basePath + '/Timesheets/{TimesheetID}/Lines/{TimesheetLineID}'
|
|
701
|
+
.replace('{' + 'TimesheetID' + '}', encodeURIComponent(String(timesheetID)))
|
|
702
|
+
.replace('{' + 'TimesheetLineID' + '}', encodeURIComponent(String(timesheetLineID)));
|
|
703
|
+
let localVarQueryParameters = {};
|
|
704
|
+
let localVarHeaderParams = Object.assign({}, this.defaultHeaders);
|
|
705
|
+
let localVarFormParams = {};
|
|
706
|
+
let acceptHeadersFromSpec = [
|
|
707
|
+
"application/json"
|
|
708
|
+
];
|
|
709
|
+
const isBufferType = acceptHeadersFromSpec.includes("application/pdf") || acceptHeadersFromSpec.includes("application/octet-stream") || acceptHeadersFromSpec.includes("application/jpg");
|
|
710
|
+
const responseTypeOption = isBufferType ? "arraybuffer" : "json";
|
|
711
|
+
// verify required parameter 'xeroTenantId' is not null or undefined
|
|
712
|
+
if (xeroTenantId === null || xeroTenantId === undefined) {
|
|
713
|
+
throw new Error('Required parameter xeroTenantId was null or undefined when calling updateTimesheetLine.');
|
|
714
|
+
}
|
|
715
|
+
// verify required parameter 'timesheetID' is not null or undefined
|
|
716
|
+
if (timesheetID === null || timesheetID === undefined) {
|
|
717
|
+
throw new Error('Required parameter timesheetID was null or undefined when calling updateTimesheetLine.');
|
|
718
|
+
}
|
|
719
|
+
// verify required parameter 'timesheetLineID' is not null or undefined
|
|
720
|
+
if (timesheetLineID === null || timesheetLineID === undefined) {
|
|
721
|
+
throw new Error('Required parameter timesheetLineID was null or undefined when calling updateTimesheetLine.');
|
|
722
|
+
}
|
|
723
|
+
// verify required parameter 'timesheetLine' is not null or undefined
|
|
724
|
+
if (timesheetLine === null || timesheetLine === undefined) {
|
|
725
|
+
throw new Error('Required parameter timesheetLine was null or undefined when calling updateTimesheetLine.');
|
|
726
|
+
}
|
|
727
|
+
localVarHeaderParams['Xero-Tenant-Id'] = models_1.ObjectSerializer.serialize(xeroTenantId, "string");
|
|
728
|
+
localVarHeaderParams['Idempotency-Key'] = models_1.ObjectSerializer.serialize(idempotencyKey, "string");
|
|
729
|
+
localVarHeaderParams['Accept'] = acceptHeadersFromSpec.join();
|
|
730
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
731
|
+
let localVarUseFormData = false;
|
|
732
|
+
let localVarRequestOptions = {
|
|
733
|
+
method: 'PUT',
|
|
734
|
+
params: localVarQueryParameters,
|
|
735
|
+
headers: localVarHeaderParams,
|
|
736
|
+
url: localVarPath,
|
|
737
|
+
responseType: responseTypeOption,
|
|
738
|
+
data: models_1.ObjectSerializer.serialize(timesheetLine, "TimesheetLine"),
|
|
739
|
+
};
|
|
740
|
+
let authenticationPromise = Promise.resolve();
|
|
741
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
|
|
742
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
743
|
+
return authenticationPromise.then(() => {
|
|
744
|
+
if (Object.keys(localVarFormParams).length) {
|
|
745
|
+
if (localVarUseFormData) {
|
|
746
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
747
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'Content-Type': 'multipart/form-data' });
|
|
748
|
+
}
|
|
749
|
+
else {
|
|
750
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
751
|
+
localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarRequestOptions.headers), { 'content-type': 'application/x-www-form-urlencoded' });
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
755
|
+
let body = null;
|
|
756
|
+
try {
|
|
757
|
+
const response = yield (0, axios_1.default)(localVarRequestOptions);
|
|
758
|
+
body = models_1.ObjectSerializer.deserialize(response.data, "TimesheetLineObject");
|
|
759
|
+
if (response.status && response.status >= 200 && response.status <= 299) {
|
|
760
|
+
resolve({ response: response, body: body });
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
reject({ response: response, body: body });
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
catch (error) {
|
|
767
|
+
const errorResponse = new ApiError_1.ApiError(error);
|
|
768
|
+
reject(JSON.stringify(errorResponse.generateError()));
|
|
769
|
+
}
|
|
770
|
+
}));
|
|
771
|
+
});
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
exports.PayrollAuV2Api = PayrollAuV2Api;
|
|
776
|
+
//# sourceMappingURL=payrollAUV2Api.js.map
|