@smartbills/sdk 1.1.0-alpha.1 → 1.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +1012 -12
- package/package.json +2 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -744,12 +744,19 @@ interface UpdateInstallationStatusRequest {
|
|
|
744
744
|
status: AppInstallationStatus;
|
|
745
745
|
}
|
|
746
746
|
|
|
747
|
+
/** Configuration for the underlying HTTP transport layer. */
|
|
747
748
|
interface HttpClientConfig {
|
|
748
749
|
baseUrl: string;
|
|
749
750
|
timeout?: number;
|
|
750
751
|
maxRetries?: number;
|
|
751
752
|
retryDelay?: number;
|
|
752
753
|
}
|
|
754
|
+
/**
|
|
755
|
+
* Low-level HTTP client that wraps Axios with automatic retry, error mapping,
|
|
756
|
+
* and multi-tenant header injection.
|
|
757
|
+
*
|
|
758
|
+
* Not intended for direct use — access services through {@link SmartbillsClient} instead.
|
|
759
|
+
*/
|
|
753
760
|
declare class HttpClient {
|
|
754
761
|
private readonly instance;
|
|
755
762
|
private accessToken?;
|
|
@@ -773,6 +780,11 @@ declare class HttpClient {
|
|
|
773
780
|
delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
774
781
|
upload<T>(url: string, formData: FormData, config?: AxiosRequestConfig): Promise<T>;
|
|
775
782
|
downloadBlob(url: string, config?: AxiosRequestConfig): Promise<Blob>;
|
|
783
|
+
downloadBlobWithFilename(method: string, url: string, data?: unknown, config?: AxiosRequestConfig): Promise<{
|
|
784
|
+
blob: Blob;
|
|
785
|
+
filename?: string;
|
|
786
|
+
}>;
|
|
787
|
+
private parseContentDispositionFilename;
|
|
776
788
|
private requestWithRetry;
|
|
777
789
|
private calculateRetryDelay;
|
|
778
790
|
private parseError;
|
|
@@ -801,6 +813,10 @@ declare abstract class BaseService {
|
|
|
801
813
|
protected _delete<T>(url: string, options?: RequestOptions): Promise<T>;
|
|
802
814
|
protected _upload<T>(url: string, formData: FormData, options?: RequestOptions): Promise<T>;
|
|
803
815
|
protected _download(url: string, options?: RequestOptions): Promise<Blob>;
|
|
816
|
+
protected _downloadWithFilename(method: string, url: string, data?: unknown, options?: RequestOptions): Promise<{
|
|
817
|
+
blob: Blob;
|
|
818
|
+
filename?: string;
|
|
819
|
+
}>;
|
|
804
820
|
protected businessUrl(path: string, options?: RequestOptions): string;
|
|
805
821
|
}
|
|
806
822
|
|
|
@@ -1311,8 +1327,13 @@ declare class ApprobationService extends BaseService {
|
|
|
1311
1327
|
* @throws {SmartbillsNotFoundError} If the report is not found
|
|
1312
1328
|
*/
|
|
1313
1329
|
downloadAttachmentsZip(reportId: number, options?: RequestOptions): Promise<Blob>;
|
|
1330
|
+
updateExpense(reportId: number, expenseId: number, data: unknown, options?: RequestOptions): Promise<unknown>;
|
|
1331
|
+
saveExpenseReview(reportId: number, data: ExpenseReportApproveRequest & {
|
|
1332
|
+
saveExpenseReviewOnly?: boolean;
|
|
1333
|
+
}, options?: RequestOptions): Promise<SBExpenseReport>;
|
|
1314
1334
|
}
|
|
1315
1335
|
|
|
1336
|
+
/** Represents the current subscription state for a business. */
|
|
1316
1337
|
interface SBSubscription {
|
|
1317
1338
|
id: string;
|
|
1318
1339
|
planName?: string;
|
|
@@ -1325,6 +1346,7 @@ interface SBSubscription {
|
|
|
1325
1346
|
cancelAtPeriodEnd?: boolean;
|
|
1326
1347
|
canceledAt?: string;
|
|
1327
1348
|
}
|
|
1349
|
+
/** Represents a billing invoice issued to the business. */
|
|
1328
1350
|
interface SBInvoice {
|
|
1329
1351
|
id: string;
|
|
1330
1352
|
number?: string;
|
|
@@ -1340,6 +1362,7 @@ interface SBInvoice {
|
|
|
1340
1362
|
hostedInvoiceUrl?: string;
|
|
1341
1363
|
invoicePdfUrl?: string;
|
|
1342
1364
|
}
|
|
1365
|
+
/** Preview of the next invoice based on the current subscription and usage. */
|
|
1343
1366
|
interface SBUpcomingInvoice {
|
|
1344
1367
|
total: number;
|
|
1345
1368
|
subtotal: number;
|
|
@@ -1349,18 +1372,21 @@ interface SBUpcomingInvoice {
|
|
|
1349
1372
|
periodEnd?: string;
|
|
1350
1373
|
lines?: SBInvoiceLine[];
|
|
1351
1374
|
}
|
|
1375
|
+
/** A single line item on an invoice. */
|
|
1352
1376
|
interface SBInvoiceLine {
|
|
1353
1377
|
description?: string;
|
|
1354
1378
|
amount: number;
|
|
1355
1379
|
currency: string;
|
|
1356
1380
|
quantity?: number;
|
|
1357
1381
|
}
|
|
1382
|
+
/** Tracks resource consumption against a quota limit (e.g., receipts, expenses). */
|
|
1358
1383
|
interface SBBillingUsage {
|
|
1359
1384
|
quotaKey: string;
|
|
1360
1385
|
used: number;
|
|
1361
1386
|
limit: number;
|
|
1362
1387
|
percentage: number;
|
|
1363
1388
|
}
|
|
1389
|
+
/** Represents an available billing plan that a business can subscribe to. */
|
|
1364
1390
|
interface SBBillingPlan {
|
|
1365
1391
|
id: string;
|
|
1366
1392
|
name: string;
|
|
@@ -1370,23 +1396,29 @@ interface SBBillingPlan {
|
|
|
1370
1396
|
interval: string;
|
|
1371
1397
|
features?: string[];
|
|
1372
1398
|
}
|
|
1399
|
+
/** Request payload for upgrading or starting a trial on a specific plan. */
|
|
1373
1400
|
interface UpgradeSubscriptionRequest {
|
|
1374
1401
|
planId: string;
|
|
1375
1402
|
}
|
|
1403
|
+
/** Request payload for creating a Stripe billing portal session. */
|
|
1376
1404
|
interface CreatePortalSessionRequest {
|
|
1377
1405
|
returnUrl?: string;
|
|
1378
1406
|
}
|
|
1407
|
+
/** Contains the URL for a Stripe billing portal session. */
|
|
1379
1408
|
interface SBPortalSession {
|
|
1380
1409
|
url: string;
|
|
1381
1410
|
}
|
|
1411
|
+
/** Query parameters for listing billing invoices. */
|
|
1382
1412
|
interface InvoiceListRequest {
|
|
1383
1413
|
page?: number;
|
|
1384
1414
|
pageSize?: number;
|
|
1385
1415
|
}
|
|
1416
|
+
/** Query parameters for retrieving usage history. */
|
|
1386
1417
|
interface UsageHistoryRequest {
|
|
1387
1418
|
page?: number;
|
|
1388
1419
|
pageSize?: number;
|
|
1389
1420
|
}
|
|
1421
|
+
/** Represents a payment method on file for billing. */
|
|
1390
1422
|
interface SBBillingPaymentMethod {
|
|
1391
1423
|
id: string;
|
|
1392
1424
|
type: string;
|
|
@@ -1398,32 +1430,58 @@ interface SBBillingPaymentMethod {
|
|
|
1398
1430
|
expYear: number;
|
|
1399
1431
|
};
|
|
1400
1432
|
}
|
|
1433
|
+
/** Contains the client secret needed to complete a Stripe SetupIntent flow. */
|
|
1401
1434
|
interface SBSetupIntent {
|
|
1402
1435
|
clientSecret: string;
|
|
1403
1436
|
}
|
|
1437
|
+
/** Result of validating whether a subscription can be downgraded. */
|
|
1404
1438
|
interface SBDowngradeValidation {
|
|
1405
1439
|
canDowngrade: boolean;
|
|
1406
1440
|
blockers?: string[];
|
|
1407
1441
|
}
|
|
1408
1442
|
|
|
1443
|
+
/**
|
|
1444
|
+
* Service for managing billing, subscriptions, and usage within a business.
|
|
1445
|
+
*
|
|
1446
|
+
* Provides methods to manage the business subscription plan, view invoices,
|
|
1447
|
+
* track usage quotas, manage payment methods, and create billing portal sessions.
|
|
1448
|
+
*/
|
|
1409
1449
|
declare class BillingService extends BaseService {
|
|
1450
|
+
/** Retrieves the current subscription for the business. */
|
|
1410
1451
|
getSubscription(options?: RequestOptions): Promise<SBSubscription>;
|
|
1452
|
+
/** Upgrades the business subscription to a new plan. */
|
|
1411
1453
|
upgradeSubscription(data: UpgradeSubscriptionRequest, options?: RequestOptions): Promise<SBSubscription>;
|
|
1454
|
+
/** Cancels the current business subscription. */
|
|
1412
1455
|
cancelSubscription(options?: RequestOptions): Promise<SBSubscription>;
|
|
1456
|
+
/** Retrieves all available billing plans. */
|
|
1413
1457
|
getPlans(options?: RequestOptions): Promise<SBBillingPlan[]>;
|
|
1458
|
+
/** Starts a trial subscription for the specified plan. */
|
|
1414
1459
|
startTrial(data: UpgradeSubscriptionRequest, options?: RequestOptions): Promise<SBSubscription>;
|
|
1460
|
+
/** Activates the free tier subscription for the business. */
|
|
1415
1461
|
activateFreeTier(options?: RequestOptions): Promise<SBSubscription>;
|
|
1462
|
+
/** Validates whether the business can downgrade to a lower plan without losing features. */
|
|
1416
1463
|
validateDowngrade(data: UpgradeSubscriptionRequest, options?: RequestOptions): Promise<SBDowngradeValidation>;
|
|
1464
|
+
/** Lists billing invoices for the business with pagination support. */
|
|
1417
1465
|
listInvoices(params?: InvoiceListRequest, options?: RequestOptions): Promise<SBListResponse<SBInvoice>>;
|
|
1466
|
+
/** Retrieves a specific billing invoice by its Stripe ID. */
|
|
1418
1467
|
getInvoice(invoiceId: string, options?: RequestOptions): Promise<SBInvoice>;
|
|
1468
|
+
/** Retrieves the upcoming invoice preview based on the current subscription. */
|
|
1419
1469
|
getUpcomingInvoice(options?: RequestOptions): Promise<SBUpcomingInvoice>;
|
|
1470
|
+
/** Retrieves current usage across all quota keys for the business. */
|
|
1420
1471
|
getUsage(options?: RequestOptions): Promise<SBBillingUsage[]>;
|
|
1472
|
+
/** Retrieves historical usage data with pagination support. */
|
|
1421
1473
|
getUsageHistory(params?: UsageHistoryRequest, options?: RequestOptions): Promise<SBListResponse<SBBillingUsage>>;
|
|
1474
|
+
/** Retrieves current usage for a specific quota key (e.g., "receipts", "expenses"). */
|
|
1422
1475
|
getUsageByKey(quotaKey: string, options?: RequestOptions): Promise<SBBillingUsage>;
|
|
1476
|
+
/** Creates a Stripe billing portal session URL for self-service subscription management. */
|
|
1423
1477
|
createPortalSession(data?: CreatePortalSessionRequest, options?: RequestOptions): Promise<SBPortalSession>;
|
|
1478
|
+
/** Retrieves all payment methods on file for the business. */
|
|
1424
1479
|
getPaymentMethods(options?: RequestOptions): Promise<SBBillingPaymentMethod[]>;
|
|
1480
|
+
/** Creates a Stripe SetupIntent for securely collecting a new payment method. */
|
|
1425
1481
|
createSetupIntent(options?: RequestOptions): Promise<SBSetupIntent>;
|
|
1482
|
+
/** Detaches (removes) a payment method from the business. */
|
|
1426
1483
|
detachPaymentMethod(paymentMethodId: string, options?: RequestOptions): Promise<void>;
|
|
1484
|
+
/** Sets a payment method as the default for future billing. */
|
|
1427
1485
|
setDefaultPaymentMethod(paymentMethodId: string, options?: RequestOptions): Promise<void>;
|
|
1428
1486
|
}
|
|
1429
1487
|
|
|
@@ -2873,6 +2931,21 @@ interface SyncSessionListRequest extends PaginationRequest {
|
|
|
2873
2931
|
interface SBEmailAccountAuthorizeResponse {
|
|
2874
2932
|
authorizationUrl: string;
|
|
2875
2933
|
}
|
|
2934
|
+
interface SBSharedMailbox {
|
|
2935
|
+
email: string;
|
|
2936
|
+
mailboxId: number;
|
|
2937
|
+
syncEnabled: boolean;
|
|
2938
|
+
}
|
|
2939
|
+
interface SBValidateSharedMailboxResponse {
|
|
2940
|
+
valid: boolean;
|
|
2941
|
+
reason?: string;
|
|
2942
|
+
displayName?: string;
|
|
2943
|
+
}
|
|
2944
|
+
interface SBHistoricalSyncResponse {
|
|
2945
|
+
message: string;
|
|
2946
|
+
fromDate?: string;
|
|
2947
|
+
toDate?: string;
|
|
2948
|
+
}
|
|
2876
2949
|
|
|
2877
2950
|
/**
|
|
2878
2951
|
* Service for managing email accounts used for receipt ingestion.
|
|
@@ -2965,7 +3038,9 @@ declare class EmailAccountService extends BaseService {
|
|
|
2965
3038
|
* @returns The reconnection authorization response
|
|
2966
3039
|
* @throws {SmartbillsNotFoundError} If the account is not found
|
|
2967
3040
|
*/
|
|
2968
|
-
reconnect(accountId: number,
|
|
3041
|
+
reconnect(accountId: number, data?: {
|
|
3042
|
+
password?: string;
|
|
3043
|
+
}, options?: RequestOptions): Promise<SBEmailAccount>;
|
|
2969
3044
|
/**
|
|
2970
3045
|
* Enables an email account.
|
|
2971
3046
|
*
|
|
@@ -3013,6 +3088,15 @@ declare class EmailAccountService extends BaseService {
|
|
|
3013
3088
|
* @throws {SmartbillsNotFoundError} If the account or mailbox is not found
|
|
3014
3089
|
*/
|
|
3015
3090
|
updateMailbox(accountId: number, mailboxId: number, data: MailboxUpdateRequest, options?: RequestOptions): Promise<SBMailbox>;
|
|
3091
|
+
getSyncSessions(accountId: number, params?: SyncSessionListRequest, options?: RequestOptions): Promise<SBListResponse<SBSyncSession>>;
|
|
3092
|
+
authorizeWithParams(params: {
|
|
3093
|
+
provider: string;
|
|
3094
|
+
redirect?: string;
|
|
3095
|
+
payerType?: string;
|
|
3096
|
+
}, options?: RequestOptions): Promise<SBEmailAccountAuthorizeResponse>;
|
|
3097
|
+
validateSharedMailbox(accountId: number, email: string, options?: RequestOptions): Promise<SBValidateSharedMailboxResponse>;
|
|
3098
|
+
addSharedMailbox(accountId: number, email: string, options?: RequestOptions): Promise<SBSharedMailbox>;
|
|
3099
|
+
removeSharedMailbox(accountId: number, email: string, options?: RequestOptions): Promise<void>;
|
|
3016
3100
|
}
|
|
3017
3101
|
|
|
3018
3102
|
/**
|
|
@@ -3221,6 +3305,11 @@ declare class ExpenseReportExpenseService extends BaseService {
|
|
|
3221
3305
|
* @throws {SmartbillsNotFoundError} If the employee, report, or expense is not found
|
|
3222
3306
|
*/
|
|
3223
3307
|
editForEmployee(employeeId: number, reportId: number, expenseId: number, data: EditExpenseInReportRequest, options?: RequestOptions): Promise<unknown>;
|
|
3308
|
+
replace(reportId: number, oldExpenseId: number, data: {
|
|
3309
|
+
newExpenseId: number;
|
|
3310
|
+
categoryId?: number;
|
|
3311
|
+
notes?: string;
|
|
3312
|
+
}, options?: RequestOptions): Promise<unknown>;
|
|
3224
3313
|
}
|
|
3225
3314
|
|
|
3226
3315
|
/**
|
|
@@ -3284,6 +3373,8 @@ declare class ExpenseReportService extends BaseService {
|
|
|
3284
3373
|
* @returns Paginated list of expense reports
|
|
3285
3374
|
*/
|
|
3286
3375
|
list(params?: ExpenseReportListRequest, options?: RequestOptions): Promise<SBListResponse<SBExpenseReport>>;
|
|
3376
|
+
listForEmployee(employeeId: number, params?: ExpenseReportListRequest, options?: RequestOptions): Promise<SBListResponse<SBExpenseReport>>;
|
|
3377
|
+
getByIdForEmployee(employeeId: number, reportId: number, options?: RequestOptions): Promise<SBExpenseReport>;
|
|
3287
3378
|
/**
|
|
3288
3379
|
* Retrieves a single expense report by ID.
|
|
3289
3380
|
*
|
|
@@ -3541,10 +3632,18 @@ interface BulkAssignVendorRequest {
|
|
|
3541
3632
|
interface BulkDeleteExpensesRequest {
|
|
3542
3633
|
expenseIds: number[];
|
|
3543
3634
|
}
|
|
3635
|
+
interface BulkSetNoteRequest {
|
|
3636
|
+
expenseIds: number[];
|
|
3637
|
+
note: string | null;
|
|
3638
|
+
}
|
|
3639
|
+
interface ExpenseReviewUpdateRequest {
|
|
3640
|
+
isReviewed: boolean;
|
|
3641
|
+
}
|
|
3544
3642
|
/**
|
|
3545
3643
|
* Request payload for exporting expenses to a file.
|
|
3546
3644
|
*/
|
|
3547
3645
|
interface ExpenseExportRequest {
|
|
3646
|
+
expenseIds?: number[];
|
|
3548
3647
|
startDate?: string;
|
|
3549
3648
|
endDate?: string;
|
|
3550
3649
|
categoryId?: number;
|
|
@@ -3558,6 +3657,7 @@ interface ExpenseExportRequest {
|
|
|
3558
3657
|
*/
|
|
3559
3658
|
interface ExpenseAttachmentDownloadRequest {
|
|
3560
3659
|
expenseIds: number[];
|
|
3660
|
+
fileNameTemplate?: string;
|
|
3561
3661
|
}
|
|
3562
3662
|
/**
|
|
3563
3663
|
* Request parameters for listing expenses with filters and pagination.
|
|
@@ -3575,18 +3675,28 @@ interface ExpenseListRequest extends PaginationRequest {
|
|
|
3575
3675
|
status?: string;
|
|
3576
3676
|
expenseReportStatus?: string[];
|
|
3577
3677
|
}
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3678
|
+
declare enum ExpenseSplitType {
|
|
3679
|
+
EQUAL = 0,
|
|
3680
|
+
BY_PERCENTAGE = 1,
|
|
3681
|
+
BY_LINE_ITEM = 2
|
|
3682
|
+
}
|
|
3683
|
+
interface ExpenseSplitLineItem {
|
|
3684
|
+
lineItemId: number;
|
|
3685
|
+
quantity?: number;
|
|
3686
|
+
percentage?: number;
|
|
3687
|
+
fullAmount?: boolean;
|
|
3688
|
+
}
|
|
3581
3689
|
interface ExpenseSplitRequest {
|
|
3690
|
+
splitType: ExpenseSplitType;
|
|
3582
3691
|
splits: ExpenseSplitItem[];
|
|
3583
3692
|
}
|
|
3584
|
-
/**
|
|
3585
|
-
* A single split item when dividing an expense.
|
|
3586
|
-
*/
|
|
3587
3693
|
interface ExpenseSplitItem {
|
|
3588
|
-
|
|
3589
|
-
|
|
3694
|
+
name?: string;
|
|
3695
|
+
percentage?: number;
|
|
3696
|
+
amount?: number;
|
|
3697
|
+
lineItems?: ExpenseSplitLineItem[];
|
|
3698
|
+
categoryId?: number | null;
|
|
3699
|
+
memo?: string | null;
|
|
3590
3700
|
note?: string;
|
|
3591
3701
|
}
|
|
3592
3702
|
/**
|
|
@@ -3793,6 +3903,8 @@ declare class ExpenseService extends BaseService {
|
|
|
3793
3903
|
* @returns Bulk action response with success and failure counts
|
|
3794
3904
|
*/
|
|
3795
3905
|
bulkAssignVendor(data: BulkAssignVendorRequest, options?: RequestOptions): Promise<SBExpenseBulkActionResponse>;
|
|
3906
|
+
bulkSetNote(data: BulkSetNoteRequest, options?: RequestOptions): Promise<SBExpenseBulkActionResponse>;
|
|
3907
|
+
updateReview(expenseId: number, data: ExpenseReviewUpdateRequest, options?: RequestOptions): Promise<SBTransaction>;
|
|
3796
3908
|
/**
|
|
3797
3909
|
* Bulk deletes multiple expenses.
|
|
3798
3910
|
*
|
|
@@ -3809,6 +3921,10 @@ declare class ExpenseService extends BaseService {
|
|
|
3809
3921
|
* @returns Blob containing the exported file
|
|
3810
3922
|
*/
|
|
3811
3923
|
export(data: ExpenseExportRequest, options?: RequestOptions): Promise<Blob>;
|
|
3924
|
+
exportWithFilename(data: ExpenseExportRequest, options?: RequestOptions): Promise<{
|
|
3925
|
+
blob: Blob;
|
|
3926
|
+
filename?: string;
|
|
3927
|
+
}>;
|
|
3812
3928
|
/**
|
|
3813
3929
|
* Downloads expense attachments as a zip or combined file.
|
|
3814
3930
|
*
|
|
@@ -3817,6 +3933,15 @@ declare class ExpenseService extends BaseService {
|
|
|
3817
3933
|
* @returns Blob containing the downloaded attachments
|
|
3818
3934
|
*/
|
|
3819
3935
|
downloadAttachments(data: ExpenseAttachmentDownloadRequest, options?: RequestOptions): Promise<Blob>;
|
|
3936
|
+
downloadAttachmentsWithFilename(data: ExpenseAttachmentDownloadRequest, options?: RequestOptions): Promise<{
|
|
3937
|
+
blob: Blob;
|
|
3938
|
+
filename?: string;
|
|
3939
|
+
}>;
|
|
3940
|
+
downloadSingleAttachment(expenseId: number, options?: RequestOptions): Promise<Blob>;
|
|
3941
|
+
downloadSingleAttachmentWithFilename(expenseId: number, options?: RequestOptions): Promise<{
|
|
3942
|
+
blob: Blob;
|
|
3943
|
+
filename?: string;
|
|
3944
|
+
}>;
|
|
3820
3945
|
/**
|
|
3821
3946
|
* Splits an expense into multiple transactions.
|
|
3822
3947
|
*
|
|
@@ -3918,6 +4043,15 @@ declare class IntegrationService extends BaseService {
|
|
|
3918
4043
|
* @throws {SmartbillsNotFoundError} If the app is not found
|
|
3919
4044
|
*/
|
|
3920
4045
|
getMarketplaceApp(slug: string, options?: RequestOptions): Promise<SBMarketplaceApp>;
|
|
4046
|
+
getInstallationById(installationId: string, options?: RequestOptions): Promise<SBIntegration>;
|
|
4047
|
+
getInstallation(appSlug: string, installationId: string, options?: RequestOptions): Promise<SBIntegration>;
|
|
4048
|
+
getSessionToken(installationId: string, options?: RequestOptions): Promise<SBSessionTokenResponse>;
|
|
4049
|
+
retryInstallation(appSlug: string, installationId: string, options?: RequestOptions): Promise<SBIntegrationAuthorizeResponse>;
|
|
4050
|
+
abortInstallation(appSlug: string, installationId: string, options?: RequestOptions): Promise<SBIntegration>;
|
|
4051
|
+
updateInstallationStatus(appSlug: string, installationId: string, data: {
|
|
4052
|
+
status: string;
|
|
4053
|
+
errorMessage?: string;
|
|
4054
|
+
}, options?: RequestOptions): Promise<SBIntegration>;
|
|
3921
4055
|
}
|
|
3922
4056
|
|
|
3923
4057
|
/**
|
|
@@ -4821,7 +4955,7 @@ declare class ReportingService extends BaseService {
|
|
|
4821
4955
|
* @param options - Request options including businessId, locale, and abort signal
|
|
4822
4956
|
* @returns Array of monthly expense summaries
|
|
4823
4957
|
*/
|
|
4824
|
-
monthlySummary(params: ReportingRequest, options?: RequestOptions): Promise<SBExpenseMonthlySummary
|
|
4958
|
+
monthlySummary(params: ReportingRequest, options?: RequestOptions): Promise<SBExpenseMonthlySummary>;
|
|
4825
4959
|
/**
|
|
4826
4960
|
* Retrieves expense breakdown by category.
|
|
4827
4961
|
*
|
|
@@ -5721,17 +5855,843 @@ declare class WorkflowService extends BaseService {
|
|
|
5721
5855
|
createFromTemplate(templateId: string, options?: RequestOptions): Promise<SBWorkflow>;
|
|
5722
5856
|
}
|
|
5723
5857
|
|
|
5858
|
+
/** Represents a customer of the business (buyer / receipt recipient). */
|
|
5859
|
+
interface SBCustomer extends SBEntity, SBTimestamps {
|
|
5860
|
+
firstName?: string;
|
|
5861
|
+
lastName?: string;
|
|
5862
|
+
name?: string;
|
|
5863
|
+
email?: string;
|
|
5864
|
+
phone?: string;
|
|
5865
|
+
acceptsMarketing?: boolean;
|
|
5866
|
+
taxExempt?: boolean;
|
|
5867
|
+
billingAddress?: SBAddress;
|
|
5868
|
+
shippingAddress?: SBAddress;
|
|
5869
|
+
ordersCount?: number;
|
|
5870
|
+
totalSpent?: number;
|
|
5871
|
+
}
|
|
5872
|
+
/** Query parameters for listing customers with search support. */
|
|
5873
|
+
interface CustomerListRequest extends PaginationRequest {
|
|
5874
|
+
search?: string;
|
|
5875
|
+
searchTerm?: string;
|
|
5876
|
+
}
|
|
5877
|
+
/** Payload for creating a new customer. */
|
|
5878
|
+
interface CustomerCreateRequest {
|
|
5879
|
+
firstName?: string;
|
|
5880
|
+
lastName?: string;
|
|
5881
|
+
name?: string;
|
|
5882
|
+
email?: string;
|
|
5883
|
+
phone?: string;
|
|
5884
|
+
acceptsMarketing?: boolean;
|
|
5885
|
+
taxExempt?: boolean;
|
|
5886
|
+
billingAddress?: SBAddress;
|
|
5887
|
+
shippingAddress?: SBAddress;
|
|
5888
|
+
}
|
|
5889
|
+
/** Payload for updating an existing customer. All fields are optional. */
|
|
5890
|
+
type CustomerUpdateRequest = Partial<CustomerCreateRequest>;
|
|
5891
|
+
|
|
5892
|
+
/**
|
|
5893
|
+
* Service for managing customers within a business.
|
|
5894
|
+
*
|
|
5895
|
+
* Customers represent the people or organizations that purchase
|
|
5896
|
+
* goods or services from the business.
|
|
5897
|
+
*/
|
|
5898
|
+
declare class CustomerService extends BaseService {
|
|
5899
|
+
/**
|
|
5900
|
+
* Retrieves a paginated list of customers.
|
|
5901
|
+
*
|
|
5902
|
+
* @param params - Optional filters, search, and pagination parameters
|
|
5903
|
+
* @param options - Request options including business context and abort signal
|
|
5904
|
+
* @returns A paginated list of customers
|
|
5905
|
+
*/
|
|
5906
|
+
list(params?: CustomerListRequest, options?: RequestOptions): Promise<SBListResponse<SBCustomer>>;
|
|
5907
|
+
/**
|
|
5908
|
+
* Retrieves a single customer by ID.
|
|
5909
|
+
*
|
|
5910
|
+
* @param id - The customer ID
|
|
5911
|
+
* @param options - Request options including business context and abort signal
|
|
5912
|
+
* @returns The customer
|
|
5913
|
+
* @throws {SmartbillsNotFoundError} If the customer is not found
|
|
5914
|
+
*/
|
|
5915
|
+
getById(id: number, options?: RequestOptions): Promise<SBCustomer>;
|
|
5916
|
+
/**
|
|
5917
|
+
* Creates a new customer.
|
|
5918
|
+
*
|
|
5919
|
+
* @param data - The customer creation payload
|
|
5920
|
+
* @param options - Request options including business context and abort signal
|
|
5921
|
+
* @returns The newly created customer
|
|
5922
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
5923
|
+
*/
|
|
5924
|
+
create(data: CustomerCreateRequest, options?: RequestOptions): Promise<SBCustomer>;
|
|
5925
|
+
/**
|
|
5926
|
+
* Updates an existing customer.
|
|
5927
|
+
*
|
|
5928
|
+
* @param id - The customer ID
|
|
5929
|
+
* @param data - The fields to update
|
|
5930
|
+
* @param options - Request options including business context and abort signal
|
|
5931
|
+
* @returns The updated customer
|
|
5932
|
+
* @throws {SmartbillsNotFoundError} If the customer is not found
|
|
5933
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
5934
|
+
*/
|
|
5935
|
+
update(id: number, data: CustomerUpdateRequest, options?: RequestOptions): Promise<SBCustomer>;
|
|
5936
|
+
/**
|
|
5937
|
+
* Deletes a customer.
|
|
5938
|
+
*
|
|
5939
|
+
* @param id - The customer ID
|
|
5940
|
+
* @param options - Request options including business context and abort signal
|
|
5941
|
+
* @throws {SmartbillsNotFoundError} If the customer is not found
|
|
5942
|
+
*/
|
|
5943
|
+
delete(id: number, options?: RequestOptions): Promise<void>;
|
|
5944
|
+
}
|
|
5945
|
+
|
|
5946
|
+
/** A lightweight representation of a team member within a department. */
|
|
5947
|
+
interface SBDepartmentMember {
|
|
5948
|
+
id: number;
|
|
5949
|
+
firstName?: string;
|
|
5950
|
+
lastName?: string;
|
|
5951
|
+
email?: string;
|
|
5952
|
+
avatar?: string;
|
|
5953
|
+
}
|
|
5954
|
+
/** Represents an organizational department within a business. */
|
|
5955
|
+
interface SBDepartment extends SBEntity, SBTimestamps {
|
|
5956
|
+
name: string;
|
|
5957
|
+
code?: string;
|
|
5958
|
+
description?: string;
|
|
5959
|
+
managerName?: string;
|
|
5960
|
+
isActive: boolean;
|
|
5961
|
+
active?: boolean;
|
|
5962
|
+
employeeCount?: number;
|
|
5963
|
+
teamMembers?: SBDepartmentMember[];
|
|
5964
|
+
}
|
|
5965
|
+
/** Query parameters for listing departments with search support. */
|
|
5966
|
+
interface DepartmentListRequest extends PaginationRequest {
|
|
5967
|
+
search?: string;
|
|
5968
|
+
}
|
|
5969
|
+
/** Payload for creating a new department. */
|
|
5970
|
+
interface DepartmentCreateRequest {
|
|
5971
|
+
name: string;
|
|
5972
|
+
code?: string;
|
|
5973
|
+
description?: string;
|
|
5974
|
+
managerName?: string;
|
|
5975
|
+
isActive?: boolean;
|
|
5976
|
+
teamMemberIds?: number[];
|
|
5977
|
+
}
|
|
5978
|
+
/** Payload for updating an existing department. */
|
|
5979
|
+
type DepartmentUpdateRequest = DepartmentCreateRequest;
|
|
5980
|
+
|
|
5981
|
+
/**
|
|
5982
|
+
* Service for managing departments within a business.
|
|
5983
|
+
*
|
|
5984
|
+
* Departments are organizational units used to categorize expenses,
|
|
5985
|
+
* employees, and budgets within a business.
|
|
5986
|
+
*/
|
|
5987
|
+
declare class DepartmentService extends BaseService {
|
|
5988
|
+
/**
|
|
5989
|
+
* Retrieves a paginated list of departments.
|
|
5990
|
+
*
|
|
5991
|
+
* @param params - Optional filters and pagination parameters
|
|
5992
|
+
* @param options - Request options including business context and abort signal
|
|
5993
|
+
* @returns A paginated list of departments
|
|
5994
|
+
*/
|
|
5995
|
+
list(params?: DepartmentListRequest, options?: RequestOptions): Promise<SBListResponse<SBDepartment>>;
|
|
5996
|
+
/**
|
|
5997
|
+
* Retrieves a single department by ID.
|
|
5998
|
+
*
|
|
5999
|
+
* @param id - The department ID
|
|
6000
|
+
* @param options - Request options including business context and abort signal
|
|
6001
|
+
* @returns The department
|
|
6002
|
+
* @throws {SmartbillsNotFoundError} If the department is not found
|
|
6003
|
+
*/
|
|
6004
|
+
getById(id: number, options?: RequestOptions): Promise<SBDepartment>;
|
|
6005
|
+
/**
|
|
6006
|
+
* Creates a new department.
|
|
6007
|
+
*
|
|
6008
|
+
* @param data - The department creation payload
|
|
6009
|
+
* @param options - Request options including business context and abort signal
|
|
6010
|
+
* @returns The newly created department
|
|
6011
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6012
|
+
*/
|
|
6013
|
+
create(data: DepartmentCreateRequest, options?: RequestOptions): Promise<SBDepartment>;
|
|
6014
|
+
/**
|
|
6015
|
+
* Updates an existing department.
|
|
6016
|
+
*
|
|
6017
|
+
* @param id - The department ID
|
|
6018
|
+
* @param data - The fields to update
|
|
6019
|
+
* @param options - Request options including business context and abort signal
|
|
6020
|
+
* @returns The updated department
|
|
6021
|
+
* @throws {SmartbillsNotFoundError} If the department is not found
|
|
6022
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6023
|
+
*/
|
|
6024
|
+
update(id: number, data: DepartmentUpdateRequest, options?: RequestOptions): Promise<SBDepartment>;
|
|
6025
|
+
/**
|
|
6026
|
+
* Deletes a department.
|
|
6027
|
+
*
|
|
6028
|
+
* @param id - The department ID
|
|
6029
|
+
* @param options - Request options including business context and abort signal
|
|
6030
|
+
* @throws {SmartbillsNotFoundError} If the department is not found
|
|
6031
|
+
*/
|
|
6032
|
+
delete(id: number, options?: RequestOptions): Promise<void>;
|
|
6033
|
+
}
|
|
6034
|
+
|
|
6035
|
+
/** Represents a product or service offered by the business. */
|
|
6036
|
+
interface SBProduct extends SBEntity, SBTimestamps {
|
|
6037
|
+
name: string;
|
|
6038
|
+
description?: string;
|
|
6039
|
+
price?: number;
|
|
6040
|
+
sku?: string;
|
|
6041
|
+
}
|
|
6042
|
+
/** Query parameters for listing products with optional search. */
|
|
6043
|
+
interface ProductListRequest extends PaginationRequest {
|
|
6044
|
+
search?: string;
|
|
6045
|
+
}
|
|
6046
|
+
|
|
6047
|
+
/**
|
|
6048
|
+
* Service for managing products within a business.
|
|
6049
|
+
*
|
|
6050
|
+
* Products represent the goods or services sold by the business
|
|
6051
|
+
* and appear on receipts and invoices.
|
|
6052
|
+
*/
|
|
6053
|
+
declare class ProductService extends BaseService {
|
|
6054
|
+
/**
|
|
6055
|
+
* Retrieves a paginated list of products.
|
|
6056
|
+
*
|
|
6057
|
+
* @param params - Optional filters, search, and pagination parameters
|
|
6058
|
+
* @param options - Request options including business context and abort signal
|
|
6059
|
+
* @returns A paginated list of products
|
|
6060
|
+
*/
|
|
6061
|
+
list(params?: ProductListRequest, options?: RequestOptions): Promise<SBListResponse<SBProduct>>;
|
|
6062
|
+
/**
|
|
6063
|
+
* Retrieves a single product by ID.
|
|
6064
|
+
*
|
|
6065
|
+
* @param id - The product ID
|
|
6066
|
+
* @param options - Request options including business context and abort signal
|
|
6067
|
+
* @returns The product
|
|
6068
|
+
* @throws {SmartbillsNotFoundError} If the product is not found
|
|
6069
|
+
*/
|
|
6070
|
+
getById(id: number, options?: RequestOptions): Promise<SBProduct>;
|
|
6071
|
+
}
|
|
6072
|
+
|
|
6073
|
+
/** Represents a tax rate configured for a business. */
|
|
6074
|
+
interface SBTax extends SBEntity, SBTimestamps {
|
|
6075
|
+
name: string;
|
|
6076
|
+
rate: number;
|
|
6077
|
+
code?: string;
|
|
6078
|
+
isDefault?: boolean;
|
|
6079
|
+
}
|
|
6080
|
+
/** Query parameters for listing tax rates with optional search. */
|
|
6081
|
+
interface TaxListRequest extends PaginationRequest {
|
|
6082
|
+
search?: string;
|
|
6083
|
+
}
|
|
6084
|
+
|
|
6085
|
+
/**
|
|
6086
|
+
* Service for managing tax configurations within a business.
|
|
6087
|
+
*
|
|
6088
|
+
* Taxes define the tax rates applied to receipts, invoices, and
|
|
6089
|
+
* expense items (e.g., GST, HST, PST, VAT).
|
|
6090
|
+
*/
|
|
6091
|
+
declare class TaxService extends BaseService {
|
|
6092
|
+
/**
|
|
6093
|
+
* Retrieves a paginated list of tax configurations.
|
|
6094
|
+
*
|
|
6095
|
+
* @param params - Optional filters and pagination parameters
|
|
6096
|
+
* @param options - Request options including business context and abort signal
|
|
6097
|
+
* @returns A paginated list of tax configurations
|
|
6098
|
+
*/
|
|
6099
|
+
list(params?: TaxListRequest, options?: RequestOptions): Promise<SBListResponse<SBTax>>;
|
|
6100
|
+
/**
|
|
6101
|
+
* Retrieves a single tax configuration by ID.
|
|
6102
|
+
*
|
|
6103
|
+
* @param id - The tax ID
|
|
6104
|
+
* @param options - Request options including business context and abort signal
|
|
6105
|
+
* @returns The tax configuration
|
|
6106
|
+
* @throws {SmartbillsNotFoundError} If the tax is not found
|
|
6107
|
+
*/
|
|
6108
|
+
getById(id: number, options?: RequestOptions): Promise<SBTax>;
|
|
6109
|
+
}
|
|
6110
|
+
|
|
6111
|
+
/** Represents a promotional code that can be applied to receipts or transactions. */
|
|
6112
|
+
interface SBPromoCode extends SBEntity, SBTimestamps {
|
|
6113
|
+
name: string;
|
|
6114
|
+
code: string;
|
|
6115
|
+
type: string;
|
|
6116
|
+
value: number;
|
|
6117
|
+
active: boolean;
|
|
6118
|
+
}
|
|
6119
|
+
|
|
6120
|
+
/**
|
|
6121
|
+
* Service for managing promotional codes within a business.
|
|
6122
|
+
*
|
|
6123
|
+
* Promo codes provide discounts to customers on receipts and invoices.
|
|
6124
|
+
*/
|
|
6125
|
+
declare class PromoCodeService extends BaseService {
|
|
6126
|
+
/**
|
|
6127
|
+
* Retrieves a single promotional code by ID.
|
|
6128
|
+
*
|
|
6129
|
+
* @param id - The promo code ID
|
|
6130
|
+
* @param options - Request options including business context and abort signal
|
|
6131
|
+
* @returns The promotional code
|
|
6132
|
+
* @throws {SmartbillsNotFoundError} If the promo code is not found
|
|
6133
|
+
*/
|
|
6134
|
+
getById(id: number, options?: RequestOptions): Promise<SBPromoCode>;
|
|
6135
|
+
}
|
|
6136
|
+
|
|
6137
|
+
/** Represents an expense category used to classify and organize expenses. */
|
|
6138
|
+
interface SBCategory extends SBEntity, SBTimestamps {
|
|
6139
|
+
name: string;
|
|
6140
|
+
code?: string;
|
|
6141
|
+
isVisible: boolean;
|
|
6142
|
+
businessId?: number;
|
|
6143
|
+
userId?: number;
|
|
6144
|
+
}
|
|
6145
|
+
/** Payload for creating a new expense category. */
|
|
6146
|
+
interface CategoryCreateRequest {
|
|
6147
|
+
name: string;
|
|
6148
|
+
code?: string;
|
|
6149
|
+
isVisible?: boolean;
|
|
6150
|
+
}
|
|
6151
|
+
/** Payload for updating an existing expense category. */
|
|
6152
|
+
interface CategoryUpdateRequest {
|
|
6153
|
+
name?: string;
|
|
6154
|
+
code?: string;
|
|
6155
|
+
isVisible?: boolean;
|
|
6156
|
+
}
|
|
6157
|
+
|
|
6158
|
+
/**
|
|
6159
|
+
* Service for managing expense categories within a business.
|
|
6160
|
+
*
|
|
6161
|
+
* Categories are used to classify expenses for reporting, budgeting,
|
|
6162
|
+
* and accounting purposes (e.g., Travel, Meals, Office Supplies).
|
|
6163
|
+
*/
|
|
6164
|
+
declare class CategoryService extends BaseService {
|
|
6165
|
+
/**
|
|
6166
|
+
* Retrieves all expense categories for the business.
|
|
6167
|
+
*
|
|
6168
|
+
* @param options - Request options including business context and abort signal
|
|
6169
|
+
* @returns An array of expense categories
|
|
6170
|
+
*/
|
|
6171
|
+
list(options?: RequestOptions): Promise<SBCategory[]>;
|
|
6172
|
+
/**
|
|
6173
|
+
* Retrieves a single expense category by ID.
|
|
6174
|
+
*
|
|
6175
|
+
* @param id - The category ID
|
|
6176
|
+
* @param options - Request options including business context and abort signal
|
|
6177
|
+
* @returns The expense category
|
|
6178
|
+
* @throws {SmartbillsNotFoundError} If the category is not found
|
|
6179
|
+
*/
|
|
6180
|
+
getById(id: number, options?: RequestOptions): Promise<SBCategory>;
|
|
6181
|
+
/**
|
|
6182
|
+
* Creates a new expense category.
|
|
6183
|
+
*
|
|
6184
|
+
* @param data - The category creation payload
|
|
6185
|
+
* @param options - Request options including business context and abort signal
|
|
6186
|
+
* @returns The newly created category
|
|
6187
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6188
|
+
*/
|
|
6189
|
+
create(data: CategoryCreateRequest, options?: RequestOptions): Promise<SBCategory>;
|
|
6190
|
+
/**
|
|
6191
|
+
* Updates an existing expense category.
|
|
6192
|
+
*
|
|
6193
|
+
* @param id - The category ID
|
|
6194
|
+
* @param data - The fields to update
|
|
6195
|
+
* @param options - Request options including business context and abort signal
|
|
6196
|
+
* @returns The updated category
|
|
6197
|
+
* @throws {SmartbillsNotFoundError} If the category is not found
|
|
6198
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6199
|
+
*/
|
|
6200
|
+
update(id: number, data: CategoryUpdateRequest, options?: RequestOptions): Promise<SBCategory>;
|
|
6201
|
+
/**
|
|
6202
|
+
* Deletes an expense category.
|
|
6203
|
+
*
|
|
6204
|
+
* @param id - The category ID
|
|
6205
|
+
* @param options - Request options including business context and abort signal
|
|
6206
|
+
* @throws {SmartbillsNotFoundError} If the category is not found
|
|
6207
|
+
*/
|
|
6208
|
+
delete(id: number, options?: RequestOptions): Promise<void>;
|
|
6209
|
+
}
|
|
6210
|
+
|
|
6211
|
+
/** Lightweight representation of an employee's manager. */
|
|
6212
|
+
interface SBEmployeeManager {
|
|
6213
|
+
id: number;
|
|
6214
|
+
firstName: string;
|
|
6215
|
+
lastName: string;
|
|
6216
|
+
name: string;
|
|
6217
|
+
email: string;
|
|
6218
|
+
}
|
|
6219
|
+
/** Department association for an employee. */
|
|
6220
|
+
interface SBEmployeeDepartment {
|
|
6221
|
+
departmentId: number;
|
|
6222
|
+
departmentName: string;
|
|
6223
|
+
}
|
|
6224
|
+
/** Location association for an employee. */
|
|
6225
|
+
interface SBEmployeeLocation {
|
|
6226
|
+
locationId: number;
|
|
6227
|
+
locationName: string;
|
|
6228
|
+
}
|
|
6229
|
+
/** Represents an employee within a business, including their manager, departments, and locations. */
|
|
6230
|
+
interface SBEmployee extends SBEntity, SBTimestamps {
|
|
6231
|
+
businessId: number;
|
|
6232
|
+
userId: number;
|
|
6233
|
+
employeeIdentifier?: string;
|
|
6234
|
+
firstName: string;
|
|
6235
|
+
lastName: string;
|
|
6236
|
+
name: string;
|
|
6237
|
+
email: string;
|
|
6238
|
+
phoneNumber?: string;
|
|
6239
|
+
managerId?: number;
|
|
6240
|
+
manager?: SBEmployeeManager;
|
|
6241
|
+
status: string;
|
|
6242
|
+
isMemberOnPlatform: boolean;
|
|
6243
|
+
birthdate?: string;
|
|
6244
|
+
departments?: SBEmployeeDepartment[];
|
|
6245
|
+
locations?: SBEmployeeLocation[];
|
|
6246
|
+
}
|
|
6247
|
+
/** Query parameters for listing employees with optional search and status filter. */
|
|
6248
|
+
interface EmployeeListRequest extends PaginationRequest {
|
|
6249
|
+
search?: string;
|
|
6250
|
+
status?: string;
|
|
6251
|
+
}
|
|
6252
|
+
/** Payload for creating a new employee record. */
|
|
6253
|
+
interface EmployeeCreateRequest {
|
|
6254
|
+
businessId: number;
|
|
6255
|
+
employeeIdentifier?: string;
|
|
6256
|
+
firstName: string;
|
|
6257
|
+
lastName: string;
|
|
6258
|
+
email: string;
|
|
6259
|
+
phoneNumber?: string;
|
|
6260
|
+
managerId?: number;
|
|
6261
|
+
departmentIds?: number[];
|
|
6262
|
+
locationIds?: number[];
|
|
6263
|
+
birthdate?: string;
|
|
6264
|
+
}
|
|
6265
|
+
/** Payload for updating an existing employee record. All fields are optional. */
|
|
6266
|
+
type EmployeeUpdateRequest = Partial<Omit<EmployeeCreateRequest, "businessId">>;
|
|
6267
|
+
/** Payload for assigning or removing a manager from a single employee. */
|
|
6268
|
+
interface EmployeeSetManagerRequest {
|
|
6269
|
+
managerId: number | null;
|
|
6270
|
+
}
|
|
6271
|
+
/** Payload for bulk-assigning a manager to multiple employees at once. */
|
|
6272
|
+
interface EmployeeBulkAssignManagerRequest {
|
|
6273
|
+
employeeIds: number[];
|
|
6274
|
+
managerId: number | null;
|
|
6275
|
+
}
|
|
6276
|
+
|
|
6277
|
+
/**
|
|
6278
|
+
* Service for managing employees within a business.
|
|
6279
|
+
*
|
|
6280
|
+
* Employees are team members who can submit expenses, be assigned to departments,
|
|
6281
|
+
* and have managers in the organizational hierarchy.
|
|
6282
|
+
*/
|
|
6283
|
+
declare class EmployeeService extends BaseService {
|
|
6284
|
+
/**
|
|
6285
|
+
* Retrieves a paginated list of employees.
|
|
6286
|
+
*
|
|
6287
|
+
* @param params - Optional filters, search, and pagination parameters
|
|
6288
|
+
* @param options - Request options including business context and abort signal
|
|
6289
|
+
* @returns A paginated list of employees
|
|
6290
|
+
*/
|
|
6291
|
+
list(params?: EmployeeListRequest, options?: RequestOptions): Promise<SBListResponse<SBEmployee>>;
|
|
6292
|
+
/**
|
|
6293
|
+
* Retrieves a single employee by ID.
|
|
6294
|
+
*
|
|
6295
|
+
* @param id - The employee ID
|
|
6296
|
+
* @param options - Request options including business context and abort signal
|
|
6297
|
+
* @returns The employee
|
|
6298
|
+
* @throws {SmartbillsNotFoundError} If the employee is not found
|
|
6299
|
+
*/
|
|
6300
|
+
getById(id: number, options?: RequestOptions): Promise<SBEmployee>;
|
|
6301
|
+
/**
|
|
6302
|
+
* Creates a new employee.
|
|
6303
|
+
*
|
|
6304
|
+
* @param data - The employee creation payload
|
|
6305
|
+
* @param options - Request options including business context and abort signal
|
|
6306
|
+
* @returns The newly created employee
|
|
6307
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6308
|
+
*/
|
|
6309
|
+
create(data: EmployeeCreateRequest, options?: RequestOptions): Promise<SBEmployee>;
|
|
6310
|
+
/**
|
|
6311
|
+
* Updates an existing employee.
|
|
6312
|
+
*
|
|
6313
|
+
* @param id - The employee ID
|
|
6314
|
+
* @param data - The fields to update
|
|
6315
|
+
* @param options - Request options including business context and abort signal
|
|
6316
|
+
* @returns The updated employee
|
|
6317
|
+
* @throws {SmartbillsNotFoundError} If the employee is not found
|
|
6318
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6319
|
+
*/
|
|
6320
|
+
update(id: number, data: EmployeeUpdateRequest, options?: RequestOptions): Promise<SBEmployee>;
|
|
6321
|
+
/**
|
|
6322
|
+
* Deletes an employee.
|
|
6323
|
+
*
|
|
6324
|
+
* @param id - The employee ID
|
|
6325
|
+
* @param options - Request options including business context and abort signal
|
|
6326
|
+
* @throws {SmartbillsNotFoundError} If the employee is not found
|
|
6327
|
+
*/
|
|
6328
|
+
delete(id: number, options?: RequestOptions): Promise<void>;
|
|
6329
|
+
/**
|
|
6330
|
+
* Assigns a manager to an employee.
|
|
6331
|
+
*
|
|
6332
|
+
* @param employeeId - The employee ID
|
|
6333
|
+
* @param data - The manager assignment payload
|
|
6334
|
+
* @param options - Request options including business context and abort signal
|
|
6335
|
+
* @returns The updated employee with the new manager
|
|
6336
|
+
* @throws {SmartbillsNotFoundError} If the employee is not found
|
|
6337
|
+
*/
|
|
6338
|
+
setManager(employeeId: number, data: EmployeeSetManagerRequest, options?: RequestOptions): Promise<SBEmployee>;
|
|
6339
|
+
/**
|
|
6340
|
+
* Assigns a manager to multiple employees in a single bulk operation.
|
|
6341
|
+
*
|
|
6342
|
+
* @param data - The bulk manager assignment payload with employee IDs and manager ID
|
|
6343
|
+
* @param options - Request options including business context and abort signal
|
|
6344
|
+
*/
|
|
6345
|
+
bulkAssignManager(data: EmployeeBulkAssignManagerRequest, options?: RequestOptions): Promise<void>;
|
|
6346
|
+
/**
|
|
6347
|
+
* Activates an employee.
|
|
6348
|
+
*
|
|
6349
|
+
* @param employeeId - The employee ID
|
|
6350
|
+
* @param options - Request options including business context and abort signal
|
|
6351
|
+
* @returns The activated employee
|
|
6352
|
+
* @throws {SmartbillsNotFoundError} If the employee is not found
|
|
6353
|
+
*/
|
|
6354
|
+
setActive(employeeId: number, options?: RequestOptions): Promise<SBEmployee>;
|
|
6355
|
+
/**
|
|
6356
|
+
* Deactivates an employee without removing them.
|
|
6357
|
+
*
|
|
6358
|
+
* @param employeeId - The employee ID
|
|
6359
|
+
* @param options - Request options including business context and abort signal
|
|
6360
|
+
* @returns The deactivated employee
|
|
6361
|
+
* @throws {SmartbillsNotFoundError} If the employee is not found
|
|
6362
|
+
*/
|
|
6363
|
+
setInactive(employeeId: number, options?: RequestOptions): Promise<SBEmployee>;
|
|
6364
|
+
}
|
|
6365
|
+
|
|
6366
|
+
/** Represents a file attachment (e.g., receipt image, PDF) associated with an expense or transaction. */
|
|
6367
|
+
interface SBAttachment extends SBEntity, SBTimestamps {
|
|
6368
|
+
fileName: string;
|
|
6369
|
+
fileSize: number;
|
|
6370
|
+
versionId: string;
|
|
6371
|
+
url: string;
|
|
6372
|
+
thumbnailUrl: string;
|
|
6373
|
+
}
|
|
6374
|
+
/** Query parameters for listing attachments with optional search. */
|
|
6375
|
+
interface AttachmentListRequest extends PaginationRequest {
|
|
6376
|
+
searchTerm?: string;
|
|
6377
|
+
}
|
|
6378
|
+
/** Payload for renaming an existing attachment. */
|
|
6379
|
+
interface AttachmentRenameRequest {
|
|
6380
|
+
fileName: string;
|
|
6381
|
+
}
|
|
6382
|
+
|
|
6383
|
+
/**
|
|
6384
|
+
* Service for managing file attachments on expenses and receipts.
|
|
6385
|
+
*
|
|
6386
|
+
* Attachments are images or documents (PDF, JPEG, PNG) associated with
|
|
6387
|
+
* expenses, receipts, or bills as proof of purchase.
|
|
6388
|
+
*/
|
|
6389
|
+
declare class AttachmentService extends BaseService {
|
|
6390
|
+
/**
|
|
6391
|
+
* Retrieves a paginated list of attachments.
|
|
6392
|
+
*
|
|
6393
|
+
* @param params - Optional filters and pagination parameters
|
|
6394
|
+
* @param options - Request options including business context and abort signal
|
|
6395
|
+
* @returns A paginated list of attachments
|
|
6396
|
+
*/
|
|
6397
|
+
list(params?: AttachmentListRequest, options?: RequestOptions): Promise<SBListResponse<SBAttachment>>;
|
|
6398
|
+
/**
|
|
6399
|
+
* Retrieves a single attachment by ID.
|
|
6400
|
+
*
|
|
6401
|
+
* @param id - The attachment ID
|
|
6402
|
+
* @param options - Request options including business context and abort signal
|
|
6403
|
+
* @returns The attachment with its metadata and URL
|
|
6404
|
+
* @throws {SmartbillsNotFoundError} If the attachment is not found
|
|
6405
|
+
*/
|
|
6406
|
+
getById(id: number, options?: RequestOptions): Promise<SBAttachment>;
|
|
6407
|
+
/**
|
|
6408
|
+
* Renames an attachment.
|
|
6409
|
+
*
|
|
6410
|
+
* @param id - The attachment ID
|
|
6411
|
+
* @param data - The rename payload with the new filename
|
|
6412
|
+
* @param options - Request options including business context and abort signal
|
|
6413
|
+
* @returns The renamed attachment
|
|
6414
|
+
* @throws {SmartbillsNotFoundError} If the attachment is not found
|
|
6415
|
+
*/
|
|
6416
|
+
rename(id: number, data: AttachmentRenameRequest, options?: RequestOptions): Promise<SBAttachment>;
|
|
6417
|
+
/**
|
|
6418
|
+
* Deletes an attachment.
|
|
6419
|
+
*
|
|
6420
|
+
* @param id - The attachment ID
|
|
6421
|
+
* @param options - Request options including business context and abort signal
|
|
6422
|
+
* @throws {SmartbillsNotFoundError} If the attachment is not found
|
|
6423
|
+
*/
|
|
6424
|
+
delete(id: number, options?: RequestOptions): Promise<void>;
|
|
6425
|
+
}
|
|
6426
|
+
|
|
6427
|
+
/** Represents an email forwarding configuration for a user or business. */
|
|
6428
|
+
interface SBEmailForwardingConfig extends SBEntity, SBTimestamps {
|
|
6429
|
+
userId?: number;
|
|
6430
|
+
businessId?: number;
|
|
6431
|
+
forwardingEmail?: string;
|
|
6432
|
+
name?: string;
|
|
6433
|
+
origin?: string;
|
|
6434
|
+
personalizedSlug?: string;
|
|
6435
|
+
emailAddress: string;
|
|
6436
|
+
departmentId?: number;
|
|
6437
|
+
employeeId?: number;
|
|
6438
|
+
isActive: boolean;
|
|
6439
|
+
}
|
|
6440
|
+
/** Payload for creating or updating an email forwarding configuration. */
|
|
6441
|
+
interface EmailForwardingConfigRequest {
|
|
6442
|
+
userId?: number;
|
|
6443
|
+
businessId?: number;
|
|
6444
|
+
forwardingEmail?: string;
|
|
6445
|
+
personalizedSlug?: string;
|
|
6446
|
+
name?: string;
|
|
6447
|
+
origin?: string;
|
|
6448
|
+
departmentId?: number;
|
|
6449
|
+
employeeId?: number;
|
|
6450
|
+
}
|
|
6451
|
+
|
|
6452
|
+
/**
|
|
6453
|
+
* Service for managing email forwarding configurations.
|
|
6454
|
+
*
|
|
6455
|
+
* Email forwarding allows businesses and users to automatically forward
|
|
6456
|
+
* receipt emails to Smartbills for expense ingestion and processing.
|
|
6457
|
+
*/
|
|
6458
|
+
declare class EmailForwardingService extends BaseService {
|
|
6459
|
+
/**
|
|
6460
|
+
* Lists all email forwarding configurations for a business.
|
|
6461
|
+
*
|
|
6462
|
+
* @param businessId - The business ID
|
|
6463
|
+
* @param options - Request options including locale and abort signal
|
|
6464
|
+
* @returns An array of email forwarding configurations
|
|
6465
|
+
*/
|
|
6466
|
+
listBusiness(businessId: number, options?: RequestOptions): Promise<SBEmailForwardingConfig[]>;
|
|
6467
|
+
/**
|
|
6468
|
+
* Retrieves the email forwarding configuration for a specific user.
|
|
6469
|
+
*
|
|
6470
|
+
* @param userId - The user ID
|
|
6471
|
+
* @param businessId - Optional business ID to scope the configuration
|
|
6472
|
+
* @param options - Request options including locale and abort signal
|
|
6473
|
+
* @returns The user's email forwarding configuration
|
|
6474
|
+
*/
|
|
6475
|
+
getUser(userId: number, businessId?: number, options?: RequestOptions): Promise<SBEmailForwardingConfig>;
|
|
6476
|
+
/**
|
|
6477
|
+
* Configures email forwarding for a business.
|
|
6478
|
+
*
|
|
6479
|
+
* @param data - The forwarding configuration payload
|
|
6480
|
+
* @param options - Request options including locale and abort signal
|
|
6481
|
+
* @returns The created email forwarding configuration
|
|
6482
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6483
|
+
*/
|
|
6484
|
+
configureBusiness(data: EmailForwardingConfigRequest, options?: RequestOptions): Promise<SBEmailForwardingConfig>;
|
|
6485
|
+
/**
|
|
6486
|
+
* Configures email forwarding for a user.
|
|
6487
|
+
*
|
|
6488
|
+
* @param data - The forwarding configuration payload
|
|
6489
|
+
* @param options - Request options including locale and abort signal
|
|
6490
|
+
* @returns The created email forwarding configuration
|
|
6491
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6492
|
+
*/
|
|
6493
|
+
configureUser(data: EmailForwardingConfigRequest, options?: RequestOptions): Promise<SBEmailForwardingConfig>;
|
|
6494
|
+
/**
|
|
6495
|
+
* Disables email forwarding for a business.
|
|
6496
|
+
*
|
|
6497
|
+
* @param businessId - The business ID
|
|
6498
|
+
* @param options - Request options including locale and abort signal
|
|
6499
|
+
* @returns The disabled email forwarding configuration
|
|
6500
|
+
*/
|
|
6501
|
+
disableBusiness(businessId: number, options?: RequestOptions): Promise<SBEmailForwardingConfig>;
|
|
6502
|
+
/**
|
|
6503
|
+
* Disables email forwarding for a user.
|
|
6504
|
+
*
|
|
6505
|
+
* @param userId - The user ID
|
|
6506
|
+
* @param options - Request options including locale and abort signal
|
|
6507
|
+
* @returns The disabled email forwarding configuration
|
|
6508
|
+
*/
|
|
6509
|
+
disableUser(userId: number, options?: RequestOptions): Promise<SBEmailForwardingConfig>;
|
|
6510
|
+
}
|
|
6511
|
+
|
|
6512
|
+
interface SBAuthorizedSender {
|
|
6513
|
+
id: number;
|
|
6514
|
+
userId: number;
|
|
6515
|
+
businessId: number | null;
|
|
6516
|
+
emailAddress: string;
|
|
6517
|
+
createdAt: string;
|
|
6518
|
+
}
|
|
6519
|
+
interface CreateAuthorizedSenderRequest {
|
|
6520
|
+
emailAddress: string;
|
|
6521
|
+
}
|
|
6522
|
+
|
|
6523
|
+
declare class AuthorizedSenderService extends BaseService {
|
|
6524
|
+
list(businessId: number, options?: RequestOptions): Promise<SBAuthorizedSender[]>;
|
|
6525
|
+
create(businessId: number, data: CreateAuthorizedSenderRequest, options?: RequestOptions): Promise<SBAuthorizedSender>;
|
|
6526
|
+
delete(businessId: number, id: number, options?: RequestOptions): Promise<void>;
|
|
6527
|
+
}
|
|
6528
|
+
|
|
6529
|
+
/** The type of rule that determines how loyalty points are accrued. */
|
|
6530
|
+
type LoyaltyRuleType = "visit" | "spend" | "item_variation" | "category";
|
|
6531
|
+
/** Base shape shared by all loyalty accrual rules. */
|
|
6532
|
+
interface SBLoyaltyRuleBase {
|
|
6533
|
+
id?: string;
|
|
6534
|
+
type: LoyaltyRuleType;
|
|
6535
|
+
value: number;
|
|
6536
|
+
description?: string;
|
|
6537
|
+
}
|
|
6538
|
+
/** Configuration data specific to visit-based loyalty rules. */
|
|
6539
|
+
interface SBVisitRuleData {
|
|
6540
|
+
minimumAmountMoney?: number;
|
|
6541
|
+
taxMode?: "include_tax" | "exclude_tax";
|
|
6542
|
+
}
|
|
6543
|
+
/** Configuration data specific to spend-based loyalty rules. */
|
|
6544
|
+
interface SBSpendRuleData {
|
|
6545
|
+
taxMode?: "include_tax" | "exclude_tax";
|
|
6546
|
+
excludedCategoryIds?: string[];
|
|
6547
|
+
excludedItemVariationIds?: string[];
|
|
6548
|
+
}
|
|
6549
|
+
/** Configuration data specific to item-variation-based loyalty rules. */
|
|
6550
|
+
interface SBItemVariationRuleData {
|
|
6551
|
+
itemVariationId: string;
|
|
6552
|
+
}
|
|
6553
|
+
/** Configuration data specific to category-based loyalty rules. */
|
|
6554
|
+
interface SBCategoryRuleData {
|
|
6555
|
+
categoryId: string;
|
|
6556
|
+
}
|
|
6557
|
+
/** Discriminated union of all loyalty accrual rule types. */
|
|
6558
|
+
type SBLoyaltyRule = (SBLoyaltyRuleBase & {
|
|
6559
|
+
type: "visit";
|
|
6560
|
+
visitData?: SBVisitRuleData;
|
|
6561
|
+
}) | (SBLoyaltyRuleBase & {
|
|
6562
|
+
type: "spend";
|
|
6563
|
+
spendData?: SBSpendRuleData;
|
|
6564
|
+
}) | (SBLoyaltyRuleBase & {
|
|
6565
|
+
type: "item_variation";
|
|
6566
|
+
itemVariationData?: SBItemVariationRuleData;
|
|
6567
|
+
}) | (SBLoyaltyRuleBase & {
|
|
6568
|
+
type: "category";
|
|
6569
|
+
categoryData?: SBCategoryRuleData;
|
|
6570
|
+
});
|
|
6571
|
+
/** How rewards are distributed to loyalty members. */
|
|
6572
|
+
type LoyaltyRewardType = "points" | "cashback" | "tier";
|
|
6573
|
+
/** Current lifecycle status of a loyalty program. */
|
|
6574
|
+
type LoyaltyProgramStatus = "active" | "draft";
|
|
6575
|
+
/** Represents a loyalty program configured for a business. */
|
|
6576
|
+
interface SBLoyaltyProgram extends SBEntity, SBTimestamps {
|
|
6577
|
+
name: string;
|
|
6578
|
+
description: string;
|
|
6579
|
+
status: LoyaltyProgramStatus;
|
|
6580
|
+
memberCount: number;
|
|
6581
|
+
pointsIssued: number;
|
|
6582
|
+
rewardType: LoyaltyRewardType;
|
|
6583
|
+
rewardValue: number;
|
|
6584
|
+
rules: SBLoyaltyRule[];
|
|
6585
|
+
}
|
|
6586
|
+
/** Payload for creating a new loyalty program. */
|
|
6587
|
+
interface LoyaltyProgramCreateRequest {
|
|
6588
|
+
name: string;
|
|
6589
|
+
description: string;
|
|
6590
|
+
rewardType: LoyaltyRewardType;
|
|
6591
|
+
rewardValue: number;
|
|
6592
|
+
status: LoyaltyProgramStatus;
|
|
6593
|
+
rules: SBLoyaltyRule[];
|
|
6594
|
+
}
|
|
6595
|
+
/** Payload for updating an existing loyalty program. All fields are optional. */
|
|
6596
|
+
interface LoyaltyProgramUpdateRequest extends Partial<LoyaltyProgramCreateRequest> {
|
|
6597
|
+
}
|
|
6598
|
+
/** Query parameters for listing loyalty programs. */
|
|
6599
|
+
interface LoyaltyProgramListRequest extends PaginationRequest {
|
|
6600
|
+
}
|
|
6601
|
+
|
|
6602
|
+
/**
|
|
6603
|
+
* Service for managing loyalty programs.
|
|
6604
|
+
*
|
|
6605
|
+
* Loyalty programs allow businesses to reward repeat customers
|
|
6606
|
+
* with points, stamps, or tier-based rewards.
|
|
6607
|
+
*/
|
|
6608
|
+
declare class LoyaltyService extends BaseService {
|
|
6609
|
+
/**
|
|
6610
|
+
* Retrieves a paginated list of loyalty programs.
|
|
6611
|
+
*
|
|
6612
|
+
* @param params - Optional filters and pagination parameters
|
|
6613
|
+
* @param options - Request options including locale and abort signal
|
|
6614
|
+
* @returns A paginated list of loyalty programs
|
|
6615
|
+
*/
|
|
6616
|
+
list(params?: LoyaltyProgramListRequest, options?: RequestOptions): Promise<SBListResponse<SBLoyaltyProgram>>;
|
|
6617
|
+
/**
|
|
6618
|
+
* Retrieves a single loyalty program by ID.
|
|
6619
|
+
*
|
|
6620
|
+
* @param id - The loyalty program ID
|
|
6621
|
+
* @param options - Request options including locale and abort signal
|
|
6622
|
+
* @returns The loyalty program
|
|
6623
|
+
* @throws {SmartbillsNotFoundError} If the loyalty program is not found
|
|
6624
|
+
*/
|
|
6625
|
+
getById(id: string, options?: RequestOptions): Promise<SBLoyaltyProgram>;
|
|
6626
|
+
/**
|
|
6627
|
+
* Creates a new loyalty program.
|
|
6628
|
+
*
|
|
6629
|
+
* @param data - The loyalty program creation payload
|
|
6630
|
+
* @param options - Request options including locale and abort signal
|
|
6631
|
+
* @returns The newly created loyalty program
|
|
6632
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6633
|
+
*/
|
|
6634
|
+
create(data: LoyaltyProgramCreateRequest, options?: RequestOptions): Promise<SBLoyaltyProgram>;
|
|
6635
|
+
/**
|
|
6636
|
+
* Updates an existing loyalty program.
|
|
6637
|
+
*
|
|
6638
|
+
* @param id - The loyalty program ID
|
|
6639
|
+
* @param data - The fields to update
|
|
6640
|
+
* @param options - Request options including locale and abort signal
|
|
6641
|
+
* @returns The updated loyalty program
|
|
6642
|
+
* @throws {SmartbillsNotFoundError} If the loyalty program is not found
|
|
6643
|
+
* @throws {SmartbillsValidationError} If the provided data fails validation
|
|
6644
|
+
*/
|
|
6645
|
+
update(id: string, data: LoyaltyProgramUpdateRequest, options?: RequestOptions): Promise<SBLoyaltyProgram>;
|
|
6646
|
+
/**
|
|
6647
|
+
* Deletes a loyalty program.
|
|
6648
|
+
*
|
|
6649
|
+
* @param id - The loyalty program ID
|
|
6650
|
+
* @param options - Request options including locale and abort signal
|
|
6651
|
+
* @throws {SmartbillsNotFoundError} If the loyalty program is not found
|
|
6652
|
+
*/
|
|
6653
|
+
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
6654
|
+
}
|
|
6655
|
+
|
|
6656
|
+
/**
|
|
6657
|
+
* Configuration options for initializing a {@link SmartbillsClient}.
|
|
6658
|
+
*/
|
|
5724
6659
|
interface SmartbillsClientOptions {
|
|
6660
|
+
/** Override the Smartbills API base URL. Defaults to `https://api.smartbills.io`. */
|
|
5725
6661
|
baseUrl?: string;
|
|
6662
|
+
/** OAuth2 access token for authenticating requests. */
|
|
5726
6663
|
accessToken?: string;
|
|
6664
|
+
/** Business ID to scope all requests to a specific business tenant. */
|
|
5727
6665
|
businessId?: number;
|
|
6666
|
+
/** Locale code for localized API responses (e.g., "en-CA", "fr-CA"). */
|
|
5728
6667
|
locale?: string;
|
|
6668
|
+
/** Request timeout in milliseconds. */
|
|
5729
6669
|
timeout?: number;
|
|
6670
|
+
/** Maximum number of automatic retries on transient failures. */
|
|
5730
6671
|
maxRetries?: number;
|
|
6672
|
+
/** Delay in milliseconds between retries. */
|
|
5731
6673
|
retryDelay?: number;
|
|
5732
6674
|
}
|
|
5733
6675
|
declare const DEFAULT_BASE_URL = "https://api.smartbills.io";
|
|
5734
6676
|
|
|
6677
|
+
/**
|
|
6678
|
+
* The main entry point for the Smartbills SDK.
|
|
6679
|
+
*
|
|
6680
|
+
* Provides access to all Smartbills API services through a single client instance.
|
|
6681
|
+
* Handles authentication, business context, and locale configuration.
|
|
6682
|
+
*
|
|
6683
|
+
* @example
|
|
6684
|
+
* ```typescript
|
|
6685
|
+
* const client = new SmartbillsClient({
|
|
6686
|
+
* accessToken: "your-access-token",
|
|
6687
|
+
* businessId: 42,
|
|
6688
|
+
* locale: "en-CA",
|
|
6689
|
+
* });
|
|
6690
|
+
*
|
|
6691
|
+
* const expenses = await client.expenses.listBusiness({ limit: 25 });
|
|
6692
|
+
* const report = await client.expenseReports.create({ name: "Q1 Travel" });
|
|
6693
|
+
* ```
|
|
6694
|
+
*/
|
|
5735
6695
|
declare class SmartbillsClient {
|
|
5736
6696
|
protected readonly http: HttpClient;
|
|
5737
6697
|
readonly users: UserService;
|
|
@@ -5762,23 +6722,63 @@ declare class SmartbillsClient {
|
|
|
5762
6722
|
readonly tables: TableService;
|
|
5763
6723
|
readonly billing: BillingService;
|
|
5764
6724
|
readonly workflows: WorkflowService;
|
|
6725
|
+
readonly customers: CustomerService;
|
|
6726
|
+
readonly departments: DepartmentService;
|
|
6727
|
+
readonly products: ProductService;
|
|
6728
|
+
readonly taxes: TaxService;
|
|
6729
|
+
readonly promoCodes: PromoCodeService;
|
|
6730
|
+
readonly categories: CategoryService;
|
|
6731
|
+
readonly employees: EmployeeService;
|
|
6732
|
+
readonly attachments: AttachmentService;
|
|
6733
|
+
readonly emailForwarding: EmailForwardingService;
|
|
6734
|
+
readonly authorizedSenders: AuthorizedSenderService;
|
|
6735
|
+
readonly loyalty: LoyaltyService;
|
|
6736
|
+
/**
|
|
6737
|
+
* Creates a new Smartbills client instance.
|
|
6738
|
+
*
|
|
6739
|
+
* @param options - Configuration options for the client (base URL, auth token, business ID, locale, retry settings)
|
|
6740
|
+
*/
|
|
5765
6741
|
constructor(options?: SmartbillsClientOptions);
|
|
6742
|
+
/** Sets the OAuth2 access token used for authenticating API requests. */
|
|
5766
6743
|
setAccessToken(token: string | undefined): void;
|
|
6744
|
+
/** Sets the business context for multi-tenant API requests. */
|
|
5767
6745
|
setBusinessId(id: number | undefined): void;
|
|
6746
|
+
/** Sets the locale for localized API responses (e.g., "en-CA", "fr-CA"). */
|
|
5768
6747
|
setLocale(locale: string | undefined): void;
|
|
6748
|
+
/** The current OAuth2 access token, if set. */
|
|
5769
6749
|
get accessToken(): string | undefined;
|
|
6750
|
+
/** The current business ID context, if set. */
|
|
5770
6751
|
get businessId(): number | undefined;
|
|
6752
|
+
/** The current locale for API responses, if set. */
|
|
5771
6753
|
get locale(): string | undefined;
|
|
5772
6754
|
}
|
|
5773
6755
|
|
|
6756
|
+
/**
|
|
6757
|
+
* Interface for providing access credentials to the Smartbills SDK.
|
|
6758
|
+
*
|
|
6759
|
+
* Implement this interface to supply custom credential retrieval logic,
|
|
6760
|
+
* such as refreshing tokens from an auth provider.
|
|
6761
|
+
*/
|
|
5774
6762
|
interface CredentialProvider {
|
|
6763
|
+
/** Returns the current access token, or `undefined` if not authenticated. */
|
|
5775
6764
|
getAccessToken(): string | undefined;
|
|
6765
|
+
/** Optional callback invoked when the current token has expired, allowing automatic refresh. */
|
|
5776
6766
|
onTokenExpired?(): Promise<string | undefined>;
|
|
5777
6767
|
}
|
|
6768
|
+
/**
|
|
6769
|
+
* Simple credential provider that stores an access token in memory.
|
|
6770
|
+
*
|
|
6771
|
+
* @example
|
|
6772
|
+
* ```typescript
|
|
6773
|
+
* const cred = new AccessToken("my-jwt-token");
|
|
6774
|
+
* console.log(cred.getAccessToken()); // "my-jwt-token"
|
|
6775
|
+
* ```
|
|
6776
|
+
*/
|
|
5778
6777
|
declare class AccessToken implements CredentialProvider {
|
|
5779
6778
|
private token?;
|
|
5780
6779
|
constructor(token?: string);
|
|
5781
6780
|
getAccessToken(): string | undefined;
|
|
6781
|
+
/** Updates the stored access token. Pass `undefined` to clear it. */
|
|
5782
6782
|
setToken(token: string | undefined): void;
|
|
5783
6783
|
}
|
|
5784
6784
|
|
|
@@ -5922,5 +6922,5 @@ declare function isConflictError(error: unknown): error is SmartbillsConflictErr
|
|
|
5922
6922
|
declare function isQuotaError(error: unknown): error is SmartbillsQuotaError;
|
|
5923
6923
|
declare function isRetryableError(error: unknown): boolean;
|
|
5924
6924
|
|
|
5925
|
-
export { AccessToken, AppInstallationService, AppInstallationStatus, ApprobationService, BaseService, BillApprovalStatus, BillApprovalType, BillService, BillStatus, BillingService, BusinessService, BusinessUserService, CheckoutDocumentType, CheckoutPaymentStatus, CheckoutService, CheckoutStatus, ConnectAccountStatus, ConnectService, DEFAULT_BASE_URL, EmailAccountService, EmailAccountStatus, EmailAccountSyncStatus, EmailAccountType, ErrorCode, ExpenseItemStatus, ExpenseJobService, ExpenseReportAuditLogAction, ExpenseReportExpenseService, ExpenseReportPaymentService, ExpenseReportService, ExpenseReportStatus, ExpenseService, HttpClient, IntegrationService, IntegrationStatus, InvitationService, InvitationStatus, LocationService, MailboxType, MembershipRole, MembershipService, NotificationService, NotificationType, PayerType, PaymentMethodService, ReceiptPaymentStatus, ReceiptPaymentType, ReceiptService, ReceiptSource, ReceiptType, ReportingService, SmartbillsApiError, SmartbillsAuthenticationError, SmartbillsClient, SmartbillsConflictError, SmartbillsError, SmartbillsNetworkError, SmartbillsNotFoundError, SmartbillsPermissionError, SmartbillsQuotaError, SmartbillsRateLimitError, SmartbillsValidationError, SyncTriggerType, TableService, TransactionService, TransactionType, UserService, VendorConnectionService, VendorConnectionStatus, VendorService, WorkflowService, WorkflowTriggerType, isApiError, isAuthenticationError, isConflictError, isNetworkError, isNotFoundError, isPermissionError, isQuotaError, isRateLimitError, isRetryableError, isSmartbillsError, isValidationError };
|
|
5926
|
-
export type { AddExpenseToReportRequest, AddExpensesToReportBatchRequest, ApprobationListRequest, AssociateExpenseReportUpdateRequest, BillApprovalRequest, BillBatchUpdateRequest, BillCancelRequest, BillCreateRequest, BillListRequest, BillMarkPaidRequest, BillReschedulePaymentRequest, BillRetryPaymentRequest, BillSchedulePaymentRequest, BillSubmitForApprovalRequest, BillTransitionRequest, BillUpdateRequest, BulkAssignCategoryRequest, BulkAssignExpenseReportRequest, BulkAssignReportCategoryRequest, BulkAssignVendorRequest, BulkBillApproveRequest, BulkBillCancelPaymentRequest, BulkBillDeleteRequest, BulkBillMarkPaidRequest, BulkBillRemindRequest, BulkBillRetryPaymentRequest, BulkBillSchedulePaymentRequest, BulkBillUnscheduleRequest, BulkBillUpdateRequest, BulkDeleteExpenseReportsRequest, BulkDeleteExpensesRequest, BulkDeleteVendorsRequest, BulkRemoveReportExpensesRequest, BusinessBatchUpdateRequest, BusinessBrandCreateRequest, BusinessCreateRequest, BusinessUpdateRequest, ConnectOnboardingRequest, CreateCheckoutPaymentIntentRequest, CreatePaymentMethodRequest, CreatePortalSessionRequest, CredentialProvider, EditExpenseInReportRequest, EmailAccountImapCreateRequest, EmailAccountListRequest, EmailAccountOAuth2CreateRequest, EmailAccountUpdateRequest, ErrorCodeType, ExpenseAttachmentDownloadRequest, ExpenseCategoryUpdateRequest, ExpenseExportRequest, ExpenseJobListRequest, ExpenseListRequest, ExpenseNoteUpdateRequest, ExpenseOverTimeRequest, ExpenseReportApproveRequest, ExpenseReportAssignLedgerAccountRequest, ExpenseReportCommentCreateRequest, ExpenseReportCreateRequest, ExpenseReportExportRequest, ExpenseReportListRequest, ExpenseReportPartialReimburseRequest, ExpenseReportPlanReimbursementRequest, ExpenseReportRecallRequest, ExpenseReportReimburseRequest, ExpenseReportRejectRequest, ExpenseReportRequestChangesRequest, ExpenseReportUpdateRequest, ExpenseSplitItem, ExpenseSplitRequest, HistoricalSyncRequest, HttpClientConfig, IntegrationCallbackRequest, IntegrationListRequest, InvitationCreateRequest, InvitationListRequest, InvoiceListRequest, LocationBatchCreateRequest, LocationBatchUpdateRequest, LocationCreateRequest, LocationImageUrlRequest, LocationListRequest, LocationUpdateRequest, MailboxUpdateRequest, MembershipCreateRequest, MembershipEmailInviteRequest, MembershipListRequest, MembershipRoleUpdateRequest, NotificationListRequest, PaginateBusinessRequest, PaginateTransactionRequest, PaginationRequest, PaymentMethodListRequest, ReceiptCreateRequest, ReceiptListRequest, ReceiptOCRCreateRequest, ReceiptUpdateRequest, RefundCheckoutPaymentRequest, ReportDateRange, ReportingRequest, RequestOptions, SBAddress, SBAppInstallation, SBApprobationSummary, SBBatchResponse, SBBill, SBBillApproval, SBBillApprovalHistoryItem, SBBillAttachment, SBBillBulkActionResponse, SBBillLineItem, SBBillStatusSummary, SBBillTax, SBBillTransitionResponse, SBBillingAddress, SBBillingPaymentMethod, SBBillingPlan, SBBillingUsage, SBBulkActionResponse, SBBulkActionResult, SBBusiness, SBBusinessBrand, SBBusinessPlan, SBCheckoutLineItem, SBCheckoutPayment, SBCheckoutPaymentDispute, SBCheckoutPaymentRefund, SBCheckoutTax, SBCheckoutTransactionResponse, SBConnectAccount, SBConnectAccountRequirements, SBConnectDashboardResponse, SBConnectOnboardingResponse, SBCoordinate, SBCreateCheckoutPaymentIntentResponse, SBDowngradeValidation, SBEmailAccount, SBEmailAccountAuthorizeResponse, SBEmployeeCategoryBreakdownReport, SBEntity, SBExpenseBulkActionResponse, SBExpenseByCategoryReport, SBExpenseByDayReport, SBExpenseByEmployeeReport, SBExpenseByVendorReport, SBExpenseJob, SBExpenseMonthlySummary, SBExpenseOverTimeDataPoint, SBExpenseOverTimeReport, SBExpenseReport, SBExpenseReportAuditLogEntry, SBExpenseReportBulkActionResponse, SBExpenseReportComment, SBExpenseReportItem, SBExpenseReportSummary, SBExpenseReportTimelineEntry, SBExpenseValidateResponse, SBFileDownloadResponse, SBIntegration, SBIntegrationAuthorizeResponse, SBInvitation, SBInvoice, SBInvoiceLine, SBListResponse, SBLocation, SBLocationImage, SBMailbox, SBMarketplaceApp, SBMembership, SBMerchantLedger, SBMoney, SBNotification, SBPagination, SBPaymentMethod, SBPaymentMethodBillingDetails, SBPaymentMethodSetupIntentResponse, SBPortalSession, SBReceipt, SBReceiptBarcode, SBReceiptBusiness, SBReceiptCustomer, SBReceiptDiscount, SBReceiptDocument, SBReceiptFee, SBReceiptLineItem, SBReceiptPayment, SBReceiptPaymentCard, SBReceiptRefund, SBReceiptTax, SBReceiptTransaction, SBReceiptVendor, SBSessionTokenResponse, SBSetupIntent, SBSubscription, SBSyncSession, SBTable, SBTableColumn, SBTableRow, SBTaxByCategoryReport, SBTaxByTypeReport, SBTaxByVendorReport, SBTaxSummaryReport, SBTimestamps, SBTransaction, SBTransactionAttachment, SBTransactionMerchant, SBTransactionTax, SBTransactionUploadResponse, SBTransactionVendor, SBUpcomingInvoice, SBUserAccount, SBValidateEmailResponse, SBVendor, SBVendorBulkActionResponse, SBVendorConnectResponse, SBVendorConnection, SBVendorImportResult, SBWorkflow, SBWorkflowCondition, SBWorkflowStep, SBWorkflowTestResponse, SmartbillsClientOptions, SmartbillsFieldError, SubmitDisputeEvidenceRequest, SyncSessionListRequest, TableCreateRequest, TableListRequest, TableUpdateRequest, TransactionBatchUpdateRequest, TransactionUpdateRequest, UpdateInstallationStatusRequest, UpgradeSubscriptionRequest, UsageHistoryRequest, UserUpdateRequest, VendorBatchUpdateRequest, VendorConnectRequest, VendorCreateRequest, VendorListRequest, VendorMergeRequest, VendorUpdateRequest, WorkflowCreateRequest, WorkflowListRequest, WorkflowTestRequest, WorkflowUpdateRequest };
|
|
6925
|
+
export { AccessToken, AppInstallationService, AppInstallationStatus, ApprobationService, AttachmentService, AuthorizedSenderService, BaseService, BillApprovalStatus, BillApprovalType, BillService, BillStatus, BillingService, BusinessService, BusinessUserService, CategoryService, CheckoutDocumentType, CheckoutPaymentStatus, CheckoutService, CheckoutStatus, ConnectAccountStatus, ConnectService, CustomerService, DEFAULT_BASE_URL, DepartmentService, EmailAccountService, EmailAccountStatus, EmailAccountSyncStatus, EmailAccountType, EmailForwardingService, EmployeeService, ErrorCode, ExpenseItemStatus, ExpenseJobService, ExpenseReportAuditLogAction, ExpenseReportExpenseService, ExpenseReportPaymentService, ExpenseReportService, ExpenseReportStatus, ExpenseService, ExpenseSplitType, HttpClient, IntegrationService, IntegrationStatus, InvitationService, InvitationStatus, LocationService, LoyaltyService, MailboxType, MembershipRole, MembershipService, NotificationService, NotificationType, PayerType, PaymentMethodService, ProductService, PromoCodeService, ReceiptPaymentStatus, ReceiptPaymentType, ReceiptService, ReceiptSource, ReceiptType, ReportingService, SmartbillsApiError, SmartbillsAuthenticationError, SmartbillsClient, SmartbillsConflictError, SmartbillsError, SmartbillsNetworkError, SmartbillsNotFoundError, SmartbillsPermissionError, SmartbillsQuotaError, SmartbillsRateLimitError, SmartbillsValidationError, SyncTriggerType, TableService, TaxService, TransactionService, TransactionType, UserService, VendorConnectionService, VendorConnectionStatus, VendorService, WorkflowService, WorkflowTriggerType, isApiError, isAuthenticationError, isConflictError, isNetworkError, isNotFoundError, isPermissionError, isQuotaError, isRateLimitError, isRetryableError, isSmartbillsError, isValidationError };
|
|
6926
|
+
export type { AddExpenseToReportRequest, AddExpensesToReportBatchRequest, ApprobationListRequest, AssociateExpenseReportUpdateRequest, AttachmentListRequest, AttachmentRenameRequest, BillApprovalRequest, BillBatchUpdateRequest, BillCancelRequest, BillCreateRequest, BillListRequest, BillMarkPaidRequest, BillReschedulePaymentRequest, BillRetryPaymentRequest, BillSchedulePaymentRequest, BillSubmitForApprovalRequest, BillTransitionRequest, BillUpdateRequest, BulkAssignCategoryRequest, BulkAssignExpenseReportRequest, BulkAssignReportCategoryRequest, BulkAssignVendorRequest, BulkBillApproveRequest, BulkBillCancelPaymentRequest, BulkBillDeleteRequest, BulkBillMarkPaidRequest, BulkBillRemindRequest, BulkBillRetryPaymentRequest, BulkBillSchedulePaymentRequest, BulkBillUnscheduleRequest, BulkBillUpdateRequest, BulkDeleteExpenseReportsRequest, BulkDeleteExpensesRequest, BulkDeleteVendorsRequest, BulkRemoveReportExpensesRequest, BulkSetNoteRequest, BusinessBatchUpdateRequest, BusinessBrandCreateRequest, BusinessCreateRequest, BusinessUpdateRequest, CategoryCreateRequest, CategoryUpdateRequest, ConnectOnboardingRequest, CreateAuthorizedSenderRequest, CreateCheckoutPaymentIntentRequest, CreatePaymentMethodRequest, CreatePortalSessionRequest, CredentialProvider, CustomerCreateRequest, CustomerListRequest, CustomerUpdateRequest, DepartmentCreateRequest, DepartmentListRequest, DepartmentUpdateRequest, EditExpenseInReportRequest, EmailAccountImapCreateRequest, EmailAccountListRequest, EmailAccountOAuth2CreateRequest, EmailAccountUpdateRequest, EmailForwardingConfigRequest, EmployeeBulkAssignManagerRequest, EmployeeCreateRequest, EmployeeListRequest, EmployeeSetManagerRequest, EmployeeUpdateRequest, ErrorCodeType, ExpenseAttachmentDownloadRequest, ExpenseCategoryUpdateRequest, ExpenseExportRequest, ExpenseJobListRequest, ExpenseListRequest, ExpenseNoteUpdateRequest, ExpenseOverTimeRequest, ExpenseReportApproveRequest, ExpenseReportAssignLedgerAccountRequest, ExpenseReportCommentCreateRequest, ExpenseReportCreateRequest, ExpenseReportExportRequest, ExpenseReportListRequest, ExpenseReportPartialReimburseRequest, ExpenseReportPlanReimbursementRequest, ExpenseReportRecallRequest, ExpenseReportReimburseRequest, ExpenseReportRejectRequest, ExpenseReportRequestChangesRequest, ExpenseReportUpdateRequest, ExpenseReviewUpdateRequest, ExpenseSplitItem, ExpenseSplitLineItem, ExpenseSplitRequest, HistoricalSyncRequest, HttpClientConfig, IntegrationCallbackRequest, IntegrationListRequest, InvitationCreateRequest, InvitationListRequest, InvoiceListRequest, LocationBatchCreateRequest, LocationBatchUpdateRequest, LocationCreateRequest, LocationImageUrlRequest, LocationListRequest, LocationUpdateRequest, LoyaltyProgramCreateRequest, LoyaltyProgramListRequest, LoyaltyProgramStatus, LoyaltyProgramUpdateRequest, LoyaltyRewardType, LoyaltyRuleType, MailboxUpdateRequest, MembershipCreateRequest, MembershipEmailInviteRequest, MembershipListRequest, MembershipRoleUpdateRequest, NotificationListRequest, PaginateBusinessRequest, PaginateTransactionRequest, PaginationRequest, PaymentMethodListRequest, ProductListRequest, ReceiptCreateRequest, ReceiptListRequest, ReceiptOCRCreateRequest, ReceiptUpdateRequest, RefundCheckoutPaymentRequest, ReportDateRange, ReportingRequest, RequestOptions, SBAddress, SBAppInstallation, SBApprobationSummary, SBAttachment, SBAuthorizedSender, SBBatchResponse, SBBill, SBBillApproval, SBBillApprovalHistoryItem, SBBillAttachment, SBBillBulkActionResponse, SBBillLineItem, SBBillStatusSummary, SBBillTax, SBBillTransitionResponse, SBBillingAddress, SBBillingPaymentMethod, SBBillingPlan, SBBillingUsage, SBBulkActionResponse, SBBulkActionResult, SBBusiness, SBBusinessBrand, SBBusinessPlan, SBCategory, SBCategoryRuleData, SBCheckoutLineItem, SBCheckoutPayment, SBCheckoutPaymentDispute, SBCheckoutPaymentRefund, SBCheckoutTax, SBCheckoutTransactionResponse, SBConnectAccount, SBConnectAccountRequirements, SBConnectDashboardResponse, SBConnectOnboardingResponse, SBCoordinate, SBCreateCheckoutPaymentIntentResponse, SBCustomer, SBDepartment, SBDepartmentMember, SBDowngradeValidation, SBEmailAccount, SBEmailAccountAuthorizeResponse, SBEmailForwardingConfig, SBEmployee, SBEmployeeCategoryBreakdownReport, SBEmployeeDepartment, SBEmployeeLocation, SBEmployeeManager, SBEntity, SBExpenseBulkActionResponse, SBExpenseByCategoryReport, SBExpenseByDayReport, SBExpenseByEmployeeReport, SBExpenseByVendorReport, SBExpenseJob, SBExpenseMonthlySummary, SBExpenseOverTimeDataPoint, SBExpenseOverTimeReport, SBExpenseReport, SBExpenseReportAuditLogEntry, SBExpenseReportBulkActionResponse, SBExpenseReportComment, SBExpenseReportItem, SBExpenseReportSummary, SBExpenseReportTimelineEntry, SBExpenseValidateResponse, SBFileDownloadResponse, SBHistoricalSyncResponse, SBIntegration, SBIntegrationAuthorizeResponse, SBInvitation, SBInvoice, SBInvoiceLine, SBItemVariationRuleData, SBListResponse, SBLocation, SBLocationImage, SBLoyaltyProgram, SBLoyaltyRule, SBLoyaltyRuleBase, SBMailbox, SBMarketplaceApp, SBMembership, SBMerchantLedger, SBMoney, SBNotification, SBPagination, SBPaymentMethod, SBPaymentMethodBillingDetails, SBPaymentMethodSetupIntentResponse, SBPortalSession, SBProduct, SBPromoCode, SBReceipt, SBReceiptBarcode, SBReceiptBusiness, SBReceiptCustomer, SBReceiptDiscount, SBReceiptDocument, SBReceiptFee, SBReceiptLineItem, SBReceiptPayment, SBReceiptPaymentCard, SBReceiptRefund, SBReceiptTax, SBReceiptTransaction, SBReceiptVendor, SBSessionTokenResponse, SBSetupIntent, SBSharedMailbox, SBSpendRuleData, SBSubscription, SBSyncSession, SBTable, SBTableColumn, SBTableRow, SBTax, SBTaxByCategoryReport, SBTaxByTypeReport, SBTaxByVendorReport, SBTaxSummaryReport, SBTimestamps, SBTransaction, SBTransactionAttachment, SBTransactionMerchant, SBTransactionTax, SBTransactionUploadResponse, SBTransactionVendor, SBUpcomingInvoice, SBUserAccount, SBValidateEmailResponse, SBValidateSharedMailboxResponse, SBVendor, SBVendorBulkActionResponse, SBVendorConnectResponse, SBVendorConnection, SBVendorImportResult, SBVisitRuleData, SBWorkflow, SBWorkflowCondition, SBWorkflowStep, SBWorkflowTestResponse, SmartbillsClientOptions, SmartbillsFieldError, SubmitDisputeEvidenceRequest, SyncSessionListRequest, TableCreateRequest, TableListRequest, TableUpdateRequest, TaxListRequest, TransactionBatchUpdateRequest, TransactionUpdateRequest, UpdateInstallationStatusRequest, UpgradeSubscriptionRequest, UsageHistoryRequest, UserUpdateRequest, VendorBatchUpdateRequest, VendorConnectRequest, VendorCreateRequest, VendorListRequest, VendorMergeRequest, VendorUpdateRequest, WorkflowCreateRequest, WorkflowListRequest, WorkflowTestRequest, WorkflowUpdateRequest };
|