rotacloud 1.0.44 → 1.0.45

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.
@@ -5,6 +5,10 @@ class LeaveType {
5
5
  constructor(leaveType) {
6
6
  this.id = leaveType.id;
7
7
  this.name = leaveType.name;
8
+ this.short_name = leaveType.short_name;
9
+ this.colour = leaveType.colour;
10
+ this.can_request = leaveType.can_request;
11
+ this.time_attendance_only = leaveType.time_attendance_only;
8
12
  }
9
13
  }
10
14
  exports.LeaveType = LeaveType;
@@ -1,6 +1,7 @@
1
1
  import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, SettingsService, ShiftsService, ToilAccrualsService, ToilAllowanceService, UsersService } from './services/index.js';
2
2
  import { SDKConfig } from './interfaces/index.js';
3
3
  import { DayNotesService } from './services/day-notes.service.js';
4
+ import { LeaveTypesService } from './services/leave-types.service.js';
4
5
  export declare class RotaCloud {
5
6
  static config: SDKConfig;
6
7
  defaultAPIURI: string | undefined;
@@ -16,6 +17,7 @@ export declare class RotaCloud {
16
17
  leaveEmbargoes: LeaveEmbargoesService;
17
18
  leaveRequests: LeaveRequestService;
18
19
  leave: LeaveService;
20
+ leaveTypes: LeaveTypesService;
19
21
  locations: LocationsService;
20
22
  roles: RolesService;
21
23
  settings: SettingsService;
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.RetryStrategy = exports.RotaCloud = void 0;
14
14
  const index_js_1 = require("./services/index.js");
15
15
  const day_notes_service_js_1 = require("./services/day-notes.service.js");
16
+ const leave_types_service_js_1 = require("./services/leave-types.service.js");
16
17
  const DEFAULT_CONFIG = {
17
18
  baseUri: 'https://api.rotacloud.com/v1',
18
19
  retry: index_js_1.RetryStrategy.Exponential,
@@ -32,6 +33,7 @@ class RotaCloud {
32
33
  this.leaveEmbargoes = new index_js_1.LeaveEmbargoesService();
33
34
  this.leaveRequests = new index_js_1.LeaveRequestService();
34
35
  this.leave = new index_js_1.LeaveService();
36
+ this.leaveTypes = new leave_types_service_js_1.LeaveTypesService();
35
37
  this.locations = new index_js_1.LocationsService();
36
38
  this.roles = new index_js_1.RolesService();
37
39
  this.settings = new index_js_1.SettingsService();
@@ -0,0 +1,12 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { ApiLeaveType } from '../interfaces/index.js';
3
+ import { Service, Options } from './index.js';
4
+ import { LeaveType } from '../models/index.js';
5
+ export declare class LeaveTypesService extends Service {
6
+ private apiPath;
7
+ get(): Promise<LeaveType[]>;
8
+ get(options: {
9
+ rawResponse: true;
10
+ }): Promise<AxiosResponse<ApiLeaveType[]>>;
11
+ get(options: Options): Promise<LeaveType[]>;
12
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LeaveTypesService = void 0;
4
+ const index_js_1 = require("./index.js");
5
+ const index_js_2 = require("../models/index.js");
6
+ class LeaveTypesService extends index_js_1.Service {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.apiPath = '/leave_types';
10
+ }
11
+ get(options) {
12
+ return super
13
+ .fetch({ url: this.apiPath }, options)
14
+ .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data.map((leaveType) => new index_js_2.LeaveType(leaveType))));
15
+ }
16
+ }
17
+ exports.LeaveTypesService = LeaveTypesService;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Version = void 0;
4
- exports.Version = { version: '1.0.44' };
4
+ exports.Version = { version: '1.0.45' };
@@ -2,5 +2,9 @@ export class LeaveType {
2
2
  constructor(leaveType) {
3
3
  this.id = leaveType.id;
4
4
  this.name = leaveType.name;
5
+ this.short_name = leaveType.short_name;
6
+ this.colour = leaveType.colour;
7
+ this.can_request = leaveType.can_request;
8
+ this.time_attendance_only = leaveType.time_attendance_only;
5
9
  }
6
10
  }
@@ -1,6 +1,7 @@
1
1
  import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, SettingsService, ShiftsService, ToilAccrualsService, ToilAllowanceService, UsersService } from './services/index.js';
2
2
  import { SDKConfig } from './interfaces/index.js';
3
3
  import { DayNotesService } from './services/day-notes.service.js';
4
+ import { LeaveTypesService } from './services/leave-types.service.js';
4
5
  export declare class RotaCloud {
5
6
  static config: SDKConfig;
6
7
  defaultAPIURI: string | undefined;
@@ -16,6 +17,7 @@ export declare class RotaCloud {
16
17
  leaveEmbargoes: LeaveEmbargoesService;
17
18
  leaveRequests: LeaveRequestService;
18
19
  leave: LeaveService;
20
+ leaveTypes: LeaveTypesService;
19
21
  locations: LocationsService;
20
22
  roles: RolesService;
21
23
  settings: SettingsService;
@@ -1,5 +1,6 @@
1
1
  import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RetryStrategy, RolesService, SettingsService, ShiftsService, ToilAccrualsService, ToilAllowanceService, UsersService, } from './services/index.js';
2
2
  import { DayNotesService } from './services/day-notes.service.js';
3
+ import { LeaveTypesService } from './services/leave-types.service.js';
3
4
  const DEFAULT_CONFIG = {
4
5
  baseUri: 'https://api.rotacloud.com/v1',
5
6
  retry: RetryStrategy.Exponential,
@@ -19,6 +20,7 @@ export class RotaCloud {
19
20
  this.leaveEmbargoes = new LeaveEmbargoesService();
20
21
  this.leaveRequests = new LeaveRequestService();
21
22
  this.leave = new LeaveService();
23
+ this.leaveTypes = new LeaveTypesService();
22
24
  this.locations = new LocationsService();
23
25
  this.roles = new RolesService();
24
26
  this.settings = new SettingsService();
@@ -0,0 +1,12 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { ApiLeaveType } from '../interfaces/index.js';
3
+ import { Service, Options } from './index.js';
4
+ import { LeaveType } from '../models/index.js';
5
+ export declare class LeaveTypesService extends Service {
6
+ private apiPath;
7
+ get(): Promise<LeaveType[]>;
8
+ get(options: {
9
+ rawResponse: true;
10
+ }): Promise<AxiosResponse<ApiLeaveType[]>>;
11
+ get(options: Options): Promise<LeaveType[]>;
12
+ }
@@ -0,0 +1,13 @@
1
+ import { Service } from './index.js';
2
+ import { LeaveType } from '../models/index.js';
3
+ export class LeaveTypesService extends Service {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.apiPath = '/leave_types';
7
+ }
8
+ get(options) {
9
+ return super
10
+ .fetch({ url: this.apiPath }, options)
11
+ .then((res) => Promise.resolve(options?.rawResponse ? res : res.data.map((leaveType) => new LeaveType(leaveType))));
12
+ }
13
+ }
@@ -1 +1 @@
1
- export const Version = { version: '1.0.44' };
1
+ export const Version = { version: '1.0.45' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rotacloud",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "The RotaCloud SDK for the RotaCloud API",
5
5
  "engines": {
6
6
  "node": ">=14.17.0"
@@ -11,5 +11,9 @@ export class LeaveType {
11
11
  constructor(leaveType: ApiLeaveType) {
12
12
  this.id = leaveType.id;
13
13
  this.name = leaveType.name;
14
+ this.short_name = leaveType.short_name;
15
+ this.colour = leaveType.colour;
16
+ this.can_request = leaveType.can_request;
17
+ this.time_attendance_only = leaveType.time_attendance_only;
14
18
  }
15
19
  }
package/src/rotacloud.ts CHANGED
@@ -21,6 +21,7 @@ import {
21
21
  } from './services/index.js';
22
22
  import { SDKConfig } from './interfaces/index.js';
23
23
  import { DayNotesService } from './services/day-notes.service.js';
24
+ import { LeaveTypesService } from './services/leave-types.service.js';
24
25
 
25
26
  const DEFAULT_CONFIG: Partial<SDKConfig> = {
26
27
  baseUri: 'https://api.rotacloud.com/v1',
@@ -43,6 +44,7 @@ export class RotaCloud {
43
44
  public leaveEmbargoes = new LeaveEmbargoesService();
44
45
  public leaveRequests = new LeaveRequestService();
45
46
  public leave = new LeaveService();
47
+ public leaveTypes = new LeaveTypesService();
46
48
  public locations = new LocationsService();
47
49
  public roles = new RolesService();
48
50
  public settings = new SettingsService();
@@ -0,0 +1,20 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { ApiLeaveType } from '../interfaces/index.js';
3
+ import { Service, Options } from './index.js';
4
+
5
+ import { LeaveType } from '../models/index.js';
6
+
7
+ export class LeaveTypesService extends Service {
8
+ private apiPath = '/leave_types';
9
+
10
+ get(): Promise<LeaveType[]>;
11
+ get(options: { rawResponse: true }): Promise<AxiosResponse<ApiLeaveType[]>>;
12
+ get(options: Options): Promise<LeaveType[]>;
13
+ get(options?: Options) {
14
+ return super
15
+ .fetch<ApiLeaveType[]>({ url: this.apiPath }, options)
16
+ .then((res) =>
17
+ Promise.resolve(options?.rawResponse ? res : res.data.map((leaveType) => new LeaveType(leaveType)))
18
+ );
19
+ }
20
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const Version = { version: '1.0.44' };
1
+ export const Version = { version: '1.0.45' };