lucee.Componentcbfreshbooks.SDK
This is the Freshbooks SDK class
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
authorizationCode
Authorization code.
|
true
|
false
|
|
any
|
cache
|
true
|
false
|
|
any
|
cachebox
|
true
|
false
|
|
any
|
identityInformation
Store the identity of the current user.
|
true
|
false
|
|
any
|
log
|
true
|
false
|
|
any
|
refreshToken
|
true
|
false
|
|
any
|
settings
The module settings.
|
true
|
false
|
|
any
|
tokenAccess
Access token and refresh token.
|
true
|
false
|
Constructor Summary | |
---|---|
init(any settings, any cachebox)
Constructor. |
Method Summary | |
---|---|
struct
|
authenticate()
Do the authentication process and retrieve the token access from a given authorization code (Use the activation handler to retrieve the auth code). |
struct
|
authResponse(any response)
Manage response and build an struct with the token information and store it in the cache. |
string
|
buildAuthorizationURL()
Generate the authorization link to retrieve the authorization code. |
struct
|
createEstimate(string accountID, struct estimateInfo)
Create an estimate. |
struct
|
createExpense(string accountID, struct expenseInfo)
Create an expense. |
struct
|
createInvoice(string accountID, struct invoiceInfo)
Create an invoice. |
struct
|
createItem(string accountID, struct itemInfo)
Create item. |
struct
|
createPayment(string accountID, struct paymentInfo)
Create payment. |
struct
|
createProject(string businessID, struct projectInfo)
Create a new project. |
struct
|
createSingleClient(string accountID, struct userInfo)
Create a single client. |
struct
|
createTax(string accountID, struct taxInfo)
Create tax. |
struct
|
createTimeEntry(string accountID, string businessID, struct timeEntryInfo)
Create time entry. |
any
|
deleteEstimate(string accountID, string estimateID, struct estimateFlag)
Delete an estimate. |
any
|
deleteExpense(string accountID, string expenseID, struct expenseFlag)
Delete an expense. |
any
|
deleteInvoice(string accountID, string invoiceID, struct invoiceFlag)
Delete an invoice. |
any
|
deleteItem(string accountID, string itemID, struct itemInfo)
Delete item. |
any
|
deletePayment(string accountID, string paymentID, struct paymentInfo)
Delete payment. |
struct
|
deleteProject(string businessID, string projectID, struct projectInfo)
Delete a project. |
any
|
deleteSingleClient(string accountID, string clientID, struct userFlag)
Delete single client -> It passes an struct with a key "vis_state" = 1 to delete that client. |
any
|
deleteStaff(string accountID, string staffID, struct staffInfo)
delete a staff member. |
any
|
deleteTax(string accountID, string taxID)
delete tax. |
any
|
deleteTimeEntry(string accountID, string businessID, string timeEntryID)
Delete time entry. |
any
|
getAuthenticationCredentials()
Retrieve the authentication credentials for this modules. |
string
|
getAuthorizationCode()
|
string
|
getCache()
|
string
|
getCachebox()
|
array
|
getClients(string accountID)
Return the list of clients, if a 404 NOT FOUND error is thrown by the request, an empty array is returned. |
struct
|
getEstimateById(string accountID, string estimateID)
Returns a single estimate if it exists. |
array
|
getEstimatesList(string accountID)
Get the list of estimates. |
struct
|
getExpenseById(string accountID, string expenseID)
Returns a single expense, if it does not exist returns an empty struct. |
array
|
getExpenseCategoriesList(string accountID)
Get the list of expense categories. |
struct
|
getExpenseCategoryById(string accountID, string expenseCategoryID)
Returns a single expense category if it exists. |
array
|
getExpensesList(string accountID)
Retrieve the list of expenses. |
array
|
getGatewaysList(string accountID)
Get the list of gateways. |
string
|
getIdentityInformation()
|
struct
|
getInvoiceById(string accountID, string invoiceID)
Returns a single invoice if it exists. |
array
|
getInvoicesList(string accountID)
Get the list of invoices. |
struct
|
getItemById(string accountID, string itemID)
Returns a single item if it exists. |
array
|
getItemsList(string accountID)
Get the list of items. |
string
|
getLog()
|
struct
|
getPaymentById(string accountID, string paymentID)
Returns a single payment if it exists. |
array
|
getPaymentsList(string accountID)
Get the list of payments. |
struct
|
getProjectById(string businessID, string projectID)
Returns a single project if it exists. |
array
|
getProjectsList(string businessID)
Get the list of the projects associated with a business ID. |
string
|
getRefreshToken()
|
string
|
getSettings()
|
struct
|
getSingleClient(string accountID, string clientID)
Retrieve a single client. |
struct
|
getStaffById(string accountID, string staffID)
Returns a single staff member if it exists. |
array
|
getStaffList(string accountID)
Get the list of the staff. |
struct
|
getTaskById(string accountID, string taskID)
Returns a single task if it exists. |
struct
|
getTaxById(string accountID, string taxID)
Returns a single tax if it exists. |
array
|
getTaxesList(string accountID)
Get the list of taxes. |
array
|
getTimeEntries(string businessID)
Get time entries. |
string
|
getTokenAccess()
|
boolean
|
isAuth()
Check if the freshbooks account is authenticated (struct stored in cache). |
private struct
|
makeRequest([string method='GET'], string url, [any body='[runtime expression]'], [struct headers='[runtime expression]'], [struct parameters='[runtime expression]'], [string type='R'], [numeric timeout='15'])
Make a request to FreshBooks API. |
struct
|
refreshToken(string refreshToken)
I take the refresh token from the autehntication procedure and get you a new access token. |
any
|
revokeAccess()
Revoke Access to the freshbooks account. |
any
|
setAuthorizationCode(any authorizationCode)
|
any
|
setCache(any cache)
|
any
|
setCachebox(any cachebox)
|
any
|
setIdentityInformation(any identityInformation)
|
any
|
setLog(any log)
|
any
|
setRefreshToken(any refreshToken)
|
any
|
setSettings(any settings)
|
any
|
setTokenAccess(any tokenAccess)
|
any
|
testCall()
Make a test call. |
struct
|
updateEstimate(string accountID, string estimateID, struct estimateInfo)
Update an estimate. |
struct
|
updateExpense(string accountID, string expenseID, struct expenseInfo)
Update an expense. |
struct
|
updateInvoice(string accountID, string invoiceID, struct invoiceInfo)
Update an invoice. |
struct
|
updateItem(string accountID, string itemID, struct itemInfo)
Update an item. |
struct
|
updatePayment(string accountID, string paymentID, struct paymentInfo)
Update payment. |
struct
|
updateProject(string businessID, string projectID, struct projectInfo)
Update a project. |
struct
|
updateSingleClient(string accountID, string clientID, struct userInfo)
Update single client. |
struct
|
updateStaff(string accountID, string staffID, struct staffInfo)
update a staff member. |
struct
|
updateTax(string accountID, string taxID, struct taxInfo)
update tax. |
struct
|
updateTimeEntry(string accountID, string businessID, string timeEntryID, struct timeEntryInfo)
Update time entry. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
settings
- The module settingscachebox
- The CacheBox referenceProperty Detail |
---|
Authorization code
access
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- cacheboxserializable
- trueStore the identity of the current user
access
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- logbox:logger:{this}serializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueThe module settings
access
- publicrequired
- falsereturntype
- anyserializable
- trueAccess token and refresh token
access
- publicrequired
- falsereturntype
- anyserializable
- trueMethod Detail |
---|
Do the authentication process and retrieve the token access from a given authorization code (Use the activation handler to retrieve the auth code) Authenticate the first time, after that returns the struct stored in cache, if the token has expired, it calls the refreshToken method and get a new token access
Manage response and build an struct with the token information and store it in the cache
response
- HTTP ResponseGenerate the authorization link to retrieve the authorization code The user has to allow manually the access to the FreshBooks account and paste the authorization code into the module settings
Create an estimate
accountID
- The account ID associated with the estimate that will be createdestimateInfo
- The struct with the estimate's info to create a new entryCreate an expense
accountID
- The account ID where the expense will be created inexpenseInfo
- The struct with the expense's info to create a new entryCreate an invoice
accountID
- The account ID associated with the invoice that will be createdinvoiceInfo
- The struct with the invoice's info to create a new entryCreate item
accountID
- The account ID associated with the item that will be createditemInfo
- struct with the item's info to create a new entryCreate payment
accountID
- The account ID Associated with the payment to createpaymentInfo
- struct with the payment's info to create a new entryCreate a new project
businessID
- The business ID associated with the project to createprojectInfo
- struct with the project's info to create a new entryCreate a single client
accountID
- The account ID where the client will be created inuserInfo
- The struct with the client's info to create a new entryCreate tax
accountID
- The account ID Associated with the tax to createtaxInfo
- struct with the tax's info to create a new entryCreate time entry meta { pages, total_logged, total_unbilled, per_page, total, page } }
accountID
- The account ID Associated with the time entry to createbusinessID
- The business ID associated with the time entry to createtimeEntryInfo
- struct with the time entry's info to create a new entryDelete an estimate
accountID
- The account ID associated with the estimate that will be deletedestimateID
- ID of the estimate that will be deletedestimateFlag
- The struct with key 'vis_state' set to 1 to delete an existing estimateDelete an expense
accountID
- The account ID associated with the expense will be deletedexpenseID
- ID of the expense to deleteexpenseFlag
- The struct with the key 'vis_state' set to 1 to delete an expenseDelete an invoice
accountID
- The account ID associated with the invoice that will be deletedinvoiceID
- Id of the invoice to deleteinvoiceFlag
- The struct with the invoice's info to update an existing entryDelete item
accountID
- The account ID of the items to listitemID
- ID of the item to deleteitemInfo
- struct with the item's key 'vis_state' set to 1 to delete its entryDelete payment
accountID
- The account ID Associated with the payment to deletepaymentID
- ID of the payment to deletepaymentInfo
- struct with the key 'vis_state' set to 1 to delete its entryDelete a project
businessID
- The business ID associated with the project to deleteprojectID
- ID of the project to deleteprojectInfo
- struct with the project's info to deleteDelete single client -> It passes an struct with a key "vis_state" = 1 to delete that client
accountID
- The account ID where the client belongs toclientID
- Id of the client to deleteuserFlag
- The struct with key 'vis_state' set to 1 to delete a single clientdelete a staff member updated, p_province, p_city, p_code, p_country, accounting_systemid, bus_phone, signup_date, language, level, userid, p_street2, vis_state, fname, organization, p_street, currency_code}
accountID
- The account ID Associated with the staff member to deletestaffID
- Id of the staff member to deletestaffInfo
- struct with the staff's info to deletedelete tax
accountID
- The account ID Associated with the tax to deletetaxID
- Id of the tax to deleteDelete time entry
accountID
- The account ID Associated with the time entry to createbusinessID
- The business ID associated with the time entry to createtimeEntryID
- Id of the time entry to updateRetrieve the authentication credentials for this modules
Return the list of clients, if a 404 NOT FOUND error is thrown by the request, an empty array is returned
accountID
- The account ID that the client belongs toReturns a single estimate if it exists
accountID
- Account Id where the estimate belongs toestimateID
- Id of the estimate to returnGet the list of estimates
accountID
- The account ID of the estimates to listReturns a single expense, if it does not exist returns an empty struct
accountID
- Account Id where the expense belong toexpenseID
- Id of the expense to returnGet the list of expense categories is_cogs:boolean, parentid, vis_state:number, id:number } , {category2}, ... ]
accountID
- The account ID of the expense categories to listReturns a single expense category if it exists is_cogs:boolean, parentid, vis_state:number, id:number }
accountID
- Account Id where the expense category belongs toexpenseCategoryID
- Id of the expense category to returnRetrieve the list of expenses expense -> { categoryid, markup_percent, projectid, clientid, isduplicate, taxName2, taxName1, taxPercent1, profileid, taxPercent2, id, invoiceid, account_name, taxAmount2, taxAmount1, vis_state, status, bank_name, updated, vendor, has_receipt, ext_systemid, staffid, date, transactionid, include_receipt, accounting_systemid, background_jobid, notes, ext_invoiceid, amount, expenseid, compounded_tax, accountid }
accountID
- The account ID of the expenses to listGet the list of gateways
accountID
- The account ID of the gateways to listReturns a single invoice if it exists
accountID
- Account Id where the invoice belong toinvoiceID
- Id of the invoice to returnGet the list of invoices invoice -> { status, deposit_percentage, create_date, outstanding, payment_status, street, code, ownerid, vat_number, id, gmail, vat_name, v3_status, discount_description, dispute_status, lname, deposit_status, ext_archive, template, basecampid, sentid, show_attachments, vis_state, current_organization, province, due_date, updated, terms, description, parent, last_order_status, street2, deposit_amount, paid, invoiceid, discount_total, address, invoice_number, customerid, discount_value, accounting_systemid, organization, due_offset_days, language, po_number, display_status, created_at, auto_bill, date_paid, amount, estimateid, city, currency_code, country, autobill_status, generation_date, return_uri, fname, notes, payment_details, accountid }
accountID
- The account ID of the invoices to listReturns a single item if it exists
accountID
- Account Id where the item belongs toitemID
- Id of the item to returnGet the list of items
accountID
- The account ID of the items to listReturns a single payment if it exists
accountID
- Account Id where the payment belongs topaymentID
Get the list of payments
accountID
- The account ID of the payments to listReturns a single project if it exists
businessID
- The business ID associated with the projects to listprojectID
- ID of the project to retrieveGet the list of the projects associated with a business ID
businessID
- The business ID associated with the projects to listRetrieve a single client
accountID
- The account ID that the client belongs toclientID
- ID of the client to retrieveReturns a single staff member if it exists updated, p_province, p_city, p_code, p_country, accounting_systemid, bus_phone, signup_date, language, level, userid, p_street2, vis_state, fname, organization, p_street, currency_code}
accountID
- Account Id where the staff member belongs tostaffID
- Id of the staff member to returnGet the list of the staff username, updated, p_province, p_city, p_code, p_country, accounting_systemid, bus_phone, signup_date, language, level, userid, p_street2, vis_state, fname, organization, p_street, currency_code}, ... ]
accountID
- The account ID of the staff to listReturns a single task if it exists
accountID
- Account Id where the task belongs totaskID
- ID of the task to retrieveReturns a single tax if it exists
accountID
- Account Id where the tax belongs totaxID
Get the list of taxes
accountID
- The account ID of the taxes to listGet time entries meta { pages, total_logged, total_unbilled, per_page, total, page } }
businessID
- The business ID associated with the time entriesCheck if the freshbooks account is authenticated (struct stored in cache)
Make a request to FreshBooks API
method
- The HTTP method callurl
- The url to make the requestbody
- The body contents of the requestheaders
- Request headersparameters
- Request parameterstype
- Flag to determine the type of request, "A" for authenticaton request and "R" for other requeststimeout
- Request TimeoutI take the refresh token from the autehntication procedure and get you a new access token.
refreshToken
- the most recent refresh token that has been providedRevoke Access to the freshbooks account Remove token access, refresh token, authorization code and authorization struct from the application
authorizationCode
cache
cachebox
identityInformation
log
refreshToken
settings
tokenAccess
Make a test call It will be deleted later
Update an estimate
accountID
- The account ID associated with the estimate that will be updatedestimateID
- ID of the estimate that will be updatedestimateInfo
- The struct with the estimate's info to updateUpdate an expense
accountID
- The account ID associated with the expense that will be updatedexpenseID
- ID of the expense to updateexpenseInfo
- The struct with the expense's info to create a new entryUpdate an invoice
accountID
- The account ID associated with the invoice that will be updatedinvoiceID
- Id of the invoice to updateinvoiceInfo
- The struct with the invoice's info to create a new entryUpdate an item
accountID
- The account ID associated with the item to updateitemID
- ID of the item to updateitemInfo
- struct with the item's info to updateUpdate payment
accountID
- The account ID Associated with the payment to updatepaymentID
- ID of the payment to updatepaymentInfo
- struct with the payment's info to updateUpdate a project
businessID
- The business ID associated with the project to updateprojectID
- ID of the project to updateprojectInfo
- struct with the project's info to updateUpdate single client
accountID
- The account ID where the client belongs toclientID
- Id of the client to updateuserInfo
- The struct with the client's data to updateupdate a staff member updated, p_province, p_city, p_code, p_country, accounting_systemid, bus_phone, signup_date, language, level, userid, p_street2, vis_state, fname, organization, p_street, currency_code}
accountID
- The account ID Associated with the staff member to updatestaffID
- Id of the staff member to updatestaffInfo
- struct with the staff's info to update a new entryupdate tax
accountID
- The account ID Associated with the tax to updatetaxID
- Id of the tax to updatetaxInfo
- struct with the tax's info to update a new entryUpdate time entry meta { pages, total_logged, total_unbilled, per_page, total, page } }
accountID
- The account ID Associated with the time entry to updatebusinessID
- The business ID associated with the time entry to updatetimeEntryID
- Id of the time entry to updatetimeEntryInfo
- struct with the time entry's info to update