Class Projects


public class Projects extends ProjectResource
FreshBooks projects resource with calls to get, list, create, update, delete
  • Constructor Details

  • Method Details

    • getPathForList

      protected String getPathForList()
      Specified by:
      getPathForList in class ProjectResource
    • getPathForSingle

      protected String getPathForSingle()
      Specified by:
      getPathForSingle in class ProjectResource
    • list

      public ProjectList list(long businessId) throws FreshBooksException
      Get a list of projects.
      Parameters:
      businessId - Id of the business
      Returns:
      ProjectList containing projects and pagination details
      Throws:
      FreshBooksException - If the call is not successful
    • list

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

      public Project get(long businessId, long projectId) throws FreshBooksException
      Get a single project with the corresponding id.
      Parameters:
      businessId - Id of the business
      projectId - Id of the resource to return
      Returns:
      The Project
      Throws:
      FreshBooksException - If the call is not successful
    • get

      public Project get(long businessId, long projectId, IncludesQueryBuilder builder) throws FreshBooksException
      Get a single project with the corresponding id.
      Parameters:
      businessId - Id of the business
      projectId - Id of the resource to return
      builder - IncludesQueryBuilder object for including additional data, sub-resources, etc.
      Returns:
      The Project
      Throws:
      FreshBooksException - If the call is not successful
    • create

      public Project create(long businessId, Project data) throws FreshBooksException
      Create a new project from the provided Project model. Makes a POST call against the project resource endpoint. This calls `project.getContent()` to get a hash map of data.
      Parameters:
      businessId - Id of the business
      data - Project model with create data
      Returns:
      The created Project
      Throws:
      FreshBooksException - If the call is not successful
    • create

      public Project create(long businessId, Map<String,Object> data) throws FreshBooksException
      Create a new project from the provided data. Makes a POST call against the project resource endpoint.
      Parameters:
      businessId - Id of the business
      data - Map of create data
      Returns:
      The created Project
      Throws:
      FreshBooksException - If the call is not successful
    • update

      public Project update(long businessId, long projectId, Project data) throws FreshBooksException
      Update the project with the corresponding id. Makes a PUT call against the project resource endpoint.
      Parameters:
      businessId - Id of the business
      projectId - Id of the resource to update
      data - Project model with updated data
      Returns:
      The updated Project
      Throws:
      FreshBooksException - If the call is not successful
    • update

      public Project update(long businessId, long projectId, Map<String,Object> data) throws FreshBooksException
      Update the project with the corresponding id. Makes a PUT call against the project resource endpoint.
      Parameters:
      businessId - Id of the business
      projectId - Id of the resource to update
      data - Map of data to change
      Returns:
      The updated Project
      Throws:
      FreshBooksException - If the call is not successful
    • delete

      public void delete(long businessId, long projectId) throws FreshBooksException
      Delete the project with the corresponding id. Makes a DELETE call against the project resource endpoint.

      Note: Most FreshBooks resources are soft-deleted,
      Parameters:
      businessId - Id of the business
      projectId - Id of the resource to update
      Throws:
      FreshBooksException - If the call is not successful