starta.apiclient 1.112.12612 → 1.112.12619

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.
@@ -2,7 +2,7 @@ import { StartaRequestRunner, Techcard, TechcardType } from '../../types';
2
2
  export default class Techcards {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
5
- add(organizationLogin: string, { name, isEnabled, type, products, autoAttach, serviceIds, customerIds, executors, steps, numberToPrepare, customDuration, customPrice, }: Techcard): Promise<import("../../types").StartaResponse>;
5
+ add(organizationLogin: string, techcard: Techcard): Promise<import("../../types").StartaResponse>;
6
6
  index(organizationLogin: string, { customerId, serviceId, executor, isEnabled, type, }?: {
7
7
  customerId?: string;
8
8
  serviceId?: string;
@@ -10,6 +10,6 @@ export default class Techcards {
10
10
  isEnabled?: boolean;
11
11
  type?: TechcardType;
12
12
  }): Promise<import("../../types").StartaResponse>;
13
- update(organizationLogin: string, techcardId: string, { name, isEnabled, type, products, autoAttach, serviceIds, customerIds, executors, steps, numberToPrepare, customDuration, customPrice, }: Techcard): Promise<import("../../types").StartaResponse>;
13
+ update(organizationLogin: string, techcardId: string, techcard: Techcard): Promise<import("../../types").StartaResponse>;
14
14
  delete(organizationLogin: string, techcardId: string): Promise<import("../../types").StartaResponse>;
15
15
  }
@@ -5,24 +5,11 @@ class Techcards {
5
5
  constructor(requestRunner) {
6
6
  this._requestRunner = requestRunner;
7
7
  }
8
- add(organizationLogin, { name, isEnabled, type, products, autoAttach, serviceIds, customerIds, executors, steps, numberToPrepare, customDuration, customPrice, }) {
8
+ add(organizationLogin, techcard) {
9
9
  return this._requestRunner.performRequest({
10
10
  url: `accounts/${organizationLogin}/techcards`,
11
11
  method: 'POST',
12
- body: {
13
- name,
14
- isEnabled,
15
- type,
16
- products,
17
- autoAttach,
18
- serviceIds,
19
- customerIds,
20
- executors,
21
- steps,
22
- numberToPrepare,
23
- customDuration,
24
- customPrice,
25
- },
12
+ body: Object.assign({}, techcard),
26
13
  });
27
14
  }
28
15
  index(organizationLogin, { customerId, serviceId, executor, isEnabled, type, } = {}) {
@@ -31,24 +18,11 @@ class Techcards {
31
18
  method: 'GET',
32
19
  });
33
20
  }
34
- update(organizationLogin, techcardId, { name, isEnabled, type, products, autoAttach, serviceIds, customerIds, executors, steps, numberToPrepare, customDuration, customPrice, }) {
21
+ update(organizationLogin, techcardId, techcard) {
35
22
  return this._requestRunner.performRequest({
36
23
  url: `accounts/${organizationLogin}/techcards/${techcardId}`,
37
24
  method: 'PUT',
38
- body: {
39
- name,
40
- isEnabled,
41
- type,
42
- products,
43
- autoAttach,
44
- serviceIds,
45
- customerIds,
46
- executors,
47
- steps,
48
- numberToPrepare,
49
- customDuration,
50
- customPrice,
51
- },
25
+ body: Object.assign({}, techcard),
52
26
  });
53
27
  }
54
28
  delete(organizationLogin, techcardId) {
package/lib/types.d.ts CHANGED
@@ -252,22 +252,20 @@ export type ServiceExecutor = {
252
252
  export type Techcard = {
253
253
  name: string;
254
254
  isEnabled: boolean;
255
- type: TechcardType;
256
- calculationMethod: 'fixedAmount' | 'proportional';
257
- products?: Array<{
258
- id: string;
259
- quantityForSale: number;
260
- unit: MeasurementUnit;
261
- }>;
262
255
  autoAttach?: boolean;
263
256
  serviceIds?: Array<string>;
264
257
  customerIds?: Array<string>;
265
258
  executors?: Array<string>;
266
259
  steps?: TechcardSteps;
267
- numberToPrepare?: number;
268
260
  customPrice?: number;
269
261
  customDuration?: number;
270
- };
262
+ } & ({
263
+ type: 'service';
264
+ } | {
265
+ type: 'product';
266
+ calculationMethod: 'fixedAmount' | 'proportional';
267
+ numberToPrepare?: number;
268
+ });
271
269
  export type TechcardType = 'service' | 'product';
272
270
  export type TechcardSteps = Array<{
273
271
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starta.apiclient",
3
- "version": "1.112.12612",
3
+ "version": "1.112.12619",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",