rotacloud 1.0.56 → 1.0.58

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.
@@ -8,33 +8,33 @@ export interface ApiAccount {
8
8
  owner: number;
9
9
  timezone: number;
10
10
  industry: number;
11
- phone: string;
12
- address_1: string;
13
- address_2: string;
14
- city: string;
15
- county: string;
16
- postcode: string;
11
+ phone: string | null;
12
+ address_1: string | null;
13
+ address_2: string | null;
14
+ city: string | null;
15
+ county: string | null;
16
+ postcode: string | null;
17
17
  country: number;
18
18
  services: ApiAccountServices[];
19
19
  total_price: number;
20
20
  pricing: object;
21
21
  expires_in: number;
22
22
  features_disabled: string[];
23
- first_billed: string;
23
+ first_billed: string | null;
24
24
  owed: number;
25
25
  trial: boolean;
26
26
  can_restart_trial: boolean;
27
27
  next_billed: string;
28
28
  hide_billing: boolean;
29
29
  total_employees: number;
30
- payment_card: string;
30
+ payment_card: string | null;
31
31
  billing_type: string;
32
32
  billing_term: string;
33
- billing_email: string;
34
- billing_address: string;
35
- grouped_billing_parent: number;
36
- grouped_billing_children: number[];
37
- vat_number: string;
33
+ billing_email: string | null;
34
+ billing_address: string | null;
35
+ grouped_billing_parent: number | null;
36
+ grouped_billing_children: number[] | null;
37
+ vat_number: string | null;
38
38
  suspended: boolean;
39
- suspended_message: string;
39
+ suspended_message: string | null;
40
40
  }
@@ -1,9 +1,17 @@
1
1
  import { RetryOptions, RetryStrategy } from '../services/service.js';
2
- export interface SDKConfig {
2
+ export interface SDKBase {
3
3
  baseUri?: string;
4
- apiKey: string;
5
4
  accountId?: number;
6
5
  userId?: number;
7
6
  retry?: false | `${RetryStrategy}` | RetryOptions;
8
7
  [key: string]: unknown;
9
8
  }
9
+ export interface SDKBearerAuth extends SDKBase {
10
+ apiKey: string;
11
+ basicAuth?: never;
12
+ }
13
+ export interface SDKBasicAuth extends SDKBase {
14
+ apiKey?: never;
15
+ basicAuth: string;
16
+ }
17
+ export type SDKConfig = SDKBasicAuth | SDKBearerAuth;
@@ -12,6 +12,7 @@ export interface ApiTerminal {
12
12
  require_photo: boolean;
13
13
  require_photo_breaks: boolean;
14
14
  debug: boolean;
15
+ secret: string | null;
15
16
  }
16
17
  export interface ApiTerminalLocation {
17
18
  lat: number;
@@ -4,5 +4,43 @@ export declare class Account {
4
4
  name: string;
5
5
  level: string;
6
6
  created: number;
7
+ expired: boolean;
8
+ owner: number;
9
+ timezone: number;
10
+ industry: number;
11
+ phone: string | null;
12
+ address_1: string | null;
13
+ address_2: string | null;
14
+ city: string | null;
15
+ county: string | null;
16
+ postcode: string | null;
17
+ country: number;
18
+ services: any;
19
+ total_price: number;
20
+ pricing: {
21
+ current: boolean;
22
+ name: string;
23
+ max_employees: number;
24
+ total_price: number;
25
+ };
26
+ expires_in: number;
27
+ features_disabled: string[];
28
+ first_billed: string | null;
29
+ owed: number;
30
+ trial: boolean;
31
+ can_restart_trial: boolean;
32
+ next_billed: string;
33
+ hide_billing: boolean;
34
+ total_employees: number;
35
+ payment_card: string | null;
36
+ billing_type: string;
37
+ billing_term: string;
38
+ billing_email: string | null;
39
+ billing_address: string | null;
40
+ grouped_billing_parent: number | null;
41
+ grouped_billing_children: number[] | null;
42
+ vat_number: string | null;
43
+ suspended: boolean;
44
+ suspended_message: string | null;
7
45
  constructor(account: ApiAccount);
8
46
  }
@@ -3,10 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Account = void 0;
4
4
  class Account {
5
5
  constructor(account) {
6
- this.id = account.id;
7
- this.name = account.name;
8
- this.level = account.level;
9
- this.created = account.created;
6
+ Object.assign(this, account);
10
7
  }
11
8
  }
12
9
  exports.Account = Account;
@@ -12,5 +12,6 @@ export declare class Terminal {
12
12
  timezone: number;
13
13
  require_photo: boolean;
14
14
  require_photo_breaks: boolean;
15
+ secret: string | null;
15
16
  constructor(terminal: ApiTerminal);
16
17
  }
@@ -15,6 +15,7 @@ class Terminal {
15
15
  this.timezone = terminal.timezone;
16
16
  this.require_photo = terminal.require_photo;
17
17
  this.require_photo_breaks = terminal.require_photo_breaks;
18
+ this.secret = terminal.secret;
18
19
  }
19
20
  }
20
21
  exports.Terminal = Terminal;
@@ -96,7 +96,9 @@ class Service {
96
96
  }
97
97
  fetch(reqConfig, options) {
98
98
  const headers = {
99
- Authorization: `Bearer ${rotacloud_js_1.RotaCloud.config.apiKey}`,
99
+ Authorization: rotacloud_js_1.RotaCloud.config.apiKey
100
+ ? `Bearer ${rotacloud_js_1.RotaCloud.config.apiKey}`
101
+ : `Basic ${rotacloud_js_1.RotaCloud.config.basicAuth}`,
100
102
  'SDK-Version': version_js_1.Version.version,
101
103
  };
102
104
  const extraHeaders = rotacloud_js_1.RotaCloud.config.headers;
@@ -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.56' };
4
+ exports.Version = { version: '1.0.58' };
@@ -8,33 +8,33 @@ export interface ApiAccount {
8
8
  owner: number;
9
9
  timezone: number;
10
10
  industry: number;
11
- phone: string;
12
- address_1: string;
13
- address_2: string;
14
- city: string;
15
- county: string;
16
- postcode: string;
11
+ phone: string | null;
12
+ address_1: string | null;
13
+ address_2: string | null;
14
+ city: string | null;
15
+ county: string | null;
16
+ postcode: string | null;
17
17
  country: number;
18
18
  services: ApiAccountServices[];
19
19
  total_price: number;
20
20
  pricing: object;
21
21
  expires_in: number;
22
22
  features_disabled: string[];
23
- first_billed: string;
23
+ first_billed: string | null;
24
24
  owed: number;
25
25
  trial: boolean;
26
26
  can_restart_trial: boolean;
27
27
  next_billed: string;
28
28
  hide_billing: boolean;
29
29
  total_employees: number;
30
- payment_card: string;
30
+ payment_card: string | null;
31
31
  billing_type: string;
32
32
  billing_term: string;
33
- billing_email: string;
34
- billing_address: string;
35
- grouped_billing_parent: number;
36
- grouped_billing_children: number[];
37
- vat_number: string;
33
+ billing_email: string | null;
34
+ billing_address: string | null;
35
+ grouped_billing_parent: number | null;
36
+ grouped_billing_children: number[] | null;
37
+ vat_number: string | null;
38
38
  suspended: boolean;
39
- suspended_message: string;
39
+ suspended_message: string | null;
40
40
  }
@@ -1,9 +1,17 @@
1
1
  import { RetryOptions, RetryStrategy } from '../services/service.js';
2
- export interface SDKConfig {
2
+ export interface SDKBase {
3
3
  baseUri?: string;
4
- apiKey: string;
5
4
  accountId?: number;
6
5
  userId?: number;
7
6
  retry?: false | `${RetryStrategy}` | RetryOptions;
8
7
  [key: string]: unknown;
9
8
  }
9
+ export interface SDKBearerAuth extends SDKBase {
10
+ apiKey: string;
11
+ basicAuth?: never;
12
+ }
13
+ export interface SDKBasicAuth extends SDKBase {
14
+ apiKey?: never;
15
+ basicAuth: string;
16
+ }
17
+ export type SDKConfig = SDKBasicAuth | SDKBearerAuth;
@@ -12,6 +12,7 @@ export interface ApiTerminal {
12
12
  require_photo: boolean;
13
13
  require_photo_breaks: boolean;
14
14
  debug: boolean;
15
+ secret: string | null;
15
16
  }
16
17
  export interface ApiTerminalLocation {
17
18
  lat: number;
@@ -4,5 +4,43 @@ export declare class Account {
4
4
  name: string;
5
5
  level: string;
6
6
  created: number;
7
+ expired: boolean;
8
+ owner: number;
9
+ timezone: number;
10
+ industry: number;
11
+ phone: string | null;
12
+ address_1: string | null;
13
+ address_2: string | null;
14
+ city: string | null;
15
+ county: string | null;
16
+ postcode: string | null;
17
+ country: number;
18
+ services: any;
19
+ total_price: number;
20
+ pricing: {
21
+ current: boolean;
22
+ name: string;
23
+ max_employees: number;
24
+ total_price: number;
25
+ };
26
+ expires_in: number;
27
+ features_disabled: string[];
28
+ first_billed: string | null;
29
+ owed: number;
30
+ trial: boolean;
31
+ can_restart_trial: boolean;
32
+ next_billed: string;
33
+ hide_billing: boolean;
34
+ total_employees: number;
35
+ payment_card: string | null;
36
+ billing_type: string;
37
+ billing_term: string;
38
+ billing_email: string | null;
39
+ billing_address: string | null;
40
+ grouped_billing_parent: number | null;
41
+ grouped_billing_children: number[] | null;
42
+ vat_number: string | null;
43
+ suspended: boolean;
44
+ suspended_message: string | null;
7
45
  constructor(account: ApiAccount);
8
46
  }
@@ -1,8 +1,5 @@
1
1
  export class Account {
2
2
  constructor(account) {
3
- this.id = account.id;
4
- this.name = account.name;
5
- this.level = account.level;
6
- this.created = account.created;
3
+ Object.assign(this, account);
7
4
  }
8
5
  }
@@ -12,5 +12,6 @@ export declare class Terminal {
12
12
  timezone: number;
13
13
  require_photo: boolean;
14
14
  require_photo_breaks: boolean;
15
+ secret: string | null;
15
16
  constructor(terminal: ApiTerminal);
16
17
  }
@@ -12,5 +12,6 @@ export class Terminal {
12
12
  this.timezone = terminal.timezone;
13
13
  this.require_photo = terminal.require_photo;
14
14
  this.require_photo_breaks = terminal.require_photo_breaks;
15
+ this.secret = terminal.secret;
15
16
  }
16
17
  }
@@ -72,7 +72,9 @@ export class Service {
72
72
  }
73
73
  fetch(reqConfig, options) {
74
74
  const headers = {
75
- Authorization: `Bearer ${RotaCloud.config.apiKey}`,
75
+ Authorization: RotaCloud.config.apiKey
76
+ ? `Bearer ${RotaCloud.config.apiKey}`
77
+ : `Basic ${RotaCloud.config.basicAuth}`,
76
78
  'SDK-Version': Version.version,
77
79
  };
78
80
  const extraHeaders = RotaCloud.config.headers;
@@ -1 +1 @@
1
- export const Version = { version: '1.0.56' };
1
+ export const Version = { version: '1.0.58' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rotacloud",
3
- "version": "1.0.56",
3
+ "version": "1.0.58",
4
4
  "description": "The RotaCloud SDK for the RotaCloud API",
5
5
  "engines": {
6
6
  "node": ">=16.10.0"
@@ -9,33 +9,33 @@ export interface ApiAccount {
9
9
  owner: number;
10
10
  timezone: number;
11
11
  industry: number;
12
- phone: string;
13
- address_1: string;
14
- address_2: string;
15
- city: string;
16
- county: string;
17
- postcode: string;
12
+ phone: string | null;
13
+ address_1: string | null;
14
+ address_2: string | null;
15
+ city: string | null;
16
+ county: string | null;
17
+ postcode: string | null;
18
18
  country: number;
19
19
  services: ApiAccountServices[];
20
20
  total_price: number;
21
21
  pricing: object;
22
22
  expires_in: number;
23
23
  features_disabled: string[];
24
- first_billed: string;
24
+ first_billed: string | null;
25
25
  owed: number;
26
26
  trial: boolean;
27
27
  can_restart_trial: boolean;
28
28
  next_billed: string;
29
29
  hide_billing: boolean;
30
30
  total_employees: number;
31
- payment_card: string;
31
+ payment_card: string | null;
32
32
  billing_type: string;
33
33
  billing_term: string;
34
- billing_email: string;
35
- billing_address: string;
36
- grouped_billing_parent: number;
37
- grouped_billing_children: number[];
38
- vat_number: string;
34
+ billing_email: string | null;
35
+ billing_address: string | null;
36
+ grouped_billing_parent: number | null;
37
+ grouped_billing_children: number[] | null;
38
+ vat_number: string | null;
39
39
  suspended: boolean;
40
- suspended_message: string;
40
+ suspended_message: string | null;
41
41
  }
@@ -1,10 +1,21 @@
1
1
  import { RetryOptions, RetryStrategy } from '../services/service.js';
2
2
 
3
- export interface SDKConfig {
3
+ export interface SDKBase {
4
4
  baseUri?: string;
5
- apiKey: string;
6
5
  accountId?: number;
7
6
  userId?: number;
8
7
  retry?: false | `${RetryStrategy}` | RetryOptions;
9
8
  [key: string]: unknown;
10
9
  }
10
+
11
+ export interface SDKBearerAuth extends SDKBase {
12
+ apiKey: string;
13
+ basicAuth?: never;
14
+ }
15
+
16
+ export interface SDKBasicAuth extends SDKBase {
17
+ apiKey?: never;
18
+ basicAuth: string;
19
+ }
20
+
21
+ export type SDKConfig = SDKBasicAuth | SDKBearerAuth;
@@ -12,6 +12,7 @@ export interface ApiTerminal {
12
12
  require_photo: boolean;
13
13
  require_photo_breaks: boolean;
14
14
  debug: boolean;
15
+ secret: string | null;
15
16
  }
16
17
 
17
18
  export interface ApiTerminalLocation {
@@ -1,15 +1,45 @@
1
1
  import { ApiAccount } from '../interfaces/index.js';
2
2
 
3
3
  export class Account {
4
- public id: number;
5
- public name: string;
6
- public level: string;
7
- public created: number;
4
+ id: number;
5
+ name: string;
6
+ level: string;
7
+ created: number;
8
+ expired: boolean;
9
+ owner: number;
10
+ timezone: number;
11
+ industry: number;
12
+ phone: string | null;
13
+ address_1: string | null;
14
+ address_2: string | null;
15
+ city: string | null;
16
+ county: string | null;
17
+ postcode: string | null;
18
+ country: number;
19
+ services: any;
20
+ total_price: number;
21
+ pricing: { current: boolean; name: string; max_employees: number; total_price: number };
22
+ expires_in: number;
23
+ features_disabled: string[];
24
+ first_billed: string | null;
25
+ owed: number;
26
+ trial: boolean;
27
+ can_restart_trial: boolean;
28
+ next_billed: string;
29
+ hide_billing: boolean;
30
+ total_employees: number;
31
+ payment_card: string | null;
32
+ billing_type: string;
33
+ billing_term: string;
34
+ billing_email: string | null;
35
+ billing_address: string | null;
36
+ grouped_billing_parent: number | null;
37
+ grouped_billing_children: number[] | null;
38
+ vat_number: string | null;
39
+ suspended: boolean;
40
+ suspended_message: string | null;
8
41
 
9
42
  constructor(account: ApiAccount) {
10
- this.id = account.id;
11
- this.name = account.name;
12
- this.level = account.level;
13
- this.created = account.created;
43
+ Object.assign(this, account);
14
44
  }
15
45
  }
@@ -13,6 +13,7 @@ export class Terminal {
13
13
  public timezone: number;
14
14
  public require_photo: boolean;
15
15
  public require_photo_breaks: boolean;
16
+ public secret: string | null;
16
17
 
17
18
  constructor(terminal: ApiTerminal) {
18
19
  this.id = terminal.id;
@@ -27,5 +28,6 @@ export class Terminal {
27
28
  this.timezone = terminal.timezone;
28
29
  this.require_photo = terminal.require_photo;
29
30
  this.require_photo_breaks = terminal.require_photo_breaks;
31
+ this.secret = terminal.secret;
30
32
  }
31
33
  }
package/src/rotacloud.ts CHANGED
@@ -24,10 +24,10 @@ import {
24
24
  UsersService,
25
25
  UsersClockInService,
26
26
  } from './services/index.js';
27
- import { SDKConfig } from './interfaces/index.js';
27
+ import { SDKBase, SDKConfig } from './interfaces/index.js';
28
28
  import { PinsService } from './services/pins.service.js';
29
29
 
30
- const DEFAULT_CONFIG: Partial<SDKConfig> = {
30
+ const DEFAULT_CONFIG: Partial<SDKBase> = {
31
31
  baseUri: 'https://api.rotacloud.com/v1',
32
32
  retry: RetryStrategy.Exponential,
33
33
  };
@@ -111,7 +111,9 @@ export abstract class Service<ApiResponse = any> {
111
111
 
112
112
  fetch<T = ApiResponse>(reqConfig: AxiosRequestConfig, options?: Options): Promise<AxiosResponse<T>> {
113
113
  const headers: Record<string, string> = {
114
- Authorization: `Bearer ${RotaCloud.config.apiKey}`,
114
+ Authorization: RotaCloud.config.apiKey
115
+ ? `Bearer ${RotaCloud.config.apiKey}`
116
+ : `Basic ${RotaCloud.config.basicAuth}`,
115
117
  'SDK-Version': Version.version,
116
118
  };
117
119
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const Version = { version: '1.0.56' };
1
+ export const Version = { version: '1.0.58' };