bukku-client 0.1.0-test.0
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/LICENSE +674 -0
- package/README.md +85 -0
- package/dist/accounting/accounts/index.d.ts +52 -0
- package/dist/accounting/accounts/index.d.ts.map +1 -0
- package/dist/accounting/accounts/index.js +72 -0
- package/dist/accounting/accounts/index.js.map +1 -0
- package/dist/accounting/accounts/type.d.ts +125 -0
- package/dist/accounting/accounts/type.d.ts.map +1 -0
- package/dist/accounting/accounts/type.js +4 -0
- package/dist/accounting/accounts/type.js.map +1 -0
- package/dist/accounting/index.d.ts +10 -0
- package/dist/accounting/index.d.ts.map +1 -0
- package/dist/accounting/index.js +16 -0
- package/dist/accounting/index.js.map +1 -0
- package/dist/accounting/journal-entries/index.d.ts +52 -0
- package/dist/accounting/journal-entries/index.d.ts.map +1 -0
- package/dist/accounting/journal-entries/index.js +72 -0
- package/dist/accounting/journal-entries/index.js.map +1 -0
- package/dist/accounting/journal-entries/type.d.ts +151 -0
- package/dist/accounting/journal-entries/type.d.ts.map +1 -0
- package/dist/accounting/journal-entries/type.js +4 -0
- package/dist/accounting/journal-entries/type.js.map +1 -0
- package/dist/common/type.d.ts +105 -0
- package/dist/common/type.d.ts.map +1 -0
- package/dist/common/type.js +3 -0
- package/dist/common/type.js.map +1 -0
- package/dist/contacts/contacts/index.d.ts +57 -0
- package/dist/contacts/contacts/index.d.ts.map +1 -0
- package/dist/contacts/contacts/index.js +82 -0
- package/dist/contacts/contacts/index.js.map +1 -0
- package/dist/contacts/contacts/type.d.ts +286 -0
- package/dist/contacts/contacts/type.d.ts.map +1 -0
- package/dist/contacts/contacts/type.js +4 -0
- package/dist/contacts/contacts/type.js.map +1 -0
- package/dist/contacts/groups/index.d.ts +42 -0
- package/dist/contacts/groups/index.d.ts.map +1 -0
- package/dist/contacts/groups/index.js +59 -0
- package/dist/contacts/groups/index.js.map +1 -0
- package/dist/contacts/groups/type.d.ts +34 -0
- package/dist/contacts/groups/type.d.ts.map +1 -0
- package/dist/contacts/groups/type.js +4 -0
- package/dist/contacts/groups/type.js.map +1 -0
- package/dist/contacts/index.d.ts +10 -0
- package/dist/contacts/index.d.ts.map +1 -0
- package/dist/contacts/index.js +15 -0
- package/dist/contacts/index.js.map +1 -0
- package/dist/control-panel/index.d.ts +15 -0
- package/dist/control-panel/index.d.ts.map +1 -0
- package/dist/control-panel/index.js +35 -0
- package/dist/control-panel/index.js.map +1 -0
- package/dist/control-panel/locations/index.d.ts +51 -0
- package/dist/control-panel/locations/index.d.ts.map +1 -0
- package/dist/control-panel/locations/index.js +70 -0
- package/dist/control-panel/locations/index.js.map +1 -0
- package/dist/control-panel/locations/type.d.ts +91 -0
- package/dist/control-panel/locations/type.d.ts.map +1 -0
- package/dist/control-panel/locations/type.js +4 -0
- package/dist/control-panel/locations/type.js.map +1 -0
- package/dist/control-panel/tag-groups/index.d.ts +44 -0
- package/dist/control-panel/tag-groups/index.d.ts.map +1 -0
- package/dist/control-panel/tag-groups/index.js +63 -0
- package/dist/control-panel/tag-groups/index.js.map +1 -0
- package/dist/control-panel/tag-groups/type.d.ts +64 -0
- package/dist/control-panel/tag-groups/type.d.ts.map +1 -0
- package/dist/control-panel/tag-groups/type.js +4 -0
- package/dist/control-panel/tag-groups/type.js.map +1 -0
- package/dist/control-panel/tags/index.d.ts +43 -0
- package/dist/control-panel/tags/index.d.ts.map +1 -0
- package/dist/control-panel/tags/index.js +60 -0
- package/dist/control-panel/tags/index.js.map +1 -0
- package/dist/control-panel/tags/type.d.ts +60 -0
- package/dist/control-panel/tags/type.d.ts.map +1 -0
- package/dist/control-panel/tags/type.js +4 -0
- package/dist/control-panel/tags/type.js.map +1 -0
- package/dist/files/index.d.ts +29 -0
- package/dist/files/index.d.ts.map +1 -0
- package/dist/files/index.js +42 -0
- package/dist/files/index.js.map +1 -0
- package/dist/files/type.d.ts +50 -0
- package/dist/files/type.d.ts.map +1 -0
- package/dist/files/type.js +4 -0
- package/dist/files/type.js.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +130 -0
- package/dist/index.js.map +1 -0
- package/dist/lists/index.d.ts +24 -0
- package/dist/lists/index.d.ts.map +1 -0
- package/dist/lists/index.js +33 -0
- package/dist/lists/index.js.map +1 -0
- package/dist/lists/type.d.ts +781 -0
- package/dist/lists/type.d.ts.map +1 -0
- package/dist/lists/type.js +3 -0
- package/dist/lists/type.js.map +1 -0
- package/dist/products/groups/index.d.ts +42 -0
- package/dist/products/groups/index.d.ts.map +1 -0
- package/dist/products/groups/index.js +59 -0
- package/dist/products/groups/index.js.map +1 -0
- package/dist/products/groups/type.d.ts +53 -0
- package/dist/products/groups/type.d.ts.map +1 -0
- package/dist/products/groups/type.js +5 -0
- package/dist/products/groups/type.js.map +1 -0
- package/dist/products/index.d.ts +10 -0
- package/dist/products/index.d.ts.map +1 -0
- package/dist/products/index.js +15 -0
- package/dist/products/index.js.map +1 -0
- package/dist/products/products/index.d.ts +51 -0
- package/dist/products/products/index.d.ts.map +1 -0
- package/dist/products/products/index.js +70 -0
- package/dist/products/products/index.js.map +1 -0
- package/dist/products/products/type.d.ts +270 -0
- package/dist/products/products/type.d.ts.map +1 -0
- package/dist/products/products/type.js +4 -0
- package/dist/products/products/type.js.map +1 -0
- package/dist/purchases/bills/index.d.ts +51 -0
- package/dist/purchases/bills/index.d.ts.map +1 -0
- package/dist/purchases/bills/index.js +75 -0
- package/dist/purchases/bills/index.js.map +1 -0
- package/dist/purchases/bills/type.d.ts +254 -0
- package/dist/purchases/bills/type.d.ts.map +1 -0
- package/dist/purchases/bills/type.js +4 -0
- package/dist/purchases/bills/type.js.map +1 -0
- package/dist/purchases/credit-notes/index.d.ts +51 -0
- package/dist/purchases/credit-notes/index.d.ts.map +1 -0
- package/dist/purchases/credit-notes/index.js +71 -0
- package/dist/purchases/credit-notes/index.js.map +1 -0
- package/dist/purchases/credit-notes/type.d.ts +204 -0
- package/dist/purchases/credit-notes/type.d.ts.map +1 -0
- package/dist/purchases/credit-notes/type.js +4 -0
- package/dist/purchases/credit-notes/type.js.map +1 -0
- package/dist/purchases/goods-received-notes/index.d.ts +51 -0
- package/dist/purchases/goods-received-notes/index.d.ts.map +1 -0
- package/dist/purchases/goods-received-notes/index.js +71 -0
- package/dist/purchases/goods-received-notes/index.js.map +1 -0
- package/dist/purchases/goods-received-notes/type.d.ts +184 -0
- package/dist/purchases/goods-received-notes/type.d.ts.map +1 -0
- package/dist/purchases/goods-received-notes/type.js +4 -0
- package/dist/purchases/goods-received-notes/type.js.map +1 -0
- package/dist/purchases/index.d.ts +18 -0
- package/dist/purchases/index.d.ts.map +1 -0
- package/dist/purchases/index.js +23 -0
- package/dist/purchases/index.js.map +1 -0
- package/dist/purchases/payments/index.d.ts +51 -0
- package/dist/purchases/payments/index.d.ts.map +1 -0
- package/dist/purchases/payments/index.js +71 -0
- package/dist/purchases/payments/index.js.map +1 -0
- package/dist/purchases/payments/type.d.ts +183 -0
- package/dist/purchases/payments/type.d.ts.map +1 -0
- package/dist/purchases/payments/type.js +4 -0
- package/dist/purchases/payments/type.js.map +1 -0
- package/dist/purchases/purchase-orders/index.d.ts +51 -0
- package/dist/purchases/purchase-orders/index.d.ts.map +1 -0
- package/dist/purchases/purchase-orders/index.js +71 -0
- package/dist/purchases/purchase-orders/index.js.map +1 -0
- package/dist/purchases/purchase-orders/type.d.ts +182 -0
- package/dist/purchases/purchase-orders/type.d.ts.map +1 -0
- package/dist/purchases/purchase-orders/type.js +4 -0
- package/dist/purchases/purchase-orders/type.js.map +1 -0
- package/dist/purchases/refunds/index.d.ts +51 -0
- package/dist/purchases/refunds/index.d.ts.map +1 -0
- package/dist/purchases/refunds/index.js +71 -0
- package/dist/purchases/refunds/index.js.map +1 -0
- package/dist/purchases/refunds/type.d.ts +181 -0
- package/dist/purchases/refunds/type.d.ts.map +1 -0
- package/dist/purchases/refunds/type.js +4 -0
- package/dist/purchases/refunds/type.js.map +1 -0
- package/dist/sales/credit-notes/index.d.ts +52 -0
- package/dist/sales/credit-notes/index.d.ts.map +1 -0
- package/dist/sales/credit-notes/index.js +72 -0
- package/dist/sales/credit-notes/index.js.map +1 -0
- package/dist/sales/credit-notes/type.d.ts +304 -0
- package/dist/sales/credit-notes/type.d.ts.map +1 -0
- package/dist/sales/credit-notes/type.js +4 -0
- package/dist/sales/credit-notes/type.js.map +1 -0
- package/dist/sales/delivery-orders/index.d.ts +51 -0
- package/dist/sales/delivery-orders/index.d.ts.map +1 -0
- package/dist/sales/delivery-orders/index.js +72 -0
- package/dist/sales/delivery-orders/index.js.map +1 -0
- package/dist/sales/delivery-orders/type.d.ts +212 -0
- package/dist/sales/delivery-orders/type.d.ts.map +1 -0
- package/dist/sales/delivery-orders/type.js +4 -0
- package/dist/sales/delivery-orders/type.js.map +1 -0
- package/dist/sales/index.d.ts +20 -0
- package/dist/sales/index.d.ts.map +1 -0
- package/dist/sales/index.js +24 -0
- package/dist/sales/index.js.map +1 -0
- package/dist/sales/invoices/index.d.ts +52 -0
- package/dist/sales/invoices/index.d.ts.map +1 -0
- package/dist/sales/invoices/index.js +73 -0
- package/dist/sales/invoices/index.js.map +1 -0
- package/dist/sales/invoices/type.d.ts +335 -0
- package/dist/sales/invoices/type.d.ts.map +1 -0
- package/dist/sales/invoices/type.js +4 -0
- package/dist/sales/invoices/type.js.map +1 -0
- package/dist/sales/payments/index.d.ts +52 -0
- package/dist/sales/payments/index.d.ts.map +1 -0
- package/dist/sales/payments/index.js +72 -0
- package/dist/sales/payments/index.js.map +1 -0
- package/dist/sales/payments/type.d.ts +242 -0
- package/dist/sales/payments/type.d.ts.map +1 -0
- package/dist/sales/payments/type.js +4 -0
- package/dist/sales/payments/type.js.map +1 -0
- package/dist/sales/quotations/index.d.ts +51 -0
- package/dist/sales/quotations/index.d.ts.map +1 -0
- package/dist/sales/quotations/index.js +71 -0
- package/dist/sales/quotations/index.js.map +1 -0
- package/dist/sales/quotations/type.d.ts +202 -0
- package/dist/sales/quotations/type.d.ts.map +1 -0
- package/dist/sales/quotations/type.js +3 -0
- package/dist/sales/quotations/type.js.map +1 -0
- package/dist/sales/refunds/index.d.ts +52 -0
- package/dist/sales/refunds/index.d.ts.map +1 -0
- package/dist/sales/refunds/index.js +72 -0
- package/dist/sales/refunds/index.js.map +1 -0
- package/dist/sales/refunds/type.d.ts +225 -0
- package/dist/sales/refunds/type.d.ts.map +1 -0
- package/dist/sales/refunds/type.js +4 -0
- package/dist/sales/refunds/type.js.map +1 -0
- package/dist/sales/sales-orders/index.d.ts +52 -0
- package/dist/sales/sales-orders/index.d.ts.map +1 -0
- package/dist/sales/sales-orders/index.js +72 -0
- package/dist/sales/sales-orders/index.js.map +1 -0
- package/dist/sales/sales-orders/type.d.ts +202 -0
- package/dist/sales/sales-orders/type.d.ts.map +1 -0
- package/dist/sales/sales-orders/type.js +4 -0
- package/dist/sales/sales-orders/type.js.map +1 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# bukku-client
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/bukku-client)
|
|
4
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
5
|
+
[](https://travis-ci.com/farhan-syah/bukku-client) <!-- Replace with your CI service -->
|
|
6
|
+
|
|
7
|
+
A TypeScript client library for interacting with the Bukku REST API. This package aims to provide an easy way to integrate Bukku services into your Node.js or TypeScript projects.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- TypeScript-first: Written in TypeScript for strong typing and better developer experience.
|
|
12
|
+
- Provides convenient methods for accessing Bukku API endpoints.
|
|
13
|
+
- Easy to integrate and use.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
You can install `bukku-client` using npm or yarn:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bun install bukku-client
|
|
21
|
+
# or
|
|
22
|
+
npm install bukku-client
|
|
23
|
+
# or
|
|
24
|
+
yarn add bukku-client
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
To use the `bukku-client`, you'll first need to instantiate the `BukkuClient` with your API Access Token and Company Subdomain. You can find your Access Token in the Control Panel > Integrations section of your Bukku web application.
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { BukkuClient } from "bukku-client";
|
|
33
|
+
|
|
34
|
+
const bukku = new BukkuClient({
|
|
35
|
+
accessToken: "YOUR_BUKKU_ACCESS_TOKEN", // Replace with your actual Access Token
|
|
36
|
+
companySubdomain: "YOUR_COMPANY_SUBDOMAIN", // Replace with your company's Bukku subdomain
|
|
37
|
+
apiBaseUrl: "https://api.bukku.fyi", // Example for Bukku staging environment
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## API Documentation
|
|
42
|
+
|
|
43
|
+
This library aims to implement the functionalities exposed by the Bukku REST API. For detailed information about the API endpoints, request/response structures, and authentication, please refer to the official Bukku API Documentation:
|
|
44
|
+
|
|
45
|
+
- **[Bukku Official API Documentation](https://developers.bukku.my)**
|
|
46
|
+
|
|
47
|
+
Detailed documentation for each method and available types within this library will be provided here as the library evolves.
|
|
48
|
+
|
|
49
|
+
The main client class, `BukkuClient`, will be the entry point for all API interactions.
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
To get started with development:
|
|
54
|
+
|
|
55
|
+
1. Clone the repository:
|
|
56
|
+
```bash
|
|
57
|
+
git clone https://github.com/farhan-syah/bukku-client.git
|
|
58
|
+
cd bukku-client
|
|
59
|
+
```
|
|
60
|
+
2. Install dependencies:
|
|
61
|
+
```bash
|
|
62
|
+
bun install
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Contributing
|
|
66
|
+
|
|
67
|
+
Contributions are welcome! If you'd like to contribute, please:
|
|
68
|
+
|
|
69
|
+
1. Fork the repository.
|
|
70
|
+
2. Create a new branch (`git checkout -b feature/your-feature-name`).
|
|
71
|
+
3. Make your changes.
|
|
72
|
+
4. Commit your changes (`git commit -m 'Add some feature'`).
|
|
73
|
+
5. Push to the branch (`git push origin feature/your-feature-name`).
|
|
74
|
+
6. Open a Pull Request.
|
|
75
|
+
|
|
76
|
+
Please make sure to update tests as appropriate.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
This project is licensed under the GPL-3.0 License - see the [LICENSE](LICENSE) file for details.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
_This is an unofficial client library for Bukku. Bukku is a trademark of its respective owners._
|
|
85
|
+
_Replace `YOUR_USERNAME` and other placeholders with your actual information._
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { BukkuAPIRequestFunction } from "../../types";
|
|
2
|
+
import { BukkuAccount, BukkuAccountCreateParams, BukkuAccountUpdateParams, BukkuAccountArchiveParams, BukkuAccountListParams, BukkuAccountListApiResponse } from "./type";
|
|
3
|
+
export declare class AccountsAPI {
|
|
4
|
+
private _request;
|
|
5
|
+
constructor(_request: BukkuAPIRequestFunction);
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new account.
|
|
8
|
+
* Endpoint: POST /accounts
|
|
9
|
+
* @param data - The data for the new account.
|
|
10
|
+
* @returns A promise that resolves to the created account.
|
|
11
|
+
*/
|
|
12
|
+
create(data: BukkuAccountCreateParams): Promise<BukkuAccount>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves a paginated list of accounts.
|
|
15
|
+
* Endpoint: GET /accounts
|
|
16
|
+
* @param params - Optional parameters for filtering and pagination.
|
|
17
|
+
* @returns A promise that resolves to the API response for listing accounts.
|
|
18
|
+
*/
|
|
19
|
+
list(params?: BukkuAccountListParams): Promise<BukkuAccountListApiResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a specific account by its ID.
|
|
22
|
+
* Endpoint: GET /accounts/{id}
|
|
23
|
+
* @param id - The ID of the account to retrieve.
|
|
24
|
+
* @returns A promise that resolves to the account.
|
|
25
|
+
*/
|
|
26
|
+
get(id: string | number): Promise<BukkuAccount>;
|
|
27
|
+
/**
|
|
28
|
+
* Updates an existing account.
|
|
29
|
+
* Endpoint: PUT /accounts/{id}
|
|
30
|
+
* @param id - The ID of the account to update.
|
|
31
|
+
* @param data - The data to update the account with.
|
|
32
|
+
* @returns A promise that resolves to the updated account.
|
|
33
|
+
*/
|
|
34
|
+
update(id: string | number, data: BukkuAccountUpdateParams): Promise<BukkuAccount>;
|
|
35
|
+
/**
|
|
36
|
+
* Archives or unarchives an account.
|
|
37
|
+
* Endpoint: PATCH /accounts/{id}
|
|
38
|
+
* @param id - The ID of the account to archive/unarchive.
|
|
39
|
+
* @param data - The archive status.
|
|
40
|
+
* @returns A promise that resolves to the updated account.
|
|
41
|
+
*/
|
|
42
|
+
updateArchiveStatus(id: string | number, data: BukkuAccountArchiveParams): Promise<BukkuAccount>;
|
|
43
|
+
/**
|
|
44
|
+
* Deletes an account.
|
|
45
|
+
* Endpoint: DELETE /accounts/{id}
|
|
46
|
+
* Note: Only accounts that are not assigned to locked system type, have no children or not used can be deleted.
|
|
47
|
+
* @param id - The ID of the account to delete.
|
|
48
|
+
* @returns A promise that resolves when the account is deleted.
|
|
49
|
+
*/
|
|
50
|
+
delete(id: string | number): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/accounting/accounts/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EAEzB,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,QAAQ,CAAC;AAEhB,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,uBAAuB;IAErD;;;;;OAKG;IACG,MAAM,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC;IASnE;;;;;OAKG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IASjF;;;;;OAKG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAQrD;;;;;;OAMG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC;IASxF;;;;;;OAMG;IACG,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,YAAY,CAAC;IAStG;;;;;;OAMG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/accounting/accounts/index.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AccountsAPI = void 0;
|
|
5
|
+
class AccountsAPI {
|
|
6
|
+
constructor(_request) {
|
|
7
|
+
this._request = _request;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new account.
|
|
11
|
+
* Endpoint: POST /accounts
|
|
12
|
+
* @param data - The data for the new account.
|
|
13
|
+
* @returns A promise that resolves to the created account.
|
|
14
|
+
*/
|
|
15
|
+
async create(data) {
|
|
16
|
+
const response = await this._request("/accounts", "POST", data);
|
|
17
|
+
return response.account;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves a paginated list of accounts.
|
|
21
|
+
* Endpoint: GET /accounts
|
|
22
|
+
* @param params - Optional parameters for filtering and pagination.
|
|
23
|
+
* @returns A promise that resolves to the API response for listing accounts.
|
|
24
|
+
*/
|
|
25
|
+
async list(params) {
|
|
26
|
+
return this._request("/accounts", "GET", undefined, params);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves a specific account by its ID.
|
|
30
|
+
* Endpoint: GET /accounts/{id}
|
|
31
|
+
* @param id - The ID of the account to retrieve.
|
|
32
|
+
* @returns A promise that resolves to the account.
|
|
33
|
+
*/
|
|
34
|
+
async get(id) {
|
|
35
|
+
const response = await this._request(`/accounts/${id}`, "GET");
|
|
36
|
+
return response.account;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Updates an existing account.
|
|
40
|
+
* Endpoint: PUT /accounts/{id}
|
|
41
|
+
* @param id - The ID of the account to update.
|
|
42
|
+
* @param data - The data to update the account with.
|
|
43
|
+
* @returns A promise that resolves to the updated account.
|
|
44
|
+
*/
|
|
45
|
+
async update(id, data) {
|
|
46
|
+
const response = await this._request(`/accounts/${id}`, "PUT", data);
|
|
47
|
+
return response.account;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Archives or unarchives an account.
|
|
51
|
+
* Endpoint: PATCH /accounts/{id}
|
|
52
|
+
* @param id - The ID of the account to archive/unarchive.
|
|
53
|
+
* @param data - The archive status.
|
|
54
|
+
* @returns A promise that resolves to the updated account.
|
|
55
|
+
*/
|
|
56
|
+
async updateArchiveStatus(id, data) {
|
|
57
|
+
const response = await this._request(`/accounts/${id}`, "PATCH", data);
|
|
58
|
+
return response.account;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Deletes an account.
|
|
62
|
+
* Endpoint: DELETE /accounts/{id}
|
|
63
|
+
* Note: Only accounts that are not assigned to locked system type, have no children or not used can be deleted.
|
|
64
|
+
* @param id - The ID of the account to delete.
|
|
65
|
+
* @returns A promise that resolves when the account is deleted.
|
|
66
|
+
*/
|
|
67
|
+
async delete(id) {
|
|
68
|
+
await this._request(`/accounts/${id}`, "DELETE");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.AccountsAPI = AccountsAPI;
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/accounting/accounts/index.ts"],"names":[],"mappings":";AAAA,mCAAmC;;;AAanC,MAAa,WAAW;IACtB,YAAoB,QAAiC;QAAjC,aAAQ,GAAR,QAAQ,CAAyB;IAAG,CAAC;IAEzD;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,IAA8B;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,WAAW,EACX,MAAM,EACN,IAAI,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,MAA+B;QACxC,OAAO,IAAI,CAAC,QAAQ,CAClB,WAAW,EACX,KAAK,EACL,SAAS,EACT,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CAAC,EAAmB;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,aAAa,EAAE,EAAE,EACjB,KAAK,CACN,CAAC;QACF,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,EAAmB,EAAE,IAA8B;QAC9D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,aAAa,EAAE,EAAE,EACjB,KAAK,EACL,IAAI,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,mBAAmB,CAAC,EAAmB,EAAE,IAA+B;QAC5E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,aAAa,EAAE,EAAE,EACjB,OAAO,EACP,IAAI,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,EAAmB;QAC9B,MAAM,IAAI,CAAC,QAAQ,CAAO,aAAa,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;CACF;AAzFD,kCAyFC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { BukkuListPagination } from "../../common/type";
|
|
2
|
+
/**
|
|
3
|
+
* Enum for Account Type (used in Create/Update and Get Single).
|
|
4
|
+
*/
|
|
5
|
+
export type BukkuAccountTypeForDetail = "current_assets" | "non_current_assets" | "other_assets" | "current_liabilities" | "non_current_liabilities" | "equity" | "income" | "other_income" | "cost_of_sales" | "expenses" | "taxation";
|
|
6
|
+
/**
|
|
7
|
+
* Enum for Account Type (used in List filter).
|
|
8
|
+
*/
|
|
9
|
+
export type BukkuAccountTypeForListFilter = "assets" | "liabilities" | "equity" | "income" | "expenses";
|
|
10
|
+
/**
|
|
11
|
+
* Enum for Account System Type.
|
|
12
|
+
*/
|
|
13
|
+
export type BukkuAccountSystemType = "bank_cash" | "accounts_receivable" | "accounts_payable" | "inventory" | "credit_card" | "fixed_assets" | "depreciation" | "my_epf_expense" | "my_socso_expense" | "my_eis_expense" | "my_salary_expense";
|
|
14
|
+
/**
|
|
15
|
+
* Enum for Account Classification.
|
|
16
|
+
*/
|
|
17
|
+
export type BukkuAccountClassification = "OPERATING" | "INVESTING" | "FINANCING";
|
|
18
|
+
/**
|
|
19
|
+
* Parameters for creating a new Account.
|
|
20
|
+
* Based on POST /accounts request body schema.
|
|
21
|
+
*/
|
|
22
|
+
export interface BukkuAccountCreateParams {
|
|
23
|
+
name: string;
|
|
24
|
+
type: BukkuAccountTypeForDetail;
|
|
25
|
+
system_type?: BukkuAccountSystemType;
|
|
26
|
+
parent_id?: number;
|
|
27
|
+
classification?: BukkuAccountClassification;
|
|
28
|
+
code?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Parameters for updating an existing Account.
|
|
33
|
+
* Based on PUT /accounts/{id} request body schema.
|
|
34
|
+
*/
|
|
35
|
+
export interface BukkuAccountUpdateParams {
|
|
36
|
+
name: string;
|
|
37
|
+
type: BukkuAccountTypeForDetail;
|
|
38
|
+
system_type?: BukkuAccountSystemType;
|
|
39
|
+
parent_id?: number;
|
|
40
|
+
classification?: BukkuAccountClassification;
|
|
41
|
+
code: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parameters for archiving/unarchiving an Account.
|
|
46
|
+
* Based on PATCH /accounts/{id} request body schema.
|
|
47
|
+
*/
|
|
48
|
+
export interface BukkuAccountArchiveParams {
|
|
49
|
+
is_archived: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Represents currency details for an Account as returned by the API.
|
|
53
|
+
*/
|
|
54
|
+
export interface BukkuAccountCurrencyDetail {
|
|
55
|
+
code: string;
|
|
56
|
+
symbol: string;
|
|
57
|
+
name: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Represents an Account object as returned by the API (for Get Single, Create/Update response).
|
|
61
|
+
* Based on the `account` object in the response sample for POST /accounts.
|
|
62
|
+
*/
|
|
63
|
+
export interface BukkuAccount {
|
|
64
|
+
id: number;
|
|
65
|
+
code: string | null;
|
|
66
|
+
name: string;
|
|
67
|
+
description: string | null;
|
|
68
|
+
currency_code: string;
|
|
69
|
+
currency: BukkuAccountCurrencyDetail;
|
|
70
|
+
balance: number | null;
|
|
71
|
+
type: BukkuAccountTypeForDetail;
|
|
72
|
+
system_type: BukkuAccountSystemType | null;
|
|
73
|
+
parent_id: number | null;
|
|
74
|
+
classification: BukkuAccountClassification | null;
|
|
75
|
+
is_locked: boolean;
|
|
76
|
+
is_archived: boolean;
|
|
77
|
+
created_at: string;
|
|
78
|
+
updated_at: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Represents the API response structure when an account is created, retrieved or updated.
|
|
82
|
+
*/
|
|
83
|
+
export interface BukkuAccountResponse {
|
|
84
|
+
account: BukkuAccount;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Parameters for listing Accounts.
|
|
88
|
+
* Based on GET /accounts query parameters.
|
|
89
|
+
*/
|
|
90
|
+
export interface BukkuAccountListParams {
|
|
91
|
+
search?: string;
|
|
92
|
+
type?: BukkuAccountTypeForListFilter;
|
|
93
|
+
is_archived?: boolean;
|
|
94
|
+
sort_by?: "code" | "name" | "balance";
|
|
95
|
+
sort_dir?: "asc" | "desc";
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Represents a summary of an Account as it might appear in a list.
|
|
100
|
+
* This structure is based on the detailed `BukkuAccount` and common list item patterns.
|
|
101
|
+
* Actual API response for the list endpoint might differ.
|
|
102
|
+
*/
|
|
103
|
+
export interface BukkuAccountListItem {
|
|
104
|
+
id: number;
|
|
105
|
+
code: string | null;
|
|
106
|
+
name: string;
|
|
107
|
+
description: string | null;
|
|
108
|
+
currency_code: string;
|
|
109
|
+
balance: number | null;
|
|
110
|
+
type: BukkuAccountTypeForDetail;
|
|
111
|
+
system_type: BukkuAccountSystemType | null;
|
|
112
|
+
parent_id: number | null;
|
|
113
|
+
is_locked: boolean;
|
|
114
|
+
is_archived: boolean;
|
|
115
|
+
created_at: string;
|
|
116
|
+
updated_at: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Represents the API response structure for listing accounts.
|
|
120
|
+
*/
|
|
121
|
+
export interface BukkuAccountListApiResponse {
|
|
122
|
+
paging: BukkuListPagination;
|
|
123
|
+
accounts: BukkuAccountListItem[];
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/accounting/accounts/type.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/accounting/accounts/type.ts"],"names":[],"mappings":";AAAA,kCAAkC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BukkuAPIRequestFunction } from "../types";
|
|
2
|
+
import { AccountsAPI } from "./accounts";
|
|
3
|
+
import { JournalEntriesAPI } from "./journal-entries";
|
|
4
|
+
export declare class AccountingAPI {
|
|
5
|
+
private _request;
|
|
6
|
+
readonly accounts: AccountsAPI;
|
|
7
|
+
readonly journalEntries: JournalEntriesAPI;
|
|
8
|
+
constructor(_request: BukkuAPIRequestFunction);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/accounting/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,qBAAa,aAAa;IAIZ,OAAO,CAAC,QAAQ;IAH5B,SAAgB,QAAQ,EAAE,WAAW,CAAC;IACtC,SAAgB,cAAc,EAAE,iBAAiB,CAAC;gBAE9B,QAAQ,EAAE,uBAAuB;CAOtD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/accounting/index.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AccountingAPI = void 0;
|
|
5
|
+
const accounts_1 = require("./accounts");
|
|
6
|
+
const journal_entries_1 = require("./journal-entries"); // Added import
|
|
7
|
+
class AccountingAPI {
|
|
8
|
+
constructor(_request) {
|
|
9
|
+
this._request = _request;
|
|
10
|
+
this.accounts = new accounts_1.AccountsAPI(this._request);
|
|
11
|
+
this.journalEntries = new journal_entries_1.JournalEntriesAPI(this._request); // Added initialization
|
|
12
|
+
// Future accounting-related modules will be initialized here
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AccountingAPI = AccountingAPI;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/accounting/index.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAG1B,yCAAyC;AACzC,uDAAsD,CAAC,eAAe;AAEtE,MAAa,aAAa;IAIxB,YAAoB,QAAiC;QAAjC,aAAQ,GAAR,QAAQ,CAAyB;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,sBAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,CAAC,cAAc,GAAG,IAAI,mCAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,uBAAuB;QACnF,6DAA6D;IAC/D,CAAC;CAGF;AAXD,sCAWC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { BukkuAPIRequestFunction } from "../../types";
|
|
2
|
+
import { BukkuJournalEntry, BukkuJournalEntryCreateParams, BukkuJournalEntryUpdateParams, BukkuJournalEntryStatusUpdateParams, BukkuJournalEntryListParams, BukkuJournalEntryListApiResponse } from "./type";
|
|
3
|
+
export declare class JournalEntriesAPI {
|
|
4
|
+
private _request;
|
|
5
|
+
constructor(_request: BukkuAPIRequestFunction);
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new journal entry.
|
|
8
|
+
* Endpoint: POST /journal_entries
|
|
9
|
+
* @param data - The data for the new journal entry.
|
|
10
|
+
* @returns A promise that resolves to the created journal entry.
|
|
11
|
+
*/
|
|
12
|
+
create(data: BukkuJournalEntryCreateParams): Promise<BukkuJournalEntry>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves a paginated list of journal entries.
|
|
15
|
+
* Endpoint: GET /journal_entries
|
|
16
|
+
* @param params - Optional parameters for filtering and pagination.
|
|
17
|
+
* @returns A promise that resolves to the API response for listing journal entries.
|
|
18
|
+
*/
|
|
19
|
+
list(params?: BukkuJournalEntryListParams): Promise<BukkuJournalEntryListApiResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a specific journal entry by its ID.
|
|
22
|
+
* Endpoint: GET /journal_entries/{transactionId}
|
|
23
|
+
* @param id - The ID of the journal entry to retrieve.
|
|
24
|
+
* @returns A promise that resolves to the journal entry.
|
|
25
|
+
*/
|
|
26
|
+
get(id: string | number): Promise<BukkuJournalEntry>;
|
|
27
|
+
/**
|
|
28
|
+
* Updates an existing journal entry.
|
|
29
|
+
* Endpoint: PUT /journal_entries/{transactionId}
|
|
30
|
+
* @param id - The ID of the journal entry to update.
|
|
31
|
+
* @param data - The data to update the journal entry with.
|
|
32
|
+
* @returns A promise that resolves to the updated journal entry.
|
|
33
|
+
*/
|
|
34
|
+
update(id: string | number, data: BukkuJournalEntryUpdateParams): Promise<BukkuJournalEntry>;
|
|
35
|
+
/**
|
|
36
|
+
* Updates the status of an existing journal entry.
|
|
37
|
+
* Endpoint: PATCH /journal_entries/{transactionId}
|
|
38
|
+
* @param id - The ID of the journal entry to update.
|
|
39
|
+
* @param data - The data containing the new status.
|
|
40
|
+
* @returns A promise that resolves to the updated journal entry.
|
|
41
|
+
*/
|
|
42
|
+
updateStatus(id: string | number, data: BukkuJournalEntryStatusUpdateParams): Promise<BukkuJournalEntry>;
|
|
43
|
+
/**
|
|
44
|
+
* Deletes a journal entry.
|
|
45
|
+
* Endpoint: DELETE /journal_entries/{transactionId}
|
|
46
|
+
* Note: Only transactions with draft and void statuses can be deleted.
|
|
47
|
+
* @param id - The ID of the journal entry to delete.
|
|
48
|
+
* @returns A promise that resolves when the journal entry is deleted.
|
|
49
|
+
*/
|
|
50
|
+
delete(id: string | number): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/accounting/journal-entries/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,6BAA6B,EAC7B,mCAAmC,EAEnC,2BAA2B,EAC3B,gCAAgC,EACjC,MAAM,QAAQ,CAAC;AAEhB,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,uBAAuB;IAErD;;;;;OAKG;IACG,MAAM,CAAC,IAAI,EAAE,6BAA6B,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAS7E;;;;;OAKG;IACG,IAAI,CACR,MAAM,CAAC,EAAE,2BAA2B,GACnC,OAAO,CAAC,gCAAgC,CAAC;IAS5C;;;;;OAKG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQ1D;;;;;;OAMG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,iBAAiB,CAAC;IAS7B;;;;;;OAMG;IACG,YAAY,CAChB,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,IAAI,EAAE,mCAAmC,GACxC,OAAO,CAAC,iBAAiB,CAAC;IAS7B;;;;;;OAMG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/accounting/journal-entries/index.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.JournalEntriesAPI = void 0;
|
|
5
|
+
class JournalEntriesAPI {
|
|
6
|
+
constructor(_request) {
|
|
7
|
+
this._request = _request;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new journal entry.
|
|
11
|
+
* Endpoint: POST /journal_entries
|
|
12
|
+
* @param data - The data for the new journal entry.
|
|
13
|
+
* @returns A promise that resolves to the created journal entry.
|
|
14
|
+
*/
|
|
15
|
+
async create(data) {
|
|
16
|
+
const response = await this._request("/journal_entries", "POST", data);
|
|
17
|
+
return response.transaction;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves a paginated list of journal entries.
|
|
21
|
+
* Endpoint: GET /journal_entries
|
|
22
|
+
* @param params - Optional parameters for filtering and pagination.
|
|
23
|
+
* @returns A promise that resolves to the API response for listing journal entries.
|
|
24
|
+
*/
|
|
25
|
+
async list(params) {
|
|
26
|
+
return this._request("/journal_entries", "GET", undefined, params);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves a specific journal entry by its ID.
|
|
30
|
+
* Endpoint: GET /journal_entries/{transactionId}
|
|
31
|
+
* @param id - The ID of the journal entry to retrieve.
|
|
32
|
+
* @returns A promise that resolves to the journal entry.
|
|
33
|
+
*/
|
|
34
|
+
async get(id) {
|
|
35
|
+
const response = await this._request(`/journal_entries/${id}`, "GET");
|
|
36
|
+
return response.transaction;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Updates an existing journal entry.
|
|
40
|
+
* Endpoint: PUT /journal_entries/{transactionId}
|
|
41
|
+
* @param id - The ID of the journal entry to update.
|
|
42
|
+
* @param data - The data to update the journal entry with.
|
|
43
|
+
* @returns A promise that resolves to the updated journal entry.
|
|
44
|
+
*/
|
|
45
|
+
async update(id, data) {
|
|
46
|
+
const response = await this._request(`/journal_entries/${id}`, "PUT", data);
|
|
47
|
+
return response.transaction;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Updates the status of an existing journal entry.
|
|
51
|
+
* Endpoint: PATCH /journal_entries/{transactionId}
|
|
52
|
+
* @param id - The ID of the journal entry to update.
|
|
53
|
+
* @param data - The data containing the new status.
|
|
54
|
+
* @returns A promise that resolves to the updated journal entry.
|
|
55
|
+
*/
|
|
56
|
+
async updateStatus(id, data) {
|
|
57
|
+
const response = await this._request(`/journal_entries/${id}`, "PATCH", data);
|
|
58
|
+
return response.transaction;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Deletes a journal entry.
|
|
62
|
+
* Endpoint: DELETE /journal_entries/{transactionId}
|
|
63
|
+
* Note: Only transactions with draft and void statuses can be deleted.
|
|
64
|
+
* @param id - The ID of the journal entry to delete.
|
|
65
|
+
* @returns A promise that resolves when the journal entry is deleted.
|
|
66
|
+
*/
|
|
67
|
+
async delete(id) {
|
|
68
|
+
await this._request(`/journal_entries/${id}`, "DELETE");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.JournalEntriesAPI = JournalEntriesAPI;
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/accounting/journal-entries/index.ts"],"names":[],"mappings":";AAAA,0CAA0C;;;AAa1C,MAAa,iBAAiB;IAC5B,YAAoB,QAAiC;QAAjC,aAAQ,GAAR,QAAQ,CAAyB;IAAG,CAAC;IAEzD;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,IAAmC;QAC9C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,kBAAkB,EAClB,MAAM,EACN,IAAI,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CACR,MAAoC;QAEpC,OAAO,IAAI,CAAC,QAAQ,CAClB,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CAAC,EAAmB;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,oBAAoB,EAAE,EAAE,EACxB,KAAK,CACN,CAAC;QACF,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,EAAmB,EACnB,IAAmC;QAEnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,oBAAoB,EAAE,EAAE,EACxB,KAAK,EACL,IAAI,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,CAChB,EAAmB,EACnB,IAAyC;QAEzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,oBAAoB,EAAE,EAAE,EACxB,OAAO,EACP,IAAI,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,EAAmB;QAC9B,MAAM,IAAI,CAAC,QAAQ,CAAO,oBAAoB,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC;CACF;AAjGD,8CAiGC"}
|