washday-sdk 0.0.75 → 0.0.76

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
@@ -28,6 +28,7 @@ import * as productsEndpoints from './products';
28
28
  import * as customersEndpoints from './customers';
29
29
  import * as csvExportEndpoints from './csv';
30
30
  import * as ordersEndpoints from './order';
31
+ import * as reviewsEndpoints from './reviews';
31
32
  function bindMethods(instance, methods) {
32
33
  const boundMethods = {};
33
34
  for (const key in methods) {
@@ -39,6 +40,9 @@ function bindMethods(instance, methods) {
39
40
  }
40
41
  const WashdayClient = function WashdayClient(apiToken) {
41
42
  this.apiToken = apiToken;
43
+ this.review = bindMethods(this, {
44
+ requestStoreReviewByCustomerId: reviewsEndpoints.getModule.requestStoreReviewByCustomerId,
45
+ });
42
46
  this.orders = bindMethods(this, {
43
47
  getList: ordersEndpoints.getModule.getList,
44
48
  getById: ordersEndpoints.getModule.getById,
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // import { WashdayClientInstance } from "../../interfaces/Api";
3
+ // import axiosInstance from "../axiosInstance";
4
+ // const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
5
+ // export const deletePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string): Promise<any> {
6
+ // try {
7
+ // const config = {
8
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ // };
10
+ // return await axiosInstance.delete(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, config);
11
+ // } catch (error) {
12
+ // console.error('Error fetching deleteById:', error);
13
+ // throw error;
14
+ // }
15
+ // };
@@ -0,0 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_SET_REVIEWS = 'api/review';
12
+ export const requestStoreReviewByCustomerId = function (storeId, customerId) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.get(`${GET_SET_REVIEWS}/${storeId}/${customerId}`, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
@@ -0,0 +1,4 @@
1
+ // export * as deleteModule from './delete';
2
+ export * as getModule from './get';
3
+ // export * as postModule from './post';
4
+ // export * as putModule from './put';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // import { WashdayClientInstance } from "../../interfaces/Api";
3
+ // import axiosInstance from "../axiosInstance";
4
+ // const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
5
+ // export const createPaymentLine = async function (this: WashdayClientInstance, id: string, data: {
6
+ // amountPaid: number,
7
+ // cashierBox: string,
8
+ // paymentMethod: string
9
+ // paymentDate: Date
10
+ // }): Promise<any> {
11
+ // try {
12
+ // const config = {
13
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
14
+ // };
15
+ // return await axiosInstance.post(`${GET_SET_ORDER_PAYMENTLINES(id)}`, data, config);
16
+ // } catch (error) {
17
+ // console.error('Error fetching create:', error);
18
+ // throw error;
19
+ // }
20
+ // };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ // import { WashdayClientInstance } from "../../interfaces/Api";
3
+ // import axiosInstance from "../axiosInstance";
4
+ // const GET_SET_ORDER = 'api/v2/order';
5
+ // const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
6
+ // export const updateById = async function (this: WashdayClientInstance, id: string, data: {
7
+ // status?: string,
8
+ // products?: any[],
9
+ // buyAndGetProducts?: any[],
10
+ // customer?: string,
11
+ // discountCode?: string | null,
12
+ // notes?: string,
13
+ // privateNotes?: string,
14
+ // delivery?: boolean,
15
+ // pickup?: boolean,
16
+ // express?: boolean,
17
+ // deliveryInfo?: {
18
+ // date: Date,
19
+ // fromTime: string,
20
+ // toTime?: string
21
+ // },
22
+ // pickupInfo?: {
23
+ // date: Date,
24
+ // fromTime: string,
25
+ // toTime?: string
26
+ // },
27
+ // notifyBy?: string,
28
+ // }): Promise<any> {
29
+ // try {
30
+ // const config = {
31
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
32
+ // };
33
+ // return await axiosInstance.put(`${GET_SET_ORDER}/${id}`, data, config);
34
+ // } catch (error) {
35
+ // console.error('Error fetching updateById:', error);
36
+ // throw error;
37
+ // }
38
+ // };
39
+ // export const updatePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string, data: {
40
+ // amountPaid: number
41
+ // updatedDate: Date
42
+ // }): Promise<any> {
43
+ // try {
44
+ // const config = {
45
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
46
+ // };
47
+ // return await axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
48
+ // } catch (error) {
49
+ // console.error('Error fetching updateById:', error);
50
+ // throw error;
51
+ // }
52
+ // };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.75",
3
+ "version": "0.0.76",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -29,6 +29,7 @@ import * as productsEndpoints from './products';
29
29
  import * as customersEndpoints from './customers';
30
30
  import * as csvExportEndpoints from './csv';
31
31
  import * as ordersEndpoints from './order';
32
+ import * as reviewsEndpoints from './reviews';
32
33
 
33
34
  type WashdayClientConstructor = {
34
35
  new(apiToken: string): WashdayClientInstance
@@ -45,6 +46,9 @@ function bindMethods<T>(instance: any, methods: any): T {
45
46
 
46
47
  const WashdayClient: WashdayClientConstructor = function WashdayClient(this: WashdayClientInstance, apiToken: string) {
47
48
  this.apiToken = apiToken;
49
+ this.review = bindMethods(this, {
50
+ requestStoreReviewByCustomerId: reviewsEndpoints.getModule.requestStoreReviewByCustomerId,
51
+ });
48
52
  this.orders = bindMethods(this, {
49
53
  getList: ordersEndpoints.getModule.getList,
50
54
  getById: ordersEndpoints.getModule.getById,
@@ -0,0 +1,15 @@
1
+ // import { WashdayClientInstance } from "../../interfaces/Api";
2
+ // import axiosInstance from "../axiosInstance";
3
+ // const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
4
+
5
+ // export const deletePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string): Promise<any> {
6
+ // try {
7
+ // const config = {
8
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ // };
10
+ // return await axiosInstance.delete(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, config);
11
+ // } catch (error) {
12
+ // console.error('Error fetching deleteById:', error);
13
+ // throw error;
14
+ // }
15
+ // };
@@ -0,0 +1,17 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { IOrder } from "../../interfaces/Order";
3
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
4
+ import axiosInstance from "../axiosInstance";
5
+ const GET_SET_REVIEWS = 'api/review';
6
+
7
+ export const requestStoreReviewByCustomerId = async function (this: WashdayClientInstance, storeId: string, customerId: string): Promise<any> {
8
+ try {
9
+ const config = {
10
+ headers: { Authorization: `Bearer ${this.apiToken}` }
11
+ };
12
+ return await axiosInstance.get(`${GET_SET_REVIEWS}/${storeId}/${customerId}`, config);
13
+ } catch (error) {
14
+ console.error('Error fetching:', error);
15
+ throw error;
16
+ }
17
+ }
@@ -0,0 +1,4 @@
1
+ // export * as deleteModule from './delete';
2
+ export * as getModule from './get';
3
+ // export * as postModule from './post';
4
+ // export * as putModule from './put';
@@ -0,0 +1,20 @@
1
+ // import { WashdayClientInstance } from "../../interfaces/Api";
2
+ // import axiosInstance from "../axiosInstance";
3
+ // const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
4
+
5
+ // export const createPaymentLine = async function (this: WashdayClientInstance, id: string, data: {
6
+ // amountPaid: number,
7
+ // cashierBox: string,
8
+ // paymentMethod: string
9
+ // paymentDate: Date
10
+ // }): Promise<any> {
11
+ // try {
12
+ // const config = {
13
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
14
+ // };
15
+ // return await axiosInstance.post(`${GET_SET_ORDER_PAYMENTLINES(id)}`, data, config);
16
+ // } catch (error) {
17
+ // console.error('Error fetching create:', error);
18
+ // throw error;
19
+ // }
20
+ // };
@@ -0,0 +1,53 @@
1
+ // import { WashdayClientInstance } from "../../interfaces/Api";
2
+ // import axiosInstance from "../axiosInstance";
3
+ // const GET_SET_ORDER = 'api/v2/order';
4
+ // const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
5
+
6
+ // export const updateById = async function (this: WashdayClientInstance, id: string, data: {
7
+ // status?: string,
8
+ // products?: any[],
9
+ // buyAndGetProducts?: any[],
10
+ // customer?: string,
11
+ // discountCode?: string | null,
12
+ // notes?: string,
13
+ // privateNotes?: string,
14
+ // delivery?: boolean,
15
+ // pickup?: boolean,
16
+ // express?: boolean,
17
+ // deliveryInfo?: {
18
+ // date: Date,
19
+ // fromTime: string,
20
+ // toTime?: string
21
+ // },
22
+ // pickupInfo?: {
23
+ // date: Date,
24
+ // fromTime: string,
25
+ // toTime?: string
26
+ // },
27
+ // notifyBy?: string,
28
+ // }): Promise<any> {
29
+ // try {
30
+ // const config = {
31
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
32
+ // };
33
+ // return await axiosInstance.put(`${GET_SET_ORDER}/${id}`, data, config);
34
+ // } catch (error) {
35
+ // console.error('Error fetching updateById:', error);
36
+ // throw error;
37
+ // }
38
+ // };
39
+
40
+ // export const updatePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string, data: {
41
+ // amountPaid: number
42
+ // updatedDate: Date
43
+ // }): Promise<any> {
44
+ // try {
45
+ // const config = {
46
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
47
+ // };
48
+ // return await axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
49
+ // } catch (error) {
50
+ // console.error('Error fetching updateById:', error);
51
+ // throw error;
52
+ // }
53
+ // };
@@ -28,9 +28,13 @@ import * as productsEndpoints from '../api/products';
28
28
  import * as customersEndpoints from '../api/customers';
29
29
  import * as csvExportEndpoints from '../api/csv';
30
30
  import * as ordersEndpoints from '../api/order';
31
+ import * as reviewsEndpoints from '../api/reviews';
31
32
 
32
33
  export interface WashdayClientInstance {
33
34
  apiToken: string;
35
+ review: {
36
+ requestStoreReviewByCustomerId: typeof reviewsEndpoints.getModule.requestStoreReviewByCustomerId;
37
+ }
34
38
  orders: {
35
39
  getList: typeof ordersEndpoints.getModule.getList;
36
40
  getById: typeof ordersEndpoints.getModule.getById;