com.smartsheet.api.UserResources Maven / Gradle / Ivy
Show all versions of smartsheet-sdk-java Show documentation
package com.smartsheet.api;
/*
* #[license]
* Smartsheet SDK for Java
* %%
* Copyright (C) 2014 Smartsheet
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* %[license]
*/
import com.smartsheet.api.models.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
/**
* This interface provides methods to access User resources.
*
* Thread Safety: Implementation of this interface must be thread safe.
*/
public interface UserResources {
/**
* List all users.
*
* It mirrors to the following Smartsheet REST API method: GET /users
*
* @return the list of all users
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public PagedResult listUsers() throws SmartsheetException;
/**
* List all users.
*
* It mirrors to the following Smartsheet REST API method: GET /users
*
* @param email the list of email addresses
* @param pagination object containing pagination query parameters
* @return the list of all users
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public PagedResult listUsers(Set email, PaginationParameters pagination) throws SmartsheetException;
/**
* Add a user to the organization, without sending email.
*
* It mirrors to the following Smartsheet REST API method: POST /users
*
* @param user the user object
* @return the user
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public User addUser(User user) throws SmartsheetException;
/**
* Add a user to the organization, without sending email.
*
* It mirrors to the following Smartsheet REST API method: POST /users
*
* @param user the user
* @param sendEmail the send email flag
* @return the user
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public User addUser(User user, boolean sendEmail) throws SmartsheetException;
/**
* Get the current user.
*
* It mirrors to the following Smartsheet REST API method: GET /users/{userId}
*
* @param userId the user id
* @return the current user
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public UserProfile getUser(long userId) throws SmartsheetException;
/**
* Get the current user.
*
* It mirrors to the following Smartsheet REST API method: GET /user/me
*
* @return the current user
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public UserProfile getCurrentUser() throws SmartsheetException;
/**
* Update a user.
*
* It mirrors to the following Smartsheet REST API method: PUT /user/{id}
*
* @param user the user to update
* @return the updated user
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public User updateUser(User user) throws SmartsheetException;
/**
* Delete a user in the organization.
*
* It mirrors to the following Smartsheet REST API method: DELETE /user/{id}
*
* @param id the id of the user
* @param parameters the object containing parameters for deleting users
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public void deleteUser(long id, DeleteUserParameters parameters) throws SmartsheetException;
/**
* List all organisation sheets.
*
* It mirrors to the following Smartsheet REST API method: GET /users/sheets
*
* @param pagination the object containing the pagination query parameters
* @param modifiedSince restrict to sheets modified on or after this date
* @return the list of all organisation sheets
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public PagedResult listOrgSheets(PaginationParameters pagination, Date modifiedSince) throws SmartsheetException;
/**
* List all organisation sheets.
*
* It mirrors to the following Smartsheet REST API method: GET /users/sheets
*
* @param pagination the object containing the pagination query parameters
* @return the list of all organisation sheets
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
@Deprecated
public PagedResult listOrgSheets(PaginationParameters pagination) throws SmartsheetException;
/**
* @param userId the userID
* @param pagination the pagination parameters
* List all user alternate email(s).
*
* It mirrors to the following Smartsheet REST API method: GET /users/{userId}/alternateemails
*
* @return the list of all user alternate email(s)
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public PagedResult listAlternateEmails(long userId, PaginationParameters pagination) throws SmartsheetException;
/**
* Get alternate email.
*
* It mirrors to the following Smartsheet REST API method: GET /users/{userId}/alternateemails/{alternateEmailId}
*
* @param userId the id of the user
* @param altEmailId the alternate email id for the alternate email to retrieve.
* @return the resource. Note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null.
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public AlternateEmail getAlternateEmail(long userId, long altEmailId) throws SmartsheetException;
/**
* Add an alternate email.
*
* It mirrors to the following Smartsheet REST API method: POST /users/{userId}/alternateemails
*
* @param userId the id of the user
* @param altEmails List of alternate email address to add.
* @return List of added alternate email(s).
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public List addAlternateEmail(long userId, List altEmails) throws SmartsheetException;
/**
* Delete an alternate email.
*
* It mirrors to the following Smartsheet REST API method: DELETE /users/{userId}/alternateemails/{alternateEmailId}
*
* @param userId the id of the user
* @param altEmailId the alternate email id for the alternate email to retrieve.
* @throws IllegalArgumentException if any argument is null or empty string
* @throws InvalidRequestException if there is any problem with the REST API request
* @throws AuthorizationException if there is any problem with the REST API authorization (access token)
* @throws ResourceNotFoundException if the resource cannot be found
* @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
* @throws SmartsheetException if there is any other error during the operation
*/
public void deleteAlternateEmail(long userId, long altEmailId) throws SmartsheetException;
}