public class

FreshbooksModule

extends Object
java.lang.Object
   ↳ org.mule.modules.freshbooks.FreshbooksModule
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

FreshBooks

Summary

Fields
private String apiUrl Api URL
private String authenticationToken Authentication Token
private FreshbooksClient freshbooksClient
Public Constructors
FreshbooksModule()
Public Methods
Callback createCallback(String sourceToken, Callback callback)
Create a new callback for a specific event or a set of events.
Category createCategory(String sourceToken, Category category)
Create a new category.
Client createClient(String sourceToken, Client client)
Create a new client and return the corresponding client_id.
Invoice createInvoice(String sourceToken, Invoice invoice)

Create a new invoice complete with line items.

Item createItem(String sourceToken, Item item)

Create a new item and return the corresponding item_id.

Payment createPayment(String sourceToken, Payment payment)
Create a new payment and returns the corresponding payment_id.
Session createSession(String sourceToken, Session session)
Create a session
SystemUser createSystemUser(String sourceToken, SystemUser systemUser)
Create a system user
Tax createTax(String sourceToken, Tax tax)
Create a new tax and returns the corresponding tax_id.
void deleteCallback(String sourceToken, Callback callback)
Deletes a callback.
void deleteCategory(String sourceToken, Category category)
Delete an existing expense category.
void deleteClient(String sourceToken, Client client)
Delete the client with the given client_id.
void deleteInvoice(String sourceToken, Invoice invoice)
Delete an existing invoice.
void deleteItem(String sourceToken, Item item)
Delete an existing item.
void deletePayment(String sourceToken, Payment payment)
Permanently delete a payment.
void deleteTax(String sourceToken, Tax tax)
Permanently delete a tax.
String getApiUrl()
String getAuthenticationToken()
Category getCategory(String sourceToken, String categoryId)
Return the complete category details associated with the given category_id.
Client getClient(String sourceToken, String clientId)
Return the client details associated with the given client_id.
Staff getCurrentUserInformation(String sourceToken)
Returns information about the current user
Invoice getInvoice(String sourceToken, String invoiceId)

Return the complete invoice details associated with the given invoice_id.

Item getItem(String sourceToken, String itemId)

Get an existing item with the given item_id.

Payment getPayment(String sourceToken, String paymentId)

Retrieve payment details according to payment_id.

Tax getTax(String sourceToken, String taxId)

Retrieve tax details according to tax_id.

void init()
Iterable<Callback> listCallbacks(String sourceToken, CallbackRequest callbackRequest)
Return a list of registered callbacks.
Iterable<Category> listCategories(String sourceToken, CategoryRequest categoryRequest)
Returns a list of expense categories.
Iterable<Client> listClients(String sourceToken, ClientRequest clientRequest)
Returns a list of client summaries in order of descending client_id.
Iterable<Invoice> listInvoices(String sourceToken, InvoiceRequest invoiceRequest)
Returns a list of invoice summaries.
Iterable<Item> listItems(String sourceToken, ItemRequest itemRequest)
Returns a list of items, ordered by descending item_id.
Iterable<Payment> listPayments(String sourceToken, PaymentRequest paymentRequest)
Returns a list of payment summaries.
Iterable<Tax> listTaxes(String sourceToken, TaxRequest taxRequest)
Returns a list of taxs, ordered by descending tax_id.
void setApiUrl(String apiUrl)
void setAuthenticationToken(String authenticationToken)
String undeleteClient(String sourceToken, Client client)
Undelete a client
String undeleteInvoice(String sourceToken, Invoice invoice)
Undelete an invoice
Category updateCategory(String sourceToken, Category category)
Update an existing expense category with the given category_id.
Client updateClient(String sourceToken, Client client)
Update the details of the client with the given client_id.
Invoice updateInvoice(String sourceToken, Invoice invoice)

Update an existing invoice with the given invoice_id.

Item updateItem(String sourceToken, Item item)

Update an existing item.

Payment updatePayment(String sourceToken, Payment payment)

Update an existing payment.

Tax updateTax(String sourceToken, Tax tax)

Update an existing tax.

Callback verifyCallback(String sourceToken, Callback callback)
Verify a callback.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private String apiUrl

Api URL

private String authenticationToken

Authentication Token

private FreshbooksClient freshbooksClient

Public Constructors

public FreshbooksModule ()

Public Methods

public Callback createCallback (String sourceToken, Callback callback)

Create a new callback for a specific event or a set of events.

Valid events

* all

* category

* category.create

* category.delete

* category.update

* client

* client.create

* client.delete

* client.update

* estimate

* estimate.create

* estimate.delete

* estimate.sendByEmail

* estimate.update

* expense

* expense.create

* expense.delete

* expense.update

* invoice

* invoice.create

* invoice.delete

* invoice.dispute

* invoice.pastdue.1

* invoice.pastdue.2

* invoice.pastdue.3

* invoice.sendByEmail

* invoice.sendBySnailMail

* invoice.update

* item

* item.create

* item.delete

* item.update

* payment

* payment.create

* payment.delete

* payment.update

* project

* project.create

* project.delete

* project.update

* recurring

* recurring.create

* recurring.delete

* recurring.update

* staff

* staff.create

* staff.delete

* staff.update

* task

* task.create

* task.delete

* task.update

* time_entry

* time_entry.create

* time_entry.delete

* time_entry.update

Parameters
sourceToken Source token value
callback To be created
Returns
  • callback id

public Category createCategory (String sourceToken, Category category)

Create a new category. If successful, returns the category id of the newly created item.

Parameters
sourceToken Source token value
category To be created
Returns
  • The created category

public Client createClient (String sourceToken, Client client)

Create a new client and return the corresponding client_id. If a password is not supplied, one will be created at random.

Parameters
sourceToken Source token value
client To be created
Returns
  • The created client

public Invoice createInvoice (String sourceToken, Invoice invoice)

Create a new invoice complete with line items. If successful, returns the invoice_id of the newly created invoice.

* If you don't specify an invoice number, it will increment from the last one.
* You may optionally specify a different address on the invoice; otherwise the address will be pulled from your client's details.
* You may optionally specify a return_uri element. If provided, users will be presented with a link to the URI when they pay the invoice.

Parameters
sourceToken Source token value
invoice To be created
Returns
  • The created invoice

public Item createItem (String sourceToken, Item item)

Create a new item and return the corresponding item_id.

Parameters
sourceToken Source token value
item To be created
Returns
  • The created item

public Payment createPayment (String sourceToken, Payment payment)

Create a new payment and returns the corresponding payment_id.

This function can have one of three possible effects depending on the presence of invoice_id and client_id:

* If you specify an invoice_id only, the payment will be recorded as an invoice payment.

* If you specify a client_id only, the payment will be recorded as a client credit.

* If you specify both an invoice_id and client_id, the payment will be recorded as an invoice payment, and the amount will be subtracted from the client's credit.

Note that 'currency_code' can only be provided when creating a credit, not a regular payment. Regular payments will default to the currency code of the invoice they are being made against.

Parameters
sourceToken Source token value
payment To be created
Returns
  • The created Payment

public Session createSession (String sourceToken, Session session)

Create a session

Parameters
sourceToken Source token value
session The session to be created
Returns
  • created session information

public SystemUser createSystemUser (String sourceToken, SystemUser systemUser)

Create a system user

Parameters
sourceToken Source token value
systemUser The system user to be created
Returns
  • created system user

public Tax createTax (String sourceToken, Tax tax)

Create a new tax and returns the corresponding tax_id.

*Tax “name” must be unique. You may not create more than one tax with the same name.

Parameters
sourceToken Source token value
tax To be created
Returns
  • The created Tax

public void deleteCallback (String sourceToken, Callback callback)

Deletes a callback.

Parameters
sourceToken Source token value
callback To be deleted

public void deleteCategory (String sourceToken, Category category)

Delete an existing expense category.

Parameters
sourceToken Source token value
category To be deleted

public void deleteClient (String sourceToken, Client client)

Delete the client with the given client_id.

Parameters
sourceToken Source token value
client To be deleted

public void deleteInvoice (String sourceToken, Invoice invoice)

Delete an existing invoice.

Parameters
sourceToken Source token value
invoice To be deleted

public void deleteItem (String sourceToken, Item item)

Delete an existing item.

Parameters
sourceToken Source token value
item To be deleted

public void deletePayment (String sourceToken, Payment payment)

Permanently delete a payment. This will modify the status of the associated invoice if required.

Parameters
sourceToken Source token value
payment To be deleted

public void deleteTax (String sourceToken, Tax tax)

Permanently delete a tax.

Parameters
sourceToken Source token value
tax To be deleted

public String getApiUrl ()

public String getAuthenticationToken ()

public Category getCategory (String sourceToken, String categoryId)

Return the complete category details associated with the given category_id.

Parameters
sourceToken Source token value
categoryId The category id
Returns

public Client getClient (String sourceToken, String clientId)

Return the client details associated with the given client_id.

Parameters
sourceToken Source token value
clientId The client id
Returns

public Staff getCurrentUserInformation (String sourceToken)

Returns information about the current user

Parameters
sourceToken Source token value
Returns
  • current user information

public Invoice getInvoice (String sourceToken, String invoiceId)

Return the complete invoice details associated with the given invoice_id.

* You can use the links element to provide your customers with direct links to the invoice for editing, viewing by the client and viewing by an administrator.

Parameters
sourceToken Source token value
invoiceId The invoice id
Returns
  • The invoice retrieved.

public Item getItem (String sourceToken, String itemId)

Get an existing item with the given item_id.

Parameters
sourceToken Source token value
itemId The item id
Returns
  • The item retrieved.

public Payment getPayment (String sourceToken, String paymentId)

Retrieve payment details according to payment_id.

Parameters
sourceToken Source token value
paymentId The payment id
Returns
  • The payment retrieved.

public Tax getTax (String sourceToken, String taxId)

Retrieve tax details according to tax_id.

Parameters
sourceToken Source token value
taxId The tax id
Returns
  • The tax retrieved.

public void init ()

public Iterable<Callback> listCallbacks (String sourceToken, CallbackRequest callbackRequest)

Return a list of registered callbacks. You can optionally filter by event or uri.

Parameters
sourceToken Source token value
callbackRequest CallbackRequest CallbackRequest object
Returns
  • iterable of callbacks

public Iterable<Category> listCategories (String sourceToken, CategoryRequest categoryRequest)

Returns a list of expense categories.

Parameters
sourceToken Source token value
categoryRequest CategoryRequest CategoryRequest Object
Returns
  • A iterable of categories

public Iterable<Client> listClients (String sourceToken, ClientRequest clientRequest)

Returns a list of client summaries in order of descending client_id.

Parameters
sourceToken Source token value
clientRequest ClientRequest ClientRequest object
Returns
  • A iterable of clients

public Iterable<Invoice> listInvoices (String sourceToken, InvoiceRequest invoiceRequest)

Returns a list of invoice summaries. Results are ordered by descending invoice_id.

Parameters
sourceToken Source token value
invoiceRequest InvoiceRequest InvoiceRequest object
Returns
  • A iterable of Invoices

public Iterable<Item> listItems (String sourceToken, ItemRequest itemRequest)

Returns a list of items, ordered by descending item_id.

Parameters
sourceToken Source token value
itemRequest ItemRequest ItemRequest object
Returns
  • A iterable of Items

public Iterable<Payment> listPayments (String sourceToken, PaymentRequest paymentRequest)

Returns a list of payment summaries. Results are ordered by descending payment_id.

Parameters
sourceToken Source token value
paymentRequest PaymentRequest PaymentRequest object
Returns
  • A iterable of Payments

public Iterable<Tax> listTaxes (String sourceToken, TaxRequest taxRequest)

Returns a list of taxs, ordered by descending tax_id.

Filters: Use a “compound” tag to return only compound or non-compound taxes.

Parameters
sourceToken Source token value
taxRequest TaxRequest TaxRequest object
Returns
  • A iterable of Taxes

public void setApiUrl (String apiUrl)

Parameters
apiUrl

public void setAuthenticationToken (String authenticationToken)

Parameters
authenticationToken

public String undeleteClient (String sourceToken, Client client)

Undelete a client

Parameters
sourceToken Source token value
client To be undeleted
Returns
  • the undeleted client id

public String undeleteInvoice (String sourceToken, Invoice invoice)

Undelete an invoice

Parameters
sourceToken Source token value
invoice To be undeleted
Returns
  • The undeleted invoice id

public Category updateCategory (String sourceToken, Category category)

Update an existing expense category with the given category_id. Any category fields left out of the request will remain unchanged.

Parameters
sourceToken Source token value
category To be updated
Returns
  • updated category

public Client updateClient (String sourceToken, Client client)

Update the details of the client with the given client_id. Any fields not referenced in the request will remain unchanged.

Parameters
sourceToken Source token value
client To be updated
Returns
  • updated client

public Invoice updateInvoice (String sourceToken, Invoice invoice)

Update an existing invoice with the given invoice_id. Any invoice fields left out of the request will remain unchanged.

* If you do not specify a lines element, the existing lines will remain unchanged. If you do specify lines elements the original ones will be replaced by the new ones.

Parameters
sourceToken Source token value
invoice To be updated
Returns
  • updated invoice

public Item updateItem (String sourceToken, Item item)

Update an existing item. All fields aside from the item_id are optional; by omitting a field, the existing value will remain unchanged.

Parameters
sourceToken Source token value
item To be updated
Returns
  • updated item

public Payment updatePayment (String sourceToken, Payment payment)

Update an existing payment. All fields besides payment_id are optional - unpassed fields will retain their existing value.

Note that 'currency_code' can only be provided when updating a credit, not a regular payment. Regular payments will default to the currency code of the invoice they are being made against.

Parameters
sourceToken Source token value
payment To be updated
Returns
  • updated Payment

public Tax updateTax (String sourceToken, Tax tax)

Update an existing tax. All fields aside from the tax_id are optional; by omitting a field, the existing value will remain unchanged.

Parameters
sourceToken Source token value
tax To be updated
Returns
  • updated Tax

public Callback verifyCallback (String sourceToken, Callback callback)

Verify a callback.

Parameters
sourceToken Source token value
callback To be verified
Returns
  • verified callback