washday-sdk 0.0.131 → 0.0.132
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/csv/get.js +27 -0
- package/dist/api/index.js +7 -1
- package/dist/api/reports/get.js +52 -0
- package/dist/api/reports/index.js +1 -0
- package/package.json +1 -1
- package/src/api/csv/get.ts +29 -0
- package/src/api/index.ts +7 -1
- package/src/api/reports/get.ts +52 -0
- package/src/api/reports/index.ts +1 -0
- package/src/interfaces/Api.ts +5 -0
package/dist/api/csv/get.js
CHANGED
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
11
|
import axiosInstance from "../axiosInstance";
|
|
12
12
|
const GENERATE_EXPORT = 'api/export';
|
|
13
|
+
const GET_SET_REPORTS = 'api/reports';
|
|
13
14
|
export const exportCustomersList = function (params) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
try {
|
|
@@ -91,3 +92,29 @@ export const exportProductsList = function (storeId) {
|
|
|
91
92
|
}
|
|
92
93
|
});
|
|
93
94
|
};
|
|
95
|
+
export const exportCleanedOrdersReport = function (storeId, params) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
try {
|
|
98
|
+
const config = {
|
|
99
|
+
headers: {
|
|
100
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
101
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
102
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
103
|
+
},
|
|
104
|
+
params: {
|
|
105
|
+
responseType: 'blob'
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const queryParams = generateQueryParamsStr([
|
|
109
|
+
'fromDate',
|
|
110
|
+
'toDate',
|
|
111
|
+
'timezone'
|
|
112
|
+
], params);
|
|
113
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders/export?${queryParams}`, config);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('Error fetching exportOrdersList:', error);
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
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 pdfExportEndpoints from './pdf';
|
|
31
|
+
import * as reportsExportEndpoints from './reports';
|
|
31
32
|
import * as ordersEndpoints from './order';
|
|
32
33
|
import * as authEndpoints from './auth';
|
|
33
34
|
import * as routesEndpoints from './routes';
|
|
@@ -219,10 +220,15 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
219
220
|
this.csv = bindMethods(this, {
|
|
220
221
|
exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
|
|
221
222
|
exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
|
|
222
|
-
exportProductsList: csvExportEndpoints.getModule.exportProductsList
|
|
223
|
+
exportProductsList: csvExportEndpoints.getModule.exportProductsList,
|
|
224
|
+
exportCleanedOrdersReport: csvExportEndpoints.getModule.exportCleanedOrdersReport
|
|
223
225
|
});
|
|
224
226
|
this.pdf = bindMethods(this, {
|
|
225
227
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
226
228
|
});
|
|
229
|
+
this.reports = bindMethods(this, {
|
|
230
|
+
getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
|
|
231
|
+
getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport
|
|
232
|
+
});
|
|
227
233
|
};
|
|
228
234
|
export default WashdayClient;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
|
+
import axiosInstance from "../axiosInstance";
|
|
12
|
+
const GET_SET_REPORTS = 'api/reports';
|
|
13
|
+
export const getCleanedOrdersReport = 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([
|
|
20
|
+
'toDate',
|
|
21
|
+
'fromDate',
|
|
22
|
+
'pageNum',
|
|
23
|
+
'limit',
|
|
24
|
+
'includeGraph',
|
|
25
|
+
], params);
|
|
26
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders?${queryParams}`, config);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('Error fetching getCleanedOrdersReport:', error);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const getCleanedOrdersGraphDataReport = function (storeId, params) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
const config = {
|
|
38
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
39
|
+
};
|
|
40
|
+
const queryParams = generateQueryParamsStr([
|
|
41
|
+
'toDate',
|
|
42
|
+
'fromDate',
|
|
43
|
+
'timezone',
|
|
44
|
+
], params);
|
|
45
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders-graph?${queryParams}`, config);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error('Error fetching getCleanedOrdersGraphDataReport :', error);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as getModule from './get';
|
package/package.json
CHANGED
package/src/api/csv/get.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
|
3
3
|
import axiosInstance from "../axiosInstance";
|
|
4
4
|
|
|
5
5
|
const GENERATE_EXPORT = 'api/export';
|
|
6
|
+
const GET_SET_REPORTS = 'api/reports';
|
|
6
7
|
|
|
7
8
|
export const exportCustomersList = async function (this: WashdayClientInstance, params: {
|
|
8
9
|
searchTerm?: string
|
|
@@ -102,4 +103,32 @@ export const exportProductsList = async function (this: WashdayClientInstance, s
|
|
|
102
103
|
console.error('Error fetching exportProductsList:', error);
|
|
103
104
|
throw error;
|
|
104
105
|
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const exportCleanedOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
109
|
+
fromDate?: string
|
|
110
|
+
toDate?: string
|
|
111
|
+
timezone?: string
|
|
112
|
+
}): Promise<any> {
|
|
113
|
+
try {
|
|
114
|
+
const config = {
|
|
115
|
+
headers: {
|
|
116
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
117
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
118
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
119
|
+
},
|
|
120
|
+
params: {
|
|
121
|
+
responseType: 'blob'
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const queryParams = generateQueryParamsStr([
|
|
125
|
+
'fromDate',
|
|
126
|
+
'toDate',
|
|
127
|
+
'timezone'
|
|
128
|
+
], params);
|
|
129
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders/export?${queryParams}`, config);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error('Error fetching exportOrdersList:', error);
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
105
134
|
};
|
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 pdfExportEndpoints from './pdf';
|
|
32
|
+
import * as reportsExportEndpoints from './reports';
|
|
32
33
|
import * as ordersEndpoints from './order';
|
|
33
34
|
import * as authEndpoints from './auth';
|
|
34
35
|
import * as routesEndpoints from './routes';
|
|
@@ -225,11 +226,16 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
225
226
|
this.csv = bindMethods(this, {
|
|
226
227
|
exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
|
|
227
228
|
exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
|
|
228
|
-
exportProductsList: csvExportEndpoints.getModule.exportProductsList
|
|
229
|
+
exportProductsList: csvExportEndpoints.getModule.exportProductsList,
|
|
230
|
+
exportCleanedOrdersReport: csvExportEndpoints.getModule.exportCleanedOrdersReport
|
|
229
231
|
});
|
|
230
232
|
this.pdf = bindMethods(this, {
|
|
231
233
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
232
234
|
});
|
|
235
|
+
this.reports = bindMethods(this, {
|
|
236
|
+
getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
|
|
237
|
+
getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport
|
|
238
|
+
});
|
|
233
239
|
} as any;
|
|
234
240
|
|
|
235
241
|
export default WashdayClient;
|
|
@@ -0,0 +1,52 @@
|
|
|
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_REPORTS = 'api/reports';
|
|
6
|
+
|
|
7
|
+
export const getCleanedOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
8
|
+
fromDate?: string
|
|
9
|
+
toDate?: string
|
|
10
|
+
timezone?: string
|
|
11
|
+
pageNum?: string
|
|
12
|
+
limit?: string
|
|
13
|
+
}): Promise<any> {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
const queryParams = generateQueryParamsStr([
|
|
19
|
+
'toDate',
|
|
20
|
+
'fromDate',
|
|
21
|
+
'pageNum',
|
|
22
|
+
'limit',
|
|
23
|
+
'includeGraph',
|
|
24
|
+
], params);
|
|
25
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders?${queryParams}`, config);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error('Error fetching getCleanedOrdersReport:', error);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getCleanedOrdersGraphDataReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
33
|
+
fromDate?: string
|
|
34
|
+
toDate?: string
|
|
35
|
+
timezone?: string
|
|
36
|
+
}): Promise<any> {
|
|
37
|
+
try {
|
|
38
|
+
const config = {
|
|
39
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
40
|
+
};
|
|
41
|
+
const queryParams = generateQueryParamsStr([
|
|
42
|
+
'toDate',
|
|
43
|
+
'fromDate',
|
|
44
|
+
'timezone',
|
|
45
|
+
], params);
|
|
46
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders-graph?${queryParams}`, config);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error('Error fetching getCleanedOrdersGraphDataReport :', error);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as getModule from './get';
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -28,6 +28,7 @@ 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 pdfExportEndpoints from '../api/pdf';
|
|
31
|
+
import * as reportsExportEndpoints from '../api/reports';
|
|
31
32
|
import * as ordersEndpoints from '../api/order';
|
|
32
33
|
import * as routesEndpoints from '../api/routes';
|
|
33
34
|
import * as reviewsEndpoints from '../api/reviews';
|
|
@@ -214,4 +215,8 @@ export interface WashdayClientInstance {
|
|
|
214
215
|
pdf: {
|
|
215
216
|
exportUnpaidOrdersReportPDF: typeof pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF;
|
|
216
217
|
};
|
|
218
|
+
reports: {
|
|
219
|
+
getCleanedOrdersReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersReport;
|
|
220
|
+
getCleanedOrdersGraphDataReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport;
|
|
221
|
+
};
|
|
217
222
|
}
|