starta.apiclient 1.35.863 → 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,9 +9,13 @@ 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);
16
+ index({ searchTerm }: {
17
+ searchTerm?: string;
18
+ }): Promise<import("../../types").StartaResponse>;
15
19
  create(account: any, { login, name, currency, timeZone, orgType }: {
16
20
  login: any;
17
21
  name: any;
@@ -49,17 +53,6 @@ export default class Organizations {
49
53
  theme: any;
50
54
  }): Promise<import("../../types").StartaResponse>;
51
55
  setBookingWidgetStyles(organizationLogin: any, bookingWidgetStyles: any): Promise<import("../../types").StartaResponse>;
52
- setWorkingSchedule(organizationLogin: any, { weekly: { mon, tue, wed, thu, fri, sat, sun } }: {
53
- weekly: {
54
- mon: any;
55
- tue: any;
56
- wed: any;
57
- thu: any;
58
- fri: any;
59
- sat: any;
60
- sun: any;
61
- };
62
- }): Promise<import("../../types").StartaResponse>;
63
56
  getMembersSchedule(organizationLogin: any, date: any): Promise<import("../../types").StartaResponse>;
64
57
  getSingleMemberSchedule(organizationLogin: any, member: any, from: any, to: any): Promise<import("../../types").StartaResponse>;
65
58
  get orders(): Orders;
@@ -72,6 +65,7 @@ export default class Organizations {
72
65
  get payments(): Payments;
73
66
  get dashboard(): Dashboard;
74
67
  get integrations(): Integrations;
68
+ get schedules(): Schedules;
75
69
  updateRoles(organizationLogin: any, roles: any): Promise<import("../../types").StartaResponse>;
76
70
  setLicense(organizationLogin: any, { maxMembers }: {
77
71
  maxMembers: any;
@@ -10,11 +10,19 @@ 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) {
16
17
  this._requestRunner = requestRunner;
17
18
  }
19
+ Organizations.prototype.index = function (_a) {
20
+ var searchTerm = _a.searchTerm;
21
+ return this._requestRunner.performRequest({
22
+ url: "organizations".concat((0, _helpers_1.buildQuery)({ searchTerm: searchTerm })),
23
+ method: 'GET',
24
+ });
25
+ };
18
26
  Organizations.prototype.create = function (account, _a) {
19
27
  var login = _a.login, name = _a.name, currency = _a.currency, timeZone = _a.timeZone, orgType = _a.orgType;
20
28
  return this._requestRunner.performRequest({
@@ -128,14 +136,6 @@ var Organizations = /** @class */ (function () {
128
136
  body: bookingWidgetStyles,
129
137
  });
130
138
  };
131
- Organizations.prototype.setWorkingSchedule = function (organizationLogin, _a) {
132
- 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;
133
- return this._requestRunner.performRequest({
134
- url: "accounts/".concat(organizationLogin, "/workingSchedule"),
135
- method: 'PUT',
136
- body: { weekly: { mon: mon, tue: tue, wed: wed, thu: thu, fri: fri, sat: sat, sun: sun } },
137
- });
138
- };
139
139
  Organizations.prototype.getMembersSchedule = function (organizationLogin, date /* YYYY-MM-DD */) {
140
140
  return this._requestRunner.performRequest({
141
141
  url: "accounts/".concat(organizationLogin, "/members/schedule/").concat(date),
@@ -218,6 +218,13 @@ var Organizations = /** @class */ (function () {
218
218
  enumerable: false,
219
219
  configurable: true
220
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
+ });
221
228
  Organizations.prototype.updateRoles = function (organizationLogin, roles) {
222
229
  return this._requestRunner.performRequest({
223
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.863",
3
+ "version": "1.35.881",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",