com.smartsheet.api.WorkspaceResources 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.ContainerDestination;
import com.smartsheet.api.models.PagedResult;
import com.smartsheet.api.models.PaginationParameters;
import com.smartsheet.api.models.Workspace;
import com.smartsheet.api.models.enums.CopyExclusion;
import com.smartsheet.api.models.enums.SourceInclusion;
import com.smartsheet.api.models.enums.WorkspaceCopyInclusion;
import com.smartsheet.api.models.enums.WorkspaceRemapExclusion;
import java.util.EnumSet;
/**
* This interface provides methods to access Workspace resources.
*
* Thread Safety: Implementation of this interface must be thread safe.
*/
public interface WorkspaceResources {
/**
* List all workspaces.
*
* It mirrors to the following Smartsheet REST API method: GET /workspaces
*
* @param parameters the object containing the pagination parameters
* @return the list of workspaces (note that an empty list will be returned if there are none)
* @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 listWorkspaces(PaginationParameters parameters) throws SmartsheetException;
/**
* Get a workspace.
*
* It mirrors to the following Smartsheet REST API method: GET /workspace/{id}
*
* @param id the id
* @param includes the include parameters
* @param loadAll the loadAll boolean value
* @return the workspace (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
*/
Workspace getWorkspace(long id, Boolean loadAll, EnumSet includes) throws SmartsheetException;
/**
* Create a workspace.
*
* It mirrors to the following Smartsheet REST API method: POST /workspaces
*
* @param workspace the workspace to create
* @return the created workspace
* @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
*/
Workspace createWorkspace(Workspace workspace) throws SmartsheetException;
/**
* Update a workspace.
*
* It mirrors to the following Smartsheet REST API method: PUT /workspace/{id}
*
* @param workspace the workspace to update
* @return the updated workspace (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
*/
Workspace updateWorkspace(Workspace workspace) throws SmartsheetException;
/**
* Delete a workspace.
*
* It mirrors to the following Smartsheet REST API method: DELETE /workspace{id}
*
* @param id the id of the workspace
* @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 deleteWorkspace(long id) throws SmartsheetException;
/**
* Creates a copy of the specified workspace.
*
* It mirrors to the following Smartsheet REST API method: POST /workspaces/{workspaceId}/copy
*
* Exceptions:
* IllegalArgumentException : if folder is null
* InvalidRequestException : if there is any problem with the REST API request
* AuthorizationException : if there is any problem with the REST API authorization(access token)
* ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
* SmartsheetRestException : if there is any other REST API related error occurred during the operation
* SmartsheetException : if there is any other error occurred during the operation
*
* @param workspaceId the folder id
* @param containerDestination describes the destination container
* @param includes optional parameters to include
* @param skipRemap optional parameters to exclude
* @return the folder
* @throws SmartsheetException the smartsheet exception
*/
Workspace copyWorkspace(
long workspaceId,
ContainerDestination containerDestination,
EnumSet includes,
EnumSet skipRemap
) throws SmartsheetException;
/**
* Creates a copy of the specified workspace.
*
* It mirrors to the following Smartsheet REST API method: POST /workspaces/{workspaceId}/copy
*
* Exceptions:
* IllegalArgumentException : if folder is null
* InvalidRequestException : if there is any problem with the REST API request
* AuthorizationException : if there is any problem with the REST API authorization(access token)
* ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
* SmartsheetRestException : if there is any other REST API related error occurred during the operation
* SmartsheetException : if there is any other error occurred during the operation
*
* @param workspaceId the folder id
* @param containerDestination describes the destination container
* @param includes optional parameters to include
* @param skipRemap optional parameters to NOT re-map in the new folder
* @param excludes optional parameters to exclude
* @return the folder
* @throws SmartsheetException the smartsheet exception
* @deprecated As of release 2.0. `excludes` param is deprecated. Please use the `copyWorkspace` method with `includes` instead.
*/
@Deprecated(since = "2.0.0", forRemoval = true)
Workspace copyWorkspace(long workspaceId, ContainerDestination containerDestination, EnumSet includes,
EnumSet skipRemap, EnumSet excludes) throws SmartsheetException;
/**
* Return the WorkspaceFolderResources object that provides access to Folder resources associated with Workspace
* resources.
*
* @return the workspace folder resources
*/
WorkspaceFolderResources folderResources();
/**
* Return the ShareResources object that provides access to Share resources associated with Workspace
* resources.
*
* @return the share resources object
*/
ShareResources shareResources();
}