Class Invoices


public class Invoices extends AccountingResource
FreshBooks invoices resource with calls to get, list, create, update, delete
  • Constructor Details

  • Method Details

    • getPath

      protected String getPath()
      Specified by:
      getPath in class AccountingResource
    • list

      public InvoiceList list(String accountId) throws FreshBooksException
      Get a list of invoices using the query strings generated by the QueryBuilder list.
      Parameters:
      accountId - Id of the account
      Returns:
      InvoiceList containing invoices and pagination details
      Throws:
      FreshBooksException - If the call is not successful
    • list

      public InvoiceList list(String accountId, List<QueryBuilder> builders) throws FreshBooksException
      Get a list of invoices using the query strings generated by the QueryBuilder list.
      Parameters:
      accountId - Id of the account
      builders - List of QueryBuilders
      Returns:
      InvoiceList containing invoices and pagination details
      Throws:
      FreshBooksException - If the call is not successful
    • get

      public Invoice get(String accountId, long invoiceId) throws FreshBooksException
      Get a single invoice with the corresponding id.
      Parameters:
      accountId - The alpha-numeric account id
      invoiceId - Id of the resource to return
      Returns:
      The Invoice
      Throws:
      FreshBooksException - If the call is not successful
    • get

      public Invoice get(String accountId, long invoiceId, IncludesQueryBuilder builder) throws FreshBooksException
      Get a single invoice with the corresponding id.
      Parameters:
      accountId - The alpha-numeric account id
      invoiceId - Id of the resource to return
      builder - IncludesQueryBuilder object for including additional data, sub-resources, etc.
      Returns:
      The Invoice
      Throws:
      FreshBooksException - If the call is not successful
    • create

      public Invoice create(String accountId, Invoice data) throws FreshBooksException
      Create a new invoice from the provided Invoice model. Makes a POST call against the invoice resource endpoint. This calls `invoice.getContent()` to get a hash map of data.
      Parameters:
      accountId - The alpha-numeric account id
      data - Invoice model with create data
      Returns:
      The created Invoice
      Throws:
      FreshBooksException - If the call is not successful
    • create

      public Invoice create(String accountId, Map<String,Object> data) throws FreshBooksException
      Create a new invoice from the provided data. Makes a POST call against the invoice resource endpoint.
      Parameters:
      accountId - The alpha-numeric account id
      data - Map of create data
      Returns:
      The created Invoice
      Throws:
      FreshBooksException - If the call is not successful
    • update

      public Invoice update(String accountId, long invoiceId, Invoice data) throws FreshBooksException
      Update the invoice with the corresponding id. Makes a PUT call against the invoice resource endpoint.
      Parameters:
      accountId - The alpha-numeric account id
      invoiceId - Id of the resource to return
      data - Invoice model with updated data
      Returns:
      The updated Invoice
      Throws:
      FreshBooksException - If the call is not successful
    • update

      public Invoice update(String accountId, long invoiceId, Map<String,Object> data) throws FreshBooksException
      Update the invoice with the corresponding id. Makes a PUT call against the invoice resource endpoint.
      Parameters:
      accountId - The alpha-numeric account id
      invoiceId - Id of the resource to update
      data - Map of data to change
      Returns:
      The updated Invoice
      Throws:
      FreshBooksException - If the call is not successful
    • delete

      public void delete(String accountId, long invoiceId) throws FreshBooksException
      Delete the invoice with the corresponding id.

      Note: Most FreshBooks resources are soft-deleted,
      Parameters:
      accountId - The alpha-numeric account id
      invoiceId - Id of the resource to update
      Throws:
      FreshBooksException - If the call is not successful
      See Also: