Class Tasks


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

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

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

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

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

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

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

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

      public Task delete(String accountId, long taskId) throws FreshBooksException
      Delete the task with the corresponding id. Makes a PUT call against the task resource endpoint with a `vis_state` of deleted. Note: Most FreshBooks resources are soft-deleted,
      Parameters:
      accountId - The alpha-numeric account id
      taskId - Id of the resource to update
      Returns:
      The deleted Task
      Throws:
      FreshBooksException - If the call is not successful
      See Also: