Class Services


public class Services extends CommentResource
FreshBooks services resource with calls to get, list, create, update, delete
  • Constructor Details

  • Method Details

    • getPathForSingle

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

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

      public ServiceList list(long businessId) throws FreshBooksException
      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

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

      public Service get(long businessId, long serviceId) throws FreshBooksException
      Get a single service with the corresponding id.
      Parameters:
      businessId - Id of the business
      serviceId - 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 business
      serviceId - Id of the resource to return
      builder - IncludesQueryBuilder object for including additional data, sub-resources, etc.
      Returns:
      The Service
      Throws:
      FreshBooksException - If the call is not successful
    • create

      public Service create(long businessId, Service data) throws FreshBooksException
      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 business
      data - Service model with create data
      Returns:
      The created Service
      Throws:
      FreshBooksException - If the call is not successful
    • create

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

      public Service update(long businessId, long serviceId, Service data) throws FreshBooksException
      Update the service with the corresponding id. Makes a PUT call against the service resource endpoint.
      Parameters:
      businessId - Id of the business
      serviceId - Id of the resource to update
      data - 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 FreshBooksException
      Update the service with the corresponding id. Makes a PUT call against the service resource endpoint.
      Parameters:
      businessId - Id of the business
      serviceId - Id of the resource to update
      data - Map of data to change
      Returns:
      The updated Service
      Throws:
      FreshBooksException - If the call is not successful
    • delete

      public void delete(long businessId, long serviceId) throws FreshBooksException
      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 business
      serviceId - Id of the resource to update
      Throws:
      FreshBooksException - If the call is not successful