washday-sdk 0.0.85 → 0.0.86

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/dist/api/index.js CHANGED
@@ -46,6 +46,7 @@ const WashdayClient = function WashdayClient(apiToken) {
46
46
  createCFDI: cfdiEndpoints.postModule.createCFDI,
47
47
  });
48
48
  this.review = bindMethods(this, {
49
+ getList: reviewsEndpoints.getModule.getList,
49
50
  requestStoreReviewByCustomerId: reviewsEndpoints.getModule.requestStoreReviewByCustomerId,
50
51
  });
51
52
  this.orders = bindMethods(this, {
@@ -7,8 +7,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
10
11
  import axiosInstance from "../axiosInstance";
11
12
  const GET_SET_REVIEWS = 'api/review';
13
+ export const getList = function (storeId, params) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ try {
16
+ const config = {
17
+ headers: { Authorization: `Bearer ${this.apiToken}` }
18
+ };
19
+ const queryParams = generateQueryParamsStr(['sortBy'], params);
20
+ return yield axiosInstance.get(`${GET_SET_REVIEWS}/${storeId}?${queryParams}`, config);
21
+ }
22
+ catch (error) {
23
+ console.error('Error fetching:', error);
24
+ throw error;
25
+ }
26
+ });
27
+ };
12
28
  export const requestStoreReviewByCustomerId = function (storeId, customerId) {
13
29
  return __awaiter(this, void 0, void 0, function* () {
14
30
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.85",
3
+ "version": "0.0.86",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -54,6 +54,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
54
54
  createCFDI: cfdiEndpoints.postModule.createCFDI,
55
55
  });
56
56
  this.review = bindMethods(this, {
57
+ getList: reviewsEndpoints.getModule.getList,
57
58
  requestStoreReviewByCustomerId: reviewsEndpoints.getModule.requestStoreReviewByCustomerId,
58
59
  });
59
60
  this.orders = bindMethods(this, {
@@ -4,6 +4,20 @@ import { generateQueryParamsStr } from "../../utils/apiUtils";
4
4
  import axiosInstance from "../axiosInstance";
5
5
  const GET_SET_REVIEWS = 'api/review';
6
6
 
7
+ export const getList = async function (this: WashdayClientInstance, storeId: string, params: { sortBy: 'desc' | 'asc' | -1 | 1 }): Promise<any> {
8
+ try {
9
+ const config = {
10
+ headers: { Authorization: `Bearer ${this.apiToken}` }
11
+ };
12
+ const queryParams = generateQueryParamsStr(['sortBy'], params);
13
+
14
+ return await axiosInstance.get(`${GET_SET_REVIEWS}/${storeId}?${queryParams}`, config);
15
+ } catch (error) {
16
+ console.error('Error fetching:', error);
17
+ throw error;
18
+ }
19
+ }
20
+
7
21
  export const requestStoreReviewByCustomerId = async function (this: WashdayClientInstance, storeId: string, customerId: string): Promise<any> {
8
22
  try {
9
23
  const config = {
@@ -38,6 +38,7 @@ export interface WashdayClientInstance {
38
38
  createCFDI: typeof cfdiEndpoints.postModule.createCFDI
39
39
  }
40
40
  review: {
41
+ getList: typeof reviewsEndpoints.getModule.getList;
41
42
  requestStoreReviewByCustomerId: typeof reviewsEndpoints.getModule.requestStoreReviewByCustomerId;
42
43
  }
43
44
  orders: {