washday-sdk 0.0.44 → 0.0.45

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.
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getCompanyById = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const GET_SET_COMPANIES = 'api/company';
18
+ const REQUEST_PARAMS = {
19
+ token: 'LOGGED_USER_TOKEN',
20
+ };
21
+ const getCompanyById = function (companyId) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ try {
24
+ const config = {
25
+ headers: { Authorization: `Bearer ${this.apiToken}` }
26
+ };
27
+ const response = yield axiosInstance_1.default.get(`${GET_SET_COMPANIES}/${companyId}`, config);
28
+ return response;
29
+ }
30
+ catch (error) {
31
+ console.error('Error fetching getCompanyById:', error);
32
+ throw error;
33
+ }
34
+ });
35
+ };
36
+ exports.getCompanyById = getCompanyById;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
package/dist/api/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const get_1 = require("./countries/get");
4
- const get_2 = require("./customers/get");
3
+ const get_1 = require("./companies/get");
4
+ const get_2 = require("./countries/get");
5
+ const get_3 = require("./customers/get");
5
6
  const put_1 = require("./products/put");
6
- const get_3 = require("./stores/get");
7
+ const get_4 = require("./stores/get");
7
8
  const post_1 = require("./stores/post");
8
9
  const put_2 = require("./stores/put");
9
10
  const put_3 = require("./users/put");
@@ -14,17 +15,18 @@ const WashdayClient = function WashdayClient(apiToken) {
14
15
  WashdayClient.prototype.products.apiToken = apiToken;
15
16
  WashdayClient.prototype.users.apiToken = apiToken;
16
17
  WashdayClient.prototype.countries.apiToken = apiToken;
18
+ WashdayClient.prototype.companies.apiToken = apiToken;
17
19
  };
18
20
  WashdayClient.prototype.customers = {
19
- getCustomerById: get_2.getCustomerById,
20
- getCustomerHighlightsById: get_2.getCustomerHighlightsById
21
+ getCustomerById: get_3.getCustomerById,
22
+ getCustomerHighlightsById: get_3.getCustomerHighlightsById
21
23
  };
22
24
  WashdayClient.prototype.stores = {
23
- getStores: get_3.getStores,
24
- getStoreById: get_3.getStoreById,
25
+ getStores: get_4.getStores,
26
+ getStoreById: get_4.getStoreById,
25
27
  updateStoreById: put_2.updateStoreById,
26
28
  createStoreImage: post_1.createStoreImage,
27
- getStoreReviewLink: get_3.getStoreReviewLink
29
+ getStoreReviewLink: get_4.getStoreReviewLink
28
30
  };
29
31
  WashdayClient.prototype.products = {
30
32
  bulkUpdate: put_1.bulkUpdate,
@@ -33,6 +35,9 @@ WashdayClient.prototype.users = {
33
35
  updateUserById: put_3.updateUserById,
34
36
  };
35
37
  WashdayClient.prototype.countries = {
36
- getCountries: get_1.getCountries,
38
+ getCountries: get_2.getCountries,
39
+ };
40
+ WashdayClient.prototype.companies = {
41
+ getCompanyById: get_1.getCompanyById,
37
42
  };
38
43
  exports.default = WashdayClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,23 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { ICustomer } from "../../interfaces/Customer";
3
+ import { IOrderInfo } from "../../interfaces/Order";
4
+ import axiosInstance from "../axiosInstance";
5
+
6
+ const GET_SET_COMPANIES = 'api/company';
7
+ const REQUEST_PARAMS = {
8
+ token: 'LOGGED_USER_TOKEN',
9
+ };
10
+
11
+
12
+ export const getCompanyById = async function (this: WashdayClientInstance, companyId: string): Promise<any> {
13
+ try {
14
+ const config = {
15
+ headers: { Authorization: `Bearer ${this.apiToken}` }
16
+ };
17
+ const response = await axiosInstance.get(`${GET_SET_COMPANIES}/${companyId}`, config);
18
+ return response;
19
+ } catch (error) {
20
+ console.error('Error fetching getCompanyById:', error);
21
+ throw error;
22
+ }
23
+ };
File without changes
File without changes
package/src/api/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { WashdayClientInstance } from "../interfaces/Api";
2
+ import { getCompanyById } from "./companies/get";
2
3
  import { getCountries } from "./countries/get";
3
4
  import { getCustomerById, getCustomerHighlightsById } from "./customers/get";
4
5
  import { bulkUpdate } from "./products/put";
@@ -20,6 +21,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
20
21
  WashdayClient.prototype.products.apiToken = apiToken;
21
22
  WashdayClient.prototype.users.apiToken = apiToken;
22
23
  WashdayClient.prototype.countries.apiToken = apiToken;
24
+ WashdayClient.prototype.companies.apiToken = apiToken;
23
25
  } as any;
24
26
 
25
27
  WashdayClient.prototype.customers = {
@@ -48,4 +50,8 @@ WashdayClient.prototype.countries = {
48
50
  getCountries: getCountries,
49
51
  };
50
52
 
53
+ WashdayClient.prototype.companies = {
54
+ getCompanyById: getCompanyById,
55
+ };
56
+
51
57
  export default WashdayClient;