Class Services
java.lang.Object
net.amcintosh.freshbooks.resources.api.Resource
net.amcintosh.freshbooks.resources.api.ProjectResource
net.amcintosh.freshbooks.resources.api.CommentResource
net.amcintosh.freshbooks.resources.Services
FreshBooks services resource with calls to get, list, create, update, delete
-
Field Summary
Fields inherited from class net.amcintosh.freshbooks.resources.api.Resource
freshBooksClient
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreate a new service from the provided data.Create a new service from the provided Service model.void
delete
(long businessId, long serviceId) Delete the service with the corresponding id.get
(long businessId, long serviceId) Get a single service with the corresponding id.get
(long businessId, long serviceId, IncludesQueryBuilder builder) Get a single service with the corresponding id.protected String
protected String
list
(long businessId) Get a list of services.list
(long businessId, List<QueryBuilder> builders) Get a list of services using the query strings generated by the QueryBuilder list.Update the service with the corresponding id.Update the service with the corresponding id.Methods inherited from class net.amcintosh.freshbooks.resources.api.CommentResource
getResourceType, getUrl, getUrl, getUrl, getUrl
Methods inherited from class net.amcintosh.freshbooks.resources.api.ProjectResource
handleListRequest, handleRequest, handleRequest
Methods inherited from class net.amcintosh.freshbooks.resources.api.Resource
buildQueryString
-
Constructor Details
-
Services
-
-
Method Details
-
getPathForSingle
- Specified by:
getPathForSingle
in classProjectResource
-
getPathForList
- Specified by:
getPathForList
in classProjectResource
-
list
Get a list of services.- Parameters:
businessId
- Id of the business- Returns:
- ServiceList containing services and pagination details
- Throws:
FreshBooksException
- If the call is not successful
-
list
Get a list of services using the query strings generated by the QueryBuilder list.- Parameters:
businessId
- Id of the businessbuilders
- List of QueryBuilders- Returns:
- ServiceList containing services and pagination details
- Throws:
FreshBooksException
- If the call is not successful
-
get
Get a single service with the corresponding id.- Parameters:
businessId
- Id of the businessserviceId
- Id of the resource to return- Returns:
- The Service
- Throws:
FreshBooksException
- If the call is not successful
-
get
public Service get(long businessId, long serviceId, IncludesQueryBuilder builder) throws FreshBooksException Get a single service with the corresponding id.- Parameters:
businessId
- Id of the businessserviceId
- Id of the resource to returnbuilder
- IncludesQueryBuilder object for including additional data, sub-resources, etc.- Returns:
- The Service
- Throws:
FreshBooksException
- If the call is not successful
-
create
Create a new service from the provided Service model. Makes a POST call against the service resource endpoint. This calls `service.getContent()` to get a hash map of data.- Parameters:
businessId
- Id of the businessdata
- Service model with create data- Returns:
- The created Service
- Throws:
FreshBooksException
- If the call is not successful
-
create
Create a new service from the provided data. Makes a POST call against the service resource endpoint.- Parameters:
businessId
- Id of the businessdata
- Map of create data- Returns:
- The created Service
- Throws:
FreshBooksException
- If the call is not successful
-
update
Update the service with the corresponding id. Makes a PUT call against the service resource endpoint.- Parameters:
businessId
- Id of the businessserviceId
- Id of the resource to updatedata
- Project model with updated data- Returns:
- The updated Service
- Throws:
FreshBooksException
- If the call is not successful
-
update
public Service update(long businessId, long serviceId, Map<String, Object> data) throws FreshBooksExceptionUpdate the service with the corresponding id. Makes a PUT call against the service resource endpoint.- Parameters:
businessId
- Id of the businessserviceId
- Id of the resource to updatedata
- Map of data to change- Returns:
- The updated Service
- Throws:
FreshBooksException
- If the call is not successful
-
delete
Delete the service with the corresponding id. Makes a DELETE call against the service resource endpoint.
Note: Most FreshBooks resources are soft-deleted,- Parameters:
businessId
- Id of the businessserviceId
- Id of the resource to update- Throws:
FreshBooksException
- If the call is not successful
-