starta.apiclient 1.35.871 → 1.35.881

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,39 +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
- export declare type OrganizationSchedule = {
13
- name: any;
14
- location: {
15
- isOnline: any;
16
- description: {
17
- default: any;
18
- };
19
- address: {
20
- id: any;
21
- formattedAddress: any;
22
- timezone: any;
23
- name: any;
24
- streetNumber: any;
25
- streetName: any;
26
- region: any;
27
- city: any;
28
- country: any;
29
- zipCode: any;
30
- appartment: any;
31
- };
32
- };
33
- schedule: {
34
- weekly: {
35
- mon: any;
36
- tue: any;
37
- wed: any;
38
- thu: any;
39
- fri: any;
40
- sat: any;
41
- sun: any;
42
- };
43
- };
44
- };
12
+ import Schedules from './schedules';
45
13
  export default class Organizations {
46
14
  private _requestRunner;
47
15
  constructor(requestRunner: StartaRequestRunner);
@@ -85,7 +53,6 @@ export default class Organizations {
85
53
  theme: any;
86
54
  }): Promise<import("../../types").StartaResponse>;
87
55
  setBookingWidgetStyles(organizationLogin: any, bookingWidgetStyles: any): Promise<import("../../types").StartaResponse>;
88
- addSchedule(organizationLogin: any, { name, location: { isOnline, description, address: { id, formattedAddress, timezone, name: addressName, streetNumber, streetName, region, city, country, zipCode, appartment, } }, schedule: { weekly: { mon, tue, wed, thu, fri, sat, sun } } }: OrganizationSchedule): Promise<import("../../types").StartaResponse>;
89
56
  getMembersSchedule(organizationLogin: any, date: any): Promise<import("../../types").StartaResponse>;
90
57
  getSingleMemberSchedule(organizationLogin: any, member: any, from: any, to: any): Promise<import("../../types").StartaResponse>;
91
58
  get orders(): Orders;
@@ -98,6 +65,7 @@ export default class Organizations {
98
65
  get payments(): Payments;
99
66
  get dashboard(): Dashboard;
100
67
  get integrations(): Integrations;
68
+ get schedules(): Schedules;
101
69
  updateRoles(organizationLogin: any, roles: any): Promise<import("../../types").StartaResponse>;
102
70
  setLicense(organizationLogin: any, { maxMembers }: {
103
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,36 +136,6 @@ var Organizations = /** @class */ (function () {
135
136
  body: bookingWidgetStyles,
136
137
  });
137
138
  };
138
- Organizations.prototype.addSchedule = function (organizationLogin, _a) {
139
- var name = _a.name, _b = _a.location, isOnline = _b.isOnline, description = _b.description, _c = _b.address, id = _c.id, formattedAddress = _c.formattedAddress, timezone = _c.timezone, addressName = _c.name, streetNumber = _c.streetNumber, streetName = _c.streetName, region = _c.region, city = _c.city, country = _c.country, zipCode = _c.zipCode, appartment = _c.appartment, _d = _a.schedule.weekly, mon = _d.mon, tue = _d.tue, wed = _d.wed, thu = _d.thu, fri = _d.fri, sat = _d.sat, sun = _d.sun;
140
- return this._requestRunner.performRequest({
141
- url: "accounts/".concat(organizationLogin, "/schedules"),
142
- method: 'POST',
143
- body: {
144
- name: name,
145
- location: {
146
- isOnline: isOnline,
147
- description: description,
148
- address: {
149
- id: id,
150
- formattedAddress: formattedAddress,
151
- timezone: timezone,
152
- name: addressName,
153
- streetNumber: streetNumber,
154
- streetName: streetName,
155
- region: region,
156
- city: city,
157
- country: country,
158
- zipCode: zipCode,
159
- appartment: appartment,
160
- }
161
- },
162
- schedule: {
163
- weekly: { mon: mon, tue: tue, wed: wed, thu: thu, fri: fri, sat: sat, sun: sun }
164
- }
165
- },
166
- });
167
- };
168
139
  Organizations.prototype.getMembersSchedule = function (organizationLogin, date /* YYYY-MM-DD */) {
169
140
  return this._requestRunner.performRequest({
170
141
  url: "accounts/".concat(organizationLogin, "/members/schedule/").concat(date),
@@ -247,6 +218,13 @@ var Organizations = /** @class */ (function () {
247
218
  enumerable: false,
248
219
  configurable: true
249
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
+ });
250
228
  Organizations.prototype.updateRoles = function (organizationLogin, roles) {
251
229
  return this._requestRunner.performRequest({
252
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: [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.871",
3
+ "version": "1.35.881",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",