starta.apiclient 1.35.866 → 1.35.883

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.
@@ -9,6 +9,7 @@ import Payments from './payments';
9
9
  import Dashboard from './dashboard';
10
10
  import Public from './public';
11
11
  import Integrations from './integrations';
12
+ import Schedules from './schedules';
12
13
  export default class Organizations {
13
14
  private _requestRunner;
14
15
  constructor(requestRunner: StartaRequestRunner);
@@ -52,17 +53,6 @@ export default class Organizations {
52
53
  theme: any;
53
54
  }): Promise<import("../../types").StartaResponse>;
54
55
  setBookingWidgetStyles(organizationLogin: any, bookingWidgetStyles: any): Promise<import("../../types").StartaResponse>;
55
- setWorkingSchedule(organizationLogin: any, { weekly: { mon, tue, wed, thu, fri, sat, sun } }: {
56
- weekly: {
57
- mon: any;
58
- tue: any;
59
- wed: any;
60
- thu: any;
61
- fri: any;
62
- sat: any;
63
- sun: any;
64
- };
65
- }): Promise<import("../../types").StartaResponse>;
66
56
  getMembersSchedule(organizationLogin: any, date: any): Promise<import("../../types").StartaResponse>;
67
57
  getSingleMemberSchedule(organizationLogin: any, member: any, from: any, to: any): Promise<import("../../types").StartaResponse>;
68
58
  get orders(): Orders;
@@ -75,6 +65,7 @@ export default class Organizations {
75
65
  get payments(): Payments;
76
66
  get dashboard(): Dashboard;
77
67
  get integrations(): Integrations;
68
+ get schedules(): Schedules;
78
69
  updateRoles(organizationLogin: any, roles: any): Promise<import("../../types").StartaResponse>;
79
70
  setLicense(organizationLogin: any, { maxMembers }: {
80
71
  maxMembers: any;
@@ -10,6 +10,7 @@ var payments_1 = require("./payments");
10
10
  var dashboard_1 = require("./dashboard");
11
11
  var public_1 = require("./public");
12
12
  var integrations_1 = require("./integrations");
13
+ var schedules_1 = require("./schedules");
13
14
  var _helpers_1 = require("../_helpers");
14
15
  var Organizations = /** @class */ (function () {
15
16
  function Organizations(requestRunner) {
@@ -135,14 +136,6 @@ var Organizations = /** @class */ (function () {
135
136
  body: bookingWidgetStyles,
136
137
  });
137
138
  };
138
- Organizations.prototype.setWorkingSchedule = function (organizationLogin, _a) {
139
- var _b = _a.weekly, mon = _b.mon, tue = _b.tue, wed = _b.wed, thu = _b.thu, fri = _b.fri, sat = _b.sat, sun = _b.sun;
140
- return this._requestRunner.performRequest({
141
- url: "accounts/".concat(organizationLogin, "/workingSchedule"),
142
- method: 'PUT',
143
- body: { weekly: { mon: mon, tue: tue, wed: wed, thu: thu, fri: fri, sat: sat, sun: sun } },
144
- });
145
- };
146
139
  Organizations.prototype.getMembersSchedule = function (organizationLogin, date /* YYYY-MM-DD */) {
147
140
  return this._requestRunner.performRequest({
148
141
  url: "accounts/".concat(organizationLogin, "/members/schedule/").concat(date),
@@ -225,6 +218,13 @@ var Organizations = /** @class */ (function () {
225
218
  enumerable: false,
226
219
  configurable: true
227
220
  });
221
+ Object.defineProperty(Organizations.prototype, "schedules", {
222
+ get: function () {
223
+ return new schedules_1.default(this._requestRunner);
224
+ },
225
+ enumerable: false,
226
+ configurable: true
227
+ });
228
228
  Organizations.prototype.updateRoles = function (organizationLogin, roles) {
229
229
  return this._requestRunner.performRequest({
230
230
  url: "accounts/".concat(organizationLogin, "/roles"),
@@ -0,0 +1,7 @@
1
+ import { StartaRequestRunner, OrganizationSchedule } from '../../types';
2
+ export default class Schedules {
3
+ private _requestRunner;
4
+ constructor(requestRunner: StartaRequestRunner);
5
+ updateRoles(organizationLogin: any, member: any, roles: any): Promise<import("../../types").StartaResponse>;
6
+ add(organizationLogin: any, { name, location, schedule }: OrganizationSchedule): Promise<import("../../types").StartaResponse>;
7
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Schedules = /** @class */ (function () {
4
+ function Schedules(requestRunner) {
5
+ this._requestRunner = requestRunner;
6
+ }
7
+ Schedules.prototype.updateRoles = function (organizationLogin, member, roles) {
8
+ return this._requestRunner.performRequest({
9
+ url: "accounts/".concat(organizationLogin, "/members/").concat(member, "/roles"),
10
+ method: 'PUT',
11
+ body: { roles: roles },
12
+ });
13
+ };
14
+ Schedules.prototype.add = function (organizationLogin, _a) {
15
+ var name = _a.name, location = _a.location, schedule = _a.schedule;
16
+ return this._requestRunner.performRequest({
17
+ url: "accounts/".concat(organizationLogin, "/schedules"),
18
+ method: 'POST',
19
+ body: {
20
+ name: name,
21
+ location: location,
22
+ schedule: schedule,
23
+ },
24
+ });
25
+ };
26
+ return Schedules;
27
+ }());
28
+ exports.default = Schedules;
package/lib/types.d.ts CHANGED
@@ -1,28 +1,67 @@
1
1
  import { AxiosRequestConfig, Method, AxiosResponse, AxiosError } from 'axios';
2
- interface StartaRequestRunner {
2
+ export interface StartaRequestRunner {
3
3
  performRequest: (requestData: StartaRequestData) => Promise<StartaResponse>;
4
4
  setAuthHeaderToken: (token: string) => void;
5
5
  }
6
- declare type StartaRequestData = {
6
+ export declare type StartaRequestData = {
7
7
  url: string;
8
8
  method: Method;
9
9
  body?: any;
10
10
  urlParams?: any;
11
11
  config?: StartaRequestConfig;
12
12
  };
13
- declare type StartaResponse = {
13
+ export declare type StartaResponse = {
14
14
  httpResponse?: AxiosResponse<any, any>;
15
15
  success: boolean;
16
16
  data: any;
17
17
  axiosError?: AxiosError;
18
18
  };
19
- interface StartaRequestConfig extends AxiosRequestConfig {
19
+ export interface StartaRequestConfig extends AxiosRequestConfig {
20
20
  rewriteBaseUrl?: (baseUrl: string) => string;
21
21
  }
22
- declare type StartaRequestMiddlewares = {
22
+ export declare type StartaRequestMiddlewares = {
23
23
  onForbidden?: (response: StartaResponse) => void;
24
24
  onUnauthorized?: (response: StartaResponse) => void;
25
25
  logger?: (...args: any[]) => void;
26
26
  cookieFactory?: () => string | null;
27
27
  };
28
- export { StartaRequestData, StartaRequestRunner, StartaResponse, StartaRequestConfig, StartaRequestMiddlewares };
28
+ export declare type Interval = {
29
+ from: string;
30
+ to: string;
31
+ };
32
+ export declare type DaySchedule = {
33
+ intervals: Array<Interval>;
34
+ };
35
+ export declare type OrganizationSchedule = {
36
+ name: any;
37
+ location: {
38
+ isOnline: boolean;
39
+ description?: {
40
+ default: any;
41
+ };
42
+ address?: {
43
+ id: any;
44
+ formattedAddress: any;
45
+ timezone: any;
46
+ name: any;
47
+ streetNumber: any;
48
+ streetName: any;
49
+ region: any;
50
+ city: any;
51
+ country: any;
52
+ zipCode: any;
53
+ appartment: any;
54
+ };
55
+ };
56
+ schedule: {
57
+ weekly: {
58
+ mon?: DaySchedule;
59
+ tue?: DaySchedule;
60
+ wed?: DaySchedule;
61
+ thu?: DaySchedule;
62
+ fri?: DaySchedule;
63
+ sat?: DaySchedule;
64
+ sun?: DaySchedule;
65
+ };
66
+ };
67
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starta.apiclient",
3
- "version": "1.35.866",
3
+ "version": "1.35.883",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",