@unified-api/typescript-sdk 2.75.3 → 2.76.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/README.md +12 -0
- package/docs/sdks/accounting/README.md +482 -0
- package/docs/sdks/expense/README.md +489 -0
- package/examples/package-lock.json +1 -1
- package/funcs/accountingCreateAccountingExpense.d.ts +15 -0
- package/funcs/accountingCreateAccountingExpense.d.ts.map +1 -0
- package/funcs/accountingCreateAccountingExpense.js +122 -0
- package/funcs/accountingCreateAccountingExpense.js.map +1 -0
- package/funcs/accountingGetAccountingExpense.d.ts +15 -0
- package/funcs/accountingGetAccountingExpense.d.ts.map +1 -0
- package/funcs/accountingGetAccountingExpense.js +125 -0
- package/funcs/accountingGetAccountingExpense.js.map +1 -0
- package/funcs/accountingListAccountingExpenses.d.ts +15 -0
- package/funcs/accountingListAccountingExpenses.d.ts.map +1 -0
- package/funcs/accountingListAccountingExpenses.js +129 -0
- package/funcs/accountingListAccountingExpenses.js.map +1 -0
- package/funcs/accountingPatchAccountingExpense.d.ts +15 -0
- package/funcs/accountingPatchAccountingExpense.d.ts.map +1 -0
- package/funcs/accountingPatchAccountingExpense.js +126 -0
- package/funcs/accountingPatchAccountingExpense.js.map +1 -0
- package/funcs/accountingRemoveAccountingExpense.d.ts +14 -0
- package/funcs/accountingRemoveAccountingExpense.d.ts.map +1 -0
- package/funcs/accountingRemoveAccountingExpense.js +122 -0
- package/funcs/accountingRemoveAccountingExpense.js.map +1 -0
- package/funcs/accountingUpdateAccountingExpense.d.ts +15 -0
- package/funcs/accountingUpdateAccountingExpense.d.ts.map +1 -0
- package/funcs/accountingUpdateAccountingExpense.js +126 -0
- package/funcs/accountingUpdateAccountingExpense.js.map +1 -0
- package/funcs/messagingListMessagingMessages.js +1 -0
- package/funcs/messagingListMessagingMessages.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/package.json +1 -1
- package/sdk/accounting.d.ts +24 -0
- package/sdk/accounting.d.ts.map +1 -1
- package/sdk/accounting.js +42 -0
- package/sdk/accounting.js.map +1 -1
- package/sdk/expense.d.ts +30 -0
- package/sdk/expense.d.ts.map +1 -0
- package/sdk/expense.js +54 -0
- package/sdk/expense.js.map +1 -0
- package/sdk/models/operations/createaccountingexpense.d.ts +45 -0
- package/sdk/models/operations/createaccountingexpense.d.ts.map +1 -0
- package/sdk/models/operations/createaccountingexpense.js +87 -0
- package/sdk/models/operations/createaccountingexpense.js.map +1 -0
- package/sdk/models/operations/getaccountingexpense.d.ts +47 -0
- package/sdk/models/operations/getaccountingexpense.d.ts.map +1 -0
- package/sdk/models/operations/getaccountingexpense.js +84 -0
- package/sdk/models/operations/getaccountingexpense.js.map +1 -0
- package/sdk/models/operations/index.d.ts +6 -0
- package/sdk/models/operations/index.d.ts.map +1 -1
- package/sdk/models/operations/index.js +6 -0
- package/sdk/models/operations/index.js.map +1 -1
- package/sdk/models/operations/listaccountingexpenses.d.ts +65 -0
- package/sdk/models/operations/listaccountingexpenses.d.ts.map +1 -0
- package/sdk/models/operations/listaccountingexpenses.js +100 -0
- package/sdk/models/operations/listaccountingexpenses.js.map +1 -0
- package/sdk/models/operations/listmessagingmessages.d.ts +5 -0
- package/sdk/models/operations/listmessagingmessages.d.ts.map +1 -1
- package/sdk/models/operations/listmessagingmessages.js +4 -0
- package/sdk/models/operations/listmessagingmessages.js.map +1 -1
- package/sdk/models/operations/patchaccountingexpense.d.ts +50 -0
- package/sdk/models/operations/patchaccountingexpense.d.ts.map +1 -0
- package/sdk/models/operations/patchaccountingexpense.js +89 -0
- package/sdk/models/operations/patchaccountingexpense.js.map +1 -0
- package/sdk/models/operations/removeaccountingexpense.d.ts +66 -0
- package/sdk/models/operations/removeaccountingexpense.d.ts.map +1 -0
- package/sdk/models/operations/removeaccountingexpense.js +115 -0
- package/sdk/models/operations/removeaccountingexpense.js.map +1 -0
- package/sdk/models/operations/updateaccountingexpense.d.ts +50 -0
- package/sdk/models/operations/updateaccountingexpense.d.ts.map +1 -0
- package/sdk/models/operations/updateaccountingexpense.js +89 -0
- package/sdk/models/operations/updateaccountingexpense.js.map +1 -0
- package/sdk/models/shared/accountingexpense.d.ts +60 -0
- package/sdk/models/shared/accountingexpense.d.ts.map +1 -0
- package/sdk/models/shared/accountingexpense.js +124 -0
- package/sdk/models/shared/accountingexpense.js.map +1 -0
- package/sdk/models/shared/index.d.ts +1 -0
- package/sdk/models/shared/index.d.ts.map +1 -1
- package/sdk/models/shared/index.js +1 -0
- package/sdk/models/shared/index.js.map +1 -1
- package/sdk/models/shared/propertyconnectionpermissions.d.ts +2 -0
- package/sdk/models/shared/propertyconnectionpermissions.d.ts.map +1 -1
- package/sdk/models/shared/propertyconnectionpermissions.js +2 -0
- package/sdk/models/shared/propertyconnectionpermissions.js.map +1 -1
- package/sdk/models/shared/webhook.d.ts +1 -0
- package/sdk/models/shared/webhook.d.ts.map +1 -1
- package/sdk/models/shared/webhook.js +1 -0
- package/sdk/models/shared/webhook.js.map +1 -1
- package/sdk/sdk.d.ts +3 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +4 -0
- package/sdk/sdk.js.map +1 -1
- package/src/funcs/accountingCreateAccountingExpense.ts +171 -0
- package/src/funcs/accountingGetAccountingExpense.ts +176 -0
- package/src/funcs/accountingListAccountingExpenses.ts +178 -0
- package/src/funcs/accountingPatchAccountingExpense.ts +177 -0
- package/src/funcs/accountingRemoveAccountingExpense.ts +181 -0
- package/src/funcs/accountingUpdateAccountingExpense.ts +177 -0
- package/src/funcs/messagingListMessagingMessages.ts +1 -0
- package/src/lib/config.ts +3 -3
- package/src/sdk/accounting.ts +90 -0
- package/src/sdk/expense.ts +100 -0
- package/src/sdk/models/operations/createaccountingexpense.ts +101 -0
- package/src/sdk/models/operations/getaccountingexpense.ts +101 -0
- package/src/sdk/models/operations/index.ts +6 -0
- package/src/sdk/models/operations/listaccountingexpenses.ts +135 -0
- package/src/sdk/models/operations/listmessagingmessages.ts +9 -0
- package/src/sdk/models/operations/patchaccountingexpense.ts +108 -0
- package/src/sdk/models/operations/removeaccountingexpense.ts +155 -0
- package/src/sdk/models/operations/updateaccountingexpense.ts +108 -0
- package/src/sdk/models/shared/accountingexpense.ts +154 -0
- package/src/sdk/models/shared/index.ts +1 -0
- package/src/sdk/models/shared/propertyconnectionpermissions.ts +2 -0
- package/src/sdk/models/shared/webhook.ts +1 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
# Expense
|
|
2
|
+
(*expense*)
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
### Available Operations
|
|
7
|
+
|
|
8
|
+
* [createAccountingExpense](#createaccountingexpense) - Create an expense
|
|
9
|
+
* [getAccountingExpense](#getaccountingexpense) - Retrieve an expense
|
|
10
|
+
* [listAccountingExpenses](#listaccountingexpenses) - List all expenses
|
|
11
|
+
* [patchAccountingExpense](#patchaccountingexpense) - Update an expense
|
|
12
|
+
* [removeAccountingExpense](#removeaccountingexpense) - Remove an expense
|
|
13
|
+
* [updateAccountingExpense](#updateaccountingexpense) - Update an expense
|
|
14
|
+
|
|
15
|
+
## createAccountingExpense
|
|
16
|
+
|
|
17
|
+
Create an expense
|
|
18
|
+
|
|
19
|
+
### Example Usage
|
|
20
|
+
|
|
21
|
+
<!-- UsageSnippet language="typescript" operationID="createAccountingExpense" method="post" path="/accounting/{connection_id}/expense" -->
|
|
22
|
+
```typescript
|
|
23
|
+
import { UnifiedTo } from "@unified-api/typescript-sdk";
|
|
24
|
+
|
|
25
|
+
const unifiedTo = new UnifiedTo({
|
|
26
|
+
security: {
|
|
27
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
async function run() {
|
|
32
|
+
const result = await unifiedTo.expense.createAccountingExpense({
|
|
33
|
+
accountingExpense: {},
|
|
34
|
+
connectionId: "<id>",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
console.log(result);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
run();
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Standalone function
|
|
44
|
+
|
|
45
|
+
The standalone function version of this method:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { UnifiedToCore } from "@unified-api/typescript-sdk/core.js";
|
|
49
|
+
import { accountingCreateAccountingExpense } from "@unified-api/typescript-sdk/funcs/accountingCreateAccountingExpense.js";
|
|
50
|
+
|
|
51
|
+
// Use `UnifiedToCore` for best tree-shaking performance.
|
|
52
|
+
// You can create one instance of it to use across an application.
|
|
53
|
+
const unifiedTo = new UnifiedToCore({
|
|
54
|
+
security: {
|
|
55
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
async function run() {
|
|
60
|
+
const res = await accountingCreateAccountingExpense(unifiedTo, {
|
|
61
|
+
accountingExpense: {},
|
|
62
|
+
connectionId: "<id>",
|
|
63
|
+
});
|
|
64
|
+
if (res.ok) {
|
|
65
|
+
const { value: result } = res;
|
|
66
|
+
console.log(result);
|
|
67
|
+
} else {
|
|
68
|
+
console.log("accountingCreateAccountingExpense failed:", res.error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
run();
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Parameters
|
|
76
|
+
|
|
77
|
+
| Parameter | Type | Required | Description |
|
|
78
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
79
|
+
| `request` | [operations.CreateAccountingExpenseRequest](../../sdk/models/operations/createaccountingexpenserequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
80
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
81
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
82
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
83
|
+
|
|
84
|
+
### Response
|
|
85
|
+
|
|
86
|
+
**Promise\<[shared.AccountingExpense](../../sdk/models/shared/accountingexpense.md)\>**
|
|
87
|
+
|
|
88
|
+
### Errors
|
|
89
|
+
|
|
90
|
+
| Error Type | Status Code | Content Type |
|
|
91
|
+
| --------------- | --------------- | --------------- |
|
|
92
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
93
|
+
|
|
94
|
+
## getAccountingExpense
|
|
95
|
+
|
|
96
|
+
Retrieve an expense
|
|
97
|
+
|
|
98
|
+
### Example Usage
|
|
99
|
+
|
|
100
|
+
<!-- UsageSnippet language="typescript" operationID="getAccountingExpense" method="get" path="/accounting/{connection_id}/expense/{id}" -->
|
|
101
|
+
```typescript
|
|
102
|
+
import { UnifiedTo } from "@unified-api/typescript-sdk";
|
|
103
|
+
|
|
104
|
+
const unifiedTo = new UnifiedTo({
|
|
105
|
+
security: {
|
|
106
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
async function run() {
|
|
111
|
+
const result = await unifiedTo.expense.getAccountingExpense({
|
|
112
|
+
connectionId: "<id>",
|
|
113
|
+
id: "<id>",
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
console.log(result);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
run();
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Standalone function
|
|
123
|
+
|
|
124
|
+
The standalone function version of this method:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { UnifiedToCore } from "@unified-api/typescript-sdk/core.js";
|
|
128
|
+
import { accountingGetAccountingExpense } from "@unified-api/typescript-sdk/funcs/accountingGetAccountingExpense.js";
|
|
129
|
+
|
|
130
|
+
// Use `UnifiedToCore` for best tree-shaking performance.
|
|
131
|
+
// You can create one instance of it to use across an application.
|
|
132
|
+
const unifiedTo = new UnifiedToCore({
|
|
133
|
+
security: {
|
|
134
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
async function run() {
|
|
139
|
+
const res = await accountingGetAccountingExpense(unifiedTo, {
|
|
140
|
+
connectionId: "<id>",
|
|
141
|
+
id: "<id>",
|
|
142
|
+
});
|
|
143
|
+
if (res.ok) {
|
|
144
|
+
const { value: result } = res;
|
|
145
|
+
console.log(result);
|
|
146
|
+
} else {
|
|
147
|
+
console.log("accountingGetAccountingExpense failed:", res.error);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
run();
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Parameters
|
|
155
|
+
|
|
156
|
+
| Parameter | Type | Required | Description |
|
|
157
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
158
|
+
| `request` | [operations.GetAccountingExpenseRequest](../../sdk/models/operations/getaccountingexpenserequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
159
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
160
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
161
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
162
|
+
|
|
163
|
+
### Response
|
|
164
|
+
|
|
165
|
+
**Promise\<[shared.AccountingExpense](../../sdk/models/shared/accountingexpense.md)\>**
|
|
166
|
+
|
|
167
|
+
### Errors
|
|
168
|
+
|
|
169
|
+
| Error Type | Status Code | Content Type |
|
|
170
|
+
| --------------- | --------------- | --------------- |
|
|
171
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
172
|
+
|
|
173
|
+
## listAccountingExpenses
|
|
174
|
+
|
|
175
|
+
List all expenses
|
|
176
|
+
|
|
177
|
+
### Example Usage
|
|
178
|
+
|
|
179
|
+
<!-- UsageSnippet language="typescript" operationID="listAccountingExpenses" method="get" path="/accounting/{connection_id}/expense" -->
|
|
180
|
+
```typescript
|
|
181
|
+
import { UnifiedTo } from "@unified-api/typescript-sdk";
|
|
182
|
+
|
|
183
|
+
const unifiedTo = new UnifiedTo({
|
|
184
|
+
security: {
|
|
185
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
async function run() {
|
|
190
|
+
const result = await unifiedTo.expense.listAccountingExpenses({
|
|
191
|
+
connectionId: "<id>",
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
console.log(result);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
run();
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Standalone function
|
|
201
|
+
|
|
202
|
+
The standalone function version of this method:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
import { UnifiedToCore } from "@unified-api/typescript-sdk/core.js";
|
|
206
|
+
import { accountingListAccountingExpenses } from "@unified-api/typescript-sdk/funcs/accountingListAccountingExpenses.js";
|
|
207
|
+
|
|
208
|
+
// Use `UnifiedToCore` for best tree-shaking performance.
|
|
209
|
+
// You can create one instance of it to use across an application.
|
|
210
|
+
const unifiedTo = new UnifiedToCore({
|
|
211
|
+
security: {
|
|
212
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
async function run() {
|
|
217
|
+
const res = await accountingListAccountingExpenses(unifiedTo, {
|
|
218
|
+
connectionId: "<id>",
|
|
219
|
+
});
|
|
220
|
+
if (res.ok) {
|
|
221
|
+
const { value: result } = res;
|
|
222
|
+
console.log(result);
|
|
223
|
+
} else {
|
|
224
|
+
console.log("accountingListAccountingExpenses failed:", res.error);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
run();
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Parameters
|
|
232
|
+
|
|
233
|
+
| Parameter | Type | Required | Description |
|
|
234
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
235
|
+
| `request` | [operations.ListAccountingExpensesRequest](../../sdk/models/operations/listaccountingexpensesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
236
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
237
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
238
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
239
|
+
|
|
240
|
+
### Response
|
|
241
|
+
|
|
242
|
+
**Promise\<[shared.AccountingExpense[]](../../models/.md)\>**
|
|
243
|
+
|
|
244
|
+
### Errors
|
|
245
|
+
|
|
246
|
+
| Error Type | Status Code | Content Type |
|
|
247
|
+
| --------------- | --------------- | --------------- |
|
|
248
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
249
|
+
|
|
250
|
+
## patchAccountingExpense
|
|
251
|
+
|
|
252
|
+
Update an expense
|
|
253
|
+
|
|
254
|
+
### Example Usage
|
|
255
|
+
|
|
256
|
+
<!-- UsageSnippet language="typescript" operationID="patchAccountingExpense" method="patch" path="/accounting/{connection_id}/expense/{id}" -->
|
|
257
|
+
```typescript
|
|
258
|
+
import { UnifiedTo } from "@unified-api/typescript-sdk";
|
|
259
|
+
|
|
260
|
+
const unifiedTo = new UnifiedTo({
|
|
261
|
+
security: {
|
|
262
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
async function run() {
|
|
267
|
+
const result = await unifiedTo.expense.patchAccountingExpense({
|
|
268
|
+
accountingExpense: {},
|
|
269
|
+
connectionId: "<id>",
|
|
270
|
+
id: "<id>",
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
console.log(result);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
run();
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Standalone function
|
|
280
|
+
|
|
281
|
+
The standalone function version of this method:
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
import { UnifiedToCore } from "@unified-api/typescript-sdk/core.js";
|
|
285
|
+
import { accountingPatchAccountingExpense } from "@unified-api/typescript-sdk/funcs/accountingPatchAccountingExpense.js";
|
|
286
|
+
|
|
287
|
+
// Use `UnifiedToCore` for best tree-shaking performance.
|
|
288
|
+
// You can create one instance of it to use across an application.
|
|
289
|
+
const unifiedTo = new UnifiedToCore({
|
|
290
|
+
security: {
|
|
291
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
292
|
+
},
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
async function run() {
|
|
296
|
+
const res = await accountingPatchAccountingExpense(unifiedTo, {
|
|
297
|
+
accountingExpense: {},
|
|
298
|
+
connectionId: "<id>",
|
|
299
|
+
id: "<id>",
|
|
300
|
+
});
|
|
301
|
+
if (res.ok) {
|
|
302
|
+
const { value: result } = res;
|
|
303
|
+
console.log(result);
|
|
304
|
+
} else {
|
|
305
|
+
console.log("accountingPatchAccountingExpense failed:", res.error);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
run();
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Parameters
|
|
313
|
+
|
|
314
|
+
| Parameter | Type | Required | Description |
|
|
315
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
316
|
+
| `request` | [operations.PatchAccountingExpenseRequest](../../sdk/models/operations/patchaccountingexpenserequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
317
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
318
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
319
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
320
|
+
|
|
321
|
+
### Response
|
|
322
|
+
|
|
323
|
+
**Promise\<[shared.AccountingExpense](../../sdk/models/shared/accountingexpense.md)\>**
|
|
324
|
+
|
|
325
|
+
### Errors
|
|
326
|
+
|
|
327
|
+
| Error Type | Status Code | Content Type |
|
|
328
|
+
| --------------- | --------------- | --------------- |
|
|
329
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
330
|
+
|
|
331
|
+
## removeAccountingExpense
|
|
332
|
+
|
|
333
|
+
Remove an expense
|
|
334
|
+
|
|
335
|
+
### Example Usage
|
|
336
|
+
|
|
337
|
+
<!-- UsageSnippet language="typescript" operationID="removeAccountingExpense" method="delete" path="/accounting/{connection_id}/expense/{id}" -->
|
|
338
|
+
```typescript
|
|
339
|
+
import { UnifiedTo } from "@unified-api/typescript-sdk";
|
|
340
|
+
|
|
341
|
+
const unifiedTo = new UnifiedTo({
|
|
342
|
+
security: {
|
|
343
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
344
|
+
},
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
async function run() {
|
|
348
|
+
const result = await unifiedTo.expense.removeAccountingExpense({
|
|
349
|
+
connectionId: "<id>",
|
|
350
|
+
id: "<id>",
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
console.log(result);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
run();
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Standalone function
|
|
360
|
+
|
|
361
|
+
The standalone function version of this method:
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
import { UnifiedToCore } from "@unified-api/typescript-sdk/core.js";
|
|
365
|
+
import { accountingRemoveAccountingExpense } from "@unified-api/typescript-sdk/funcs/accountingRemoveAccountingExpense.js";
|
|
366
|
+
|
|
367
|
+
// Use `UnifiedToCore` for best tree-shaking performance.
|
|
368
|
+
// You can create one instance of it to use across an application.
|
|
369
|
+
const unifiedTo = new UnifiedToCore({
|
|
370
|
+
security: {
|
|
371
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
async function run() {
|
|
376
|
+
const res = await accountingRemoveAccountingExpense(unifiedTo, {
|
|
377
|
+
connectionId: "<id>",
|
|
378
|
+
id: "<id>",
|
|
379
|
+
});
|
|
380
|
+
if (res.ok) {
|
|
381
|
+
const { value: result } = res;
|
|
382
|
+
console.log(result);
|
|
383
|
+
} else {
|
|
384
|
+
console.log("accountingRemoveAccountingExpense failed:", res.error);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
run();
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Parameters
|
|
392
|
+
|
|
393
|
+
| Parameter | Type | Required | Description |
|
|
394
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
395
|
+
| `request` | [operations.RemoveAccountingExpenseRequest](../../sdk/models/operations/removeaccountingexpenserequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
396
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
397
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
398
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
399
|
+
|
|
400
|
+
### Response
|
|
401
|
+
|
|
402
|
+
**Promise\<[operations.RemoveAccountingExpenseResponse](../../sdk/models/operations/removeaccountingexpenseresponse.md)\>**
|
|
403
|
+
|
|
404
|
+
### Errors
|
|
405
|
+
|
|
406
|
+
| Error Type | Status Code | Content Type |
|
|
407
|
+
| --------------- | --------------- | --------------- |
|
|
408
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
409
|
+
|
|
410
|
+
## updateAccountingExpense
|
|
411
|
+
|
|
412
|
+
Update an expense
|
|
413
|
+
|
|
414
|
+
### Example Usage
|
|
415
|
+
|
|
416
|
+
<!-- UsageSnippet language="typescript" operationID="updateAccountingExpense" method="put" path="/accounting/{connection_id}/expense/{id}" -->
|
|
417
|
+
```typescript
|
|
418
|
+
import { UnifiedTo } from "@unified-api/typescript-sdk";
|
|
419
|
+
|
|
420
|
+
const unifiedTo = new UnifiedTo({
|
|
421
|
+
security: {
|
|
422
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
423
|
+
},
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
async function run() {
|
|
427
|
+
const result = await unifiedTo.expense.updateAccountingExpense({
|
|
428
|
+
accountingExpense: {},
|
|
429
|
+
connectionId: "<id>",
|
|
430
|
+
id: "<id>",
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
console.log(result);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
run();
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Standalone function
|
|
440
|
+
|
|
441
|
+
The standalone function version of this method:
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
import { UnifiedToCore } from "@unified-api/typescript-sdk/core.js";
|
|
445
|
+
import { accountingUpdateAccountingExpense } from "@unified-api/typescript-sdk/funcs/accountingUpdateAccountingExpense.js";
|
|
446
|
+
|
|
447
|
+
// Use `UnifiedToCore` for best tree-shaking performance.
|
|
448
|
+
// You can create one instance of it to use across an application.
|
|
449
|
+
const unifiedTo = new UnifiedToCore({
|
|
450
|
+
security: {
|
|
451
|
+
jwt: "<YOUR_API_KEY_HERE>",
|
|
452
|
+
},
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
async function run() {
|
|
456
|
+
const res = await accountingUpdateAccountingExpense(unifiedTo, {
|
|
457
|
+
accountingExpense: {},
|
|
458
|
+
connectionId: "<id>",
|
|
459
|
+
id: "<id>",
|
|
460
|
+
});
|
|
461
|
+
if (res.ok) {
|
|
462
|
+
const { value: result } = res;
|
|
463
|
+
console.log(result);
|
|
464
|
+
} else {
|
|
465
|
+
console.log("accountingUpdateAccountingExpense failed:", res.error);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
run();
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### Parameters
|
|
473
|
+
|
|
474
|
+
| Parameter | Type | Required | Description |
|
|
475
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
476
|
+
| `request` | [operations.UpdateAccountingExpenseRequest](../../sdk/models/operations/updateaccountingexpenserequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
477
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
478
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
479
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
480
|
+
|
|
481
|
+
### Response
|
|
482
|
+
|
|
483
|
+
**Promise\<[shared.AccountingExpense](../../sdk/models/shared/accountingexpense.md)\>**
|
|
484
|
+
|
|
485
|
+
### Errors
|
|
486
|
+
|
|
487
|
+
| Error Type | Status Code | Content Type |
|
|
488
|
+
| --------------- | --------------- | --------------- |
|
|
489
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UnifiedToCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../sdk/models/errors/httpclienterrors.js";
|
|
4
|
+
import { ResponseValidationError } from "../sdk/models/errors/responsevalidationerror.js";
|
|
5
|
+
import { SDKValidationError } from "../sdk/models/errors/sdkvalidationerror.js";
|
|
6
|
+
import { UnifiedToError } from "../sdk/models/errors/unifiedtoerror.js";
|
|
7
|
+
import * as operations from "../sdk/models/operations/index.js";
|
|
8
|
+
import * as shared from "../sdk/models/shared/index.js";
|
|
9
|
+
import { APIPromise } from "../sdk/types/async.js";
|
|
10
|
+
import { Result } from "../sdk/types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Create an expense
|
|
13
|
+
*/
|
|
14
|
+
export declare function accountingCreateAccountingExpense(client: UnifiedToCore, request: operations.CreateAccountingExpenseRequest, options?: RequestOptions): APIPromise<Result<shared.AccountingExpense, UnifiedToError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
15
|
+
//# sourceMappingURL=accountingCreateAccountingExpense.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountingCreateAccountingExpense.d.ts","sourceRoot":"","sources":["../src/funcs/accountingCreateAccountingExpense.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAK3C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,KAAK,UAAU,MAAM,mCAAmC,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAW,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,UAAU,CAAC,8BAA8B,EAClD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CACX,MAAM,CACJ,MAAM,CAAC,iBAAiB,EACtB,cAAc,GACd,uBAAuB,GACvB,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,CACrB,CACF,CAMA"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.accountingCreateAccountingExpense = accountingCreateAccountingExpense;
|
|
40
|
+
const encodings_js_1 = require("../lib/encodings.js");
|
|
41
|
+
const M = __importStar(require("../lib/matchers.js"));
|
|
42
|
+
const primitives_js_1 = require("../lib/primitives.js");
|
|
43
|
+
const schemas_js_1 = require("../lib/schemas.js");
|
|
44
|
+
const security_js_1 = require("../lib/security.js");
|
|
45
|
+
const url_js_1 = require("../lib/url.js");
|
|
46
|
+
const operations = __importStar(require("../sdk/models/operations/index.js"));
|
|
47
|
+
const shared = __importStar(require("../sdk/models/shared/index.js"));
|
|
48
|
+
const async_js_1 = require("../sdk/types/async.js");
|
|
49
|
+
/**
|
|
50
|
+
* Create an expense
|
|
51
|
+
*/
|
|
52
|
+
function accountingCreateAccountingExpense(client, request, options) {
|
|
53
|
+
return new async_js_1.APIPromise($do(client, request, options));
|
|
54
|
+
}
|
|
55
|
+
async function $do(client, request, options) {
|
|
56
|
+
const parsed = (0, schemas_js_1.safeParse)(request, (value) => operations.CreateAccountingExpenseRequest$outboundSchema.parse(value), "Input validation failed");
|
|
57
|
+
if (!parsed.ok) {
|
|
58
|
+
return [parsed, { status: "invalid" }];
|
|
59
|
+
}
|
|
60
|
+
const payload = parsed.value;
|
|
61
|
+
const body = (0, encodings_js_1.encodeJSON)("body", payload.AccountingExpense, { explode: true });
|
|
62
|
+
const pathParams = {
|
|
63
|
+
connection_id: (0, encodings_js_1.encodeSimple)("connection_id", payload.connection_id, {
|
|
64
|
+
explode: false,
|
|
65
|
+
charEncoding: "percent",
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
const path = (0, url_js_1.pathToFunc)("/accounting/{connection_id}/expense")(pathParams);
|
|
69
|
+
const query = (0, encodings_js_1.encodeFormQuery)({
|
|
70
|
+
"fields": payload.fields,
|
|
71
|
+
"raw": payload.raw,
|
|
72
|
+
});
|
|
73
|
+
const headers = new Headers((0, primitives_js_1.compactMap)({
|
|
74
|
+
"Content-Type": "application/json",
|
|
75
|
+
Accept: "application/json",
|
|
76
|
+
}));
|
|
77
|
+
const securityInput = await (0, security_js_1.extractSecurity)(client._options.security);
|
|
78
|
+
const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput);
|
|
79
|
+
const context = {
|
|
80
|
+
options: client._options,
|
|
81
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
82
|
+
operationID: "createAccountingExpense",
|
|
83
|
+
oAuth2Scopes: null,
|
|
84
|
+
resolvedSecurity: requestSecurity,
|
|
85
|
+
securitySource: client._options.security,
|
|
86
|
+
retryConfig: options?.retries
|
|
87
|
+
|| client._options.retryConfig
|
|
88
|
+
|| { strategy: "none" },
|
|
89
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
90
|
+
};
|
|
91
|
+
const requestRes = client._createRequest(context, {
|
|
92
|
+
security: requestSecurity,
|
|
93
|
+
method: "POST",
|
|
94
|
+
baseURL: options?.serverURL,
|
|
95
|
+
path: path,
|
|
96
|
+
headers: headers,
|
|
97
|
+
query: query,
|
|
98
|
+
body: body,
|
|
99
|
+
userAgent: client._options.userAgent,
|
|
100
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
101
|
+
}, options);
|
|
102
|
+
if (!requestRes.ok) {
|
|
103
|
+
return [requestRes, { status: "invalid" }];
|
|
104
|
+
}
|
|
105
|
+
const req = requestRes.value;
|
|
106
|
+
const doResult = await client._do(req, {
|
|
107
|
+
context,
|
|
108
|
+
errorCodes: ["4XX", "5XX"],
|
|
109
|
+
retryConfig: context.retryConfig,
|
|
110
|
+
retryCodes: context.retryCodes,
|
|
111
|
+
});
|
|
112
|
+
if (!doResult.ok) {
|
|
113
|
+
return [doResult, { status: "request-error", request: req }];
|
|
114
|
+
}
|
|
115
|
+
const response = doResult.value;
|
|
116
|
+
const [result] = await M.match(M.json(200, shared.AccountingExpense$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req);
|
|
117
|
+
if (!result.ok) {
|
|
118
|
+
return [result, { status: "complete", request: req, response }];
|
|
119
|
+
}
|
|
120
|
+
return [result, { status: "complete", request: req, response }];
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=accountingCreateAccountingExpense.js.map
|