starta.apiclient 1.112.9213 → 1.112.9216

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.
package/lib/request.js CHANGED
@@ -13,11 +13,15 @@ exports.requestFactory = void 0;
13
13
  const axios_1 = require("axios");
14
14
  const requestFactory = (baseURL, middlewares) => {
15
15
  let authHeaderToken = '';
16
+ let appDetails = '';
16
17
  return {
17
18
  replaceBaseUrl: (newBaseUrl) => requestFactory(newBaseUrl(baseURL), middlewares),
18
19
  setAuthHeaderToken: (token) => {
19
20
  authHeaderToken = token;
20
21
  },
22
+ setAppDetails: (name, version) => {
23
+ appDetails = `${name}:${version}`;
24
+ },
21
25
  performRequest: ({ url, method, urlParams, body, config = {}, }) => __awaiter(void 0, void 0, void 0, function* () {
22
26
  const performRequestWithRetry = (retryCount = 3) => __awaiter(void 0, void 0, void 0, function* () {
23
27
  var _a;
@@ -40,6 +44,10 @@ const requestFactory = (baseURL, middlewares) => {
40
44
  config.headers[h] = headers[h];
41
45
  });
42
46
  }
47
+ if (appDetails) {
48
+ config.headers['User-Agent'] =
49
+ `${appDetails} ${config.headers['User-Agent'] || ''}`.trim();
50
+ }
43
51
  const requestConfig = Object.assign({ baseURL: config.rewriteBaseUrl
44
52
  ? config.rewriteBaseUrl(baseURL)
45
53
  : baseURL, method, params: urlParams, data: body, withCredentials: true }, config);
@@ -39,6 +39,6 @@ export default class Communications {
39
39
  }): Promise<import("../types").StartaResponse>;
40
40
  getSMSCreditsBalance(organizationLogin: string): Promise<import("../types").StartaResponse>;
41
41
  refillSMSCreditsBonusBalance(organizationLogin: string): Promise<import("../types").StartaResponse>;
42
- getSMSCreditsPaymentLink(organizationLogin: string, creditsPackage: 'lite250' | 'lite1100' | 'pro250' | 'pro1100'): Promise<import("../types").StartaResponse>;
42
+ getSMSCreditsPaymentLink(organizationLogin: string, creditsPackage: 'lite250' | 'lite1100' | 'pro250' | 'pro1100', eventId: string): Promise<import("../types").StartaResponse>;
43
43
  resendSMS(login: string, smsId: string): Promise<import("../types").StartaResponse>;
44
44
  }
@@ -86,9 +86,9 @@ class Communications {
86
86
  },
87
87
  });
88
88
  }
89
- getSMSCreditsPaymentLink(organizationLogin, creditsPackage) {
89
+ getSMSCreditsPaymentLink(organizationLogin, creditsPackage, eventId) {
90
90
  return this._requestRunner.performRequest({
91
- url: `accounts/${organizationLogin}/smsCreditsPaymentLink${(0, _helpers_1.buildQuery)({ creditsPackage })}`,
91
+ url: `accounts/${organizationLogin}/smsCreditsPaymentLink${(0, _helpers_1.buildQuery)({ creditsPackage, eventId })}`,
92
92
  method: 'GET',
93
93
  });
94
94
  }
@@ -112,7 +112,7 @@ export default class Organizations {
112
112
  setEndOfTrial(organizationLogin: string, endOfTrialAt: string): Promise<import("../../types").StartaResponse>;
113
113
  setForYearBonus(organizationLogin: string, bonusForYearUntil: string): Promise<import("../../types").StartaResponse>;
114
114
  getBillingInfo(organizationLogin: string, month?: string): Promise<import("../../types").StartaResponse>;
115
- setTariff(organizationLogin: string, { tariff, period, successUrl, cancelUrl }: TariffDetails): Promise<import("../../types").StartaResponse>;
115
+ setTariff(organizationLogin: string, { tariff, period, successUrl, cancelUrl }: TariffDetails, eventId?: string): Promise<import("../../types").StartaResponse>;
116
116
  addBalance(organizationLogin: string, { amount, comment, type, }: {
117
117
  amount: number;
118
118
  comment: string;
@@ -241,11 +241,11 @@ class Organizations {
241
241
  method: 'GET',
242
242
  });
243
243
  }
244
- setTariff(organizationLogin, { tariff, period, successUrl, cancelUrl }) {
244
+ setTariff(organizationLogin, { tariff, period, successUrl, cancelUrl }, eventId) {
245
245
  return this._requestRunner.performRequest({
246
246
  url: `accounts/${organizationLogin}/tariff`,
247
247
  method: 'PUT',
248
- body: { tariff, period, successUrl, cancelUrl },
248
+ body: { tariff, period, successUrl, cancelUrl, eventId },
249
249
  });
250
250
  }
251
251
  addBalance(organizationLogin, { amount, comment, type, }) {
package/lib/types.d.ts CHANGED
@@ -2,6 +2,7 @@ import { AxiosRequestConfig, Method, AxiosResponse, AxiosError, AxiosRequestHead
2
2
  export interface StartaRequestRunner {
3
3
  performRequest: (requestData: StartaRequestData) => Promise<StartaResponse>;
4
4
  setAuthHeaderToken: (token: string) => void;
5
+ setAppDetails: (name: string, version: string) => void;
5
6
  replaceBaseUrl: (newBaseUrl: (baseURL: string) => string) => StartaRequestRunner;
6
7
  }
7
8
  export declare type DraftjsObject = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starta.apiclient",
3
- "version": "1.112.9213",
3
+ "version": "1.112.9216",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",