Interface UsersApi

All Superinterfaces:
Api.Create<User>, Api.Delete<User>, Api.Get<User>, Api.Simple<User>
All Known Implementing Classes:
UsersApiImpl

public interface UsersApi extends Api.Simple<User>
API for UserAssignments. All methods are specific to a given project
See Also:
  • Method Details

    • list

      default List<User> list()
      Returns a list of your users. The users are returned sorted by creation date, with the most recently created users appearing first. This method does not filter results. Same as list(null, null);
      Returns:
      a list of all users
    • list

      List<User> list(Boolean isActive, Instant updatedSince)
      Return a list of users, filtered by activity and update date, newest user first.
      Parameters:
      isActive - if true, return only getActive users. Set to null to disable filtering
      updatedSince - return only users that have been updated at least 1 second after updatedSince. Set to null to disable filtering.
      Returns:
      a list of all users, filtered accordingly
    • list

      Pagination<User> list(Boolean isActive, Instant updatedSince, int page, int perPage)
      Return a list of users, filtered by activity and update date, newest user first. Page and perPage allow controlling how many results to return.
      Parameters:
      isActive - if true, return only getActive users. Set to null to disable filtering
      updatedSince - return only users that have been updated at least 1 second after updatedSince. Set to null to disable filtering.
      page - the page number
      perPage - how many results to return for one page. Max 100
      Returns:
      a list of users, filtered accordingly
    • create

      User create(User userCreationInfo)
      Create a new User. First name, last name and email are required.
      Specified by:
      create in interface Api.Create<User>
      Parameters:
      userCreationInfo - a user creation object with the wanted properties. Null fields will get a default value according to the Harvest docs
      Returns:
      the User that was just created
    • getSelf

      User getSelf()
      Retrieve the currently authenticated user
      Returns:
      the currently authenticated user
    • get

      User get(Reference<User> userReference)
      Retrieve an existing user
      Specified by:
      get in interface Api.Get<User>
      Parameters:
      userReference - a reference to an existing User
      Returns:
      the full User object
    • update

      User update(Reference<User> user, UserUpdateInfo toChange)
      Change an existing user.
      Parameters:
      user - a reference to an existing User
      toChange - The properties to be changed. Null fields will be left as is.
      Returns:
      the updated User
    • delete

      void delete(Reference<User> userReference)
      Delete a user. Deleting a user is only possible if they have no time entries or expenses associated with them
      Specified by:
      delete in interface Api.Delete<User>
      Parameters:
      userReference - a reference to an existing User to be deleted