bamboohr.com 1.4.8 → 1.5.1
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/dist/BambooHR.js +5 -5
- package/dist/Endpoints.d.ts +1 -1
- package/dist/Endpoints.js +6 -5
- package/dist/api/EmployeesAPI.d.ts +3 -3
- package/dist/api/EmployeesAPI.js +2 -2
- package/dist/api/TimeOffAPI.d.ts +3 -3
- package/package.json +10 -11
package/dist/BambooHR.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BambooHR = void 0;
|
|
4
|
-
const
|
|
4
|
+
const api_client_1 = require("@ffflorian/api-client");
|
|
5
5
|
const api_1 = require("./api");
|
|
6
6
|
class BambooHR {
|
|
7
7
|
constructor(options) {
|
|
8
8
|
this.options = options;
|
|
9
|
-
|
|
9
|
+
const baseURL = `https://api.bamboohr.com/api/gateway.php/${options.companyDomain}/v1/`;
|
|
10
|
+
this.apiClient = new api_client_1.APIClient(baseURL, {
|
|
10
11
|
auth: {
|
|
11
12
|
// eslint-disable-next-line no-magic-numbers
|
|
12
13
|
password: Math.random().toString(36).substring(7),
|
|
13
14
|
username: this.options.apiKey,
|
|
14
15
|
},
|
|
15
|
-
baseURL: `https://api.bamboohr.com/api/gateway.php/${options.companyDomain}/v1/`,
|
|
16
16
|
headers: {
|
|
17
17
|
Accept: 'application/json',
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
|
-
this.apiClient.interceptors.response.
|
|
21
|
-
const errorMessage = response.headers
|
|
20
|
+
this.apiClient.interceptors.response.push(response => {
|
|
21
|
+
const errorMessage = response.headers.get('x-bamboohr-error-message') || response.statusText;
|
|
22
22
|
throw new Error(`HTTP error ${response.status}: ${errorMessage}`);
|
|
23
23
|
});
|
|
24
24
|
this.api = {
|
package/dist/Endpoints.d.ts
CHANGED
package/dist/Endpoints.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Endpoint = void 0;
|
|
4
|
-
const qs = require("qs");
|
|
5
4
|
exports.Endpoint = {
|
|
6
5
|
DIRECTORY: 'directory',
|
|
7
6
|
EMPLOYEES: 'employees',
|
|
@@ -13,14 +12,16 @@ exports.Endpoint = {
|
|
|
13
12
|
WHOS_OUT: 'whos_out',
|
|
14
13
|
Employees: {
|
|
15
14
|
employees(id, fields) {
|
|
16
|
-
|
|
15
|
+
const url = new URL(`/${exports.Endpoint.EMPLOYEES}/`, 'https://example.com');
|
|
17
16
|
if (id) {
|
|
18
|
-
|
|
17
|
+
url.pathname += `${id}/`;
|
|
19
18
|
}
|
|
20
19
|
if (fields) {
|
|
21
|
-
|
|
20
|
+
const params = new URLSearchParams();
|
|
21
|
+
params.append('fields', fields.join(','));
|
|
22
|
+
url.search = params.toString();
|
|
22
23
|
}
|
|
23
|
-
return
|
|
24
|
+
return `${url.pathname}${url.search}`;
|
|
24
25
|
},
|
|
25
26
|
employeeDirectory() {
|
|
26
27
|
return `/${exports.Endpoint.EMPLOYEES}/${exports.Endpoint.DIRECTORY}/`;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { Fields, Employee, WritableFields, EmployeeDirectory } from '../interfaces';
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
|
+
import type { Fields, Employee, WritableFields, EmployeeDirectory } from '../interfaces';
|
|
3
3
|
export declare class EmployeesAPI {
|
|
4
4
|
private readonly apiClient;
|
|
5
|
-
constructor(apiClient:
|
|
5
|
+
constructor(apiClient: APIClient);
|
|
6
6
|
/**
|
|
7
7
|
* Update an employee, based on employee id.
|
|
8
8
|
* @see https://documentation.bamboohr.com/reference#add-employee-1
|
package/dist/api/EmployeesAPI.js
CHANGED
|
@@ -22,7 +22,7 @@ class EmployeesAPI {
|
|
|
22
22
|
addEmployee(fields) {
|
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
const endpoint = Endpoints_1.Endpoint.Employees.employees();
|
|
25
|
-
const { data } = yield this.apiClient.post(endpoint,
|
|
25
|
+
const { data } = yield this.apiClient.post(endpoint, fields);
|
|
26
26
|
return data;
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -55,7 +55,7 @@ class EmployeesAPI {
|
|
|
55
55
|
updateEmployee(id, fields) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
57
|
const endpoint = Endpoints_1.Endpoint.Employees.employees(id);
|
|
58
|
-
const { data } = yield this.apiClient.post(endpoint,
|
|
58
|
+
const { data } = yield this.apiClient.post(endpoint, fields);
|
|
59
59
|
return data;
|
|
60
60
|
});
|
|
61
61
|
}
|
package/dist/api/TimeOffAPI.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { OffEmployee, TimeOffPolicy, TimeOffTypes, TimeOffRequestsOptions, TimeOffRequest } from '../interfaces';
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
|
+
import type { OffEmployee, TimeOffPolicy, TimeOffTypes, TimeOffRequestsOptions, TimeOffRequest } from '../interfaces';
|
|
3
3
|
export declare class TimeOffAPI {
|
|
4
4
|
private readonly apiClient;
|
|
5
|
-
constructor(apiClient:
|
|
5
|
+
constructor(apiClient: APIClient);
|
|
6
6
|
/**
|
|
7
7
|
* This endpoint will return a list, sorted by date, of employees who will be out, and company holidays, for a period of time.
|
|
8
8
|
* @see https://documentation.bamboohr.com/reference#get-a-list-of-whos-out-1
|
package/package.json
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Florian Imdahl <git@ffflorian.de>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@
|
|
5
|
-
"
|
|
6
|
-
"qs": "6.14.0"
|
|
4
|
+
"@ffflorian/api-client": "2.1.2",
|
|
5
|
+
"@hapi/hawk": "8.0.0"
|
|
7
6
|
},
|
|
8
7
|
"description": "An bamboohr.com API client",
|
|
9
8
|
"devDependencies": {
|
|
10
|
-
"@types/hapi__hawk": "8.0.
|
|
9
|
+
"@types/hapi__hawk": "8.0.7",
|
|
11
10
|
"@types/node": "~24",
|
|
12
|
-
"rimraf": "6.0
|
|
13
|
-
"typedoc": "0.28.
|
|
11
|
+
"rimraf": "6.1.0",
|
|
12
|
+
"typedoc": "0.28.14",
|
|
14
13
|
"typescript": "5.9.3"
|
|
15
14
|
},
|
|
16
15
|
"engines": {
|
|
17
|
-
"node": ">=
|
|
16
|
+
"node": ">= 21"
|
|
18
17
|
},
|
|
19
18
|
"files": [
|
|
20
19
|
"dist"
|
|
@@ -29,12 +28,12 @@
|
|
|
29
28
|
"name": "bamboohr.com",
|
|
30
29
|
"repository": "https://github.com/ffflorian/api-clients/tree/main/packages/bamboohr.com",
|
|
31
30
|
"scripts": {
|
|
32
|
-
"build:ts": "tsc",
|
|
33
|
-
"build:docs": "typedoc --options ../../typedoc.json --out ../../docs/packages/bamboohr.com src/index.ts",
|
|
31
|
+
"build:ts": "tsc -p tsconfig.build.json",
|
|
32
|
+
"build:docs": "typedoc --tsconfig tsconfig.build.json --options ../../typedoc.json --out ../../docs/packages/bamboohr.com src/index.ts",
|
|
34
33
|
"clean": "rimraf dist",
|
|
35
34
|
"dist": "yarn clean && yarn build:ts",
|
|
36
35
|
"test": "exit 0"
|
|
37
36
|
},
|
|
38
|
-
"version": "1.
|
|
39
|
-
"gitHead": "
|
|
37
|
+
"version": "1.5.1",
|
|
38
|
+
"gitHead": "e5aa38e74982d788efcfac2dd3b46be012c98afb"
|
|
40
39
|
}
|