Class Projects
java.lang.Object
net.amcintosh.freshbooks.resources.api.Resource
net.amcintosh.freshbooks.resources.api.ProjectResource
net.amcintosh.freshbooks.resources.Projects
FreshBooks projects resource with calls to get, list, create, update, delete
-
Field Summary
Fields inherited from class net.amcintosh.freshbooks.resources.api.Resource
freshBooksClient -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a new project from the provided data.Create a new project from the provided Project model.voiddelete(long businessId, long projectId) Delete the project with the corresponding id.get(long businessId, long projectId) Get a single project with the corresponding id.get(long businessId, long projectId, IncludesQueryBuilder builder) Get a single project with the corresponding id.protected Stringprotected Stringlist(long businessId) Get a list of projects.list(long businessId, List<QueryBuilder> builders) Get a list of projects using the query strings generated by the QueryBuilder list.Update the project with the corresponding id.Update the project with the corresponding id.Methods inherited from class net.amcintosh.freshbooks.resources.api.ProjectResource
getResourceType, getUrl, getUrl, getUrl, getUrl, handleListRequest, handleRequest, handleRequestMethods inherited from class net.amcintosh.freshbooks.resources.api.Resource
buildQueryString
-
Constructor Details
-
Projects
-
-
Method Details
-
getPathForList
- Specified by:
getPathForListin classProjectResource
-
getPathForSingle
- Specified by:
getPathForSinglein classProjectResource
-
list
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
Get a list of projects using the query strings generated by the QueryBuilder list.- Parameters:
businessId- Id of the businessbuilders- List of QueryBuilders- Returns:
- ProjectList containing projects and pagination details
- Throws:
FreshBooksException- If the call is not successful
-
get
Get a single project with the corresponding id.- Parameters:
businessId- Id of the businessprojectId- 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 businessprojectId- Id of the resource to returnbuilder- IncludesQueryBuilder object for including additional data, sub-resources, etc.- Returns:
- The Project
- Throws:
FreshBooksException- If the call is not successful
-
create
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 businessdata- Project model with create data- Returns:
- The created Project
- Throws:
FreshBooksException- If the call is not successful
-
create
Create a new project from the provided data. Makes a POST call against the project resource endpoint.- Parameters:
businessId- Id of the businessdata- Map of create data- Returns:
- The created Project
- Throws:
FreshBooksException- If the call is not successful
-
update
Update the project with the corresponding id. Makes a PUT call against the project resource endpoint.- Parameters:
businessId- Id of the businessprojectId- Id of the resource to updatedata- 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 FreshBooksExceptionUpdate the project with the corresponding id. Makes a PUT call against the project resource endpoint.- Parameters:
businessId- Id of the businessprojectId- Id of the resource to updatedata- Map of data to change- Returns:
- The updated Project
- Throws:
FreshBooksException- If the call is not successful
-
delete
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 businessprojectId- Id of the resource to update- Throws:
FreshBooksException- If the call is not successful
-