quickbooks-node-promise
Version:
Connect to QuickBooks Online API with OAuth 2 with typescript on entities
1,537 lines (1,536 loc) • 121 kB
TypeScript
/**
* @file Node.js client for QuickBooks V3 API
* @name quickbooks-promise
* @author Peter Brink <michael_cohen@intuit.com>
* @license ISC
* @copyright (c) 2019 Peter Brink
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee
* is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
* FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Modified from:
* https://github.com/mcohen01/node-quickbooks
* 2014 Michael Cohen
*/
/// <reference types="node" />
import { Response } from "node-fetch";
import FormData from "form-data";
import { QuickbooksTypes } from "./qbTypes";
export interface WebhookEntity {
/** The name of the entity that changed (customer, Invoice, etc.) */
name: EntityName;
/** The ID of the changed entity */
id: string;
/** The type of change */
operation: "Create" | "Update" | "Delete" | "Merge" | "Void";
/** The latest timestamp in UTC */
lastUpdated: string;
/** The ID of the deleted or merged entity (this only applies to merge events) */
deletedID?: string;
}
export type QuickbookEntityType = keyof QuickbooksTypes;
type QuickbooksTypesArrayed = {
[P in QuickbookEntityType]: QuickbooksTypes[P][];
};
export interface WebhookEventNotification {
realmId: string;
dataChangeEvent: {
entities: WebhookEntity[];
};
}
export interface WebhookPayload {
eventNotifications: WebhookEventNotification[];
}
export interface TokenData {
access_token: string;
token_type: string;
x_refresh_token_expires_in: number;
refresh_token: string;
id_token?: string;
expires_in: 3600;
}
export interface TokenExtraFields {
access_expire_timestamp?: number | Date;
refresh_expire_timestamp?: number | Date;
}
export interface RealmTokenData {
realmID: number | string;
/** @deprecated - data is just joined with realm and no longer a seperate property */
token: TokenData;
}
export interface StoreTokenData extends Partial<TokenData> {
realmID?: number | string;
access_token: string;
access_expire_timestamp?: number | Date;
refresh_expire_timestamp?: number | Date;
}
export interface StoreSaveTokenData extends StoreTokenData, RealmTokenData {
realmID: number | string;
access_token: string;
access_expire_timestamp?: number | Date;
refresh_expire_timestamp?: number | Date;
}
export interface StoreGetTokenData {
realmID: number | string;
}
export interface QBStoreStrategy {
getQBToken(storeGetTokenData: StoreGetTokenData, appConfig: AppConfigClean, extra: any): Promise<StoreTokenData>;
storeQBToken(storeSaveTokenData: StoreSaveTokenData, appConfig: AppConfigClean, extra: any): Promise<StoreTokenData>;
}
export declare class DefaultStore implements QBStoreStrategy {
realmInfo: {
[key: string]: StoreTokenData;
};
constructor();
getQBToken(getTokenData: StoreGetTokenData): Promise<StoreTokenData>;
storeQBToken(storeTokenData: StoreTokenData): Promise<StoreTokenData>;
}
export declare enum EntityName {
Account = "Account",
Attachable = "Attachable",
Bill = "Bill",
BillPayment = "BillPayment",
Budget = "Budget",
Class = "Class",
CreditMemo = "CreditMemo",
CompanyInfo = "CompanyInfo",
Customer = "Customer",
Department = "Department",
Deposit = "Deposit",
Employee = "Employee",
Estimate = "Estimate",
Exchangerate = "Exchangerate",
Invoice = "Invoice",
Item = "Item",
JournalCode = "JournalCode",
JournalEntry = "JournalEntry",
Payment = "Payment",
PaymentMethod = "PaymentMethod",
Preferences = "Preferences",
Purchase = "Purchase",
PurchaseOrder = "PurchaseOrder",
RefundReceipt = "RefundReceipt",
SalesReceipt = "SalesReceipt",
TaxAgency = "TaxAgency",
TaxService = "TaxService",
TaxCode = "TaxCode",
TaxRate = "TaxRate",
Term = "Term",
TimeActivity = "TimeActivity",
Transfer = "Transfer",
Vendor = "Vendor",
VendorCredit = "VendorCredit"
}
export declare enum ReportName {
AccountList = "AccountList",
AgedPayableDetail = "AgedPayableDetail",
AgedPayables = "AgedPayables",
AgedReceivableDetail = "AgedReceivableDetail",
AgedReceivables = "AgedReceivables",
BalanceSheet = "BalanceSheet",
CashFlow = "CashFlow",
ClassSales = "ClassSales",
CustomerBalance = "CustomerBalance",
CustomerBalanceDetail = "CustomerBalanceDetail",
CustomerIncome = "CustomerIncome",
CustomerSales = "CustomerSales",
DepartmentSales = "DepartmentSales",
GeneralLedger = "GeneralLedger",
InventoryValuationSummary = "InventoryValuationSummary",
ItemSales = "ItemSales",
ProfitAndLoss = "ProfitAndLoss",
ProfitAndLossDetail = "ProfitAndLossDetail",
TaxSummary = "TaxSummary",
TransactionList = "TransactionList",
TrialBalance = "TrialBalance",
VendorBalance = "VendorBalance",
VendorBalanceDetail = "VendorBalanceDetail",
VendorExpenses = "VendorExpenses"
}
export type UserInfo = {
sub: string;
givenName: string;
familyName: string;
email: string;
emailVerified: boolean;
phoneNumber: string;
phoneNumberVerified: boolean;
address: {
streetAddress: string;
locality: string;
region: string;
postalCode: string;
country: string;
};
};
export type CreateInput<T extends QuickbookEntityType> = Partial<QuickbooksTypes[T]>;
export type UpdateInput<T extends QuickbookEntityType> = Partial<QuickbooksTypes[T]>;
export type DeleteInput<T extends QuickbookEntityType> = number | string | Partial<QuickbooksTypes[T]>;
export interface RequestOptions {
url: string;
qs?: Record<string, any>;
headers?: object;
fullurl?: boolean;
formData?: FormData;
returnHeadersInBody?: boolean;
}
interface BaseRequest {
time: string;
}
interface HeaderAdditions {
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
}
type QueryRequest<K extends QuickbookEntityType> = {
startPosition: number;
totalCount: number;
maxResults: number;
} & Record<K, Array<QuickbooksTypes[K]>>;
type QueryResponse<K extends QuickbookEntityType> = {
QueryResponse: {
[P in keyof (QueryRequest<K>)]?: (QueryRequest<K>)[P];
};
time: string;
};
export interface CriteriaItem {
field: string;
value: string;
operator?: "IN" | "=" | "<" | ">" | "<=" | ">=" | "LIKE" | null;
/**
* @deprecated The method should not be used
*/
count?: boolean;
}
export type QuerySortInput = ([string, "ASC" | "DESC" | null] | string)[] | [string, "ASC" | "DESC" | null] | string;
export type QuerySort = [string, "ASC" | "DESC"][];
export interface QueryBase {
limit?: number;
offset?: number;
asc?: string;
desc?: string;
sort?: QuerySort;
fetchAll?: boolean;
/**
* @deprecated The method should not be used
*/
count?: boolean;
}
export interface QueryData extends QueryBase {
items?: CriteriaItem[];
}
export interface QueryDataWithProperties {
limit?: number;
offset?: number;
asc?: string;
desc?: string;
fetchAll?: boolean;
sort?: QuerySortInput;
items?: CriteriaItem[];
/**
* @deprecated The method should not be used
*/
count?: boolean;
[key: string]: any;
}
export type QueryInput = string | QueryDataWithProperties | CriteriaItem | CriteriaItem[];
interface GetExchangeRateOptions {
/** Currency code, 3 characters */
sourceCurrencyCode: string;
/** yyyy-mm-dd. if not given will use current date */
asOfDate?: string;
}
type DeleteResponse<K extends QuickbookEntityType> = Record<K, {
status: string;
domain: string;
Id: string;
}>;
export interface AttachableResponseData {
AttachableResponse: {
Attachable: {
Id: string;
SyncToken: string;
[module: string]: any;
};
time: string;
};
}
interface AppConfigBase {
/** Required for token management such as creating, refreshing or revoking tokens. not needed if supplying a token and just need to hit normal endpoints */
appKey?: string;
/** Required for token management such as creating, refreshing or revoking tokens. not needed if supplying a token and just need to hit normal endpoints */
appSecret?: string;
/** Required if using Oauth flow. Must be the same as the url put on the quickbooks developer portal */
redirectUrl?: string;
/** Required if using Oauth flow. */
scope?: string[];
/** null for latest version */
minorversion?: number | null;
/** Used for verifying the webook */
webhookVerifierToken?: string;
/** default is false */
useProduction?: string | boolean;
/** default is false */
debug?: boolean | string;
/** CSRF Token */
state?: string;
/** default is true, will auto refresh auth token if about to expire */
autoRefresh?: boolean;
/**
* number of seconds before token expires that will trigger to get a new token
*
* defualt is 60 seconds (1 minute)
*/
autoRefreshBufferSeconds?: number;
}
export type StoreMethod = 'Class' | 'Function' | 'Internal';
export interface AppConfigStoreInternal {
accessToken?: string;
refreshToken?: string;
}
export interface AppConfigStoreClass {
storeStrategy: QBStoreStrategy;
}
export interface AppConfigStoreFunctions {
saveToken: (realmId: number | string, saveTokenData: StoreTokenData, appConfig: AppConfigClean, extra: any) => Promise<StoreTokenData>;
getToken: (realmId: number | string, appConfig: AppConfigClean, extra: any) => Promise<StoreTokenData>;
}
export type AppConfig = AppConfigBase & (AppConfigStoreInternal | AppConfigStoreClass | AppConfigStoreFunctions);
interface AppConfigCleanInternal extends AppConfigStoreInternal {
storeMethod: 'Internal';
}
interface AppConfigCleanClass extends AppConfigStoreClass {
storeMethod: 'Class';
}
interface AppConfigCleanFunctions extends AppConfigStoreFunctions {
storeMethod: 'Function';
}
export interface AppConfigCleanBase extends AppConfigBase {
useProduction: boolean;
debug: boolean;
autoRefresh: boolean;
autoRefreshBufferSeconds: number;
}
export type AppConfigClean = AppConfigCleanBase & (AppConfigCleanInternal | AppConfigCleanClass | AppConfigCleanFunctions);
declare class Quickbooks {
static AUTHORIZATION_URL: string;
static TOKEN_URL: string;
static USER_INFO_URL: string;
static REVOKE_URL: string;
static IDTOKEN_ISSUER_URL: string;
static JWKS_URL: string;
static APP_CENTER_BASE: string;
static V3_ENDPOINT_BASE_URL: string;
static QUERY_OPERATORS: string[];
static EXPIRATION_BUFFER_SECONDS: number;
static scopes: {
Accounting: string;
Payment: string;
Payroll: string;
TimeTracking: string;
Benefits: string;
Profile: string;
Email: string;
Phone: string;
Address: string;
OpenId: string;
Intuit_name: string;
};
config: AppConfigClean;
realmID: number | string;
storeTokenData?: StoreTokenData;
useProduction: boolean;
extra: any;
/**
* Node.js client encapsulating access to the QuickBooks V3 Rest API. An instance
* of this class should be instantiated on behalf of each user and company accessing the api.
*/
constructor(appConfig: AppConfig, realmID: string | number, extra?: any);
static generateCsrf: () => string;
static getApiEndpoint: (useProduction: boolean) => string;
static getUserInfoEndpoint: (useProduction: boolean) => string;
/**
* Redirect link to Authorization Page
*
* Can use generateCsrf to create a state string
*/
static authorizeUrl: (appConfig: AppConfig, state?: string) => string;
/**
* Save token
*
* @deprecated - use Quickbooks instance method going forward
*/
static saveToken: (appConfig: AppConfig, tokenData: RealmTokenData) => Promise<StoreTokenData>;
/**
* Save token
* @param tokenData - token information sent back from Quickbooks or as simple as { access_token: string }, Realm token information is depricated going forward
*/
saveToken: (tokenInput: TokenData | RealmTokenData) => Promise<StoreTokenData>;
/**
* Creates new token for the realmID from the returned authorization code received in the callback request
*
* @deprecated - use Quickbooks instance method going forward
*/
static createToken: (appConfig: AppConfig, authCode: string, realmID: string | number) => Promise<StoreTokenData>;
/**
* Creates new token for the realmID from the returned authorization code received in the callback request
* @param authCode - The code returned in your callback as a param called "code"
* @param realmID - DEPRICATED The company identifier in your callback as a param called "realmId"
* @returns new token with expiration dates from storeStrategy
*/
createToken: (authCode: string, realmID?: string | number) => Promise<StoreTokenData>;
/**
* Check if access_token is valid
*
* uses default expire time buffer
* @param token - returned from storeStrategy
* @param timoutBufferSeconds - optional timout in seconds, default is 1 min
* @return token has expired or not
*/
static isAccessTokenExpired: (token: StoreTokenData, timoutBufferSeconds?: number) => boolean;
/**
* Check if there is a valid (not expired) access token
* @param token - returned from storeStrategy
* @param timoutBufferSeconds - optional timout in seconds, default is 1 min
* @return token has expired or not
*/
static isRefreshTokenExpired: (token: StoreTokenData, timoutBufferSeconds?: number) => boolean;
/**
* Get token
*
* @deprecated use Quickbooks instance method going forward
*/
static getToken: (appConfig: AppConfig, info: StoreGetTokenData) => Promise<StoreTokenData>;
/**
* Get token
*/
getToken: () => Promise<StoreTokenData>;
/**
* Get token and refresh if needed
*
* If config has autoRefresh false then return token regardless
*/
getTokenWithRefresh: () => Promise<StoreTokenData>;
refreshAcessTokenWithToken: (refreshToken: string) => Promise<StoreTokenData>;
/**
* Use the refresh token to obtain a new access token.
* @param token - has the refresh_token
* @returns returns fresh token with access_token and refresh_token
*
* @deprecated use new method refreshAccessTokenWithToken going forward
*/
refreshWithAccessToken: (storeTokenOrRefreshString: {
refresh_token: string;
} | string) => Promise<StoreTokenData>;
/**
* Use the refresh token to obtain a new access token.
*/
refreshAccessToken: () => Promise<StoreTokenData>;
revokeAccessOtherToken: (token: string) => Promise<Response>;
/**
* Use either refresh token or access token to revoke access (OAuth2).
*
* @param useRefresh - boolean - Indicates which token to use: true to use the refresh token, false to use the access token.
*/
revokeAccess: (useRefresh?: boolean) => Promise<Response>;
/**
* Validate id_token
*
*/
validateIdToken: () => Promise<boolean>;
/**
* get Public Key
* @param modulus
* @param exponent
*/
getPublicKey: (modulus: any, exponent: any) => any;
static verifyWebhook: (verifierToken: string, payload: WebhookPayload, signature: string) => boolean;
static VerifyWebhookWithConfig: (appConfig: AppConfig, payload: WebhookPayload, signature: string) => boolean;
verifyWebhook: (payload: WebhookPayload, signature: string) => boolean;
/*** API HELPER FUNCTIONS ***/
request: <T>(verb: string, options: RequestOptions, entity: any) => Promise<T>;
requestPdf: (entityName: EntityName, id: string | number) => Promise<Buffer>;
create: <K extends keyof QuickbooksTypes>(entityName: K, entity: Partial<QuickbooksTypes[K]>) => Promise<{ [P in keyof (BaseRequest & HeaderAdditions & Record<K, QuickbooksTypes[K]>)]: (BaseRequest & HeaderAdditions & Record<K, QuickbooksTypes[K]>)[P]; }>;
read: <K extends keyof QuickbooksTypes>(entityName: K, id: string | number | null, options?: object) => Promise<{ [P in keyof (BaseRequest & HeaderAdditions & Record<K, QuickbooksTypes[K]>)]: (BaseRequest & HeaderAdditions & Record<K, QuickbooksTypes[K]>)[P]; }>;
update: <K extends keyof QuickbooksTypes>(entityName: K, entity: Partial<QuickbooksTypes[K]>) => Promise<{ [P in keyof (BaseRequest & HeaderAdditions & Record<K, QuickbooksTypes[K]>)]: (BaseRequest & HeaderAdditions & Record<K, QuickbooksTypes[K]>)[P]; }>;
delete: <K extends keyof QuickbooksTypes>(entityName: K, idOrEntity: string | number | Partial<QuickbooksTypes[K]>) => Promise<{ [P in keyof (DeleteResponse<K> & HeaderAdditions)]: (DeleteResponse<K> & HeaderAdditions)[P]; }>;
void: <K extends keyof QuickbooksTypes>(entityName: K, idOrEntity: string | number | Partial<QuickbooksTypes[K]>) => Promise<{ [P in keyof (BaseRequest & HeaderAdditions & Record<K, QuickbooksTypes[K]>)]: (BaseRequest & HeaderAdditions & Record<K, QuickbooksTypes[K]>)[P]; }>;
query: <K extends keyof QuickbooksTypes>(entityName: K, queryInput?: QueryInput | null) => Promise<{
QueryResponse: { [P in keyof QueryRequest<K>]?: QueryRequest<K>[P]; };
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
}>;
queryCount: <K extends keyof QuickbooksTypes>(entityName: K, queryInput?: QueryInput | null) => Promise<{
QueryResponse: {
totalCount: number;
};
time: string;
} & HeaderAdditions>;
report: <T>(reportType: ReportName, criteria: any) => Promise<T>;
pluralize: (s: string) => string;
unwrap: (data: any, baseProperty: string) => any;
/*** API CALLS HERE ***/
/**
* Get user info (OAuth2).
*
* fields returned based on scope
* givenName, familyName - profile scope
* Email, EmailVerified - email scope
* Phone, PhoneVerified - phone scope
* Address - address scope
*/
getUserInfo: () => Promise<UserInfo>;
/**
* Batch operation to enable an application to perform multiple operations in a single request.
* The following batch items are supported:
create
update
delete
query
* The maximum number of batch items in a single request is 25.
*
* @param items - JavaScript array of batch items
*/
batch: (items: any[]) => Promise<unknown>;
/**
* The change data capture (CDC) operation returns a list of entities that have changed since a specified time.
*
* @param entities - Comma separated list or JavaScript array of entities to search for changes
* @param since - JS Date object, JS Date milliseconds, or string in ISO 8601 - to look back for changes until
*/
changeDataCapture: <K extends keyof QuickbooksTypes | (keyof QuickbooksTypes)[]>(entities: K, since: Date | number | string) => Promise<{
CDCResponse: {
QueryResponse: ({
startPosition?: number;
maxResults?: number;
totalCount?: number;
} & Pick<Partial<QuickbooksTypesArrayed>, K extends any[] ? K[number] : K>)[];
}[];
time: string;
} & HeaderAdditions>;
/**
* Updates QuickBooks version of Attachable
*
* @param attachable - The persistent Attachable, including Id and SyncToken fields
*/
updateAttachable: (attachable: any) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Attachable: import("./qbTypes").Attachable;
}>;
/**
* Uploads a file as an Attachable in QBO, optionally linking it to the specified
* QBO Entity.
*
* @param filename - the name of the file
* @param contentType - the mime type of the file
* @param buffer - Buffer of file contents
* @param entityType - optional string name of the QBO entity the Attachable will be linked to (e.g. Invoice)
* @param entityId - optional Id of the QBO entity the Attachable will be linked to
*/
upload: (filename: string, contentType: string, buffer: Buffer, entityType: QuickbookEntityType, entityId: string | number) => Promise<{
AttachableResponse: {
Attachable: QuickbooksTypes[EntityName.Attachable];
}[];
}>;
/**
* Downloads the file associated with the specified Attachable.
*/
download: (id: string | number) => Promise<any>;
/**
* Creates the Account in QuickBooks
*
* @param {object} account - The unsaved account, to be persisted in QuickBooks
*/
createAccount: (account: CreateInput<EntityName.Account>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Account: import("./qbTypes").Account;
}>;
/**
* Creates the Attachable in QuickBooks
*
* @param {object} attachable - The unsaved attachable, to be persisted in QuickBooks
*/
createAttachable: (attachable: CreateInput<EntityName.Attachable>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Attachable: import("./qbTypes").Attachable;
}>;
/**
* Creates the Bill in QuickBooks
*
* @param {object} bill - The unsaved bill, to be persisted in QuickBooks
*/
createBill: (bill: CreateInput<EntityName.Bill>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Bill: import("./qbTypes").Bill;
}>;
/**
* Creates the BillPayment in QuickBooks
*
* @param {object} billPayment - The unsaved billPayment, to be persisted in QuickBooks
*/
createBillPayment: (billPayment: CreateInput<EntityName.BillPayment>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
BillPayment: import("./qbTypes").BillPayment;
}>;
/**
* Creates the Class in QuickBooks
*
* @param classqb - The unsaved class, to be persisted in QuickBooks
*/
createClass: (classqb: CreateInput<EntityName.Class>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Class: import("./qbTypes").Class;
}>;
/**
* Creates the CreditMemo in QuickBooks
*
* @param {object} creditMemo - The unsaved creditMemo, to be persisted in QuickBooks
*/
createCreditMemo: (creditMemo: CreateInput<EntityName.CreditMemo>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
CreditMemo: import("./qbTypes").CreditMemo;
}>;
/**
* Creates the Customer in QuickBooks
*
* @param {object} customer - The unsaved customer, to be persisted in QuickBooks
*/
createCustomer: (customer: CreateInput<EntityName.Customer>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Customer: import("./qbTypes").Customer;
}>;
/**
* Creates the Department in QuickBooks
*
* @param {object} department - The unsaved department, to be persisted in QuickBooks
*/
createDepartment: (department: CreateInput<EntityName.Department>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Department: import("./qbTypes").Department;
}>;
/**
* Creates the Deposit in QuickBooks
*
* @param {object} deposit - The unsaved Deposit, to be persisted in QuickBooks
*/
createDeposit: (deposit: CreateInput<EntityName.Deposit>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Deposit: import("./qbTypes").Deposit;
}>;
/**
* Creates the Employee in QuickBooks
*
* @param {object} employee - The unsaved employee, to be persisted in QuickBooks
*/
createEmployee: (employee: CreateInput<EntityName.Employee>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Employee: import("./qbTypes").Employee;
}>;
/**
* Creates the Estimate in QuickBooks
*
* @param {object} estimate - The unsaved estimate, to be persisted in QuickBooks
*/
createEstimate: (estimate: CreateInput<EntityName.Estimate>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Estimate: import("./qbTypes").Estimate;
}>;
/**
* Creates the Invoice in QuickBooks
*
* @param {object} invoice - The unsaved invoice, to be persisted in QuickBooks
*/
createInvoice: (invoice: CreateInput<EntityName.Invoice>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Invoice: import("./qbTypes").Invoice;
}>;
/**
* Creates the Item in QuickBooks
*
* @param {object} item - The unsaved item, to be persisted in QuickBooks
*/
createItem: (item: CreateInput<EntityName.Item>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Item: import("./qbTypes").Item;
}>;
/**
* Creates the JournalCode in QuickBooks
*
* @param {object} journalCode - The unsaved journalCode, to be persisted in QuickBooks
*/
createJournalCode: (journalCode: CreateInput<EntityName.JournalCode>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
JournalCode: import("./qbTypes").JournalCode;
}>;
/**
* Creates the JournalEntry in QuickBooks
*
* @param {object} journalEntry - The unsaved journalEntry, to be persisted in QuickBooks
*/
createJournalEntry: (journalEntry: CreateInput<EntityName.JournalEntry>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
JournalEntry: import("./qbTypes").JournalEntry;
}>;
/**
* Creates the Payment in QuickBooks
*
* @param {object} payment - The unsaved payment, to be persisted in QuickBooks
*/
createPayment: (payment: CreateInput<EntityName.Payment>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Payment: import("./qbTypes").Payment;
}>;
/**
* Creates the PaymentMethod in QuickBooks
*
* @param {object} paymentMethod - The unsaved paymentMethod, to be persisted in QuickBooks
*/
createPaymentMethod: (paymentMethod: CreateInput<EntityName.PaymentMethod>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
PaymentMethod: import("./qbTypes").PaymentMethod;
}>;
/**
* Creates the Purchase in QuickBooks
*
* @param {object} purchase - The unsaved purchase, to be persisted in QuickBooks
*/
createPurchase: (purchase: CreateInput<EntityName.Purchase>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Purchase: import("./qbTypes").Purchase;
}>;
/**
* Creates the PurchaseOrder in QuickBooks
*
* @param {object} purchaseOrder - The unsaved purchaseOrder, to be persisted in QuickBooks
*/
createPurchaseOrder: (purchaseOrder: CreateInput<EntityName.PurchaseOrder>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
PurchaseOrder: import("./qbTypes").PurchaseOrder;
}>;
/**
* Creates the RefundReceipt in QuickBooks
*
* @param {object} refundReceipt - The unsaved refundReceipt, to be persisted in QuickBooks
*/
createRefundReceipt: (refundReceipt: CreateInput<EntityName.RefundReceipt>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
RefundReceipt: import("./qbTypes").RefundReceipt;
}>;
/**
* Creates the SalesReceipt in QuickBooks
*
* @param {object} salesReceipt - The unsaved salesReceipt, to be persisted in QuickBooks
*/
createSalesReceipt: (salesReceipt: CreateInput<EntityName.SalesReceipt>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
SalesReceipt: import("./qbTypes").SalesReceipt;
}>;
/**
* Creates the TaxAgency in QuickBooks
*
* @param {object} taxAgency - The unsaved taxAgency, to be persisted in QuickBooks
*/
createTaxAgency: (taxAgency: CreateInput<EntityName.TaxAgency>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
TaxAgency: import("./qbTypes").TaxAgency;
}>;
/**
* Creates the Term in QuickBooks
*
* @param {object} term - The unsaved term, to be persisted in QuickBooks
*/
createTerm: (term: CreateInput<EntityName.Term>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Term: import("./qbTypes").Term;
}>;
/**
* Creates the TimeActivity in QuickBooks
*
* @param {object} timeActivity - The unsaved timeActivity, to be persisted in QuickBooks
*/
createTimeActivity: (timeActivity: CreateInput<EntityName.TimeActivity>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
TimeActivity: import("./qbTypes").TimeActivity;
}>;
/**
* Creates the Transfer in QuickBooks
*
* @param {object} transfer - The unsaved Transfer, to be persisted in QuickBooks
*/
createTransfer: (transfer: CreateInput<EntityName.Transfer>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Transfer: import("./qbTypes").Transfer;
}>;
/**
* Creates the Vendor in QuickBooks
*
* @param {object} vendor - The unsaved vendor, to be persisted in QuickBooks
*/
createVendor: (vendor: CreateInput<EntityName.Vendor>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Vendor: import("./qbTypes").Vendor;
}>;
/**
* Creates the VendorCredit in QuickBooks
*
* @param {object} vendorCredit - The unsaved vendorCredit, to be persisted in QuickBooks
*/
createVendorCredit: (vendorCredit: CreateInput<EntityName.VendorCredit>) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
VendorCredit: import("./qbTypes").VendorCredit;
}>;
/**
* Creates the TaxService in QuickBooks
*
* Different return than other create methods, does not include entity name in top level
*
* @param {object} taxService - The unsaved taxService, to be persisted in QuickBooks
*/
createTaxService: (taxService: any) => Promise<any>;
/**
* Retrieves the Account from QuickBooks
*
* @param Id - The Id of persistent Account
*/
getAccount: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Account: import("./qbTypes").Account;
}>;
/**
* Retrieves the Attachable from QuickBooks
*
* @param Id - The Id of persistent Attachable
*/
getAttachable: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Attachable: import("./qbTypes").Attachable;
}>;
/**
* Retrieves the Bill from QuickBooks
*
* @param Id - The Id of persistent Bill
*/
getBill: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Bill: import("./qbTypes").Bill;
}>;
/**
* Retrieves the BillPayment from QuickBooks
*
* @param Id - The Id of persistent BillPayment
*/
getBillPayment: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
BillPayment: import("./qbTypes").BillPayment;
}>;
/**
* Retrieves the Class from QuickBooks
*
* @param Id - The Id of persistent Class
*/
getClass: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Class: import("./qbTypes").Class;
}>;
/**
* Retrieves the CompanyInfo from QuickBooks
*
* @param Id - The Id of persistent CompanyInfo
*/
getCompanyInfo: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
CompanyInfo: import("./qbTypes").CompanyInfo;
}>;
/**
* Retrieves the CreditMemo from QuickBooks
*
* @param Id - The Id of persistent CreditMemo
*/
getCreditMemo: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
CreditMemo: import("./qbTypes").CreditMemo;
}>;
/**
* Retrieves the Customer from QuickBooks
*
* @param Id - The Id of persistent Customer
*/
getCustomer: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Customer: import("./qbTypes").Customer;
}>;
/**
* Retrieves the Department from QuickBooks
*
* @param Id - The Id of persistent Department
*/
getDepartment: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Department: import("./qbTypes").Department;
}>;
/**
* Retrieves the Deposit from QuickBooks
*
* @param Id - The Id of persistent Deposit
*/
getDeposit: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Deposit: import("./qbTypes").Deposit;
}>;
/**
* Retrieves the Employee from QuickBooks
*
* @param Id - The Id of persistent Employee
*/
getEmployee: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Employee: import("./qbTypes").Employee;
}>;
/**
* Retrieves the Estimate from QuickBooks
*
* @param Id - The Id of persistent Estimate
*/
getEstimate: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Estimate: import("./qbTypes").Estimate;
}>;
/**
* Retrieves an ExchangeRate from QuickBooks
*
* @param options - An object with options including the required `sourcecurrencycode` parameter and optional `asofdate` parameter.
*/
getExchangeRate: (options: GetExchangeRateOptions) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Exchangerate: import("./qbTypes").Exchangerate;
}>;
/**
* Retrieves the Invoice from QuickBooks
*
* @param Id - The Id of persistent Invoice
*/
getInvoice: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Invoice: import("./qbTypes").Invoice;
}>;
/**
* Retrieves the Item from QuickBooks
*
* @param Id - The Id of persistent Item
*/
getItem: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Item: import("./qbTypes").Item;
}>;
/**
* Retrieves the JournalCode from QuickBooks
*
* @param Id - The Id of persistent JournalCode
*/
getJournalCode: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
JournalCode: import("./qbTypes").JournalCode;
}>;
/**
* Retrieves the JournalEntry from QuickBooks
*
* @param Id - The Id of persistent JournalEntry
*/
getJournalEntry: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
JournalEntry: import("./qbTypes").JournalEntry;
}>;
/**
* Retrieves the Payment from QuickBooks
*
* @param Id - The Id of persistent Payment
*/
getPayment: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Payment: import("./qbTypes").Payment;
}>;
/**
* Retrieves the PaymentMethod from QuickBooks
*
* @param Id - The Id of persistent PaymentMethod
*/
getPaymentMethod: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
PaymentMethod: import("./qbTypes").PaymentMethod;
}>;
/**
* Retrieves the Preferences from QuickBooks
*
*/
getPreferences: () => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Preferences: import("./qbTypes").Preferences;
}>;
/**
* Retrieves the Purchase from QuickBooks
*
* @param Id - The Id of persistent Purchase
*/
getPurchase: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Purchase: import("./qbTypes").Purchase;
}>;
/**
* Retrieves the PurchaseOrder from QuickBooks
*
* @param Id - The Id of persistent PurchaseOrder
*/
getPurchaseOrder: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
PurchaseOrder: import("./qbTypes").PurchaseOrder;
}>;
/**
* Retrieves the RefundReceipt from QuickBooks
*
* @param Id - The Id of persistent RefundReceipt
*/
getRefundReceipt: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
RefundReceipt: import("./qbTypes").RefundReceipt;
}>;
/**
* Retrieves the Reports from QuickBooks
*
* @param Id - The Id of persistent Reports
*/
/**
* Retrieves the SalesReceipt from QuickBooks
*
* @param Id - The Id of persistent SalesReceipt
*/
getSalesReceipt: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
SalesReceipt: import("./qbTypes").SalesReceipt;
}>;
/**
* Retrieves the TaxAgency from QuickBooks
*
* @param Id - The Id of persistent TaxAgency
*/
getTaxAgency: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
TaxAgency: import("./qbTypes").TaxAgency;
}>;
/**
* Retrieves the TaxCode from QuickBooks
*
* @param Id - The Id of persistent TaxCode
*/
getTaxCode: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
TaxCode: import("./qbTypes").TaxCode;
}>;
/**
* Retrieves the TaxRate from QuickBooks
*
* @param Id - The Id of persistent TaxRate
*/
getTaxRate: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
TaxRate: import("./qbTypes").TaxRate;
}>;
/**
* Retrieves the Term from QuickBooks
*
* @param Id - The Id of persistent Term
*/
getTerm: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Term: import("./qbTypes").Term;
}>;
/**
* Retrieves the TimeActivity from QuickBooks
*
* @param Id - The Id of persistent TimeActivity
*/
getTimeActivity: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
TimeActivity: import("./qbTypes").TimeActivity;
}>;
/**
* Retrieves the Transfer from QuickBooks
*
* @param Id - The Id of persistent Term
*/
getTransfer: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Transfer: import("./qbTypes").Transfer;
}>;
/**
* Retrieves the Vendor from QuickBooks
*
* @param Id - The Id of persistent Vendor
*/
getVendor: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
Vendor: import("./qbTypes").Vendor;
}>;
/**
* Retrieves the VendorCredit from QuickBooks
*
* @param Id - The Id of persistent VendorCredit
*/
getVendorCredit: (id: string | number) => Promise<{
time: string;
specialHeaders: {
intuitTid: string;
server: string;
qboVersion: string;
expires: string;
date: string;
};
VendorCredit: import("./qbTypes").VendorCredit;
}>;
/**
* Retrieves the Estimate PDF from QuickBooks
*
* @param Id - The Id of persistent Estimate
*/
getEstimatePdf: (id: string | number) => Promise<Buffer>;
/**
* Retrieves the Invoice PDF from QuickBooks
*
* @param Id - The Id of persistent Invoice
*/
getInvoicePdf: (id: string | number) => Promise<Buffer>;
/**
* Retrieves the SalesReceipt PDF from QuickBooks
*
* @param Id - The Id of persistent SalesReceipt
*/
getSalesReceiptPdf: (id: string | number) => Promise<Buffer>;
/