Class TimeEntries


public class TimeEntries extends TimeTrackingResource
FreshBooks TimeEntries resource with calls to get, list, create, update, delete
  • Constructor Details

    • TimeEntries

      public TimeEntries(FreshBooksClient freshBooksClient)
      Parameters:
      freshBooksClient - Initialized instance of FreshBooksClient
  • Method Details

    • getPathForSingle

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

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

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

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

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

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

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

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

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

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

      public void delete(long businessId, long timeEntryId) throws FreshBooksException
      Delete the time entry with the corresponding id. Makes a DELETE call against the time_entries resource endpoint.

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