starta.apiclient 1.112.12901 → 1.112.12959

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.
@@ -8,7 +8,6 @@ import EmailConfirmations from './emailConfirmations';
8
8
  import PhoneConfirmations from './phoneConfirmations';
9
9
  import System from './system';
10
10
  import Chats from './chats';
11
- import Webhooks from './webhooks';
12
11
  import Communications from './communications';
13
12
  import Search from './search';
14
13
  import ServiceCategories from './serviceCategories';
@@ -17,20 +16,19 @@ import MarketingCampaigns from './marketingCampaigns';
17
16
  import Links from './links';
18
17
  import Agenda from './agenda';
19
18
  import LandingChats from './landingChats';
20
- import { AxiosRequestHeaders } from 'axios';
19
+ import { AxiosRequestConfig, AxiosRequestHeaders } from 'axios';
21
20
  export default class StartaApiClient {
22
21
  private _requestRunner;
23
22
  constructor(requestRunner: StartaRequestRunner);
24
23
  setAuthHeaderToken(token: any): void;
25
24
  setCustomHeaders(customHeaders?: AxiosRequestHeaders): void;
26
- performCustomRequest(url: any, method: any, body: any, rewriteBaseUrl: (string: any) => string): Promise<import("../types").StartaResponse>;
25
+ performCustomRequest(url: any, method: any, body: any, rewriteBaseUrl?: (baseUrl: string) => string, config?: Omit<AxiosRequestConfig, 'baseURL'>): Promise<import("../types").StartaResponse>;
27
26
  get sessions(): Sessions;
28
27
  get search(): Search;
29
28
  get accounts(): Accounts;
30
29
  get communications(): Communications;
31
30
  get organizations(): Organizations;
32
31
  get passwordResets(): PasswordResets;
33
- get webhooks(): Webhooks;
34
32
  get system(): System;
35
33
  get emailConfirmations(): EmailConfirmations;
36
34
  get serviceCategories(): ServiceCategories;
@@ -9,7 +9,6 @@ const emailConfirmations_1 = require("./emailConfirmations");
9
9
  const phoneConfirmations_1 = require("./phoneConfirmations");
10
10
  const system_1 = require("./system");
11
11
  const chats_1 = require("./chats");
12
- const webhooks_1 = require("./webhooks");
13
12
  const communications_1 = require("./communications");
14
13
  const search_1 = require("./search");
15
14
  const serviceCategories_1 = require("./serviceCategories");
@@ -28,14 +27,12 @@ class StartaApiClient {
28
27
  setCustomHeaders(customHeaders = {}) {
29
28
  this._requestRunner.setCustomHeaders(customHeaders);
30
29
  }
31
- performCustomRequest(url, method, body, rewriteBaseUrl) {
30
+ performCustomRequest(url, method, body, rewriteBaseUrl = (baseUrl) => baseUrl, config = {}) {
32
31
  return this._requestRunner.performRequest({
33
32
  url,
34
33
  method,
35
34
  body,
36
- config: {
37
- rewriteBaseUrl,
38
- },
35
+ config: Object.assign({ rewriteBaseUrl }, config),
39
36
  });
40
37
  }
41
38
  get sessions() {
@@ -56,9 +53,6 @@ class StartaApiClient {
56
53
  get passwordResets() {
57
54
  return new passwordResets_1.default(this._requestRunner);
58
55
  }
59
- get webhooks() {
60
- return new webhooks_1.default(this._requestRunner);
61
- }
62
56
  get system() {
63
57
  return new system_1.default(this._requestRunner);
64
58
  }
@@ -1,4 +1,4 @@
1
- import { StartaRequestRunner, StartaSSECallbacks, StartaSSEHandle } from '../types';
1
+ import { StartaRequestRunner, StartaSSECallbacks, StartaSSEHandle, SortDirection } from '../types';
2
2
  export default class LandingChats {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
@@ -23,4 +23,14 @@ export default class LandingChats {
23
23
  * @param landingChatId Chat session ID
24
24
  */
25
25
  get(landingChatId: string): Promise<import("../types").StartaResponse>;
26
+ /**
27
+ * Get paginated list of landing chats.
28
+ * @param options Pagination and sorting options
29
+ */
30
+ index({ skip, limit, sortColumn, sortDirection, }?: {
31
+ skip?: number;
32
+ limit?: number;
33
+ sortColumn?: 'createdAt';
34
+ sortDirection?: SortDirection;
35
+ }): Promise<import("../types").StartaResponse>;
26
36
  }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const _helpers_1 = require("./_helpers");
3
4
  class LandingChats {
4
5
  constructor(requestRunner) {
5
6
  this._requestRunner = requestRunner;
@@ -59,5 +60,23 @@ class LandingChats {
59
60
  },
60
61
  });
61
62
  }
63
+ /**
64
+ * Get paginated list of landing chats.
65
+ * @param options Pagination and sorting options
66
+ */
67
+ index({ skip, limit, sortColumn, sortDirection, } = {}) {
68
+ return this._requestRunner.performRequest({
69
+ url: `landing-chats${(0, _helpers_1.buildQuery)({
70
+ skip,
71
+ limit,
72
+ sortColumn,
73
+ sortDirection,
74
+ })}`,
75
+ method: 'GET',
76
+ config: {
77
+ rewriteBaseUrl: (url) => url.replace('/api', '/comm/api'),
78
+ },
79
+ });
80
+ }
62
81
  }
63
82
  exports.default = LandingChats;
@@ -1,5 +1,5 @@
1
1
  import { StartaRequestRunner } from '../types';
2
- export default class EmailConfirmations {
2
+ export default class System {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
5
5
  configjs(): Promise<import("../types").StartaResponse>;
@@ -16,26 +16,4 @@ export default class EmailConfirmations {
16
16
  groupBy?: 'date' | 'dayOfWeek' | 'hour';
17
17
  }): Promise<import("../types").StartaResponse>;
18
18
  getExchangeRate(currency: string): Promise<import("../types").StartaResponse>;
19
- resetIpLocks(): Promise<import("../types").StartaResponse>;
20
- resyncAccounts({ login, sectorIndex, sectorSize, includeInactive, }?: {
21
- login?: string;
22
- sectorIndex?: number;
23
- sectorSize?: number;
24
- includeInactive?: boolean;
25
- }): Promise<import("../types").StartaResponse>;
26
- confirmAccount(login: string, { email, phone }: {
27
- email: string;
28
- phone: string;
29
- }): Promise<import("../types").StartaResponse>;
30
- notifyAboutBirthdayOfCustomers(): Promise<import("../types").StartaResponse>;
31
- assignTrialCouponsForOrganizations(): Promise<import("../types").StartaResponse>;
32
- sendDailyReportEmails(organizationLogin?: string, daysShift?: number): Promise<import("../types").StartaResponse>;
33
- sendNewFeatureNotificationToChats({ featureId, ticketId, title, text, organizationLogin, organizationCountry, }: {
34
- featureId: string;
35
- ticketId: string;
36
- title: string;
37
- text: string;
38
- organizationLogin?: string;
39
- organizationCountry?: string;
40
- }): Promise<import("../types").StartaResponse>;
41
19
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const _helpers_1 = require("./_helpers");
4
- class EmailConfirmations {
4
+ class System {
5
5
  constructor(requestRunner) {
6
6
  this._requestRunner = requestRunner;
7
7
  }
@@ -54,68 +54,5 @@ class EmailConfirmations {
54
54
  method: 'GET',
55
55
  });
56
56
  }
57
- resetIpLocks() {
58
- return this._requestRunner.performRequest({
59
- url: `resetIpLocks`,
60
- method: 'GET',
61
- });
62
- }
63
- resyncAccounts({ login, sectorIndex, sectorSize, includeInactive, } = {}) {
64
- return this._requestRunner.performRequest({
65
- url: `accounts/admin/approveAllForSearch${(0, _helpers_1.buildQuery)({
66
- login,
67
- sectorIndex,
68
- sectorSize,
69
- includeInactive,
70
- })}`,
71
- method: 'GET',
72
- });
73
- }
74
- confirmAccount(login, { email, phone }) {
75
- return this._requestRunner.performRequest({
76
- url: `accounts/${login}/confirmations`,
77
- method: 'PUT',
78
- body: {
79
- email,
80
- phone,
81
- },
82
- });
83
- }
84
- notifyAboutBirthdayOfCustomers() {
85
- return this._requestRunner.performRequest({
86
- url: `accounts/notify-birthdays`,
87
- method: 'POST',
88
- });
89
- }
90
- assignTrialCouponsForOrganizations() {
91
- return this._requestRunner.performRequest({
92
- url: `accounts/assign-trial-coupons`,
93
- method: 'POST',
94
- });
95
- }
96
- sendDailyReportEmails(organizationLogin, daysShift) {
97
- return this._requestRunner.performRequest({
98
- url: `accounts/send-daily-report-emails`,
99
- method: 'POST',
100
- body: {
101
- organizationLogin,
102
- daysShift,
103
- },
104
- });
105
- }
106
- sendNewFeatureNotificationToChats({ featureId, ticketId, title, text, organizationLogin, organizationCountry, }) {
107
- return this._requestRunner.performRequest({
108
- url: `system/send-new-feature-notification-to-chats`,
109
- method: 'POST',
110
- body: {
111
- featureId,
112
- ticketId,
113
- title,
114
- text,
115
- organizationLogin,
116
- organizationCountry,
117
- },
118
- });
119
- }
120
57
  }
121
- exports.default = EmailConfirmations;
58
+ exports.default = System;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starta.apiclient",
3
- "version": "1.112.12901",
3
+ "version": "1.112.12959",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",
@@ -1,6 +0,0 @@
1
- import { StartaRequestRunner } from '../types';
2
- export default class EmailConfirmations {
3
- private _requestRunner;
4
- constructor(requestRunner: StartaRequestRunner);
5
- stripe(body: any, signature: string): Promise<import("../types").StartaResponse>;
6
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class EmailConfirmations {
4
- constructor(requestRunner) {
5
- this._requestRunner = requestRunner;
6
- }
7
- stripe(body, signature) {
8
- return this._requestRunner.performRequest({
9
- url: `webhooks/stripe`,
10
- method: 'POST',
11
- body,
12
- config: {
13
- headers: {
14
- 'stripe-signature': signature,
15
- },
16
- },
17
- });
18
- }
19
- }
20
- exports.default = EmailConfirmations;