@kiminix/tp-client 1.37.0 → 1.39.0

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,19 @@
1
1
  import { Business } from "./types/get-id";
2
2
  export declare class BusinessAdminAPIs {
3
+ /**
4
+ *
5
+ * @param token
6
+ * @throws unauthorized, internal_error
7
+ * @returns
8
+ */
3
9
  static get(token?: string): Promise<Business>;
10
+ static subscription(props: {
11
+ name: string;
12
+ address: string;
13
+ addition: string;
14
+ firstName: string;
15
+ lastName: string;
16
+ phone: string;
17
+ socialNetwork?: string;
18
+ }): Promise<any>;
4
19
  }
@@ -37,15 +37,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  import axios from "axios";
38
38
  import { base } from "../constants";
39
39
  import { parseISO } from "date-fns";
40
+ import { RequestUtils } from "../utils/request-utils";
40
41
  // business module admin APIs
41
42
  var BusinessAdminAPIs = /** @class */ (function () {
42
43
  function BusinessAdminAPIs() {
43
44
  }
45
+ /**
46
+ *
47
+ * @param token
48
+ * @throws unauthorized, internal_error
49
+ * @returns
50
+ */
44
51
  BusinessAdminAPIs.get = function (token) {
45
52
  return __awaiter(this, void 0, void 0, function () {
46
53
  return __generator(this, function (_a) {
47
- switch (_a.label) {
48
- case 0: return [4 /*yield*/, axios.get(base + "/business/admin", {
54
+ return [2 /*return*/, RequestUtils.send(function () {
55
+ return axios.get(base + "/business/admin", {
49
56
  headers: {
50
57
  'Authorization': "".concat(token)
51
58
  }
@@ -55,16 +62,26 @@ var BusinessAdminAPIs = /** @class */ (function () {
55
62
  // to fix the date format
56
63
  data.createdAt = parseISO("".concat(data.createdAt));
57
64
  return data;
58
- })
59
- .catch(function (error) {
60
- // handle error
61
- if (error.response.status == 401)
62
- throw new Error("unauthorized");
63
- else
64
- throw new Error('internal_error', error);
65
- })];
66
- case 1: return [2 /*return*/, _a.sent()];
67
- }
65
+ });
66
+ })];
67
+ });
68
+ });
69
+ };
70
+ BusinessAdminAPIs.subscription = function (props) {
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ return __generator(this, function (_a) {
73
+ return [2 /*return*/, RequestUtils.send(function () {
74
+ return axios.post(base + "/business/subscriptions", {
75
+ name: props.name,
76
+ address: props.address,
77
+ addition: props.addition,
78
+ firstName: props.firstName,
79
+ lastName: props.lastName,
80
+ phone: props.phone,
81
+ socialNetwork: props.socialNetwork
82
+ }, {})
83
+ .then(function (response) { return response.data; });
84
+ })];
68
85
  });
69
86
  });
70
87
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "1.37.0",
3
+ "version": "1.39.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [