com.smartsheet.api.GroupResources Maven / Gradle / Ivy
Show all versions of smartsheet-sdk-java Show documentation
/*
* Copyright (C) 2023 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.
*/
package com.smartsheet.api;
import com.smartsheet.api.models.Group;
import com.smartsheet.api.models.PagedResult;
import com.smartsheet.api.models.PaginationParameters;
/**
* This interface provides methods to access Group resources
*
* Thread Safety: Implementation of this interface must be thread safe.
*/
public interface GroupResources {
/**
* List all group.
*
* It mirrors to the following Smartsheet REST API method: GET /groups
*
* @param parameters the paging parameters object
* @return A list of all {@link Group}s. Note that the groups do not contain the membership details. You must get each group
* individually for group membership.
* @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
*/
PagedResult listGroups(PaginationParameters parameters) throws SmartsheetException;
/**
* Get a {@link Group}.
*
* It mirrors to the following Smartsheet REST API method: GET /group/{id}
*
* @param groupId the {@link Group} id
* @return the {@link Group} (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
*/
Group getGroup(long groupId) throws SmartsheetException;
/**
* Create a {@link Group}. Use {@link Group.CreateGroupBuilder} to create the model for a new {@link Group}
*
* It mirrors to the following Smartsheet REST API method: POST /groups
*
* @param group the {@link Group} to create. Use {@link Group.CreateGroupBuilder} to create this model.
* @return the newly created {@link Group}
* @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
*/
Group createGroup(Group group) throws SmartsheetException;
/**
* Update a {@link Group}. Use {@link Group.CreateGroupBuilder} to create the model for a new {@link Group}
*
* It mirrors to the following Smartsheet REST API method: PUT /group/{groupId}
*
* @param group the {@link Group} to create. Use {@link Group.CreateGroupBuilder} to create this model.
* @return the newly created {@link Group}
* @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
*/
Group updateGroup(Group group) throws SmartsheetException;
/**
* Delete a {@link Group}.
*
* It mirrors to the following Smartsheet REST API method: DELETE /group/{groupId}
*
* @param groupId the id of the {@link Group} to delete.
*
* @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
*/
void deleteGroup(long groupId) throws SmartsheetException;
/**
* Represents the GroupMemberResources.
* It will be initialized in constructor and will not change afterwards.
*
* @return members object
* @throws SmartsheetException if there is any other error during the operation
*/
GroupMemberResources memberResources() throws SmartsheetException;
}