Class Clients


public class Clients extends AccountingResource
FreshBooks clients 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 ClientList list(String accountId) throws FreshBooksException
      Get a list of clients using the query strings generated by the QueryBuilder list.
      Parameters:
      accountId - Id of the account
      Returns:
      ClientList containing clients and pagination details
      Throws:
      FreshBooksException - If the call is not successful
    • list

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

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

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

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

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

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

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

      public Client delete(String accountId, long clientId) throws FreshBooksException
      Delete the client with the corresponding id. Makes a PUT call against the client resource endpoint with a `vis_state` of deleted.

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