timber-node 0.0.1
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/README.md +0 -0
- package/dist/billPayment.d.ts +115 -0
- package/dist/billPayment.js +144 -0
- package/dist/customer.d.ts +93 -0
- package/dist/customer.js +82 -0
- package/dist/employee.d.ts +120 -0
- package/dist/employee.js +99 -0
- package/dist/expense.d.ts +116 -0
- package/dist/expense.js +105 -0
- package/dist/expenseCategory.d.ts +95 -0
- package/dist/expenseCategory.js +87 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +50 -0
- package/dist/invoice.d.ts +109 -0
- package/dist/invoice.js +100 -0
- package/dist/invoicePayment.d.ts +119 -0
- package/dist/invoicePayment.js +113 -0
- package/dist/rawExpense.d.ts +87 -0
- package/dist/rawExpense.js +76 -0
- package/dist/salary.d.ts +121 -0
- package/dist/salary.js +101 -0
- package/dist/taxRate.d.ts +36 -0
- package/dist/taxRate.js +26 -0
- package/dist/vendorPayment.d.ts +195 -0
- package/dist/vendorPayment.js +236 -0
- package/package.json +46 -0
package/README.md
ADDED
|
Binary file
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosResponse } from "axios";
|
|
2
|
+
export interface CreateBillPaymentRequest {
|
|
3
|
+
invoice: string;
|
|
4
|
+
date: string;
|
|
5
|
+
payment_method: "cash" | "bank" | "card" | "cheque" | "net_banking" | "other";
|
|
6
|
+
cheque_no?: string;
|
|
7
|
+
cheque_date?: string;
|
|
8
|
+
cheque_due_date?: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
bank_name?: string;
|
|
11
|
+
is_paid: boolean;
|
|
12
|
+
file: [File];
|
|
13
|
+
}
|
|
14
|
+
export type UpdateBillPaymentRequest = Partial<CreateBillPaymentRequest>;
|
|
15
|
+
export interface BillPayment {
|
|
16
|
+
_id: string;
|
|
17
|
+
company: string;
|
|
18
|
+
user: string;
|
|
19
|
+
zoho_payment_id?: string;
|
|
20
|
+
wafeq_payment_id?: string;
|
|
21
|
+
qb_payment_id?: string;
|
|
22
|
+
reconciled: boolean;
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at: string;
|
|
25
|
+
}
|
|
26
|
+
export interface BillPaymentQueryParams {
|
|
27
|
+
page: number;
|
|
28
|
+
limit: number;
|
|
29
|
+
sort: string;
|
|
30
|
+
filters: string;
|
|
31
|
+
invoice: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Service for Bill Payment
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
39
|
+
* const client = createClient('your-api-key');
|
|
40
|
+
* const billPayment = await client.billPayment.list({ page: 1, limit: 10 });
|
|
41
|
+
* console.log(billPayment.data);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare class BillPaymentService {
|
|
45
|
+
private http;
|
|
46
|
+
constructor(http: AxiosInstance);
|
|
47
|
+
/**
|
|
48
|
+
* Fetch a paginated list of bill payments.
|
|
49
|
+
*
|
|
50
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
51
|
+
* @returns List of bill payments matching the query.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const billPayments = await client.billPayment.list({ page: 1, limit: 5 });
|
|
56
|
+
* console.log(billPayments.data);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
list(params: BillPaymentQueryParams): Promise<AxiosResponse<BillPayment[]>>;
|
|
60
|
+
/**
|
|
61
|
+
* Create a new bill payment.
|
|
62
|
+
*
|
|
63
|
+
* @param data - Bill payment creation payload
|
|
64
|
+
* @returns The created bill payment
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const newBillPayment = {
|
|
69
|
+
* invoice: "INV-1234",
|
|
70
|
+
* date: "2025-06-23",
|
|
71
|
+
* payment_method: "cash",
|
|
72
|
+
* cheque_no: "123456789",
|
|
73
|
+
* cheque_date: "2025-06-23",
|
|
74
|
+
* cheque_due_date: "2025-06-23",
|
|
75
|
+
* amount: 45.75,
|
|
76
|
+
* bank_name: "Bank of America",
|
|
77
|
+
* is_paid: false,
|
|
78
|
+
* file: [File],
|
|
79
|
+
* };
|
|
80
|
+
* const response = await client.billPayment.create(newBillPayment);
|
|
81
|
+
* console.log(response.data);
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
create(data: CreateBillPaymentRequest): Promise<AxiosResponse<BillPayment>>;
|
|
85
|
+
/**
|
|
86
|
+
* Update an existing bill payment.
|
|
87
|
+
*
|
|
88
|
+
* @param id - Bill payment ID
|
|
89
|
+
* @param data - Partial update data
|
|
90
|
+
* @returns Updated bill payment
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* const updates = { amount: 50.0 };
|
|
95
|
+
* const updated = await client.billPayment.update('bill_payment_id_here', updates);
|
|
96
|
+
* console.log(updated.data);
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
update(id: string, data: CreateBillPaymentRequest): Promise<AxiosResponse<BillPayment>>;
|
|
100
|
+
/**
|
|
101
|
+
* Delete an bill payment by ID.
|
|
102
|
+
*
|
|
103
|
+
* @param id - Bill payment ID
|
|
104
|
+
* @returns Confirmation message
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const response = await client.billPayment.delete('bill_payment_id_here');
|
|
109
|
+
* console.log(response.data.message);
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
delete(id: string): Promise<AxiosResponse<{
|
|
113
|
+
message: string;
|
|
114
|
+
}>>;
|
|
115
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BillPaymentService = void 0;
|
|
7
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
8
|
+
/**
|
|
9
|
+
* Service for Bill Payment
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
14
|
+
* const client = createClient('your-api-key');
|
|
15
|
+
* const billPayment = await client.billPayment.list({ page: 1, limit: 10 });
|
|
16
|
+
* console.log(billPayment.data);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
class BillPaymentService {
|
|
20
|
+
constructor(http) {
|
|
21
|
+
this.http = http;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fetch a paginated list of bill payments.
|
|
25
|
+
*
|
|
26
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
27
|
+
* @returns List of bill payments matching the query.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const billPayments = await client.billPayment.list({ page: 1, limit: 5 });
|
|
32
|
+
* console.log(billPayments.data);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
async list(params) {
|
|
36
|
+
return await this.http.get("/customer/purchase/payment-record", {
|
|
37
|
+
params,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a new bill payment.
|
|
42
|
+
*
|
|
43
|
+
* @param data - Bill payment creation payload
|
|
44
|
+
* @returns The created bill payment
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const newBillPayment = {
|
|
49
|
+
* invoice: "INV-1234",
|
|
50
|
+
* date: "2025-06-23",
|
|
51
|
+
* payment_method: "cash",
|
|
52
|
+
* cheque_no: "123456789",
|
|
53
|
+
* cheque_date: "2025-06-23",
|
|
54
|
+
* cheque_due_date: "2025-06-23",
|
|
55
|
+
* amount: 45.75,
|
|
56
|
+
* bank_name: "Bank of America",
|
|
57
|
+
* is_paid: false,
|
|
58
|
+
* file: [File],
|
|
59
|
+
* };
|
|
60
|
+
* const response = await client.billPayment.create(newBillPayment);
|
|
61
|
+
* console.log(response.data);
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
async create(data) {
|
|
65
|
+
const formData = new form_data_1.default();
|
|
66
|
+
formData.append("invoice", data.invoice);
|
|
67
|
+
formData.append("date", data.date);
|
|
68
|
+
formData.append("payment_method", data.payment_method);
|
|
69
|
+
if (data.cheque_no) {
|
|
70
|
+
formData.append("cheque_no", data.cheque_no);
|
|
71
|
+
}
|
|
72
|
+
if (data.cheque_date) {
|
|
73
|
+
formData.append("cheque_date", data.cheque_date);
|
|
74
|
+
}
|
|
75
|
+
if (data.cheque_due_date) {
|
|
76
|
+
formData.append("cheque_due_date", data.cheque_due_date);
|
|
77
|
+
}
|
|
78
|
+
if (data.bank_name) {
|
|
79
|
+
formData.append("bank_name", data.bank_name);
|
|
80
|
+
}
|
|
81
|
+
formData.append("amount", data.amount.toString());
|
|
82
|
+
if (data.file) {
|
|
83
|
+
formData.append("file", data.file[0]);
|
|
84
|
+
}
|
|
85
|
+
return await this.http.post("/customer/purchase/payment-record", formData, {
|
|
86
|
+
headers: formData.getHeaders(),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Update an existing bill payment.
|
|
91
|
+
*
|
|
92
|
+
* @param id - Bill payment ID
|
|
93
|
+
* @param data - Partial update data
|
|
94
|
+
* @returns Updated bill payment
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const updates = { amount: 50.0 };
|
|
99
|
+
* const updated = await client.billPayment.update('bill_payment_id_here', updates);
|
|
100
|
+
* console.log(updated.data);
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
async update(id, data) {
|
|
104
|
+
const formData = new form_data_1.default();
|
|
105
|
+
formData.append("invoice", data.invoice);
|
|
106
|
+
formData.append("date", data.date);
|
|
107
|
+
formData.append("payment_method", data.payment_method);
|
|
108
|
+
if (data.cheque_no) {
|
|
109
|
+
formData.append("cheque_no", data.cheque_no);
|
|
110
|
+
}
|
|
111
|
+
if (data.cheque_date) {
|
|
112
|
+
formData.append("cheque_date", data.cheque_date);
|
|
113
|
+
}
|
|
114
|
+
if (data.cheque_due_date) {
|
|
115
|
+
formData.append("cheque_due_date", data.cheque_due_date);
|
|
116
|
+
}
|
|
117
|
+
if (data.bank_name) {
|
|
118
|
+
formData.append("bank_name", data.bank_name);
|
|
119
|
+
}
|
|
120
|
+
formData.append("amount", data.amount.toString());
|
|
121
|
+
if (data.file) {
|
|
122
|
+
formData.append("file", data.file[0]);
|
|
123
|
+
}
|
|
124
|
+
return await this.http.put(`/customer/purchase/payment-record/${id}`, formData, {
|
|
125
|
+
headers: formData.getHeaders(),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Delete an bill payment by ID.
|
|
130
|
+
*
|
|
131
|
+
* @param id - Bill payment ID
|
|
132
|
+
* @returns Confirmation message
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* const response = await client.billPayment.delete('bill_payment_id_here');
|
|
137
|
+
* console.log(response.data.message);
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
async delete(id) {
|
|
141
|
+
return await this.http.delete(`/customer/purchase/payment-record/${id}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.BillPaymentService = BillPaymentService;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosResponse } from "axios";
|
|
2
|
+
export interface CustomerData {
|
|
3
|
+
name: string;
|
|
4
|
+
email: number;
|
|
5
|
+
mobile?: string;
|
|
6
|
+
country_code?: string;
|
|
7
|
+
country?: string;
|
|
8
|
+
city: string;
|
|
9
|
+
role: 'customer' | 'vendor' | 'biller';
|
|
10
|
+
address: string;
|
|
11
|
+
trn?: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
export interface Customer extends CustomerData {
|
|
15
|
+
_id: string;
|
|
16
|
+
createdAt?: string;
|
|
17
|
+
updatedAt?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CustomerQueryParams {
|
|
20
|
+
page?: number;
|
|
21
|
+
limit?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Service for Customer
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
29
|
+
* const client = createClient('your-api-key');
|
|
30
|
+
* const customer = await client.customer.list({ page: 1, limit: 10 });
|
|
31
|
+
* console.log(customer.data);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class CustomerService {
|
|
35
|
+
private http;
|
|
36
|
+
constructor(http: AxiosInstance);
|
|
37
|
+
/**
|
|
38
|
+
* Fetch a paginated list of customers.
|
|
39
|
+
*
|
|
40
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
41
|
+
* @returns List of customers matching the query.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const customers = await client.customer.list({ page: 1, limit: 5 });
|
|
46
|
+
* console.log(customers.data);
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
list(params?: CustomerQueryParams): Promise<AxiosResponse<Customer[]>>;
|
|
50
|
+
/**
|
|
51
|
+
* Fetch a single customer by ID.
|
|
52
|
+
*
|
|
53
|
+
* @param id - Customer ID
|
|
54
|
+
* @returns Customer object
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const customer = await client.customer.get('customer_id_here');
|
|
59
|
+
* console.log(customer.data);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
create(data: CustomerData): Promise<AxiosResponse<Customer>>;
|
|
63
|
+
/**
|
|
64
|
+
* Update an existing customer.
|
|
65
|
+
*
|
|
66
|
+
* @param id - Customer ID
|
|
67
|
+
* @param data - Partial update data
|
|
68
|
+
* @returns Updated customer
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const updates = { name: "John Doe" };
|
|
73
|
+
* const updated = await client.customer.update('customer_id_here', updates);
|
|
74
|
+
* console.log(updated.data);
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
update(id: string, data: Partial<CustomerData>): Promise<AxiosResponse<Customer>>;
|
|
78
|
+
/**
|
|
79
|
+
* Delete an customer by ID.
|
|
80
|
+
*
|
|
81
|
+
* @param id - Customer ID
|
|
82
|
+
* @returns Confirmation message
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* const response = await client.customer.delete('customer_id_here');
|
|
87
|
+
* console.log(response.data.message);
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
delete(id: string): Promise<AxiosResponse<{
|
|
91
|
+
message: string;
|
|
92
|
+
}>>;
|
|
93
|
+
}
|
package/dist/customer.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Service for Customer
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
10
|
+
* const client = createClient('your-api-key');
|
|
11
|
+
* const customer = await client.customer.list({ page: 1, limit: 10 });
|
|
12
|
+
* console.log(customer.data);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
class CustomerService {
|
|
16
|
+
constructor(http) {
|
|
17
|
+
this.http = http;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Fetch a paginated list of customers.
|
|
21
|
+
*
|
|
22
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
23
|
+
* @returns List of customers matching the query.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const customers = await client.customer.list({ page: 1, limit: 5 });
|
|
28
|
+
* console.log(customers.data);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
async list(params = {}) {
|
|
32
|
+
return await this.http.get("/customer/customer", { params });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Fetch a single customer by ID.
|
|
36
|
+
*
|
|
37
|
+
* @param id - Customer ID
|
|
38
|
+
* @returns Customer object
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const customer = await client.customer.get('customer_id_here');
|
|
43
|
+
* console.log(customer.data);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
async create(data) {
|
|
47
|
+
return await this.http.post("/customer/customer", data);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Update an existing customer.
|
|
51
|
+
*
|
|
52
|
+
* @param id - Customer ID
|
|
53
|
+
* @param data - Partial update data
|
|
54
|
+
* @returns Updated customer
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const updates = { name: "John Doe" };
|
|
59
|
+
* const updated = await client.customer.update('customer_id_here', updates);
|
|
60
|
+
* console.log(updated.data);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
async update(id, data) {
|
|
64
|
+
return await this.http.put(`/customer/customer/${id}`, data);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Delete an customer by ID.
|
|
68
|
+
*
|
|
69
|
+
* @param id - Customer ID
|
|
70
|
+
* @returns Confirmation message
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const response = await client.customer.delete('customer_id_here');
|
|
75
|
+
* console.log(response.data.message);
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
async delete(id) {
|
|
79
|
+
return await this.http.delete(`/customer/customer/${id}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.CustomerService = CustomerService;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosResponse } from "axios";
|
|
2
|
+
export interface CreateEmployeeRequest {
|
|
3
|
+
employee_id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
designation: string;
|
|
6
|
+
mobile: string;
|
|
7
|
+
country_code: string;
|
|
8
|
+
basic_salary: number;
|
|
9
|
+
allowance: number;
|
|
10
|
+
joining_date: string;
|
|
11
|
+
is_active: boolean;
|
|
12
|
+
}
|
|
13
|
+
export type UpdateEmployeeRequest = Partial<CreateEmployeeRequest>;
|
|
14
|
+
export interface Employee {
|
|
15
|
+
_id: string;
|
|
16
|
+
company: string;
|
|
17
|
+
user: string;
|
|
18
|
+
created_at: string;
|
|
19
|
+
updated_at: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Service for Employee
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
27
|
+
* const client = createClient('your-api-key');
|
|
28
|
+
* const employee = await client.employee.list({ page: 1, limit: 10 });
|
|
29
|
+
* console.log(employee.data);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export interface EmployeeQueryParams {
|
|
33
|
+
page: number;
|
|
34
|
+
limit: number;
|
|
35
|
+
sort: string;
|
|
36
|
+
}
|
|
37
|
+
export declare class EmployeeService {
|
|
38
|
+
private http;
|
|
39
|
+
constructor(http: AxiosInstance);
|
|
40
|
+
/**
|
|
41
|
+
* Fetch a paginated list of employees.
|
|
42
|
+
*
|
|
43
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
44
|
+
* @returns List of employees matching the query.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const employees = await client.employee.list({ page: 1, limit: 5 });
|
|
49
|
+
* console.log(employees.data);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
list(params: EmployeeQueryParams): Promise<AxiosResponse<Employee[]>>;
|
|
53
|
+
/**
|
|
54
|
+
* Create a new employee.
|
|
55
|
+
*
|
|
56
|
+
* @param data - Employee creation payload
|
|
57
|
+
* @returns The created employee
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const newEmployee = {
|
|
62
|
+
* employee_id: "123456789",
|
|
63
|
+
* name: "John Doe",
|
|
64
|
+
* designation: "CEO",
|
|
65
|
+
* mobile: "1234567890",
|
|
66
|
+
* country_code: "+1",
|
|
67
|
+
* basic_salary: 50000,
|
|
68
|
+
* allowance: 10000,
|
|
69
|
+
* joining_date: "2025-06-23",
|
|
70
|
+
* is_active: true,
|
|
71
|
+
* };
|
|
72
|
+
* const response = await client.employee.create(newEmployee);
|
|
73
|
+
* console.log(response.data);
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
create(data: CreateEmployeeRequest): Promise<AxiosResponse<Employee>>;
|
|
77
|
+
/**
|
|
78
|
+
* Fetch an employee by ID.
|
|
79
|
+
*
|
|
80
|
+
* @param id - Employee ID
|
|
81
|
+
* @returns Employee object
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const employee = await client.employee.get('employee_id_here');
|
|
86
|
+
* console.log(employee.data);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
get(id: string): Promise<AxiosResponse<Employee>>;
|
|
90
|
+
/**
|
|
91
|
+
* Update an existing employee.
|
|
92
|
+
*
|
|
93
|
+
* @param id - Employee ID
|
|
94
|
+
* @param data - Partial update data
|
|
95
|
+
* @returns Updated employee
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const updates = { basic_salary: 60000 };
|
|
100
|
+
* const updated = await client.employee.update('employee_id_here', updates);
|
|
101
|
+
* console.log(updated.data);
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
update(id: string, data: CreateEmployeeRequest): Promise<AxiosResponse<Employee>>;
|
|
105
|
+
/**
|
|
106
|
+
* Delete an employee by ID.
|
|
107
|
+
*
|
|
108
|
+
* @param id - Employee ID
|
|
109
|
+
* @returns Confirmation message
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* const response = await client.employee.delete('employee_id_here');
|
|
114
|
+
* console.log(response.data.message);
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
delete(id: string): Promise<AxiosResponse<{
|
|
118
|
+
message: string;
|
|
119
|
+
}>>;
|
|
120
|
+
}
|
package/dist/employee.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmployeeService = void 0;
|
|
4
|
+
class EmployeeService {
|
|
5
|
+
constructor(http) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Fetch a paginated list of employees.
|
|
10
|
+
*
|
|
11
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
12
|
+
* @returns List of employees matching the query.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const employees = await client.employee.list({ page: 1, limit: 5 });
|
|
17
|
+
* console.log(employees.data);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
async list(params) {
|
|
21
|
+
return await this.http.get("/customer/employee", {
|
|
22
|
+
params,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create a new employee.
|
|
27
|
+
*
|
|
28
|
+
* @param data - Employee creation payload
|
|
29
|
+
* @returns The created employee
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const newEmployee = {
|
|
34
|
+
* employee_id: "123456789",
|
|
35
|
+
* name: "John Doe",
|
|
36
|
+
* designation: "CEO",
|
|
37
|
+
* mobile: "1234567890",
|
|
38
|
+
* country_code: "+1",
|
|
39
|
+
* basic_salary: 50000,
|
|
40
|
+
* allowance: 10000,
|
|
41
|
+
* joining_date: "2025-06-23",
|
|
42
|
+
* is_active: true,
|
|
43
|
+
* };
|
|
44
|
+
* const response = await client.employee.create(newEmployee);
|
|
45
|
+
* console.log(response.data);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
async create(data) {
|
|
49
|
+
return await this.http.post("/customer/employee", data);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Fetch an employee by ID.
|
|
53
|
+
*
|
|
54
|
+
* @param id - Employee ID
|
|
55
|
+
* @returns Employee object
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const employee = await client.employee.get('employee_id_here');
|
|
60
|
+
* console.log(employee.data);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
async get(id) {
|
|
64
|
+
return await this.http.get(`/customer/employee/${id}`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Update an existing employee.
|
|
68
|
+
*
|
|
69
|
+
* @param id - Employee ID
|
|
70
|
+
* @param data - Partial update data
|
|
71
|
+
* @returns Updated employee
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const updates = { basic_salary: 60000 };
|
|
76
|
+
* const updated = await client.employee.update('employee_id_here', updates);
|
|
77
|
+
* console.log(updated.data);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
async update(id, data) {
|
|
81
|
+
return await this.http.put(`/customer/employee/${id}`, data);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Delete an employee by ID.
|
|
85
|
+
*
|
|
86
|
+
* @param id - Employee ID
|
|
87
|
+
* @returns Confirmation message
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const response = await client.employee.delete('employee_id_here');
|
|
92
|
+
* console.log(response.data.message);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
async delete(id) {
|
|
96
|
+
return await this.http.delete(`/customer/employee/${id}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.EmployeeService = EmployeeService;
|