absence.io 2.4.6 → 2.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/AbsenceIO.d.ts +17 -0
  2. package/dist/AbsenceIO.js +82 -0
  3. package/dist/Endpoints.d.ts +39 -0
  4. package/dist/Endpoints.js +64 -0
  5. package/dist/api/APIBase.d.ts +18 -0
  6. package/dist/api/APIBase.js +31 -0
  7. package/dist/api/AbsenceAPI.d.ts +26 -0
  8. package/dist/api/AbsenceAPI.js +68 -0
  9. package/dist/api/AllowanceTypeAPI.d.ts +16 -0
  10. package/dist/api/AllowanceTypeAPI.js +44 -0
  11. package/dist/api/DepartmentAPI.d.ts +16 -0
  12. package/dist/api/DepartmentAPI.js +44 -0
  13. package/dist/api/LocationAPI.d.ts +16 -0
  14. package/dist/api/LocationAPI.js +44 -0
  15. package/dist/api/ReasonAPI.d.ts +17 -0
  16. package/dist/api/ReasonAPI.js +44 -0
  17. package/dist/api/TeamAPI.d.ts +16 -0
  18. package/dist/api/TeamAPI.js +44 -0
  19. package/dist/api/TimespanAPI.d.ts +36 -0
  20. package/dist/api/TimespanAPI.js +84 -0
  21. package/dist/api/UserAPI.d.ts +48 -0
  22. package/dist/api/UserAPI.js +97 -0
  23. package/dist/api/index.d.ts +8 -0
  24. package/dist/api/index.js +24 -0
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.js +19 -0
  27. package/dist/interfaces/API.d.ts +11 -0
  28. package/dist/interfaces/API.js +2 -0
  29. package/dist/interfaces/Absence.d.ts +75 -0
  30. package/dist/interfaces/Absence.js +2 -0
  31. package/dist/interfaces/Allowance.d.ts +14 -0
  32. package/dist/interfaces/Allowance.js +2 -0
  33. package/dist/interfaces/ClientOptions.d.ts +7 -0
  34. package/dist/interfaces/ClientOptions.js +2 -0
  35. package/dist/interfaces/Department.d.ts +19 -0
  36. package/dist/interfaces/Department.js +2 -0
  37. package/dist/interfaces/EmailList.d.ts +6 -0
  38. package/dist/interfaces/EmailList.js +2 -0
  39. package/dist/interfaces/Location.d.ts +24 -0
  40. package/dist/interfaces/Location.js +2 -0
  41. package/dist/interfaces/Options.d.ts +17 -0
  42. package/dist/interfaces/Options.js +2 -0
  43. package/dist/interfaces/Reason.d.ts +28 -0
  44. package/dist/interfaces/Reason.js +2 -0
  45. package/dist/interfaces/Result.d.ts +7 -0
  46. package/dist/interfaces/Result.js +2 -0
  47. package/dist/interfaces/Team.d.ts +10 -0
  48. package/dist/interfaces/Team.js +2 -0
  49. package/dist/interfaces/Timespan.d.ts +24 -0
  50. package/dist/interfaces/Timespan.js +2 -0
  51. package/dist/interfaces/User.d.ts +65 -0
  52. package/dist/interfaces/User.js +16 -0
  53. package/dist/interfaces/WorkingDay.d.ts +10 -0
  54. package/dist/interfaces/WorkingDay.js +13 -0
  55. package/dist/interfaces/index.d.ts +14 -0
  56. package/dist/interfaces/index.js +30 -0
  57. package/package.json +4 -3
@@ -0,0 +1,17 @@
1
+ import type { API, Authorization, ClientOptions } from './interfaces';
2
+ export declare class AbsenceIO {
3
+ readonly api: API;
4
+ private readonly apiClient;
5
+ private readonly options;
6
+ constructor(options: ClientOptions);
7
+ /**
8
+ * Set a new API key.
9
+ * @param authorization The API authorization data
10
+ */
11
+ setApiAuthorization(authorization: Authorization): void;
12
+ /**
13
+ * Set a new API URL.
14
+ * @param newURL The new API URL
15
+ */
16
+ setApiUrl(newURL: string): void;
17
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AbsenceIO = void 0;
37
+ const api_client_1 = require("@ffflorian/api-client");
38
+ const hawk = __importStar(require("@hapi/hawk"));
39
+ const api_1 = require("./api");
40
+ class AbsenceIO {
41
+ constructor(options) {
42
+ this.options = options;
43
+ const baseURL = options.apiUrl || 'https://app.absence.io/api/v2';
44
+ const credentials = {
45
+ algorithm: 'sha256',
46
+ id: this.options.apiKeyId,
47
+ key: this.options.apiKey,
48
+ };
49
+ this.apiClient = new api_client_1.APIClient(baseURL);
50
+ this.apiClient.interceptors.request.push(config => {
51
+ const hawkHeader = hawk.client.header(config.url.toString(), config.method, { credentials });
52
+ config.headers = Object.assign(Object.assign({}, config.headers), { Authorization: hawkHeader.header });
53
+ return config;
54
+ });
55
+ this.api = {
56
+ absence: new api_1.AbsenceAPI(this.apiClient, options),
57
+ allowanceType: new api_1.AllowanceTypeAPI(this.apiClient, options),
58
+ department: new api_1.DepartmentAPI(this.apiClient, options),
59
+ location: new api_1.LocationAPI(this.apiClient, options),
60
+ reason: new api_1.ReasonAPI(this.apiClient, options),
61
+ team: new api_1.TeamAPI(this.apiClient, options),
62
+ timespan: new api_1.TimespanAPI(this.apiClient, options),
63
+ user: new api_1.UserAPI(this.apiClient, options),
64
+ };
65
+ }
66
+ /**
67
+ * Set a new API key.
68
+ * @param authorization The API authorization data
69
+ */
70
+ setApiAuthorization(authorization) {
71
+ this.options.apiKey = authorization.apiKey;
72
+ this.options.apiKeyId = authorization.apiKeyId;
73
+ }
74
+ /**
75
+ * Set a new API URL.
76
+ * @param newURL The new API URL
77
+ */
78
+ setApiUrl(newURL) {
79
+ this.apiClient.setBaseURL(newURL);
80
+ }
81
+ }
82
+ exports.AbsenceIO = AbsenceIO;
@@ -0,0 +1,39 @@
1
+ export declare const Endpoint: {
2
+ Absence: {
3
+ absences(id?: string): string;
4
+ create(): string;
5
+ };
6
+ ABSENCES: string;
7
+ ALLOWANCE_TYPES: string;
8
+ AllowanceType: {
9
+ allowanceTypes(id?: string): string;
10
+ };
11
+ CREATE: string;
12
+ Department: {
13
+ departments(id?: string): string;
14
+ };
15
+ DEPARTMENTS: string;
16
+ INVITE: string;
17
+ Location: {
18
+ locations(id?: string): string;
19
+ };
20
+ LOCATIONS: string;
21
+ Reason: {
22
+ reasons(id?: string): string;
23
+ };
24
+ REASONS: string;
25
+ Team: {
26
+ teams(id?: string): string;
27
+ };
28
+ TEAMS: string;
29
+ Timespan: {
30
+ create(): string;
31
+ timespans(id?: string): string;
32
+ };
33
+ TIMESPANS: string;
34
+ User: {
35
+ invite(): string;
36
+ users(id?: string): string;
37
+ };
38
+ USERS: string;
39
+ };
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Endpoint = void 0;
4
+ exports.Endpoint = {
5
+ Absence: {
6
+ absences(id) {
7
+ return `/${exports.Endpoint.ABSENCES}/${id ? `${id}/` : ''}`;
8
+ },
9
+ create() {
10
+ return `/${exports.Endpoint.ABSENCES}/${exports.Endpoint.CREATE}/`;
11
+ },
12
+ },
13
+ ABSENCES: 'absences',
14
+ ALLOWANCE_TYPES: 'allowancetypes',
15
+ AllowanceType: {
16
+ allowanceTypes(id) {
17
+ return `/${exports.Endpoint.ALLOWANCE_TYPES}/${id ? `${id}/` : ''}`;
18
+ },
19
+ },
20
+ CREATE: 'create',
21
+ Department: {
22
+ departments(id) {
23
+ return `/${exports.Endpoint.DEPARTMENTS}/${id ? `${id}/` : ''}`;
24
+ },
25
+ },
26
+ DEPARTMENTS: 'departments',
27
+ INVITE: 'invite',
28
+ Location: {
29
+ locations(id) {
30
+ return `/${exports.Endpoint.LOCATIONS}/${id ? `${id}/` : ''}`;
31
+ },
32
+ },
33
+ LOCATIONS: 'locations',
34
+ Reason: {
35
+ reasons(id) {
36
+ return `/${exports.Endpoint.REASONS}/${id ? `${id}/` : ''}`;
37
+ },
38
+ },
39
+ REASONS: 'reasons',
40
+ Team: {
41
+ teams(id) {
42
+ return `/${exports.Endpoint.TEAMS}/${id ? `${id}/` : ''}`;
43
+ },
44
+ },
45
+ TEAMS: 'teams',
46
+ Timespan: {
47
+ create() {
48
+ return `/${exports.Endpoint.TIMESPANS}/${exports.Endpoint.CREATE}/`;
49
+ },
50
+ timespans(id) {
51
+ return `/${exports.Endpoint.TIMESPANS}/${id ? `${id}/` : ''}`;
52
+ },
53
+ },
54
+ TIMESPANS: 'timespans',
55
+ User: {
56
+ invite() {
57
+ return `/${exports.Endpoint.USERS}/${exports.Endpoint.INVITE}/`;
58
+ },
59
+ users(id) {
60
+ return `/${exports.Endpoint.USERS}/${id ? `${id}/` : ''}`;
61
+ },
62
+ },
63
+ USERS: 'users',
64
+ };
@@ -0,0 +1,18 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { Authorization, ClientOptions } from '../interfaces';
3
+ export declare class APIBase {
4
+ protected readonly apiClient: APIClient;
5
+ protected readonly options: ClientOptions;
6
+ constructor(apiClient: APIClient, options: ClientOptions);
7
+ /**
8
+ * Set a new API key.
9
+ * @param authorization The API authorization data
10
+ */
11
+ setApiAuthorization(authorization: Authorization): void;
12
+ /**
13
+ * Set a new API URL.
14
+ * @param newURL The new API url
15
+ */
16
+ setApiUrl(newURL: string): void;
17
+ protected checkApiKey(apiName?: string): void;
18
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APIBase = void 0;
4
+ class APIBase {
5
+ constructor(apiClient, options) {
6
+ this.apiClient = apiClient;
7
+ this.options = options;
8
+ }
9
+ /**
10
+ * Set a new API key.
11
+ * @param authorization The API authorization data
12
+ */
13
+ setApiAuthorization(authorization) {
14
+ this.options.apiKey = authorization.apiKey;
15
+ this.options.apiKeyId = authorization.apiKeyId;
16
+ }
17
+ /**
18
+ * Set a new API URL.
19
+ * @param newURL The new API url
20
+ */
21
+ setApiUrl(newURL) {
22
+ this.apiClient.setBaseURL(newURL);
23
+ }
24
+ checkApiKey(apiName) {
25
+ const name = apiName ? `the "${apiName}"` : 'this';
26
+ if (!this.options.apiKey || !this.options.apiKeyId) {
27
+ throw new Error(`An API key needs to be set in order to use ${name} API`);
28
+ }
29
+ }
30
+ }
31
+ exports.APIBase = APIBase;
@@ -0,0 +1,26 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { Absence, ClientOptions, NewAbsence, Paginated, PaginationOptions } from '../interfaces/';
3
+ import { APIBase } from './APIBase';
4
+ export declare class AbsenceAPI extends APIBase {
5
+ constructor(apiClient: APIClient, options: ClientOptions);
6
+ /**
7
+ * Create absences
8
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#f7548ccc-b114-46f8-493c-dc86b659dbbc
9
+ */
10
+ createAbsence(absenceData: NewAbsence): Promise<Absence>;
11
+ /**
12
+ * Retrieve an absence
13
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#191890ad-7f0d-3c2d-11d8-ed91e6193944
14
+ */
15
+ retrieveAbsence(id: string): Promise<Absence>;
16
+ /**
17
+ * Retrieve absences
18
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#72b55ac7-c4bc-30dc-8cd8-6ac1e15f2639
19
+ */
20
+ retrieveAbsences(options?: PaginationOptions): Promise<Paginated<Absence[]>>;
21
+ /**
22
+ * Update an existing absence
23
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#f6f7f6a0-4520-f550-6132-610076d58a91
24
+ */
25
+ updateAbsence(id: string, absenceData: Partial<Absence>): Promise<Absence>;
26
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AbsenceAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ const APIBase_1 = require("./APIBase");
15
+ class AbsenceAPI extends APIBase_1.APIBase {
16
+ constructor(apiClient, options) {
17
+ super(apiClient, options);
18
+ }
19
+ /**
20
+ * Create absences
21
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#f7548ccc-b114-46f8-493c-dc86b659dbbc
22
+ */
23
+ createAbsence(absenceData) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ this.checkApiKey('Absence');
26
+ const endpoint = Endpoints_1.Endpoint.Absence.create();
27
+ const { data: absence } = yield this.apiClient.post(endpoint, absenceData);
28
+ return absence;
29
+ });
30
+ }
31
+ /**
32
+ * Retrieve an absence
33
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#191890ad-7f0d-3c2d-11d8-ed91e6193944
34
+ */
35
+ retrieveAbsence(id) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ this.checkApiKey('Absence');
38
+ const endpoint = Endpoints_1.Endpoint.Absence.absences(id);
39
+ const { data: absence } = yield this.apiClient.get(endpoint);
40
+ return absence;
41
+ });
42
+ }
43
+ /**
44
+ * Retrieve absences
45
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#72b55ac7-c4bc-30dc-8cd8-6ac1e15f2639
46
+ */
47
+ retrieveAbsences(options) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ this.checkApiKey('Absence');
50
+ const endpoint = Endpoints_1.Endpoint.Absence.absences();
51
+ const { data: absences } = yield this.apiClient.post(endpoint, options);
52
+ return absences;
53
+ });
54
+ }
55
+ /**
56
+ * Update an existing absence
57
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#f6f7f6a0-4520-f550-6132-610076d58a91
58
+ */
59
+ updateAbsence(id, absenceData) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ this.checkApiKey('Absence');
62
+ const endpoint = Endpoints_1.Endpoint.Absence.absences(id);
63
+ const { data } = yield this.apiClient.put(endpoint, absenceData);
64
+ return data;
65
+ });
66
+ }
67
+ }
68
+ exports.AbsenceAPI = AbsenceAPI;
@@ -0,0 +1,16 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { Allowance, ClientOptions, Paginated, PaginationOptions } from '../interfaces/';
3
+ import { APIBase } from './APIBase';
4
+ export declare class AllowanceTypeAPI extends APIBase {
5
+ constructor(apiClient: APIClient, options: ClientOptions);
6
+ /**
7
+ * Retrieve a single allowance type
8
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#ae42d612-c1ae-52da-0804-3fe77ba1a6fe
9
+ */
10
+ retrieveAllowanceType(id: string): Promise<Allowance>;
11
+ /**
12
+ * Retrieve allowance types
13
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#ddea0e36-bd15-1ed0-0b56-bd4c480d7cce
14
+ */
15
+ retrieveAllowanceTypes(options?: PaginationOptions): Promise<Paginated<Allowance[]>>;
16
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AllowanceTypeAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ const APIBase_1 = require("./APIBase");
15
+ class AllowanceTypeAPI extends APIBase_1.APIBase {
16
+ constructor(apiClient, options) {
17
+ super(apiClient, options);
18
+ }
19
+ /**
20
+ * Retrieve a single allowance type
21
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#ae42d612-c1ae-52da-0804-3fe77ba1a6fe
22
+ */
23
+ retrieveAllowanceType(id) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ this.checkApiKey('AllowanceType');
26
+ const endpoint = Endpoints_1.Endpoint.AllowanceType.allowanceTypes(id);
27
+ const { data: allowance } = yield this.apiClient.get(endpoint);
28
+ return allowance;
29
+ });
30
+ }
31
+ /**
32
+ * Retrieve allowance types
33
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#ddea0e36-bd15-1ed0-0b56-bd4c480d7cce
34
+ */
35
+ retrieveAllowanceTypes(options) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ this.checkApiKey('AllowanceType');
38
+ const endpoint = Endpoints_1.Endpoint.AllowanceType.allowanceTypes();
39
+ const { data: allowances } = yield this.apiClient.post(endpoint, options);
40
+ return allowances;
41
+ });
42
+ }
43
+ }
44
+ exports.AllowanceTypeAPI = AllowanceTypeAPI;
@@ -0,0 +1,16 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { ClientOptions, Department, Paginated, PaginationOptions } from '../interfaces/';
3
+ import { APIBase } from './APIBase';
4
+ export declare class DepartmentAPI extends APIBase {
5
+ constructor(apiClient: APIClient, options: ClientOptions);
6
+ /**
7
+ * Retrieve a single department
8
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#a9c45164-59e5-3daf-93f2-4c64f6cc52f0
9
+ */
10
+ retrieveDepartment(id: string): Promise<Department>;
11
+ /**
12
+ * Retrieve departments
13
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#d596a243-9bc4-cb5f-dbc5-456c46437d09
14
+ */
15
+ retrieveDepartments(options?: PaginationOptions): Promise<Paginated<Department[]>>;
16
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DepartmentAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ const APIBase_1 = require("./APIBase");
15
+ class DepartmentAPI extends APIBase_1.APIBase {
16
+ constructor(apiClient, options) {
17
+ super(apiClient, options);
18
+ }
19
+ /**
20
+ * Retrieve a single department
21
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#a9c45164-59e5-3daf-93f2-4c64f6cc52f0
22
+ */
23
+ retrieveDepartment(id) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ this.checkApiKey('Department');
26
+ const endpoint = Endpoints_1.Endpoint.Department.departments(id);
27
+ const { data: department } = yield this.apiClient.get(endpoint);
28
+ return department;
29
+ });
30
+ }
31
+ /**
32
+ * Retrieve departments
33
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#d596a243-9bc4-cb5f-dbc5-456c46437d09
34
+ */
35
+ retrieveDepartments(options) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ this.checkApiKey('Department');
38
+ const endpoint = Endpoints_1.Endpoint.Department.departments();
39
+ const { data: departments } = yield this.apiClient.post(endpoint, options);
40
+ return departments;
41
+ });
42
+ }
43
+ }
44
+ exports.DepartmentAPI = DepartmentAPI;
@@ -0,0 +1,16 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { ClientOptions, Location, Paginated, PaginationOptions } from '../interfaces/';
3
+ import { APIBase } from './APIBase';
4
+ export declare class LocationAPI extends APIBase {
5
+ constructor(apiClient: APIClient, options: ClientOptions);
6
+ /**
7
+ * Retrieve a single location
8
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#11905bb3-ce8d-80b4-656b-4b9097e35825
9
+ */
10
+ retrieveLocation(id: string): Promise<Location>;
11
+ /**
12
+ * Retrieve locations
13
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#641bf728-23a1-538d-511f-5d1f69f15ba9
14
+ */
15
+ retrieveLocations(options?: PaginationOptions): Promise<Paginated<Location>>;
16
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LocationAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ const APIBase_1 = require("./APIBase");
15
+ class LocationAPI extends APIBase_1.APIBase {
16
+ constructor(apiClient, options) {
17
+ super(apiClient, options);
18
+ }
19
+ /**
20
+ * Retrieve a single location
21
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#11905bb3-ce8d-80b4-656b-4b9097e35825
22
+ */
23
+ retrieveLocation(id) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ this.checkApiKey('Location');
26
+ const endpoint = Endpoints_1.Endpoint.Location.locations(id);
27
+ const { data: location } = yield this.apiClient.get(endpoint);
28
+ return location;
29
+ });
30
+ }
31
+ /**
32
+ * Retrieve locations
33
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#641bf728-23a1-538d-511f-5d1f69f15ba9
34
+ */
35
+ retrieveLocations(options) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ this.checkApiKey('Location');
38
+ const endpoint = Endpoints_1.Endpoint.Location.locations();
39
+ const { data: locations } = yield this.apiClient.post(endpoint, options);
40
+ return locations;
41
+ });
42
+ }
43
+ }
44
+ exports.LocationAPI = LocationAPI;
@@ -0,0 +1,17 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { ClientOptions, Paginated } from '../interfaces/';
3
+ import type { Reason } from '../interfaces/Reason';
4
+ import { APIBase } from './APIBase';
5
+ export declare class ReasonAPI extends APIBase {
6
+ constructor(apiClient: APIClient, options: ClientOptions);
7
+ /**
8
+ * Retrieve a single reason
9
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#2829e308-b906-3b27-10f7-52827f34dfdd
10
+ */
11
+ retrieveReason(id: string): Promise<Reason>;
12
+ /**
13
+ * Retrieve reasons
14
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#cd901260-489c-7437-aaff-65c14cb8e91e
15
+ */
16
+ retrieveReasons(): Promise<Paginated<Reason[]>>;
17
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ReasonAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ const APIBase_1 = require("./APIBase");
15
+ class ReasonAPI extends APIBase_1.APIBase {
16
+ constructor(apiClient, options) {
17
+ super(apiClient, options);
18
+ }
19
+ /**
20
+ * Retrieve a single reason
21
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#2829e308-b906-3b27-10f7-52827f34dfdd
22
+ */
23
+ retrieveReason(id) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ this.checkApiKey('Reason');
26
+ const endpoint = Endpoints_1.Endpoint.Reason.reasons(id);
27
+ const { data: reason } = yield this.apiClient.get(endpoint);
28
+ return reason;
29
+ });
30
+ }
31
+ /**
32
+ * Retrieve reasons
33
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#cd901260-489c-7437-aaff-65c14cb8e91e
34
+ */
35
+ retrieveReasons() {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ this.checkApiKey('Reason');
38
+ const endpoint = Endpoints_1.Endpoint.Reason.reasons();
39
+ const { data: reasons } = yield this.apiClient.post(endpoint, null);
40
+ return reasons;
41
+ });
42
+ }
43
+ }
44
+ exports.ReasonAPI = ReasonAPI;
@@ -0,0 +1,16 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { ClientOptions, Paginated, PaginationOptions, Team } from '../interfaces/';
3
+ import { APIBase } from './APIBase';
4
+ export declare class TeamAPI extends APIBase {
5
+ constructor(apiClient: APIClient, options: ClientOptions);
6
+ /**
7
+ * Retrieve a single team
8
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#08486bf6-c138-5808-7c1d-7ead5c8b1aee
9
+ */
10
+ retrieveTeam(id: string): Promise<Team>;
11
+ /**
12
+ * Retrieve teams
13
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#ec24e740-47e6-3daa-5698-040f99ac9dfd
14
+ */
15
+ retrieveTeams(options?: PaginationOptions): Promise<Paginated<Team[]>>;
16
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TeamAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ const APIBase_1 = require("./APIBase");
15
+ class TeamAPI extends APIBase_1.APIBase {
16
+ constructor(apiClient, options) {
17
+ super(apiClient, options);
18
+ }
19
+ /**
20
+ * Retrieve a single team
21
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#08486bf6-c138-5808-7c1d-7ead5c8b1aee
22
+ */
23
+ retrieveTeam(id) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ this.checkApiKey('Team');
26
+ const endpoint = Endpoints_1.Endpoint.Team.teams(id);
27
+ const { data: team } = yield this.apiClient.get(endpoint);
28
+ return team;
29
+ });
30
+ }
31
+ /**
32
+ * Retrieve teams
33
+ * @see https://documenter.getpostman.com/view/799228/absenceio-api-documentation/2Fwbis#ec24e740-47e6-3daa-5698-040f99ac9dfd
34
+ */
35
+ retrieveTeams(options) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ this.checkApiKey('Team');
38
+ const endpoint = Endpoints_1.Endpoint.Team.teams();
39
+ const { data: teams } = yield this.apiClient.post(endpoint, options);
40
+ return teams;
41
+ });
42
+ }
43
+ }
44
+ exports.TeamAPI = TeamAPI;