washday-sdk 0.0.62 → 0.0.63

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.
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getCashierboxesById = exports.getCashierboxesByStoreId = void 0;
15
+ exports.getCashierBoxMovementsHistory = exports.getCashierboxesById = exports.getCashierboxesByStoreId = void 0;
16
16
  const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
17
  const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
18
18
  const getCashierboxesByStoreId = function (storeId, queryParams) {
@@ -47,3 +47,26 @@ const getCashierboxesById = function (storeId, id, queryParams) {
47
47
  });
48
48
  };
49
49
  exports.getCashierboxesById = getCashierboxesById;
50
+ const getCashierBoxMovementsHistory = function (storeId, id, params) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ try {
53
+ const config = {
54
+ headers: { Authorization: `Bearer ${this.apiToken}` }
55
+ };
56
+ let queryParams = '';
57
+ if (params === null || params === void 0 ? void 0 : params.hasOwnProperty('pageNum')) {
58
+ queryParams += `pageNum=${params === null || params === void 0 ? void 0 : params.pageNum}`;
59
+ }
60
+ if (params === null || params === void 0 ? void 0 : params.hasOwnProperty('limit')) {
61
+ queryParams += `&limit=${params === null || params === void 0 ? void 0 : params.limit}`;
62
+ }
63
+ const response = yield axiosInstance_1.default.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}/history?${queryParams}`, config);
64
+ return response;
65
+ }
66
+ catch (error) {
67
+ console.error('Error fetching getCashierboxesById:', error);
68
+ throw error;
69
+ }
70
+ });
71
+ };
72
+ exports.getCashierBoxMovementsHistory = getCashierBoxMovementsHistory;
package/dist/api/index.js CHANGED
@@ -67,6 +67,7 @@ WashdayClient.prototype.countries = {
67
67
  WashdayClient.prototype.cashierboxes = {
68
68
  getCashierboxesByStoreId: get_1.getCashierboxesByStoreId,
69
69
  getCashierboxesById: get_1.getCashierboxesById,
70
+ getCashierBoxMovementsHistory: get_1.getCashierBoxMovementsHistory,
70
71
  createCashierBox: post_1.createCashierBox,
71
72
  updateCashierBoxById: put_1.updateCashierBoxById,
72
73
  deleteCashierBoxById: delete_1.deleteCashierBoxById,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.62",
3
+ "version": "0.0.63",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -16,7 +16,6 @@ export const getCashierboxesByStoreId = async function (this: WashdayClientInsta
16
16
  }
17
17
  };
18
18
 
19
-
20
19
  export const getCashierboxesById = async function (this: WashdayClientInstance, storeId: string, id: string, queryParams?: string): Promise<any> {
21
20
  try {
22
21
  const config = {
@@ -29,3 +28,26 @@ export const getCashierboxesById = async function (this: WashdayClientInstance,
29
28
  throw error;
30
29
  }
31
30
  };
31
+
32
+ export const getCashierBoxMovementsHistory = async function (this: WashdayClientInstance, storeId: string, id: string, params?: {
33
+ pageNum: number;
34
+ limit: number
35
+ }): Promise<any> {
36
+ try {
37
+ const config = {
38
+ headers: { Authorization: `Bearer ${this.apiToken}` }
39
+ };
40
+ let queryParams = '';
41
+ if (params?.hasOwnProperty('pageNum')) {
42
+ queryParams += `pageNum=${params?.pageNum}`
43
+ }
44
+ if (params?.hasOwnProperty('limit')) {
45
+ queryParams += `&limit=${params?.limit}`
46
+ }
47
+ const response = await axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}/history?${queryParams}`, config);
48
+ return response;
49
+ } catch (error) {
50
+ console.error('Error fetching getCashierboxesById:', error);
51
+ throw error;
52
+ }
53
+ };
package/src/api/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { WashdayClientInstance } from "../interfaces/Api";
2
2
  import { deleteCashierBoxById } from "./cashierbox/delete";
3
- import { getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
3
+ import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
4
4
  import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
5
5
  import { updateCashierBoxById } from "./cashierbox/put";
6
6
  import { getCompanyById } from "./companies/get";
@@ -81,6 +81,7 @@ WashdayClient.prototype.countries = {
81
81
  WashdayClient.prototype.cashierboxes = {
82
82
  getCashierboxesByStoreId: getCashierboxesByStoreId,
83
83
  getCashierboxesById: getCashierboxesById,
84
+ getCashierBoxMovementsHistory: getCashierBoxMovementsHistory,
84
85
  createCashierBox: createCashierBox,
85
86
  updateCashierBoxById: updateCashierBoxById,
86
87
  deleteCashierBoxById: deleteCashierBoxById,