Class UsersApiImpl

Object
ch.aaap.harvestclient.impl.UsersApiImpl
All Implemented Interfaces:
Api.Create<User>, Api.Delete<User>, Api.Get<User>, Api.Simple<User>, UsersApi

public class UsersApiImpl extends Object implements UsersApi
  • Constructor Details

    • UsersApiImpl

      public UsersApiImpl(UserService userService)
  • Method Details

    • list

      public List<User> list(Boolean isActive, Instant updatedSince)
      Description copied from interface: UsersApi
      Return a list of users, filtered by activity and update date, newest user first.
      Specified by:
      list in interface UsersApi
      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

      public Pagination<User> list(Boolean isActive, Instant updatedSince, int page, int perPage)
      Description copied from interface: UsersApi
      Return a list of users, filtered by activity and update date, newest user first. Page and perPage allow controlling how many results to return.
      Specified by:
      list in interface UsersApi
      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

      public User create(User creationInfo)
      Description copied from interface: UsersApi
      Create a new User. First name, last name and email are required.
      Specified by:
      create in interface Api.Create<User>
      Specified by:
      create in interface UsersApi
      Parameters:
      creationInfo - 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

      public User getSelf()
      Description copied from interface: UsersApi
      Retrieve the currently authenticated user
      Specified by:
      getSelf in interface UsersApi
      Returns:
      the currently authenticated user
    • get

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

      public User update(Reference<User> userReference, UserUpdateInfo toChange)
      Description copied from interface: UsersApi
      Change an existing user.
      Specified by:
      update in interface UsersApi
      Parameters:
      userReference - a reference to an existing User
      toChange - The properties to be changed. Null fields will be left as is.
      Returns:
      the updated User
    • delete

      public void delete(Reference<User> userReference)
      Description copied from interface: UsersApi
      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>
      Specified by:
      delete in interface UsersApi
      Parameters:
      userReference - a reference to an existing User to be deleted