starta.apiclient 1.37.7016 → 1.37.7044

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.
@@ -1,4 +1,4 @@
1
- import { StartaRequestRunner, OrderStatus, OrderRepeatSettings } from '../../types';
1
+ import { StartaRequestRunner, OrderStatus, OrderData, CreateOrderData } from '../../types';
2
2
  export default class Orders {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
@@ -21,89 +21,16 @@ export default class Orders {
21
21
  branchId?: string;
22
22
  }): Promise<import("../../types").StartaResponse>;
23
23
  isTimeSlotAvailable(organizationLogin: string, { executor, starttime, endtime, skipOrderId, scheduleId, resources, }: {
24
- executor: string;
24
+ scheduleId: string;
25
25
  starttime: string;
26
26
  endtime: string;
27
+ executor?: string;
27
28
  skipOrderId?: string;
28
- scheduleId: string;
29
29
  resources?: Array<string>;
30
30
  }): Promise<import("../../types").StartaResponse>;
31
31
  get(organizationOrCustomerLogin: string, orderId: any): Promise<import("../../types").StartaResponse>;
32
- add(organizationLogin: string, { products, usedMaterials, starttime, endtime, customerId, scheduleId, status, repeatSettings, discountType, discount, organizationComment, }: {
33
- products: Array<{
34
- type: string;
35
- id: string;
36
- executors?: Array<string>;
37
- amount?: number;
38
- price?: number;
39
- duration?: number;
40
- timeOffset?: number;
41
- warehouseId?: string;
42
- resources?: Array<string>;
43
- }>;
44
- usedMaterials?: Array<{
45
- serviceId: string;
46
- techcardId?: string;
47
- steps?: Array<{
48
- name: string;
49
- items: Array<{
50
- type: 'product';
51
- warehouseId: string;
52
- productId: string;
53
- amount: number;
54
- } | {
55
- type: 'comment';
56
- comment: string;
57
- }>;
58
- }>;
59
- }>;
60
- starttime?: any;
61
- endtime?: any;
62
- customerId: any;
63
- scheduleId?: any;
64
- status?: OrderStatus;
65
- repeatSettings?: OrderRepeatSettings;
66
- discountType?: 'relative' | 'absolute';
67
- discount?: number;
68
- organizationComment?: string;
69
- }): Promise<import("../../types").StartaResponse>;
70
- update(organizationLogin: string, orderId: string, { products, usedMaterials, starttime, endtime, scheduleId, status, repeatSettings, discountType, discount, organizationComment, }: {
71
- products: Array<{
72
- type: string;
73
- id: string;
74
- executors?: Array<string>;
75
- amount?: number;
76
- price?: number;
77
- duration?: number;
78
- timeOffset?: number;
79
- warehouseId?: string;
80
- resources?: Array<string>;
81
- }>;
82
- usedMaterials?: Array<{
83
- serviceId: string;
84
- techcardId?: string;
85
- steps?: Array<{
86
- name: string;
87
- items: Array<{
88
- type: 'product';
89
- warehouseId: string;
90
- productId: string;
91
- amount: number;
92
- } | {
93
- type: 'comment';
94
- comment: string;
95
- }>;
96
- }>;
97
- }>;
98
- starttime?: any;
99
- endtime?: any;
100
- scheduleId?: any;
101
- status?: OrderStatus;
102
- repeatSettings?: OrderRepeatSettings;
103
- discountType?: 'relative' | 'absolute';
104
- discount?: number;
105
- organizationComment?: string;
106
- }): Promise<import("../../types").StartaResponse>;
32
+ add(organizationLogin: string, { products, usedMaterials, customerId, scheduleId, status, repeatSettings, organizationComment, }: CreateOrderData): Promise<import("../../types").StartaResponse>;
33
+ update(organizationLogin: string, orderId: string, { products, usedMaterials, scheduleId, status, repeatSettings, organizationComment, }: OrderData): Promise<import("../../types").StartaResponse>;
107
34
  delete(organizationLogin: string, orderId: string): Promise<import("../../types").StartaResponse>;
108
35
  setConfirmation(organizationOrCustomerLogin: string, orderId: string, { isConfirmed }: {
109
36
  isConfirmed: boolean;
@@ -43,39 +43,31 @@ class Orders {
43
43
  method: 'GET',
44
44
  });
45
45
  }
46
- add(organizationLogin, { products, usedMaterials, starttime, endtime, customerId, scheduleId, status = 'new', repeatSettings, discountType, discount, organizationComment, }) {
46
+ add(organizationLogin, { products, usedMaterials, customerId, scheduleId, status = 'new', repeatSettings, organizationComment, }) {
47
47
  return this._requestRunner.performRequest({
48
48
  url: `accounts/${organizationLogin}/orders`,
49
49
  method: 'POST',
50
50
  body: {
51
51
  products,
52
52
  usedMaterials,
53
- starttime,
54
- endtime,
55
53
  customerId,
56
54
  scheduleId,
57
55
  status,
58
56
  repeatSettings,
59
- discountType,
60
- discount,
61
57
  organizationComment,
62
58
  },
63
59
  });
64
60
  }
65
- update(organizationLogin, orderId, { products, usedMaterials, starttime, endtime, scheduleId, status, repeatSettings, discountType, discount, organizationComment, }) {
61
+ update(organizationLogin, orderId, { products, usedMaterials, scheduleId, status, repeatSettings, organizationComment, }) {
66
62
  return this._requestRunner.performRequest({
67
63
  url: `accounts/${organizationLogin}/orders/${orderId}`,
68
64
  method: 'PUT',
69
65
  body: {
70
66
  products,
71
67
  usedMaterials,
72
- starttime,
73
- endtime,
74
68
  scheduleId,
75
69
  status,
76
70
  repeatSettings,
77
- discountType,
78
- discount,
79
71
  organizationComment,
80
72
  },
81
73
  });
@@ -6,13 +6,10 @@ export default class Public {
6
6
  getContact(organizationLogin: string, contactIndex: number, recaptchaToken?: string): Promise<import("../../types").StartaResponse>;
7
7
  getAvailableTimeSlots(organizationLogin: string, { products, month, scheduleId, }: {
8
8
  products: Array<{
9
- type: any;
10
- id: any;
9
+ type: 'service' | 'product';
10
+ id: string;
11
11
  executors?: Array<string>;
12
12
  amount?: number;
13
- timeOffset?: number;
14
- price?: number;
15
- duration?: number;
16
13
  }>;
17
14
  month: string;
18
15
  scheduleId: string;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const _helpers_1 = require("../_helpers");
4
3
  class Public {
5
4
  constructor(requestRunner) {
6
5
  this._requestRunner = requestRunner;
@@ -20,12 +19,13 @@ class Public {
20
19
  }
21
20
  getAvailableTimeSlots(organizationLogin, { products, month, scheduleId, }) {
22
21
  return this._requestRunner.performRequest({
23
- url: `accounts/${organizationLogin}/public/availableTimeSlots${(0, _helpers_1.buildQuery)({
22
+ url: `accounts/${organizationLogin}/public/availableTimeSlots`,
23
+ method: 'POST',
24
+ body: {
24
25
  month,
25
26
  scheduleId,
26
- products: JSON.stringify(products),
27
- })}`,
28
- method: 'GET',
27
+ products,
28
+ },
29
29
  });
30
30
  }
31
31
  cancelOrder(organizationLogin, orderId) {
package/lib/types.d.ts CHANGED
@@ -151,3 +151,43 @@ export type TechcardSteps = Array<{
151
151
  comment: string;
152
152
  }>;
153
153
  }>;
154
+ export type OrderData = {
155
+ products: Array<OrderItem>;
156
+ usedMaterials?: OrderUsedMaterials;
157
+ scheduleId: string;
158
+ status?: OrderStatus;
159
+ repeatSettings?: OrderRepeatSettings;
160
+ organizationComment?: string;
161
+ };
162
+ export type CreateOrderData = OrderData & {
163
+ customerId: string;
164
+ };
165
+ export type OrderItem = {
166
+ type: 'service' | 'product' | 'roomRent' | 'seminar';
167
+ id: string;
168
+ executors?: Array<string>;
169
+ amount?: number;
170
+ price?: number;
171
+ duration?: number;
172
+ timeOffset?: number;
173
+ warehouseId?: string;
174
+ resources?: Array<string>;
175
+ discountType?: 'relative' | 'absolute';
176
+ discount?: number;
177
+ };
178
+ export type OrderUsedMaterials = Array<{
179
+ serviceId: string;
180
+ techcardId?: string;
181
+ steps?: Array<{
182
+ name: string;
183
+ items: Array<{
184
+ type: 'product';
185
+ warehouseId: string;
186
+ productId: string;
187
+ amount: number;
188
+ } | {
189
+ type: 'comment';
190
+ comment: string;
191
+ }>;
192
+ }>;
193
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starta.apiclient",
3
- "version": "1.37.7016",
3
+ "version": "1.37.7044",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",