qubesync 0.1.0 → 0.2.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/CHANGELOG.md +38 -2
- package/README.md +188 -5
- package/client.js +660 -0
- package/index.d.ts +211 -1
- package/index.js +5 -1
- package/index.mjs +2 -0
- package/operations/account.d.ts +263 -0
- package/operations/account.js +50 -0
- package/operations/account_tax_line_info.d.ts +31 -0
- package/operations/account_tax_line_info.js +26 -0
- package/operations/aging_report.d.ts +100 -0
- package/operations/aging_report.js +26 -0
- package/operations/alert.d.ts +118 -0
- package/operations/alert.js +50 -0
- package/operations/ar_refund_credit_card.d.ts +201 -0
- package/operations/ar_refund_credit_card.js +38 -0
- package/operations/bar_code.d.ts +40 -0
- package/operations/bar_code.js +26 -0
- package/operations/bill.d.ts +612 -0
- package/operations/bill.js +50 -0
- package/operations/bill_payment_check.d.ts +276 -0
- package/operations/bill_payment_check.js +50 -0
- package/operations/bill_payment_credit_card.d.ts +178 -0
- package/operations/bill_payment_credit_card.js +38 -0
- package/operations/bill_to_pay.d.ts +54 -0
- package/operations/bill_to_pay.js +26 -0
- package/operations/billing_rate.d.ts +159 -0
- package/operations/billing_rate.js +38 -0
- package/operations/budget_summary_report.d.ts +71 -0
- package/operations/budget_summary_report.js +26 -0
- package/operations/build_assembly.d.ts +264 -0
- package/operations/build_assembly.js +50 -0
- package/operations/charge.d.ts +330 -0
- package/operations/charge.js +50 -0
- package/operations/check.d.ts +394 -0
- package/operations/check.js +50 -0
- package/operations/class.d.ts +170 -0
- package/operations/class.js +50 -0
- package/operations/cleared_status.d.ts +43 -0
- package/operations/cleared_status.js +26 -0
- package/operations/client.d.ts +254 -0
- package/operations/company.d.ts +36 -0
- package/operations/company.js +26 -0
- package/operations/company_activity.d.ts +32 -0
- package/operations/company_activity.js +26 -0
- package/operations/credit_card_charge.d.ts +280 -0
- package/operations/credit_card_charge.js +50 -0
- package/operations/credit_card_credit.d.ts +280 -0
- package/operations/credit_card_credit.js +50 -0
- package/operations/credit_memo.d.ts +642 -0
- package/operations/credit_memo.js +50 -0
- package/operations/currency.d.ts +195 -0
- package/operations/currency.js +50 -0
- package/operations/custom_detail_report.d.ts +108 -0
- package/operations/custom_detail_report.js +26 -0
- package/operations/custom_summary_report.d.ts +119 -0
- package/operations/custom_summary_report.js +26 -0
- package/operations/customer.d.ts +639 -0
- package/operations/customer.js +50 -0
- package/operations/customer_msg.d.ts +121 -0
- package/operations/customer_msg.js +38 -0
- package/operations/customer_type.d.ts +127 -0
- package/operations/customer_type.js +38 -0
- package/operations/data_event_recovery_info.d.ts +61 -0
- package/operations/data_event_recovery_info.js +38 -0
- package/operations/data_ext.d.ts +197 -0
- package/operations/data_ext.js +50 -0
- package/operations/data_ext_def.d.ts +173 -0
- package/operations/data_ext_def.js +62 -0
- package/operations/date_driven_terms.d.ts +141 -0
- package/operations/date_driven_terms.js +38 -0
- package/operations/deposit.d.ts +402 -0
- package/operations/deposit.js +50 -0
- package/operations/employee.d.ts +683 -0
- package/operations/employee.js +50 -0
- package/operations/employee_default.d.ts +133 -0
- package/operations/employee_default.js +38 -0
- package/operations/entity.d.ts +96 -0
- package/operations/entity.js +26 -0
- package/operations/estimate.d.ts +590 -0
- package/operations/estimate.js +50 -0
- package/operations/form1099_category_account_mapping.d.ts +89 -0
- package/operations/form1099_category_account_mapping.js +38 -0
- package/operations/general_detail_report.d.ts +108 -0
- package/operations/general_detail_report.js +26 -0
- package/operations/general_summary_report.d.ts +115 -0
- package/operations/general_summary_report.js +26 -0
- package/operations/host.d.ts +43 -0
- package/operations/host.js +26 -0
- package/operations/index.js +397 -0
- package/operations/inventory_adjustment.d.ts +389 -0
- package/operations/inventory_adjustment.js +50 -0
- package/operations/inventory_site.d.ts +247 -0
- package/operations/inventory_site.js +50 -0
- package/operations/invoice.d.ts +682 -0
- package/operations/invoice.js +50 -0
- package/operations/item.d.ts +100 -0
- package/operations/item.js +26 -0
- package/operations/item_assemblies_can_build.d.ts +41 -0
- package/operations/item_assemblies_can_build.js +26 -0
- package/operations/item_discount.d.ts +256 -0
- package/operations/item_discount.js +50 -0
- package/operations/item_fixed_asset.d.ts +382 -0
- package/operations/item_fixed_asset.js +50 -0
- package/operations/item_group.d.ts +236 -0
- package/operations/item_group.js +50 -0
- package/operations/item_inventory.d.ts +350 -0
- package/operations/item_inventory.js +50 -0
- package/operations/item_inventory_assembly.d.ts +368 -0
- package/operations/item_inventory_assembly.js +50 -0
- package/operations/item_non_inventory.d.ts +264 -0
- package/operations/item_non_inventory.js +50 -0
- package/operations/item_other_charge.d.ts +244 -0
- package/operations/item_other_charge.js +50 -0
- package/operations/item_payment.d.ts +220 -0
- package/operations/item_payment.js +50 -0
- package/operations/item_receipt.d.ts +362 -0
- package/operations/item_receipt.js +50 -0
- package/operations/item_sales_tax.d.ts +228 -0
- package/operations/item_sales_tax.js +50 -0
- package/operations/item_sales_tax_group.d.ts +192 -0
- package/operations/item_sales_tax_group.js +50 -0
- package/operations/item_service.d.ts +256 -0
- package/operations/item_service.js +50 -0
- package/operations/item_sites.d.ts +81 -0
- package/operations/item_sites.js +26 -0
- package/operations/item_subtotal.d.ts +188 -0
- package/operations/item_subtotal.js +50 -0
- package/operations/job_report.d.ts +99 -0
- package/operations/job_report.js +26 -0
- package/operations/job_type.d.ts +127 -0
- package/operations/job_type.js +38 -0
- package/operations/journal_entry.d.ts +339 -0
- package/operations/journal_entry.js +50 -0
- package/operations/lead.d.ts +291 -0
- package/operations/lead.js +50 -0
- package/operations/list.d.ts +39 -0
- package/operations/list.js +26 -0
- package/operations/list_deleted.d.ts +44 -0
- package/operations/list_deleted.js +26 -0
- package/operations/list_display.d.ts +65 -0
- package/operations/list_display.js +38 -0
- package/operations/list_merge.d.ts +58 -0
- package/operations/list_merge.js +26 -0
- package/operations/other_name.d.ts +280 -0
- package/operations/other_name.js +50 -0
- package/operations/paycheck.d.ts +82 -0
- package/operations/paycheck.js +26 -0
- package/operations/payment_method.d.ts +131 -0
- package/operations/payment_method.js +38 -0
- package/operations/payroll_detail_report.d.ts +97 -0
- package/operations/payroll_detail_report.js +26 -0
- package/operations/payroll_item.d.ts +83 -0
- package/operations/payroll_item.js +26 -0
- package/operations/payroll_item_addition.d.ts +95 -0
- package/operations/payroll_item_addition.js +38 -0
- package/operations/payroll_item_company_contribution.d.ts +105 -0
- package/operations/payroll_item_company_contribution.js +38 -0
- package/operations/payroll_item_deduction.d.ts +101 -0
- package/operations/payroll_item_deduction.js +38 -0
- package/operations/payroll_item_direct_deposit.d.ts +65 -0
- package/operations/payroll_item_direct_deposit.js +38 -0
- package/operations/payroll_item_non_wage.d.ts +92 -0
- package/operations/payroll_item_non_wage.js +26 -0
- package/operations/payroll_item_tax.d.ts +108 -0
- package/operations/payroll_item_tax.js +38 -0
- package/operations/payroll_item_wage.d.ts +169 -0
- package/operations/payroll_item_wage.js +50 -0
- package/operations/payroll_item_workers_compensation.d.ts +77 -0
- package/operations/payroll_item_workers_compensation.js +38 -0
- package/operations/payroll_last_period.d.ts +31 -0
- package/operations/payroll_last_period.js +26 -0
- package/operations/payroll_liability_adjustment.d.ts +137 -0
- package/operations/payroll_liability_adjustment.js +38 -0
- package/operations/payroll_liability_check.d.ts +82 -0
- package/operations/payroll_liability_check.js +26 -0
- package/operations/payroll_prior_payment.d.ts +126 -0
- package/operations/payroll_prior_payment.js +38 -0
- package/operations/payroll_summary_report.d.ts +107 -0
- package/operations/payroll_summary_report.js +26 -0
- package/operations/payroll_year_to_date_adjustment.d.ts +156 -0
- package/operations/payroll_year_to_date_adjustment.js +38 -0
- package/operations/preferences.d.ts +64 -0
- package/operations/preferences.js +38 -0
- package/operations/price_level.d.ts +234 -0
- package/operations/price_level.js +50 -0
- package/operations/purchase_order.d.ts +620 -0
- package/operations/purchase_order.js +50 -0
- package/operations/qb_command_exec.d.ts +49 -0
- package/operations/qb_command_exec.js +26 -0
- package/operations/receive_payment.d.ts +450 -0
- package/operations/receive_payment.js +50 -0
- package/operations/receive_payment_to_deposit.d.ts +36 -0
- package/operations/receive_payment_to_deposit.js +26 -0
- package/operations/sales_order.d.ts +612 -0
- package/operations/sales_order.js +50 -0
- package/operations/sales_receipt.d.ts +650 -0
- package/operations/sales_receipt.js +50 -0
- package/operations/sales_rep.d.ts +170 -0
- package/operations/sales_rep.js +50 -0
- package/operations/sales_tax_code.d.ts +194 -0
- package/operations/sales_tax_code.js +50 -0
- package/operations/sales_tax_payable.d.ts +42 -0
- package/operations/sales_tax_payable.js +26 -0
- package/operations/sales_tax_payment_check.d.ts +254 -0
- package/operations/sales_tax_payment_check.js +50 -0
- package/operations/sales_tax_return.d.ts +35 -0
- package/operations/sales_tax_return.js +26 -0
- package/operations/sales_tax_return_line.d.ts +36 -0
- package/operations/sales_tax_return_line.js +26 -0
- package/operations/ship_method.d.ts +121 -0
- package/operations/ship_method.js +38 -0
- package/operations/special_account.d.ts +40 -0
- package/operations/special_account.js +26 -0
- package/operations/special_item.d.ts +44 -0
- package/operations/special_item.js +26 -0
- package/operations/standard_terms.d.ts +133 -0
- package/operations/standard_terms.js +38 -0
- package/operations/template.d.ts +36 -0
- package/operations/template.js +26 -0
- package/operations/terms.d.ts +90 -0
- package/operations/terms.js +26 -0
- package/operations/time_report.d.ts +84 -0
- package/operations/time_report.js +26 -0
- package/operations/time_tracking.d.ts +214 -0
- package/operations/time_tracking.js +50 -0
- package/operations/to_do.d.ts +254 -0
- package/operations/to_do.js +50 -0
- package/operations/transaction.d.ts +244 -0
- package/operations/transaction.js +26 -0
- package/operations/transfer.d.ts +178 -0
- package/operations/transfer.js +50 -0
- package/operations/transfer_inventory.d.ts +290 -0
- package/operations/transfer_inventory.js +50 -0
- package/operations/txn.d.ts +39 -0
- package/operations/txn.js +26 -0
- package/operations/txn_deleted.d.ts +44 -0
- package/operations/txn_deleted.js +26 -0
- package/operations/txn_display.d.ts +69 -0
- package/operations/txn_display.js +38 -0
- package/operations/txn_void.d.ts +39 -0
- package/operations/txn_void.js +26 -0
- package/operations/types.d.ts +1259 -0
- package/operations/unit_of_measure_set.d.ts +168 -0
- package/operations/unit_of_measure_set.js +38 -0
- package/operations/vehicle.d.ts +168 -0
- package/operations/vehicle.js +50 -0
- package/operations/vehicle_mileage.d.ts +147 -0
- package/operations/vehicle_mileage.js +38 -0
- package/operations/vendor.d.ts +541 -0
- package/operations/vendor.js +50 -0
- package/operations/vendor_credit.d.ts +365 -0
- package/operations/vendor_credit.js +50 -0
- package/operations/vendor_type.d.ts +127 -0
- package/operations/vendor_type.js +38 -0
- package/operations/workers_comp_code.d.ts +199 -0
- package/operations/workers_comp_code.js +50 -0
- package/package.json +14 -4
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for qubesync (QuBe Sync webhooks).
|
|
1
|
+
// Type definitions for qubesync (the QuBe Sync v2 API client and webhooks).
|
|
2
2
|
|
|
3
3
|
export type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
|
|
4
4
|
export interface JsonObject {
|
|
@@ -155,3 +155,213 @@ export declare function verify(
|
|
|
155
155
|
|
|
156
156
|
/** Parses a body into a typed event without verifying it. */
|
|
157
157
|
export declare function parse(rawBody: RawBody): WebhookEvent;
|
|
158
|
+
|
|
159
|
+
// ---------------------------------------------------------------------------
|
|
160
|
+
// The v2 API client
|
|
161
|
+
|
|
162
|
+
/** What the API answers: plain objects with the API's own snake_case keys. */
|
|
163
|
+
export type ApiObject = { [key: string]: any };
|
|
164
|
+
|
|
165
|
+
export type QueryValue = string | number | boolean | null | undefined;
|
|
166
|
+
export type Query = { [key: string]: QueryValue | readonly QueryValue[] };
|
|
167
|
+
|
|
168
|
+
/** What `onRetry` is told before each retry's wait. Never the API key, headers or body. */
|
|
169
|
+
export interface RetryInfo {
|
|
170
|
+
/** The retry about to be made: 1, 2... */
|
|
171
|
+
readonly attempt: number;
|
|
172
|
+
readonly maxRetries: number;
|
|
173
|
+
/** The wait before it, in ms (the backoff, or the answer's Retry-After). */
|
|
174
|
+
readonly delayMs: number;
|
|
175
|
+
/** Ms since the call started. */
|
|
176
|
+
readonly elapsedMs: number;
|
|
177
|
+
/** Upper case. */
|
|
178
|
+
readonly method: string;
|
|
179
|
+
/** The request URL without its query string. */
|
|
180
|
+
readonly url: string;
|
|
181
|
+
/** The HTTP status that's retried, or null for a network failure or timeout. */
|
|
182
|
+
readonly status: number | null;
|
|
183
|
+
/** The network failure or timeout that's retried, or null for a status. */
|
|
184
|
+
readonly error: Error | null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface ClientOptions {
|
|
188
|
+
/** Your app's API key. Required; the client never reads the environment. */
|
|
189
|
+
apiKey: string;
|
|
190
|
+
/** Default `"https://qubesync.com"`. Trailing slashes are dropped; the API is `baseUrl + "/api/v2"`. */
|
|
191
|
+
baseUrl?: string;
|
|
192
|
+
/** Milliseconds to open the connection. Default 5000. */
|
|
193
|
+
connectTimeout?: number;
|
|
194
|
+
/** Milliseconds the socket may sit idle waiting for the answer. Default 30000. */
|
|
195
|
+
timeout?: number;
|
|
196
|
+
/** Retries for a retry-safe request (GET, PUT, DELETE, or one with an Idempotency-Key). Default 2. */
|
|
197
|
+
maxRetries?: number;
|
|
198
|
+
/** Ms a call may take, retries and their waits included. Default 60000. */
|
|
199
|
+
totalTimeout?: number;
|
|
200
|
+
/** Called before each retry's wait. Anything it throws stops the call and rejects with that error. */
|
|
201
|
+
onRetry?: (info: RetryInfo) => void;
|
|
202
|
+
/** Waits between retries; for tests. Default: setTimeout. */
|
|
203
|
+
sleep?: (ms: number) => Promise<void>;
|
|
204
|
+
/** A monotonic clock in ms; for tests. Default: performance.now. */
|
|
205
|
+
clock?: () => number;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface ConnectionOptions {
|
|
209
|
+
webhookUrl?: string;
|
|
210
|
+
name?: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface StartRunOptions {
|
|
214
|
+
/** Your own id for the run; also sent as the Idempotency-Key. */
|
|
215
|
+
reference: string;
|
|
216
|
+
webhookUrl: string;
|
|
217
|
+
version?: number;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface ListRunsFilters {
|
|
221
|
+
reference?: string;
|
|
222
|
+
state?: string;
|
|
223
|
+
outcome?: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface RunEventsOptions {
|
|
227
|
+
after?: number | string;
|
|
228
|
+
limit?: number;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface RunEventsPage {
|
|
232
|
+
data: ApiObject[];
|
|
233
|
+
next_after: number | string | null;
|
|
234
|
+
[key: string]: any;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface AnswerOptions {
|
|
238
|
+
/** One of the prompt's choices. */
|
|
239
|
+
choice: string | number;
|
|
240
|
+
/** The fields the choice takes. */
|
|
241
|
+
data?: ApiObject;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface SearchOptions {
|
|
245
|
+
field: string;
|
|
246
|
+
q: string;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
import type { OperationOptions, QueuedRequest } from "./operations/types";
|
|
250
|
+
import type { ClientOperations } from "./operations/client";
|
|
251
|
+
export type { OperationOptions, QueuedRequest } from "./operations/types";
|
|
252
|
+
export type { ClientOperations } from "./operations/client";
|
|
253
|
+
|
|
254
|
+
export type QueueMethod = "GET" | "POST" | "PUT" | "DELETE" | "get" | "post" | "put" | "delete";
|
|
255
|
+
|
|
256
|
+
export interface QueueOptions extends OperationOptions {
|
|
257
|
+
/** Needed, with `path`, for an operation id this version doesn't know; case-insensitive. */
|
|
258
|
+
method?: QueueMethod;
|
|
259
|
+
/** Relative to the connection (`"customers"`); needed, with `method`, for an id this version doesn't know. */
|
|
260
|
+
path?: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface QueueQbxmlOptions {
|
|
264
|
+
webhookUrl: string;
|
|
265
|
+
idempotencyKey?: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface ListRequestsFilters {
|
|
269
|
+
page?: number;
|
|
270
|
+
pageSize?: number;
|
|
271
|
+
state?: string;
|
|
272
|
+
webhookState?: string;
|
|
273
|
+
sort?: string;
|
|
274
|
+
sortDirection?: "asc" | "desc" | string;
|
|
275
|
+
searchPhrase?: string;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface RequestsPage {
|
|
279
|
+
data: ApiObject[];
|
|
280
|
+
meta: { page: number; total_pages: number; [key: string]: any };
|
|
281
|
+
[key: string]: any;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface RequestOptions {
|
|
285
|
+
query?: Query;
|
|
286
|
+
headers?: { [name: string]: string | number | undefined };
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* The QuBe Sync v2 API. Every method returns a Promise of the response's `data`, or null
|
|
291
|
+
* for an empty answer. A non-2xx answer rejects with `APIError`; a connection that still fails
|
|
292
|
+
* after the retries rejects with Node's own error. A link on another origin than `baseUrl`
|
|
293
|
+
* rejects with a `TypeError` before any request is made.
|
|
294
|
+
*/
|
|
295
|
+
/** The entity accessors (`qube.customer`, `qube.customerMsg`...) come from `ClientOperations`. */
|
|
296
|
+
export interface Client extends ClientOperations {}
|
|
297
|
+
export declare class Client {
|
|
298
|
+
constructor(options: ClientOptions);
|
|
299
|
+
readonly baseUrl: string;
|
|
300
|
+
readonly connectTimeout: number;
|
|
301
|
+
readonly timeout: number;
|
|
302
|
+
readonly maxRetries: number;
|
|
303
|
+
readonly totalTimeout: number;
|
|
304
|
+
toJSON(): { baseUrl: string };
|
|
305
|
+
|
|
306
|
+
createConnection(options: ConnectionOptions & { webhookUrl: string }): Promise<ApiObject>;
|
|
307
|
+
getConnection(id: string): Promise<ApiObject>;
|
|
308
|
+
listConnections(): Promise<ApiObject[]>;
|
|
309
|
+
updateConnection(id: string, options: ConnectionOptions): Promise<ApiObject>;
|
|
310
|
+
/** Null on success, and on a retry's 404 after an earlier attempt's answer was lost. */
|
|
311
|
+
deleteConnection(id: string): Promise<null>;
|
|
312
|
+
regenerateOnboarding(id: string): Promise<ApiObject>;
|
|
313
|
+
/** `{ id, password }`. Without `password`, QuBe Sync makes one. */
|
|
314
|
+
setPassword(id: string, options?: { password?: string }): Promise<ApiObject>;
|
|
315
|
+
/** The QWC file's XML. */
|
|
316
|
+
getQwc(id: string): Promise<string>;
|
|
317
|
+
|
|
318
|
+
startRun(connectionId: string, workflow: string, input: ApiObject, options: StartRunOptions): Promise<ApiObject>;
|
|
319
|
+
/** A run by its `links.run` URL, or by connection and run id. */
|
|
320
|
+
getRun(runUrl: string): Promise<ApiObject>;
|
|
321
|
+
getRun(connectionId: string, runId: string): Promise<ApiObject>;
|
|
322
|
+
listRuns(connectionId: string, filters?: ListRunsFilters): Promise<ApiObject[]>;
|
|
323
|
+
/** Takes the run's `links.cancel`. */
|
|
324
|
+
cancelRun(cancelUrl: string, options?: { reason?: string }): Promise<ApiObject>;
|
|
325
|
+
/** The whole body, `{ data, next_after }`. */
|
|
326
|
+
runEvents(connectionId: string, runId: string, options?: RunEventsOptions): Promise<RunEventsPage>;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Takes the prompt's `links.decisions`. Retried when the link has a `prompt_token`; a retry after
|
|
330
|
+
* a lost answer may reject with a 409 `prompt_changed`: the question has been answered.
|
|
331
|
+
*/
|
|
332
|
+
answer(decisionsUrl: string, options: AnswerOptions): Promise<ApiObject>;
|
|
333
|
+
/** Takes the prompt's `links.search`. */
|
|
334
|
+
search(searchUrl: string, options: SearchOptions): Promise<ApiObject[]>;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Queues any operation by its id (`"customer.create"`), as `qube.customer.create(...)` does. An id
|
|
338
|
+
* this version doesn't know (an operation newer than it) needs `method` and `path`.
|
|
339
|
+
*/
|
|
340
|
+
queue(operationId: string, connectionId: string, params: ApiObject | undefined, options: QueueOptions): Promise<QueuedRequest>;
|
|
341
|
+
queueQbxml(connectionId: string, requestXml: string, options: QueueQbxmlOptions): Promise<ApiObject>;
|
|
342
|
+
getRequest(connectionId: string, id: string): Promise<ApiObject>;
|
|
343
|
+
requestPages(connectionId: string, id: string): Promise<ApiObject[]>;
|
|
344
|
+
/** The whole body, `{ data, meta: { page, total_pages } }`. */
|
|
345
|
+
listRequests(connectionId: string, filters?: ListRequestsFilters): Promise<RequestsPage>;
|
|
346
|
+
/** Every request on every page. */
|
|
347
|
+
eachRequest(connectionId: string, filters?: Omit<ListRequestsFilters, "page">): AsyncGenerator<ApiObject, void, undefined>;
|
|
348
|
+
discardRequest(connectionId: string, id: string): Promise<ApiObject>;
|
|
349
|
+
|
|
350
|
+
/** Any v2 call: a path under /api/v2 or a same-origin URL. Returns the parsed body whole, or null. */
|
|
351
|
+
request(method: string, pathOrUrl: string, body?: unknown, options?: RequestOptions): Promise<any>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** Any answer outside 2xx. The message is one line and never holds the API key. */
|
|
355
|
+
export declare class APIError extends Error {
|
|
356
|
+
readonly name: "APIError";
|
|
357
|
+
/** The HTTP status. */
|
|
358
|
+
readonly status: number;
|
|
359
|
+
/** `errors["code"]` when `errors` is an object with a string code (`prompt_changed`, `not_awaiting_input`). */
|
|
360
|
+
readonly code: string | null;
|
|
361
|
+
/** The body's `errors` as parsed: a sentence, `{ detail, code }`, fields, or `{ path, message }` problems. */
|
|
362
|
+
readonly errors: string | ApiObject | ApiObject[] | null;
|
|
363
|
+
/** The raw response body. */
|
|
364
|
+
readonly body: string;
|
|
365
|
+
/** The `x-request-id` header, for support. */
|
|
366
|
+
readonly requestId: string | null;
|
|
367
|
+
}
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
const crypto = require("crypto");
|
|
7
7
|
|
|
8
|
-
const VERSION = "0.
|
|
8
|
+
const VERSION = "0.2.0";
|
|
9
9
|
const SIGNATURE_HEADER = "X-QUBE-Signature";
|
|
10
10
|
const DEFAULT_TOLERANCE = 300;
|
|
11
11
|
const REASONS = Object.freeze(["missing", "malformed", "stale", "mismatch"]);
|
|
@@ -387,6 +387,8 @@ function verify(rawBody, header, options) {
|
|
|
387
387
|
return parse(bytes);
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
+
const { Client, APIError } = require("./client");
|
|
391
|
+
|
|
390
392
|
module.exports = {
|
|
391
393
|
VERSION,
|
|
392
394
|
SIGNATURE_HEADER,
|
|
@@ -402,4 +404,6 @@ module.exports = {
|
|
|
402
404
|
ConnectionEvent,
|
|
403
405
|
NameIndexEvent,
|
|
404
406
|
UnknownEvent,
|
|
407
|
+
Client,
|
|
408
|
+
APIError,
|
|
405
409
|
};
|
package/index.mjs
CHANGED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
// Generated from operations.json by scripts/generate-operations.js: don't edit.
|
|
2
|
+
|
|
3
|
+
import type { Client } from "../index";
|
|
4
|
+
import type { OperationOptions, QueuedRequest, CurrencyFilter, CurrencyRef, NameFilter, NameRangeFilter } from "./types";
|
|
5
|
+
|
|
6
|
+
/** QuickBooks account operations: `qube.account.<action>(connectionId, params, { webhookUrl })`. */
|
|
7
|
+
export declare class Account {
|
|
8
|
+
constructor(client: Client);
|
|
9
|
+
/**
|
|
10
|
+
* Create account: `POST /connections/{connection_id}/accounts`, queued for QuickBooks.
|
|
11
|
+
*
|
|
12
|
+
* The answer comes to `webhookUrl` as one webhook.
|
|
13
|
+
* Params go in the JSON body.
|
|
14
|
+
*
|
|
15
|
+
* Fields: `account_number`, `account_type` (required), `bank_number`, `currency_ref`, `desc`, `detail_account_type`, `include_ret_element`, `is_active`, `name` (required), `open_balance`, `open_balance_date`, `parent_ref`, `request_id`, `sales_tax_code_ref`, `tax_line_id`.
|
|
16
|
+
*
|
|
17
|
+
* Resolves to the queued request.
|
|
18
|
+
* @see https://docs.qubesync.com/api-reference/v2/accounts/create-account
|
|
19
|
+
*/
|
|
20
|
+
create(connectionId: string, params: AccountCreateParams, options: OperationOptions): Promise<QueuedRequest>;
|
|
21
|
+
/**
|
|
22
|
+
* List accounts: `GET /connections/{connection_id}/accounts`, queued for QuickBooks.
|
|
23
|
+
*
|
|
24
|
+
* The answer comes to `webhookUrl` as one webhook.
|
|
25
|
+
* Params go in the query string.
|
|
26
|
+
*
|
|
27
|
+
* Fields: `account_type`, `active_status`, `currency_filter`, `from_modified_date`, `full_name`, `include_ret_element`, `list_id`, `max_returned`, `meta_data`, `name_filter`, `name_range_filter`, `owner_id`, `request_id`, `to_modified_date`.
|
|
28
|
+
*
|
|
29
|
+
* Resolves to the queued request.
|
|
30
|
+
* @see https://docs.qubesync.com/api-reference/v2/accounts/list-accounts
|
|
31
|
+
*/
|
|
32
|
+
query(connectionId: string, params: AccountQueryParams | undefined, options: OperationOptions): Promise<QueuedRequest>;
|
|
33
|
+
/**
|
|
34
|
+
* Update account: `PUT /connections/{connection_id}/accounts`, queued for QuickBooks.
|
|
35
|
+
*
|
|
36
|
+
* The answer comes to `webhookUrl` as one webhook.
|
|
37
|
+
* Params go in the JSON body.
|
|
38
|
+
*
|
|
39
|
+
* Fields: `account_number`, `account_type`, `bank_number`, `currency_ref`, `desc`, `edit_sequence` (required), `include_ret_element`, `is_active`, `list_id` (required), `name`, `open_balance`, `open_balance_date`, `parent_ref`, `request_id`, `sales_tax_code_ref`, `tax_line_id`.
|
|
40
|
+
*
|
|
41
|
+
* Resolves to the queued request.
|
|
42
|
+
* @see https://docs.qubesync.com/api-reference/v2/accounts/update-account
|
|
43
|
+
*/
|
|
44
|
+
update(connectionId: string, params: AccountUpdateParams, options: OperationOptions): Promise<QueuedRequest>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The params of `account.create`: Create account.
|
|
49
|
+
*/
|
|
50
|
+
export interface AccountCreateParams {
|
|
51
|
+
/**
|
|
52
|
+
* Account numbers appear in the QuickBooks chart of accounts, Account fields, and reports and graphs. If the IsUsingAccountNumber preference is false (that is, if the QuickBooks user has the account numbers Preference turned off), you can still set account numbers through the SDK, but the numbers won’t be visible in the user interface.
|
|
53
|
+
*/
|
|
54
|
+
account_number?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The type of QuickBooks account. You can’t create or modify a non-posting account through the SDK, because QuickBooks creates these accounts behind the scenes. This means that you can’t send an AccountAdd request with an `account_type` of NonPosting.
|
|
57
|
+
*/
|
|
58
|
+
account_type: "AccountsPayable" | "AccountsReceivable" | "Bank" | "CostOfGoodsSold" | "CreditCard" | "Equity" | "Expense" | "FixedAsset" | "Income" | "LongTermLiability" | "NonPosting" | "OtherAsset" | "OtherCurrentAsset" | "OtherCurrentLiability" | "OtherExpense" | "OtherIncome";
|
|
59
|
+
/**
|
|
60
|
+
* The bank account number or an identifying note about the account. If a `bank_number` exists in a QuickBooks company file, it will only be returned to applications that have been granted permission to access sensitive data and that are using SDK v2.0 or greater.
|
|
61
|
+
*/
|
|
62
|
+
bank_number?: string;
|
|
63
|
+
/**
|
|
64
|
+
* A currency record defines how QuickBooks stores and displays a currency. Built-in currency name/code values are fixed; formatting and active status can vary by settings and workflow.
|
|
65
|
+
*/
|
|
66
|
+
currency_ref?: CurrencyRef;
|
|
67
|
+
/**
|
|
68
|
+
* A descriptive text field.
|
|
69
|
+
*/
|
|
70
|
+
desc?: string;
|
|
71
|
+
detail_account_type?: "AP" | "AR" | "AccumulatedAdjustment" | "AccumulatedAmortization" | "AccumulatedAmortizationOfOtherAssets" | "AccumulatedDepletion" | "AccumulatedDepreciation" | "AdvertisingOrPromotional" | "AllowanceForBadDebts" | "Amortization" | "Auto" | "BadDebts" | "BankCharges" | "Buildings" | "CashOnHand" | "CharitableContributions" | "Checking" | "CommonStock" | "CostOfLabor" | "CostOfLaborCOS" | "CreditCard" | "DepletableAssets" | "Depreciation" | "DevelopmentCosts" | "DiscountsOrRefundsGiven" | "DividendIncome" | "DuesAndSubscriptions" | "EmployeeCashAdvances" | "Entertainment" | "EntertainmentMeals" | "EquipmentRental" | "EquipmentRentalCOS" | "FederalIncomeTaxPayable" | "FurnitureAndFixtures" | "Goodwill" | "Insurance" | "InsurancePayable" | "IntangibleAssets" | "InterestEarned" | "InterestPaid" | "Inventory" | "InvestmentMortgageOrRealEstateLoans" | "InvestmentOther" | "InvestmentTaxExemptSecurities" | "InvestmentUSGovObligations" | "Land" | "LeaseBuyout" | "LeaseholdImprovements" | "LegalAndProfessionalFees" | "Licenses" | "LineOfCredit" | "LoanPayable" | "LoansToOfficers" | "LoansToOthers" | "LoansToStockholders" | "MachineryAndEquipment" | "MoneyMarket" | "NonProfitIncome" | "NotesPayable" | "OfficeOrGeneralAdministrativeExpenses" | "OpeningBalanceEquity" | "OrganizationalCosts" | "OtherCostsOfServiceCOS" | "OtherCurrentAssets" | "OtherCurrentLiab" | "OtherFixedAssets" | "OtherInvestmentIncome" | "OtherLongTermAssets" | "OtherLongTermLiab" | "OtherMiscExpense" | "OtherMiscIncome" | "OtherMiscServiceCost" | "OtherPrimaryIncome" | "OwnersEquity" | "PaidInCapitalOrSurplus" | "PartnerContributions" | "PartnerDistributions" | "PartnersEquity" | "PayrollClearing" | "PayrollExpenses" | "PayrollTaxPayable" | "PenaltiesAndSettlements" | "PreferredStock" | "PrepaidExpenses" | "PrepaidExpensesPayable" | "PromotionalMeals" | "RentOrLeaseOfBuildings" | "RentsHeldInTrust" | "RentsInTrustLiab" | "RepairAndMaintenance" | "Retainage" | "RetainedEarnings" | "SalesOfProductIncome" | "SalesTaxPayable" | "Savings" | "SecurityDeposits" | "ServiceOrFeeIncome" | "ShareholderNotesPayable" | "ShippingFreightAndDelivery" | "ShippingFreightAndDeliveryCOS" | "StateOrLocalIncomeTaxPayable" | "SuppliesAndMaterials" | "SuppliesAndMaterialsCOGS" | "TaxExemptInterest" | "TaxesPaid" | "Travel" | "TravelMeals" | "TreasuryStock" | "TrustAccounts" | "TrustAccountsLiab" | "UndepositedFunds" | "Utilities" | "Vehicles";
|
|
72
|
+
include_ret_element?: Array<"AccountNumber" | "AccountType" | "Balance" | "BankNumber" | "CashFlowClassification" | "CurrencyRef" | "DataExtRet" | "Desc" | "DetailAccountType" | "EditSequence" | "ExternalGUID" | "FullName" | "IsActive" | "IsTaxAccount" | "LastCheckNumber" | "ListID" | "Name" | "OwnerID" | "ParentRef" | "SalesTaxCodeRef" | "SpecialAccountType" | "Sublevel" | "TaxLineInfoRet" | "TimeCreated" | "TimeModified" | "TotalBalance" | "TxnID" | "TxnNumber">;
|
|
73
|
+
/**
|
|
74
|
+
* If `is_active` is true, this object is currently enabled for use by QuickBooks. The default value is true.
|
|
75
|
+
*/
|
|
76
|
+
is_active?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Name is the case-insensitive short name of a list object (without ancestors). It must be unique within its hierarchy scope. Hierarchical lists can reuse the same Name in different branches because `full_name` remains distinct.
|
|
79
|
+
*/
|
|
80
|
+
name: string;
|
|
81
|
+
/**
|
|
82
|
+
* The amount of money in, or the value of, this account as of `open_balance_date`. On a bank statement, the amount of money in the account at the beginning of the statement period.
|
|
83
|
+
*/
|
|
84
|
+
open_balance?: number;
|
|
85
|
+
/**
|
|
86
|
+
* The date when an opening balance was entered for this account.
|
|
87
|
+
*
|
|
88
|
+
* Format: date.
|
|
89
|
+
*/
|
|
90
|
+
open_balance_date?: string;
|
|
91
|
+
/**
|
|
92
|
+
* A reference to the list object that is one level above this one. For example, an inventory item with the `full_name` of GermanCars:Mercedes-Benz:CL500I99AA might have a parent object with the `full_name` of GermanCars:Mercedes-Benz. In a request, if a `parent_ref` aggregate includes both `full_name` and `list_id`, `full_name` will be ignored.
|
|
93
|
+
*/
|
|
94
|
+
parent_ref?: CurrencyRef;
|
|
95
|
+
/**
|
|
96
|
+
* Your own label for the request, sent to QuickBooks as its qbXML `requestID` and echoed in the raw answer (`response_xml`); optional, since the answer's webhook already carries the request's `id`.
|
|
97
|
+
*/
|
|
98
|
+
request_id?: string;
|
|
99
|
+
/**
|
|
100
|
+
* `sales_tax_code_ref` points to the sales-tax code used for an item or customer context. QuickBooks includes default TAX and NON codes, and a code can be deleted only when nothing references it. If sales tax is disabled, QuickBooks assigns the default non-taxable code. If both `full_name` and `list_id` are provided in `sales_tax_code_ref`, `full_name` is ignored.
|
|
101
|
+
*/
|
|
102
|
+
sales_tax_code_ref?: CurrencyRef;
|
|
103
|
+
/**
|
|
104
|
+
* An internal representation of the tax line associated with this account.
|
|
105
|
+
*/
|
|
106
|
+
tax_line_id?: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The params of `account.query`: List accounts.
|
|
111
|
+
*/
|
|
112
|
+
export interface AccountQueryParams {
|
|
113
|
+
/**
|
|
114
|
+
* The type of QuickBooks account. You can’t create or modify a non-posting account through the SDK, because QuickBooks creates these accounts behind the scenes. This means that you can’t send an AccountAdd request with an `account_type` of NonPosting.
|
|
115
|
+
*
|
|
116
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
117
|
+
*/
|
|
118
|
+
account_type?: Array<"AccountsPayable" | "AccountsReceivable" | "Bank" | "CostOfGoodsSold" | "CreditCard" | "Equity" | "Expense" | "FixedAsset" | "Income" | "LongTermLiability" | "NonPosting" | "OtherAsset" | "OtherCurrentAsset" | "OtherCurrentLiability" | "OtherExpense" | "OtherIncome">;
|
|
119
|
+
/**
|
|
120
|
+
* Used in filters to select list objects based on whether or not they are currently enabled for use by QuickBooks. The default value is asActiveOnly, which selects only list objects that are active.
|
|
121
|
+
*
|
|
122
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
123
|
+
*/
|
|
124
|
+
active_status?: "ActiveOnly" | "All" | "InactiveOnly";
|
|
125
|
+
/**
|
|
126
|
+
* Filters by the specified currency.
|
|
127
|
+
*
|
|
128
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
129
|
+
*/
|
|
130
|
+
currency_filter?: CurrencyFilter;
|
|
131
|
+
/**
|
|
132
|
+
* Filters results to objects modified on or after this timestamp. QuickBooks Desktop accepts 1970-01-01 through 2038-01-19T03:14:07. If only a date is provided, time defaults to 00:00:00.
|
|
133
|
+
*
|
|
134
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
135
|
+
*
|
|
136
|
+
* Format: date-time.
|
|
137
|
+
*/
|
|
138
|
+
from_modified_date?: string;
|
|
139
|
+
/**
|
|
140
|
+
* `full_name` (along with `list_id`) is a way to identify a list object. The `full_name` is the name prefixed by the names of each ancestor, for example Jones:Kitchen:Cabinets. `full_name` values aren’t case-sensitive.
|
|
141
|
+
*
|
|
142
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
143
|
+
*/
|
|
144
|
+
full_name?: string[];
|
|
145
|
+
include_ret_element?: Array<"AccountNumber" | "AccountType" | "Balance" | "BankNumber" | "CashFlowClassification" | "CurrencyRef" | "DataExtRet" | "Desc" | "DetailAccountType" | "EditSequence" | "FullName" | "IsActive" | "IsTaxAccount" | "LastCheckNumber" | "ListID" | "Name" | "ParentRef" | "SalesTaxCodeRef" | "SpecialAccountType" | "Sublevel" | "TaxLineInfoRet" | "TimeCreated" | "TimeModified" | "TotalBalance">;
|
|
146
|
+
/**
|
|
147
|
+
* `list_id` and `full_name` both identify a list object. QuickBooks assigns `list_id` when the object is created. `list_id` values are unique within a list type, not globally across all lists. If both `full_name` and `list_id` are supplied in a request, QuickBooks uses `list_id` and ignores `full_name`.
|
|
148
|
+
*
|
|
149
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
150
|
+
*/
|
|
151
|
+
list_id?: string[];
|
|
152
|
+
/**
|
|
153
|
+
* Limits the number of objects that a query returns. (To get a count of how many objects could possibly be returned, use the `meta_data` query attribute.) If you include a `max_returned` value, it must be at least 1.
|
|
154
|
+
*
|
|
155
|
+
* QuickBooks doesn't page this query: at most this many records come back, in one answer, with no sign of whether more matched. Leave it out for every match, in one answer; one over 4 MB as the Web Connector sends it, about 3 MB of qbXML isn't kept (`error_type` `response_too_large`), so narrow a large one with its filters.
|
|
156
|
+
*
|
|
157
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
158
|
+
*
|
|
159
|
+
* Minimum 1.
|
|
160
|
+
*/
|
|
161
|
+
max_returned?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Use the `meta_data` attribute to control whether query responses include counts. Options are NoMetaData (default), MetaDataOnly (count only), and MetaDataAndResponseData (count plus objects). Counts are approximate and may vary slightly if records are created or deleted during processing.
|
|
164
|
+
*/
|
|
165
|
+
meta_data?: "MetaDataAndResponseData" | "MetaDataOnly" | "NoMetaData";
|
|
166
|
+
/**
|
|
167
|
+
* Filters according to the object’s Name.
|
|
168
|
+
*
|
|
169
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
170
|
+
*/
|
|
171
|
+
name_filter?: NameFilter;
|
|
172
|
+
/**
|
|
173
|
+
* Filters according to the object’s Name.
|
|
174
|
+
*
|
|
175
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
176
|
+
*/
|
|
177
|
+
name_range_filter?: NameRangeFilter;
|
|
178
|
+
/**
|
|
179
|
+
* `owner_id` identifies who owns the data extension. Use 0 for QuickBooks custom fields that appear in the UI, or use a GUID for private extensions owned by an app. Keep private GUIDs confidential unless you intentionally share extensions across apps. If you do share them, both apps must use the same `owner_id` and `data_ext_name`, because that pair uniquely identifies the extension.
|
|
180
|
+
*/
|
|
181
|
+
owner_id?: string[];
|
|
182
|
+
/**
|
|
183
|
+
* Your own label for the request, sent to QuickBooks as its qbXML `requestID` and echoed in the raw answer (`response_xml`); optional, since the answer's webhook already carries the request's `id`.
|
|
184
|
+
*/
|
|
185
|
+
request_id?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Filters results to objects modified on or before this timestamp. QuickBooks Desktop accepts 1970-01-01 through 2038-01-19T03:14:07. If only a date is provided, time defaults to end-of-day (23:59:59).
|
|
188
|
+
*
|
|
189
|
+
* Choose at most one of: `list_id`, or `full_name`, or the set (`account_type`, `active_status`, `currency_filter`, `from_modified_date`, `max_returned`, `name_filter`, `name_range_filter`, `to_modified_date`). Members of a set combine with each other, not with the other choices.
|
|
190
|
+
*
|
|
191
|
+
* Format: date-time.
|
|
192
|
+
*/
|
|
193
|
+
to_modified_date?: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The params of `account.update`: Update account.
|
|
198
|
+
*/
|
|
199
|
+
export interface AccountUpdateParams {
|
|
200
|
+
/**
|
|
201
|
+
* Account numbers appear in the QuickBooks chart of accounts, Account fields, and reports and graphs. If the IsUsingAccountNumber preference is false (that is, if the QuickBooks user has the account numbers Preference turned off), you can still set account numbers through the SDK, but the numbers won’t be visible in the user interface.
|
|
202
|
+
*/
|
|
203
|
+
account_number?: string;
|
|
204
|
+
/**
|
|
205
|
+
* The type of QuickBooks account. You can’t create or modify a non-posting account through the SDK, because QuickBooks creates these accounts behind the scenes. This means that you can’t send an AccountAdd request with an `account_type` of NonPosting.
|
|
206
|
+
*/
|
|
207
|
+
account_type?: "AccountsPayable" | "AccountsReceivable" | "Bank" | "CostOfGoodsSold" | "CreditCard" | "Equity" | "Expense" | "FixedAsset" | "Income" | "LongTermLiability" | "NonPosting" | "OtherAsset" | "OtherCurrentAsset" | "OtherCurrentLiability" | "OtherExpense" | "OtherIncome";
|
|
208
|
+
/**
|
|
209
|
+
* The bank account number or an identifying note about the account. If a `bank_number` exists in a QuickBooks company file, it will only be returned to applications that have been granted permission to access sensitive data and that are using SDK v2.0 or greater.
|
|
210
|
+
*/
|
|
211
|
+
bank_number?: string;
|
|
212
|
+
/**
|
|
213
|
+
* A currency record defines how QuickBooks stores and displays a currency. Built-in currency name/code values are fixed; formatting and active status can vary by settings and workflow.
|
|
214
|
+
*/
|
|
215
|
+
currency_ref?: CurrencyRef;
|
|
216
|
+
/**
|
|
217
|
+
* A descriptive text field.
|
|
218
|
+
*/
|
|
219
|
+
desc?: string;
|
|
220
|
+
/**
|
|
221
|
+
* `edit_sequence` is a server-generated revision token. It changes each time the object is updated. To modify an existing object, you must send the current `edit_sequence`. If your value is stale, the update is rejected to prevent overwriting newer changes.
|
|
222
|
+
*/
|
|
223
|
+
edit_sequence: string;
|
|
224
|
+
include_ret_element?: Array<"AccountNumber" | "AccountType" | "Balance" | "BankNumber" | "CashFlowClassification" | "CurrencyRef" | "DataExtRet" | "Desc" | "DetailAccountType" | "EditSequence" | "ExternalGUID" | "FullName" | "IsActive" | "IsTaxAccount" | "LastCheckNumber" | "ListID" | "Name" | "OwnerID" | "ParentRef" | "SalesTaxCodeRef" | "SpecialAccountType" | "Sublevel" | "TaxLineInfoRet" | "TimeCreated" | "TimeModified" | "TotalBalance" | "TxnID" | "TxnNumber">;
|
|
225
|
+
/**
|
|
226
|
+
* If `is_active` is true, this object is currently enabled for use by QuickBooks. The default value is true.
|
|
227
|
+
*/
|
|
228
|
+
is_active?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* `list_id` and `full_name` both identify a list object. QuickBooks assigns `list_id` when the object is created. `list_id` values are unique within a list type, not globally across all lists. If both `full_name` and `list_id` are supplied in a request, QuickBooks uses `list_id` and ignores `full_name`.
|
|
231
|
+
*/
|
|
232
|
+
list_id: string;
|
|
233
|
+
/**
|
|
234
|
+
* Name is the case-insensitive short name of a list object (without ancestors). It must be unique within its hierarchy scope. Hierarchical lists can reuse the same Name in different branches because `full_name` remains distinct.
|
|
235
|
+
*/
|
|
236
|
+
name?: string;
|
|
237
|
+
/**
|
|
238
|
+
* The amount of money in, or the value of, this account as of `open_balance_date`. On a bank statement, the amount of money in the account at the beginning of the statement period.
|
|
239
|
+
*/
|
|
240
|
+
open_balance?: number;
|
|
241
|
+
/**
|
|
242
|
+
* The date when an opening balance was entered for this account.
|
|
243
|
+
*
|
|
244
|
+
* Format: date.
|
|
245
|
+
*/
|
|
246
|
+
open_balance_date?: string;
|
|
247
|
+
/**
|
|
248
|
+
* A reference to the list object that is one level above this one. For example, an inventory item with the `full_name` of GermanCars:Mercedes-Benz:CL500I99AA might have a parent object with the `full_name` of GermanCars:Mercedes-Benz. In a request, if a `parent_ref` aggregate includes both `full_name` and `list_id`, `full_name` will be ignored.
|
|
249
|
+
*/
|
|
250
|
+
parent_ref?: CurrencyRef;
|
|
251
|
+
/**
|
|
252
|
+
* Your own label for the request, sent to QuickBooks as its qbXML `requestID` and echoed in the raw answer (`response_xml`); optional, since the answer's webhook already carries the request's `id`.
|
|
253
|
+
*/
|
|
254
|
+
request_id?: string;
|
|
255
|
+
/**
|
|
256
|
+
* `sales_tax_code_ref` points to the sales-tax code used for an item or customer context. QuickBooks includes default TAX and NON codes, and a code can be deleted only when nothing references it. If sales tax is disabled, QuickBooks assigns the default non-taxable code. If both `full_name` and `list_id` are provided in `sales_tax_code_ref`, `full_name` is ignored.
|
|
257
|
+
*/
|
|
258
|
+
sales_tax_code_ref?: CurrencyRef;
|
|
259
|
+
/**
|
|
260
|
+
* An internal representation of the tax line associated with this account.
|
|
261
|
+
*/
|
|
262
|
+
tax_line_id?: number;
|
|
263
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Generated from operations.json by scripts/generate-operations.js: don't edit.
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/** QuickBooks account operations. Types: account.d.ts. */
|
|
5
|
+
class Account {
|
|
6
|
+
#client;
|
|
7
|
+
|
|
8
|
+
/** @param {import("../index").Client} client */
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.#client = client;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Create account.
|
|
15
|
+
* @param {string} connectionId
|
|
16
|
+
* @param {import("./account").AccountCreateParams} params
|
|
17
|
+
* @param {import("./types").OperationOptions} options
|
|
18
|
+
* @returns {Promise<import("./types").QueuedRequest>}
|
|
19
|
+
* @see https://docs.qubesync.com/api-reference/v2/accounts/create-account
|
|
20
|
+
*/
|
|
21
|
+
create(connectionId, params, options) {
|
|
22
|
+
return this.#client.queue("account.create", connectionId, params, options);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* List accounts.
|
|
27
|
+
* @param {string} connectionId
|
|
28
|
+
* @param {import("./account").AccountQueryParams} params
|
|
29
|
+
* @param {import("./types").OperationOptions} options
|
|
30
|
+
* @returns {Promise<import("./types").QueuedRequest>}
|
|
31
|
+
* @see https://docs.qubesync.com/api-reference/v2/accounts/list-accounts
|
|
32
|
+
*/
|
|
33
|
+
query(connectionId, params, options) {
|
|
34
|
+
return this.#client.queue("account.query", connectionId, params, options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Update account.
|
|
39
|
+
* @param {string} connectionId
|
|
40
|
+
* @param {import("./account").AccountUpdateParams} params
|
|
41
|
+
* @param {import("./types").OperationOptions} options
|
|
42
|
+
* @returns {Promise<import("./types").QueuedRequest>}
|
|
43
|
+
* @see https://docs.qubesync.com/api-reference/v2/accounts/update-account
|
|
44
|
+
*/
|
|
45
|
+
update(connectionId, params, options) {
|
|
46
|
+
return this.#client.queue("account.update", connectionId, params, options);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = { Account };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Generated from operations.json by scripts/generate-operations.js: don't edit.
|
|
2
|
+
|
|
3
|
+
import type { Client } from "../index";
|
|
4
|
+
import type { OperationOptions, QueuedRequest } from "./types";
|
|
5
|
+
|
|
6
|
+
/** QuickBooks account tax line info operations: `qube.accountTaxLineInfo.<action>(connectionId, params, { webhookUrl })`. */
|
|
7
|
+
export declare class AccountTaxLineInfo {
|
|
8
|
+
constructor(client: Client);
|
|
9
|
+
/**
|
|
10
|
+
* List account tax line infos: `GET /connections/{connection_id}/account-tax-line-infos`, queued for QuickBooks.
|
|
11
|
+
*
|
|
12
|
+
* The answer comes to `webhookUrl` as one webhook.
|
|
13
|
+
* Params go in the query string.
|
|
14
|
+
*
|
|
15
|
+
* Fields: `request_id`.
|
|
16
|
+
*
|
|
17
|
+
* Resolves to the queued request.
|
|
18
|
+
* @see https://docs.qubesync.com/api-reference/v2/account-tax-line-infos/list-account-tax-line-infos
|
|
19
|
+
*/
|
|
20
|
+
query(connectionId: string, params: AccountTaxLineInfoQueryParams | undefined, options: OperationOptions): Promise<QueuedRequest>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The params of `account_tax_line_info.query`: List account tax line infos.
|
|
25
|
+
*/
|
|
26
|
+
export interface AccountTaxLineInfoQueryParams {
|
|
27
|
+
/**
|
|
28
|
+
* Your own label for the request, sent to QuickBooks as its qbXML `requestID` and echoed in the raw answer (`response_xml`); optional, since the answer's webhook already carries the request's `id`.
|
|
29
|
+
*/
|
|
30
|
+
request_id?: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Generated from operations.json by scripts/generate-operations.js: don't edit.
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/** QuickBooks account tax line info operations. Types: account_tax_line_info.d.ts. */
|
|
5
|
+
class AccountTaxLineInfo {
|
|
6
|
+
#client;
|
|
7
|
+
|
|
8
|
+
/** @param {import("../index").Client} client */
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.#client = client;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* List account tax line infos.
|
|
15
|
+
* @param {string} connectionId
|
|
16
|
+
* @param {import("./account_tax_line_info").AccountTaxLineInfoQueryParams} params
|
|
17
|
+
* @param {import("./types").OperationOptions} options
|
|
18
|
+
* @returns {Promise<import("./types").QueuedRequest>}
|
|
19
|
+
* @see https://docs.qubesync.com/api-reference/v2/account-tax-line-infos/list-account-tax-line-infos
|
|
20
|
+
*/
|
|
21
|
+
query(connectionId, params, options) {
|
|
22
|
+
return this.#client.queue("account_tax_line_info.query", connectionId, params, options);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = { AccountTaxLineInfo };
|