id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
135,000
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java
OAuthFlowImpl.newAuthorizationURL
public String newAuthorizationURL(EnumSet<AccessScope> scopes, String state) { Util.throwIfNull(scopes); if(state == null){state = "";} // Build a map of parameters for the URL HashMap<String,Object> params = new HashMap<String, Object>(); params.put("response_type", "code"); params.put("client_id", clientId); params.put("redirect_uri", redirectURL); params.put("state", state); StringBuilder scopeBuffer = new StringBuilder(); for(AccessScope scope : scopes) { scopeBuffer.append(scope.name()+","); } params.put("scope",scopeBuffer.substring(0,scopeBuffer.length()-1)); // Generate the URL with the parameters return QueryUtil.generateUrl(authorizationURL, params); }
java
public String newAuthorizationURL(EnumSet<AccessScope> scopes, String state) { Util.throwIfNull(scopes); if(state == null){state = "";} // Build a map of parameters for the URL HashMap<String,Object> params = new HashMap<String, Object>(); params.put("response_type", "code"); params.put("client_id", clientId); params.put("redirect_uri", redirectURL); params.put("state", state); StringBuilder scopeBuffer = new StringBuilder(); for(AccessScope scope : scopes) { scopeBuffer.append(scope.name()+","); } params.put("scope",scopeBuffer.substring(0,scopeBuffer.length()-1)); // Generate the URL with the parameters return QueryUtil.generateUrl(authorizationURL, params); }
[ "public", "String", "newAuthorizationURL", "(", "EnumSet", "<", "AccessScope", ">", "scopes", ",", "String", "state", ")", "{", "Util", ".", "throwIfNull", "(", "scopes", ")", ";", "if", "(", "state", "==", "null", ")", "{", "state", "=", "\"\"", ";", ...
Generate a new authorization URL. Exceptions: - IllegalArgumentException : if scopes is null/empty @param scopes the scopes @param state an arbitrary string that will be returned to your app; intended to be used by you to ensure that this redirect is indeed from an OAuth flow that you initiated @return the authorization URL @throws UnsupportedEncodingException the unsupported encoding exception
[ "Generate", "a", "new", "authorization", "URL", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L136-L155
135,001
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java
OAuthFlowImpl.obtainNewToken
public Token obtainNewToken(AuthorizationResult authorizationResult) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException { if(authorizationResult == null){ throw new IllegalArgumentException(); } // Prepare the hash String doHash = clientSecret + "|" + authorizationResult.getCode(); MessageDigest md; try { md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Your JVM does not support SHA-256, which is required for OAuth with Smartsheet.", e); } byte[] digest; try { digest = md.digest(doHash.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } //String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest); String hash = org.apache.commons.codec.binary.Hex.encodeHexString(digest); // create a Map of the parameters HashMap<String, Object> params = new HashMap<String, Object>(); params.put("grant_type", "authorization_code"); params.put("client_id", clientId); params.put("code", authorizationResult.getCode()); params.put("redirect_uri",redirectURL); params.put("hash", hash); // Generate the URL and then get the token return requestToken(QueryUtil.generateUrl(tokenURL, params)); }
java
public Token obtainNewToken(AuthorizationResult authorizationResult) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException { if(authorizationResult == null){ throw new IllegalArgumentException(); } // Prepare the hash String doHash = clientSecret + "|" + authorizationResult.getCode(); MessageDigest md; try { md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Your JVM does not support SHA-256, which is required for OAuth with Smartsheet.", e); } byte[] digest; try { digest = md.digest(doHash.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } //String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest); String hash = org.apache.commons.codec.binary.Hex.encodeHexString(digest); // create a Map of the parameters HashMap<String, Object> params = new HashMap<String, Object>(); params.put("grant_type", "authorization_code"); params.put("client_id", clientId); params.put("code", authorizationResult.getCode()); params.put("redirect_uri",redirectURL); params.put("hash", hash); // Generate the URL and then get the token return requestToken(QueryUtil.generateUrl(tokenURL, params)); }
[ "public", "Token", "obtainNewToken", "(", "AuthorizationResult", "authorizationResult", ")", "throws", "OAuthTokenException", ",", "JSONSerializerException", ",", "HttpClientException", ",", "URISyntaxException", ",", "InvalidRequestException", "{", "if", "(", "authorizationR...
Obtain a new token using AuthorizationResult. Exceptions: - IllegalArgumentException : if authorizationResult is null - InvalidTokenRequestException : if the token request is invalid (note that this won't really happen in current implementation) - InvalidOAuthClientException : if the client information is invalid - InvalidOAuthGrantException : if the authorization code or refresh token is invalid or expired, the redirect_uri does not match, or the hash value does not match the client secret and/or code - UnsupportedOAuthGrantTypeException : if the grant type is invalid (note that this won't really happen in current implementation) - OAuthTokenException : if any other error occurred during the operation @param authorizationResult the authorization result @return the token @throws NoSuchAlgorithmException the no such algorithm exception @throws UnsupportedEncodingException the unsupported encoding exception @throws OAuthTokenException the o auth token exception @throws JSONSerializerException the JSON serializer exception @throws HttpClientException the http client exception @throws URISyntaxException the URI syntax exception @throws InvalidRequestException the invalid request exception
[ "Obtain", "a", "new", "token", "using", "AuthorizationResult", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L243-L278
135,002
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java
OAuthFlowImpl.refreshToken
public Token refreshToken(Token token) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException { // Prepare the hash String doHash = clientSecret + "|" + token.getRefreshToken(); MessageDigest md; try { md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Your JVM does not support SHA-256, which is required for OAuth with Smartsheet.", e); } byte[] digest; try { digest = md.digest(doHash.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } //String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest); String hash = org.apache.commons.codec.binary.Hex.encodeHexString(digest); // Create a map of the parameters Map<String,Object> params = new HashMap<String,Object>(); params.put("grant_type", "refresh_token"); params.put("client_id",clientId); params.put("refresh_token",token.getRefreshToken()); params.put("redirect_uri", redirectURL); params.put("hash",hash); // Generate the URL and get the token return requestToken(QueryUtil.generateUrl(tokenURL, params)); }
java
public Token refreshToken(Token token) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException { // Prepare the hash String doHash = clientSecret + "|" + token.getRefreshToken(); MessageDigest md; try { md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Your JVM does not support SHA-256, which is required for OAuth with Smartsheet.", e); } byte[] digest; try { digest = md.digest(doHash.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } //String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest); String hash = org.apache.commons.codec.binary.Hex.encodeHexString(digest); // Create a map of the parameters Map<String,Object> params = new HashMap<String,Object>(); params.put("grant_type", "refresh_token"); params.put("client_id",clientId); params.put("refresh_token",token.getRefreshToken()); params.put("redirect_uri", redirectURL); params.put("hash",hash); // Generate the URL and get the token return requestToken(QueryUtil.generateUrl(tokenURL, params)); }
[ "public", "Token", "refreshToken", "(", "Token", "token", ")", "throws", "OAuthTokenException", ",", "JSONSerializerException", ",", "HttpClientException", ",", "URISyntaxException", ",", "InvalidRequestException", "{", "// Prepare the hash", "String", "doHash", "=", "cli...
Refresh token. Exceptions: - IllegalArgumentException : if token is null. - InvalidTokenRequestException : if the token request is invalid - InvalidOAuthClientException : if the client information is invalid - InvalidOAuthGrantException : if the authorization code or refresh token is invalid or expired, the redirect_uri does not match, or the hash value does not match the client secret and/or code - UnsupportedOAuthGrantTypeException : if the grant type is invalid - OAuthTokenException : if any other error occurred during the operation @param token the token to refresh @return the refreshed token @throws NoSuchAlgorithmException the no such algorithm exception @throws UnsupportedEncodingException the unsupported encoding exception @throws OAuthTokenException the o auth token exception @throws JSONSerializerException the JSON serializer exception @throws HttpClientException the http client exception @throws URISyntaxException the URI syntax exception @throws InvalidRequestException the invalid request exception
[ "Refresh", "token", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L302-L331
135,003
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java
OAuthFlowImpl.requestToken
private Token requestToken(String url) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException { // Create the request and send it to get the response/token. HttpRequest request = new HttpRequest(); request.setUri(new URI(url)); request.setMethod(HttpMethod.POST); request.setHeaders(new HashMap<String, String>()); request.getHeaders().put("Content-Type", "application/x-www-form-urlencoded"); HttpResponse response = httpClient.request(request); // Create a map of the response InputStream inputStream = response.getEntity().getContent(); Map<String, Object> map = jsonSerializer.deserializeMap(inputStream); httpClient.releaseConnection(); // Check for a error response and throw it. if (response.getStatusCode() != 200 && map.get("error") != null) { String errorType = map.get("error").toString(); String errorDescription = map.get("message")==null?"":(String)map.get("message"); if ("invalid_request".equals(errorType)) { throw new InvalidTokenRequestException(errorDescription); } else if ("invalid_client".equals(errorType)) { throw new InvalidOAuthClientException(errorDescription); } else if ("invalid_grant".equals(errorType)) { throw new InvalidOAuthGrantException(errorDescription); } else if ("unsupported_grant_type".equals(errorType)) { throw new UnsupportedOAuthGrantTypeException(errorDescription); } else { throw new OAuthTokenException(errorDescription); } } // Another error by not getting a 200 result else if(response.getStatusCode() != 200){ throw new OAuthTokenException("Token request failed with http error code: "+response.getStatusCode()); } // Create a token based on the response Token token = new Token(); Object tempObj = map.get("access_token"); token.setAccessToken(tempObj == null ? "" : (String) tempObj); tempObj = map.get("token_type"); token.setTokenType(tempObj==null?"":(String)tempObj); tempObj = map.get("refresh_token"); token.setRefreshToken(tempObj==null?"":(String)tempObj); Long expiresIn; try{ expiresIn = Long.parseLong(String.valueOf(map.get("expires_in"))); }catch(NumberFormatException nfe){ expiresIn = 0L; } token.setExpiresInSeconds(expiresIn); return token; }
java
private Token requestToken(String url) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException { // Create the request and send it to get the response/token. HttpRequest request = new HttpRequest(); request.setUri(new URI(url)); request.setMethod(HttpMethod.POST); request.setHeaders(new HashMap<String, String>()); request.getHeaders().put("Content-Type", "application/x-www-form-urlencoded"); HttpResponse response = httpClient.request(request); // Create a map of the response InputStream inputStream = response.getEntity().getContent(); Map<String, Object> map = jsonSerializer.deserializeMap(inputStream); httpClient.releaseConnection(); // Check for a error response and throw it. if (response.getStatusCode() != 200 && map.get("error") != null) { String errorType = map.get("error").toString(); String errorDescription = map.get("message")==null?"":(String)map.get("message"); if ("invalid_request".equals(errorType)) { throw new InvalidTokenRequestException(errorDescription); } else if ("invalid_client".equals(errorType)) { throw new InvalidOAuthClientException(errorDescription); } else if ("invalid_grant".equals(errorType)) { throw new InvalidOAuthGrantException(errorDescription); } else if ("unsupported_grant_type".equals(errorType)) { throw new UnsupportedOAuthGrantTypeException(errorDescription); } else { throw new OAuthTokenException(errorDescription); } } // Another error by not getting a 200 result else if(response.getStatusCode() != 200){ throw new OAuthTokenException("Token request failed with http error code: "+response.getStatusCode()); } // Create a token based on the response Token token = new Token(); Object tempObj = map.get("access_token"); token.setAccessToken(tempObj == null ? "" : (String) tempObj); tempObj = map.get("token_type"); token.setTokenType(tempObj==null?"":(String)tempObj); tempObj = map.get("refresh_token"); token.setRefreshToken(tempObj==null?"":(String)tempObj); Long expiresIn; try{ expiresIn = Long.parseLong(String.valueOf(map.get("expires_in"))); }catch(NumberFormatException nfe){ expiresIn = 0L; } token.setExpiresInSeconds(expiresIn); return token; }
[ "private", "Token", "requestToken", "(", "String", "url", ")", "throws", "OAuthTokenException", ",", "JSONSerializerException", ",", "HttpClientException", ",", "URISyntaxException", ",", "InvalidRequestException", "{", "// Create the request and send it to get the response/token...
Request a token. Exceptions: - IllegalArgumentException : if url is null or empty - InvalidTokenRequestException : if the token request is invalid - InvalidOAuthClientException : if the client information is invalid - InvalidOAuthGrantException : if the authorization code or refresh token is invalid or expired, the redirect_uri does not match, or the hash value does not match the client secret and/or code - UnsupportedOAuthGrantTypeException : if the grant type is invalid - OAuthTokenException : if any other error occurred during the operation @param url the URL (with request parameters) from which the token will be requested @return the token @throws OAuthTokenException the o auth token exception @throws JSONSerializerException the JSON serializer exception @throws HttpClientException the http client exception @throws URISyntaxException the URI syntax exception @throws InvalidRequestException the invalid request exception
[ "Request", "a", "token", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L353-L409
135,004
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java
OAuthFlowImpl.revokeAccessToken
public void revokeAccessToken(Token token) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException{ HttpRequest request = new HttpRequest(); request.setUri(new URI(tokenURL)); request.setMethod(HttpMethod.DELETE); request.setHeaders(new HashMap<String, String>()); request.getHeaders().put("Authorization", "Bearer " + token.getAccessToken()); HttpResponse response = httpClient.request(request); if(response.getStatusCode() != 200){ throw new OAuthTokenException("Token request failed with http error code: "+response.getStatusCode()); } httpClient.releaseConnection(); }
java
public void revokeAccessToken(Token token) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException{ HttpRequest request = new HttpRequest(); request.setUri(new URI(tokenURL)); request.setMethod(HttpMethod.DELETE); request.setHeaders(new HashMap<String, String>()); request.getHeaders().put("Authorization", "Bearer " + token.getAccessToken()); HttpResponse response = httpClient.request(request); if(response.getStatusCode() != 200){ throw new OAuthTokenException("Token request failed with http error code: "+response.getStatusCode()); } httpClient.releaseConnection(); }
[ "public", "void", "revokeAccessToken", "(", "Token", "token", ")", "throws", "OAuthTokenException", ",", "JSONSerializerException", ",", "HttpClientException", ",", "URISyntaxException", ",", "InvalidRequestException", "{", "HttpRequest", "request", "=", "new", "HttpReque...
Revoke access token. Exceptions: - IllegalArgumentException : if url is null or empty - InvalidTokenRequestException : if the token request is invalid - InvalidOAuthClientException : if the client information is invalid - InvalidOAuthGrantException : if the authorization code or refresh token is invalid or expired, the redirect_uri does not match, or the hash value does not match the client secret and/or code - UnsupportedOAuthGrantTypeException : if the grant type is invalid - OAuthTokenException : if any other error occurred during the operation @param token the access token to revoke access from @throws OAuthTokenException the o auth token exception @throws JSONSerializerException the JSON serializer exception @throws HttpClientException the http client exception @throws URISyntaxException the URI syntax exception @throws InvalidRequestException the invalid request exception
[ "Revoke", "access", "token", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L430-L445
135,005
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/RowDiscussionResourcesImpl.java
RowDiscussionResourcesImpl.createDiscussion
public Discussion createDiscussion(long sheetId, long rowId, Discussion discussion) throws SmartsheetException{ return this.createResource("sheets/" + sheetId + "/rows/" + rowId + "/discussions", Discussion.class, discussion); }
java
public Discussion createDiscussion(long sheetId, long rowId, Discussion discussion) throws SmartsheetException{ return this.createResource("sheets/" + sheetId + "/rows/" + rowId + "/discussions", Discussion.class, discussion); }
[ "public", "Discussion", "createDiscussion", "(", "long", "sheetId", ",", "long", "rowId", ",", "Discussion", "discussion", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "createResource", "(", "\"sheets/\"", "+", "sheetId", "+", "\"/rows/\"", "+...
Create discussion on a row. It mirrors to the following Smartsheet REST API method: /sheets/{sheetId}/rows/{rowId}/discussions Exceptions: IllegalArgumentException : if any argument 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 sheetId the sheet ID @param rowId the row ID @param discussion the comment to add, limited to the following required attributes: text @return the created comment @throws SmartsheetException the smartsheet exception
[ "Create", "discussion", "on", "a", "row", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/RowDiscussionResourcesImpl.java#L63-L65
135,006
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/RowDiscussionResourcesImpl.java
RowDiscussionResourcesImpl.listDiscussions
public PagedResult<Discussion> listDiscussions(long sheetId, long rowId, PaginationParameters pagination, EnumSet<DiscussionInclusion> includes) throws SmartsheetException{ String path = "sheets/" + sheetId + "/rows/" + rowId + "/discussions" ; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); path += QueryUtil.generateUrl(null, parameters); if (pagination != null) { path += pagination.toQueryString(); } return this.listResourcesWithWrapper(path, Discussion.class); }
java
public PagedResult<Discussion> listDiscussions(long sheetId, long rowId, PaginationParameters pagination, EnumSet<DiscussionInclusion> includes) throws SmartsheetException{ String path = "sheets/" + sheetId + "/rows/" + rowId + "/discussions" ; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); path += QueryUtil.generateUrl(null, parameters); if (pagination != null) { path += pagination.toQueryString(); } return this.listResourcesWithWrapper(path, Discussion.class); }
[ "public", "PagedResult", "<", "Discussion", ">", "listDiscussions", "(", "long", "sheetId", ",", "long", "rowId", ",", "PaginationParameters", "pagination", ",", "EnumSet", "<", "DiscussionInclusion", ">", "includes", ")", "throws", "SmartsheetException", "{", "Stri...
Gets a list of all Discussions associated with the specified Row. It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/rows/{rowId}/discussions Exceptions: IllegalArgumentException : if any argument 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 sheetId the sheet ID @param rowId the row ID @param pagination the pagination pagination @param includes the optional include parameters @return the row discussions @throws SmartsheetException the smartsheet exception
[ "Gets", "a", "list", "of", "all", "Discussions", "associated", "with", "the", "specified", "Row", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/RowDiscussionResourcesImpl.java#L115-L127
135,007
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/json/JacksonJsonSerializer.java
JacksonJsonSerializer.serialize
public <T> String serialize(T object) throws JSONSerializerException { Util.throwIfNull(object); String value; try { value= OBJECT_MAPPER.writeValueAsString(object); } catch (JsonGenerationException e) { throw new JSONSerializerException(e); } catch (JsonMappingException e) { throw new JSONSerializerException(e); } catch (IOException e) { throw new JSONSerializerException(e); } return value; }
java
public <T> String serialize(T object) throws JSONSerializerException { Util.throwIfNull(object); String value; try { value= OBJECT_MAPPER.writeValueAsString(object); } catch (JsonGenerationException e) { throw new JSONSerializerException(e); } catch (JsonMappingException e) { throw new JSONSerializerException(e); } catch (IOException e) { throw new JSONSerializerException(e); } return value; }
[ "public", "<", "T", ">", "String", "serialize", "(", "T", "object", ")", "throws", "JSONSerializerException", "{", "Util", ".", "throwIfNull", "(", "object", ")", ";", "String", "value", ";", "try", "{", "value", "=", "OBJECT_MAPPER", ".", "writeValueAsStrin...
Serialize an object to JSON. Parameters: object : the object to serialize outputStream : the output stream to which the JSON will be written Returns: None Exceptions: - IllegalArgumentException : if any argument is null - JSONSerializerException : if there is any other error occurred during the operation @param object @throws JSONSerializerException @throws IOException @throws JsonMappingException @throws JsonGenerationException
[ "Serialize", "an", "object", "to", "JSON", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/json/JacksonJsonSerializer.java#L176-L190
135,008
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/json/JacksonJsonSerializer.java
JacksonJsonSerializer.deserializeCopyOrMoveRow
@Override public CopyOrMoveRowResult deserializeCopyOrMoveRow(java.io.InputStream inputStream) throws JSONSerializerException{ Util.throwIfNull(inputStream); CopyOrMoveRowResult rw = null; try { // Read the json input stream into a List. rw = OBJECT_MAPPER.readValue(inputStream, CopyOrMoveRowResult.class); } catch (JsonParseException e) { throw new JSONSerializerException(e); } catch (JsonMappingException e) { throw new JSONSerializerException(e); } catch (IOException e) { throw new JSONSerializerException(e); } return rw; }
java
@Override public CopyOrMoveRowResult deserializeCopyOrMoveRow(java.io.InputStream inputStream) throws JSONSerializerException{ Util.throwIfNull(inputStream); CopyOrMoveRowResult rw = null; try { // Read the json input stream into a List. rw = OBJECT_MAPPER.readValue(inputStream, CopyOrMoveRowResult.class); } catch (JsonParseException e) { throw new JSONSerializerException(e); } catch (JsonMappingException e) { throw new JSONSerializerException(e); } catch (IOException e) { throw new JSONSerializerException(e); } return rw; }
[ "@", "Override", "public", "CopyOrMoveRowResult", "deserializeCopyOrMoveRow", "(", "java", ".", "io", ".", "InputStream", "inputStream", ")", "throws", "JSONSerializerException", "{", "Util", ".", "throwIfNull", "(", "inputStream", ")", ";", "CopyOrMoveRowResult", "rw...
De-serialize to a CopyOrMoveRowResult object from JSON @param inputStream @return @throws JSONSerializerException
[ "De", "-", "serialize", "to", "a", "CopyOrMoveRowResult", "object", "from", "JSON" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/json/JacksonJsonSerializer.java#L401-L419
135,009
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetUpdateRequestResourcesImpl.java
SheetUpdateRequestResourcesImpl.listUpdateRequests
public PagedResult<UpdateRequest> listUpdateRequests(long sheetId, PaginationParameters paging) throws SmartsheetException { String path = "sheets/" + sheetId + "/updaterequests"; HashMap<String, Object> parameters = new HashMap<String, Object>(); if (paging != null) { parameters = paging.toHashMap(); } path += QueryUtil.generateUrl(null, parameters); return this.listResourcesWithWrapper(path, UpdateRequest.class); }
java
public PagedResult<UpdateRequest> listUpdateRequests(long sheetId, PaginationParameters paging) throws SmartsheetException { String path = "sheets/" + sheetId + "/updaterequests"; HashMap<String, Object> parameters = new HashMap<String, Object>(); if (paging != null) { parameters = paging.toHashMap(); } path += QueryUtil.generateUrl(null, parameters); return this.listResourcesWithWrapper(path, UpdateRequest.class); }
[ "public", "PagedResult", "<", "UpdateRequest", ">", "listUpdateRequests", "(", "long", "sheetId", ",", "PaginationParameters", "paging", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", "+", "sheetId", "+", "\"/updaterequests\"", ";", ...
Gets a list of all Update Requests that have future schedules associated with the specified Sheet. It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/updaterequests @param paging the object containing the pagination parameters @return A list of all UpdateRequests (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
[ "Gets", "a", "list", "of", "all", "Update", "Requests", "that", "have", "future", "schedules", "associated", "with", "the", "specified", "Sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetUpdateRequestResourcesImpl.java#L65-L75
135,010
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetUpdateRequestResourcesImpl.java
SheetUpdateRequestResourcesImpl.updateUpdateRequest
public UpdateRequest updateUpdateRequest(long sheetId, UpdateRequest updateRequest) throws SmartsheetException { return this.updateResource("sheets/" + sheetId + "/updaterequests/" + updateRequest.getId(), UpdateRequest.class, updateRequest); }
java
public UpdateRequest updateUpdateRequest(long sheetId, UpdateRequest updateRequest) throws SmartsheetException { return this.updateResource("sheets/" + sheetId + "/updaterequests/" + updateRequest.getId(), UpdateRequest.class, updateRequest); }
[ "public", "UpdateRequest", "updateUpdateRequest", "(", "long", "sheetId", ",", "UpdateRequest", "updateRequest", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "updateResource", "(", "\"sheets/\"", "+", "sheetId", "+", "\"/updaterequests/\"", "+", "...
Changes the specified Update Request for the Sheet. It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/updaterequests/{updateRequestId} @param sheetId the Id of the sheet @param updateRequest the update request object @return the update request resource. @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
[ "Changes", "the", "specified", "Update", "Request", "for", "the", "Sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetUpdateRequestResourcesImpl.java#L149-L152
135,011
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetUpdateRequestResourcesImpl.java
SheetUpdateRequestResourcesImpl.listSentUpdateRequests
public PagedResult<SentUpdateRequest> listSentUpdateRequests(long sheetId, PaginationParameters paging) throws SmartsheetException { String path = "sheets/" + sheetId + "/sentupdaterequests"; HashMap<String, Object> parameters = new HashMap<String, Object>(); if (paging != null) { parameters = paging.toHashMap(); } path += QueryUtil.generateUrl(null, parameters); return this.listResourcesWithWrapper(path, SentUpdateRequest.class); }
java
public PagedResult<SentUpdateRequest> listSentUpdateRequests(long sheetId, PaginationParameters paging) throws SmartsheetException { String path = "sheets/" + sheetId + "/sentupdaterequests"; HashMap<String, Object> parameters = new HashMap<String, Object>(); if (paging != null) { parameters = paging.toHashMap(); } path += QueryUtil.generateUrl(null, parameters); return this.listResourcesWithWrapper(path, SentUpdateRequest.class); }
[ "public", "PagedResult", "<", "SentUpdateRequest", ">", "listSentUpdateRequests", "(", "long", "sheetId", ",", "PaginationParameters", "paging", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", "+", "sheetId", "+", "\"/sentupdaterequests\...
Gets a list of all Sent Update Requests that have future schedules associated with the specified Sheet. It mirrors To the following Smartsheet REST API method: GET /sheets/{sheetId}/sentupdaterequests @param sheetId the Id of the sheet @param paging the object containing the pagination parameters @return A list of all UpdateRequests (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
[ "Gets", "a", "list", "of", "all", "Sent", "Update", "Requests", "that", "have", "future", "schedules", "associated", "with", "the", "specified", "Sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetUpdateRequestResourcesImpl.java#L169-L179
135,012
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AttachmentVersioningResourcesImpl.java
AttachmentVersioningResourcesImpl.listAllVersions
public PagedResult<Attachment> listAllVersions(long sheetId, long attachmentId, PaginationParameters parameters) throws SmartsheetException { String path = "sheets/"+ sheetId + "/attachments/" + attachmentId + "/versions"; if (parameters != null) { path += parameters.toQueryString(); } return this.listResourcesWithWrapper(path, Attachment.class); }
java
public PagedResult<Attachment> listAllVersions(long sheetId, long attachmentId, PaginationParameters parameters) throws SmartsheetException { String path = "sheets/"+ sheetId + "/attachments/" + attachmentId + "/versions"; if (parameters != null) { path += parameters.toQueryString(); } return this.listResourcesWithWrapper(path, Attachment.class); }
[ "public", "PagedResult", "<", "Attachment", ">", "listAllVersions", "(", "long", "sheetId", ",", "long", "attachmentId", ",", "PaginationParameters", "parameters", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", "+", "sheetId", "+", ...
Get all versions of an attachment. It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/attachments/{attachmentId}/versions @param sheetId the id @param attachmentId the attachment id @param parameters the pagination paramaters @return the attachment (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
[ "Get", "all", "versions", "of", "an", "attachment", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AttachmentVersioningResourcesImpl.java#L86-L93
135,013
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AttachmentVersioningResourcesImpl.java
AttachmentVersioningResourcesImpl.attachNewVersion
private Attachment attachNewVersion (long sheetId, long attachmentId, InputStream inputStream, String contentType, long contentLength, String attachmentName) throws SmartsheetException { return super.attachFile("sheets/"+ sheetId + "/attachments/"+ attachmentId +"/versions", inputStream, contentType, contentLength, attachmentName); }
java
private Attachment attachNewVersion (long sheetId, long attachmentId, InputStream inputStream, String contentType, long contentLength, String attachmentName) throws SmartsheetException { return super.attachFile("sheets/"+ sheetId + "/attachments/"+ attachmentId +"/versions", inputStream, contentType, contentLength, attachmentName); }
[ "private", "Attachment", "attachNewVersion", "(", "long", "sheetId", ",", "long", "attachmentId", ",", "InputStream", "inputStream", ",", "String", "contentType", ",", "long", "contentLength", ",", "String", "attachmentName", ")", "throws", "SmartsheetException", "{",...
Attach a new version of an attachment. It mirrors to the following Smartsheet REST API method: POST /attachment/{id}/versions @param sheetId the id of the sheet @param attachmentId the id of the object @param inputStream the {@link InputStream} of the file to attach @param contentType the content type of the file @param contentLength the size of the file in bytes. @param attachmentName the name of the file. @return the created attachment @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
[ "Attach", "a", "new", "version", "of", "an", "attachment", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AttachmentVersioningResourcesImpl.java#L139-L142
135,014
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java
UserResourcesImpl.listUsers
public PagedResult<User> listUsers(Set<String> email, PaginationParameters pagination) throws SmartsheetException { String path = "users"; HashMap<String, Object> parameters = new HashMap<String, Object>(); if (pagination != null){ parameters = pagination.toHashMap(); } parameters.put("email", QueryUtil.generateCommaSeparatedList(email)); path += QueryUtil.generateUrl(null, parameters); return this.listResourcesWithWrapper(path, User.class); }
java
public PagedResult<User> listUsers(Set<String> email, PaginationParameters pagination) throws SmartsheetException { String path = "users"; HashMap<String, Object> parameters = new HashMap<String, Object>(); if (pagination != null){ parameters = pagination.toHashMap(); } parameters.put("email", QueryUtil.generateCommaSeparatedList(email)); path += QueryUtil.generateUrl(null, parameters); return this.listResourcesWithWrapper(path, User.class); }
[ "public", "PagedResult", "<", "User", ">", "listUsers", "(", "Set", "<", "String", ">", "email", ",", "PaginationParameters", "pagination", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"users\"", ";", "HashMap", "<", "String", ",", "Obje...
List all users. It mirrors to the following Smartsheet REST API method: GET /users Exceptions: - 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 email the list of email addresses @param pagination the object containing the pagination query parameters @return all users (note that empty list will be returned if there is none) @throws SmartsheetException the smartsheet exception
[ "List", "all", "users", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java#L91-L102
135,015
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java
UserResourcesImpl.addUser
public User addUser(User user, boolean sendEmail) throws SmartsheetException { return this.createResource("users?sendEmail=" + sendEmail, User.class, user); }
java
public User addUser(User user, boolean sendEmail) throws SmartsheetException { return this.createResource("users?sendEmail=" + sendEmail, User.class, user); }
[ "public", "User", "addUser", "(", "User", "user", ",", "boolean", "sendEmail", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "createResource", "(", "\"users?sendEmail=\"", "+", "sendEmail", ",", "User", ".", "class", ",", "user", ")", ";", ...
Add a user to the organization, without sending email. It mirrors to the following Smartsheet REST API method: POST /users Exceptions: - IllegalArgumentException : if any argument 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) - ResourceNotFoundException : if the resource can not be found - 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 user the created user @param sendEmail whether to send email @return the user object limited to the following attributes: * admin * email * licensedSheetCreator @throws SmartsheetException the smartsheet exception
[ "Add", "a", "user", "to", "the", "organization", "without", "sending", "email", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java#L145-L147
135,016
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java
UserResourcesImpl.listAlternateEmails
public PagedResult<AlternateEmail> listAlternateEmails(long userId, PaginationParameters pagination) throws SmartsheetException { String path = "users/" + userId + "/alternateemails"; if (pagination != null) { path += pagination.toQueryString(); } return this.listResourcesWithWrapper(path, AlternateEmail.class); }
java
public PagedResult<AlternateEmail> listAlternateEmails(long userId, PaginationParameters pagination) throws SmartsheetException { String path = "users/" + userId + "/alternateemails"; if (pagination != null) { path += pagination.toQueryString(); } return this.listResourcesWithWrapper(path, AlternateEmail.class); }
[ "public", "PagedResult", "<", "AlternateEmail", ">", "listAlternateEmails", "(", "long", "userId", ",", "PaginationParameters", "pagination", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"users/\"", "+", "userId", "+", "\"/alternateemails\"", ";...
List all user alternate emails. It mirrors to the following Smartsheet REST API method: GET /users/{userId}/alternateemails @param userId the id of the user @param pagination the object containing the pagination query parameters @return the list of all user alternate emails @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
[ "List", "all", "user", "alternate", "emails", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java#L260-L267
135,017
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java
UserResourcesImpl.addAlternateEmail
public List<AlternateEmail> addAlternateEmail(long userId, List<AlternateEmail> altEmails) throws SmartsheetException { Util.throwIfNull(altEmails); if (altEmails.size() == 0) { return altEmails; } return this.postAndReceiveList("users/" + userId + "/alternateemails", altEmails, AlternateEmail.class); }
java
public List<AlternateEmail> addAlternateEmail(long userId, List<AlternateEmail> altEmails) throws SmartsheetException { Util.throwIfNull(altEmails); if (altEmails.size() == 0) { return altEmails; } return this.postAndReceiveList("users/" + userId + "/alternateemails", altEmails, AlternateEmail.class); }
[ "public", "List", "<", "AlternateEmail", ">", "addAlternateEmail", "(", "long", "userId", ",", "List", "<", "AlternateEmail", ">", "altEmails", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "altEmails", ")", ";", "if", "(", "altEm...
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 AlternateEmail alternate email address to add. @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
[ "Add", "an", "alternate", "email", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java#L305-L311
135,018
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java
UserResourcesImpl.promoteAlternateEmail
public AlternateEmail promoteAlternateEmail(long userId, long altEmailId) throws SmartsheetException { HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve( "users/" + userId + "/alternateemails/" + altEmailId + "/makeprimary"), HttpMethod.POST); Object obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeResult(AlternateEmail.class, response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return (AlternateEmail)obj; }
java
public AlternateEmail promoteAlternateEmail(long userId, long altEmailId) throws SmartsheetException { HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve( "users/" + userId + "/alternateemails/" + altEmailId + "/makeprimary"), HttpMethod.POST); Object obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeResult(AlternateEmail.class, response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return (AlternateEmail)obj; }
[ "public", "AlternateEmail", "promoteAlternateEmail", "(", "long", "userId", ",", "long", "altEmailId", ")", "throws", "SmartsheetException", "{", "HttpRequest", "request", "=", "createHttpRequest", "(", "smartsheet", ".", "getBaseURI", "(", ")", ".", "resolve", "(",...
Promote and alternate email to primary. @param userId id of the user @param altEmailId alternate email id @return alternateEmail of the primary @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 f there is any other error during the operation
[ "Promote", "and", "alternate", "email", "to", "primary", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java#L346-L367
135,019
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java
UserResourcesImpl.addProfileImage
public User addProfileImage(long userId, String file, String fileType) throws SmartsheetException, FileNotFoundException { return attachProfileImage("users/" + userId + "/profileimage", file, fileType); }
java
public User addProfileImage(long userId, String file, String fileType) throws SmartsheetException, FileNotFoundException { return attachProfileImage("users/" + userId + "/profileimage", file, fileType); }
[ "public", "User", "addProfileImage", "(", "long", "userId", ",", "String", "file", ",", "String", "fileType", ")", "throws", "SmartsheetException", ",", "FileNotFoundException", "{", "return", "attachProfileImage", "(", "\"users/\"", "+", "userId", "+", "\"/profilei...
Uploads a profile image for the specified user. @param userId id of the user @param file path to the image file @param fileType content type of the image file @return 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 f there is any other error during the operation
[ "Uploads", "a", "profile", "image", "for", "the", "specified", "user", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java#L383-L385
135,020
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/CommentAttachmentResourcesImpl.java
CommentAttachmentResourcesImpl.attachFile
public Attachment attachFile(long sheetId, long commentId, File file, String contentType) throws FileNotFoundException, SmartsheetException { Util.throwIfNull(sheetId, commentId, file, contentType); Util.throwIfEmpty(contentType); return attachFile(sheetId, commentId, new FileInputStream(file), contentType, file.length(), file.getName()); }
java
public Attachment attachFile(long sheetId, long commentId, File file, String contentType) throws FileNotFoundException, SmartsheetException { Util.throwIfNull(sheetId, commentId, file, contentType); Util.throwIfEmpty(contentType); return attachFile(sheetId, commentId, new FileInputStream(file), contentType, file.length(), file.getName()); }
[ "public", "Attachment", "attachFile", "(", "long", "sheetId", ",", "long", "commentId", ",", "File", "file", ",", "String", "contentType", ")", "throws", "FileNotFoundException", ",", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "sheetId", ",", "...
Attach a file to a comment with simple upload. It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/comments/{commentId}/attachments @param sheetId the id of the sheet @param commentId the id of the comment @param file the file to attach @param contentType the content type of the file @return the created attachment @throws FileNotFoundException the file not found exception @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
[ "Attach", "a", "file", "to", "a", "comment", "with", "simple", "upload", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/CommentAttachmentResourcesImpl.java#L81-L87
135,021
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.setMaxRetryTimeMillis
public void setMaxRetryTimeMillis(long maxRetryTimeMillis) { if (this.httpClient instanceof DefaultHttpClient) { ((DefaultHttpClient) this.httpClient).setMaxRetryTimeMillis(maxRetryTimeMillis); } else throw new UnsupportedOperationException("Invalid operation for class " + this.httpClient.getClass()); }
java
public void setMaxRetryTimeMillis(long maxRetryTimeMillis) { if (this.httpClient instanceof DefaultHttpClient) { ((DefaultHttpClient) this.httpClient).setMaxRetryTimeMillis(maxRetryTimeMillis); } else throw new UnsupportedOperationException("Invalid operation for class " + this.httpClient.getClass()); }
[ "public", "void", "setMaxRetryTimeMillis", "(", "long", "maxRetryTimeMillis", ")", "{", "if", "(", "this", ".", "httpClient", "instanceof", "DefaultHttpClient", ")", "{", "(", "(", "DefaultHttpClient", ")", "this", ".", "httpClient", ")", ".", "setMaxRetryTimeMill...
Sets the max retry time if the HttpClient is an instance of DefaultHttpClient @param maxRetryTimeMillis max retry time
[ "Sets", "the", "max", "retry", "time", "if", "the", "HttpClient", "is", "an", "instance", "of", "DefaultHttpClient" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L426-L432
135,022
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.setTracePrettyPrint
public void setTracePrettyPrint(boolean pretty) { if (this.httpClient instanceof DefaultHttpClient) { ((DefaultHttpClient)this.httpClient).setTracePrettyPrint(pretty); } else throw new UnsupportedOperationException("Invalid operation for class " + this.httpClient.getClass()); }
java
public void setTracePrettyPrint(boolean pretty) { if (this.httpClient instanceof DefaultHttpClient) { ((DefaultHttpClient)this.httpClient).setTracePrettyPrint(pretty); } else throw new UnsupportedOperationException("Invalid operation for class " + this.httpClient.getClass()); }
[ "public", "void", "setTracePrettyPrint", "(", "boolean", "pretty", ")", "{", "if", "(", "this", ".", "httpClient", "instanceof", "DefaultHttpClient", ")", "{", "(", "(", "DefaultHttpClient", ")", "this", ".", "httpClient", ")", ".", "setTracePrettyPrint", "(", ...
set whether or not to generate "pretty formatted" JSON in trace-logging
[ "set", "whether", "or", "not", "to", "generate", "pretty", "formatted", "JSON", "in", "trace", "-", "logging" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L444-L450
135,023
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.homeResources
public HomeResources homeResources() { if (home.get() == null) { home.compareAndSet(null, new HomeResourcesImpl(this)); } return home.get(); }
java
public HomeResources homeResources() { if (home.get() == null) { home.compareAndSet(null, new HomeResourcesImpl(this)); } return home.get(); }
[ "public", "HomeResources", "homeResources", "(", ")", "{", "if", "(", "home", ".", "get", "(", ")", "==", "null", ")", "{", "home", ".", "compareAndSet", "(", "null", ",", "new", "HomeResourcesImpl", "(", "this", ")", ")", ";", "}", "return", "home", ...
Returns the HomeResources instance that provides access to Home resources. @return the home resources
[ "Returns", "the", "HomeResources", "instance", "that", "provides", "access", "to", "Home", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L457-L462
135,024
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.workspaceResources
public WorkspaceResources workspaceResources() { if (workspaces.get() == null) { workspaces.compareAndSet(null, new WorkspaceResourcesImpl(this)); } return workspaces.get(); }
java
public WorkspaceResources workspaceResources() { if (workspaces.get() == null) { workspaces.compareAndSet(null, new WorkspaceResourcesImpl(this)); } return workspaces.get(); }
[ "public", "WorkspaceResources", "workspaceResources", "(", ")", "{", "if", "(", "workspaces", ".", "get", "(", ")", "==", "null", ")", "{", "workspaces", ".", "compareAndSet", "(", "null", ",", "new", "WorkspaceResourcesImpl", "(", "this", ")", ")", ";", "...
Returns the WorkspaceResources instance that provides access to Workspace resources. @return the workspace resources
[ "Returns", "the", "WorkspaceResources", "instance", "that", "provides", "access", "to", "Workspace", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L469-L474
135,025
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.folderResources
public FolderResources folderResources() { if (folders.get() == null) { folders.compareAndSet(null, new FolderResourcesImpl(this)); } return folders.get(); }
java
public FolderResources folderResources() { if (folders.get() == null) { folders.compareAndSet(null, new FolderResourcesImpl(this)); } return folders.get(); }
[ "public", "FolderResources", "folderResources", "(", ")", "{", "if", "(", "folders", ".", "get", "(", ")", "==", "null", ")", "{", "folders", ".", "compareAndSet", "(", "null", ",", "new", "FolderResourcesImpl", "(", "this", ")", ")", ";", "}", "return",...
Returns the FolderResources instance that provides access to Folder resources. @return the folder resources
[ "Returns", "the", "FolderResources", "instance", "that", "provides", "access", "to", "Folder", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L481-L486
135,026
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.templateResources
public TemplateResources templateResources() { if (templates.get() == null) { templates.compareAndSet(null, new TemplateResourcesImpl(this)); } return templates.get(); }
java
public TemplateResources templateResources() { if (templates.get() == null) { templates.compareAndSet(null, new TemplateResourcesImpl(this)); } return templates.get(); }
[ "public", "TemplateResources", "templateResources", "(", ")", "{", "if", "(", "templates", ".", "get", "(", ")", "==", "null", ")", "{", "templates", ".", "compareAndSet", "(", "null", ",", "new", "TemplateResourcesImpl", "(", "this", ")", ")", ";", "}", ...
Returns the TemplateResources instance that provides access to Template resources. @return the template resources
[ "Returns", "the", "TemplateResources", "instance", "that", "provides", "access", "to", "Template", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L493-L498
135,027
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.sheetResources
public SheetResources sheetResources() { if (sheets.get() == null) { sheets.compareAndSet(null, new SheetResourcesImpl(this)); } return sheets.get(); }
java
public SheetResources sheetResources() { if (sheets.get() == null) { sheets.compareAndSet(null, new SheetResourcesImpl(this)); } return sheets.get(); }
[ "public", "SheetResources", "sheetResources", "(", ")", "{", "if", "(", "sheets", ".", "get", "(", ")", "==", "null", ")", "{", "sheets", ".", "compareAndSet", "(", "null", ",", "new", "SheetResourcesImpl", "(", "this", ")", ")", ";", "}", "return", "s...
Returns the SheetResources instance that provides access to Sheet resources. @return the sheet resources
[ "Returns", "the", "SheetResources", "instance", "that", "provides", "access", "to", "Sheet", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L505-L510
135,028
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.sightResources
public SightResources sightResources() { if (sights.get() == null) { sights.compareAndSet(null, new SightResourcesImpl(this)); } return sights.get(); }
java
public SightResources sightResources() { if (sights.get() == null) { sights.compareAndSet(null, new SightResourcesImpl(this)); } return sights.get(); }
[ "public", "SightResources", "sightResources", "(", ")", "{", "if", "(", "sights", ".", "get", "(", ")", "==", "null", ")", "{", "sights", ".", "compareAndSet", "(", "null", ",", "new", "SightResourcesImpl", "(", "this", ")", ")", ";", "}", "return", "s...
Returns the SightResources instance that provides access to Sight resources. @return the sight resources
[ "Returns", "the", "SightResources", "instance", "that", "provides", "access", "to", "Sight", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L517-L522
135,029
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.favoriteResources
public FavoriteResources favoriteResources() { if (favorites.get() == null) { favorites.compareAndSet(null, new FavoriteResourcesImpl(this)); } return favorites.get(); }
java
public FavoriteResources favoriteResources() { if (favorites.get() == null) { favorites.compareAndSet(null, new FavoriteResourcesImpl(this)); } return favorites.get(); }
[ "public", "FavoriteResources", "favoriteResources", "(", ")", "{", "if", "(", "favorites", ".", "get", "(", ")", "==", "null", ")", "{", "favorites", ".", "compareAndSet", "(", "null", ",", "new", "FavoriteResourcesImpl", "(", "this", ")", ")", ";", "}", ...
Returns the FavoriteResources instance that provides access to Favorite resources. @return the favorite resources
[ "Returns", "the", "FavoriteResources", "instance", "that", "provides", "access", "to", "Favorite", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L528-L533
135,030
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.tokenResources
public TokenResources tokenResources() { if (tokens.get() == null) { tokens.compareAndSet(null, new TokenResourcesImpl(this)); } return tokens.get(); }
java
public TokenResources tokenResources() { if (tokens.get() == null) { tokens.compareAndSet(null, new TokenResourcesImpl(this)); } return tokens.get(); }
[ "public", "TokenResources", "tokenResources", "(", ")", "{", "if", "(", "tokens", ".", "get", "(", ")", "==", "null", ")", "{", "tokens", ".", "compareAndSet", "(", "null", ",", "new", "TokenResourcesImpl", "(", "this", ")", ")", ";", "}", "return", "t...
Returns the TokenResources instance that provides access to token resources. @return the token resources
[ "Returns", "the", "TokenResources", "instance", "that", "provides", "access", "to", "token", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L600-L605
135,031
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.contactResources
public ContactResources contactResources() { if (contacts.get() == null) { contacts.compareAndSet(null, new ContactResourcesImpl(this)); } return contacts.get(); }
java
public ContactResources contactResources() { if (contacts.get() == null) { contacts.compareAndSet(null, new ContactResourcesImpl(this)); } return contacts.get(); }
[ "public", "ContactResources", "contactResources", "(", ")", "{", "if", "(", "contacts", ".", "get", "(", ")", "==", "null", ")", "{", "contacts", ".", "compareAndSet", "(", "null", ",", "new", "ContactResourcesImpl", "(", "this", ")", ")", ";", "}", "ret...
Returns the ContactResources instance that provides access to contact resources. @return the contact resources
[ "Returns", "the", "ContactResources", "instance", "that", "provides", "access", "to", "contact", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L612-L617
135,032
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.imageUrlResources
public ImageUrlResources imageUrlResources() { if (imageUrls.get() == null) { imageUrls.compareAndSet(null, new ImageUrlResourcesImpl(this)); } return imageUrls.get(); }
java
public ImageUrlResources imageUrlResources() { if (imageUrls.get() == null) { imageUrls.compareAndSet(null, new ImageUrlResourcesImpl(this)); } return imageUrls.get(); }
[ "public", "ImageUrlResources", "imageUrlResources", "(", ")", "{", "if", "(", "imageUrls", ".", "get", "(", ")", "==", "null", ")", "{", "imageUrls", ".", "compareAndSet", "(", "null", ",", "new", "ImageUrlResourcesImpl", "(", "this", ")", ")", ";", "}", ...
Returns the ImageUrlResources instance that provides access to image url resources. @return the image url resources
[ "Returns", "the", "ImageUrlResources", "instance", "that", "provides", "access", "to", "image", "url", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L624-L629
135,033
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.webhookResources
public WebhookResources webhookResources() { if (webhooks.get() == null) { webhooks.compareAndSet(null, new WebhookResourcesImpl(this)); } return webhooks.get(); }
java
public WebhookResources webhookResources() { if (webhooks.get() == null) { webhooks.compareAndSet(null, new WebhookResourcesImpl(this)); } return webhooks.get(); }
[ "public", "WebhookResources", "webhookResources", "(", ")", "{", "if", "(", "webhooks", ".", "get", "(", ")", "==", "null", ")", "{", "webhooks", ".", "compareAndSet", "(", "null", ",", "new", "WebhookResourcesImpl", "(", "this", ")", ")", ";", "}", "ret...
Returns the WebhookResources instance that provides access to webhook resources. @return the webhook resources
[ "Returns", "the", "WebhookResources", "instance", "that", "provides", "access", "to", "webhook", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L636-L641
135,034
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java
SmartsheetImpl.passthroughResources
public PassthroughResources passthroughResources() { if (passthrough.get() == null) { passthrough.compareAndSet(null, new PassthroughResourcesImpl(this)); } return passthrough.get(); }
java
public PassthroughResources passthroughResources() { if (passthrough.get() == null) { passthrough.compareAndSet(null, new PassthroughResourcesImpl(this)); } return passthrough.get(); }
[ "public", "PassthroughResources", "passthroughResources", "(", ")", "{", "if", "(", "passthrough", ".", "get", "(", ")", "==", "null", ")", "{", "passthrough", ".", "compareAndSet", "(", "null", ",", "new", "PassthroughResourcesImpl", "(", "this", ")", ")", ...
Returns the PassthroughResources instance that provides access to passthrough resources. @return the passthrough resources
[ "Returns", "the", "PassthroughResources", "instance", "that", "provides", "access", "to", "passthrough", "resources", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SmartsheetImpl.java#L648-L653
135,035
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/WebhookResourcesImpl.java
WebhookResourcesImpl.updateWebhook
public Webhook updateWebhook(Webhook webhook) throws SmartsheetException { return this.updateResource("webhooks/" + webhook.getId(), Webhook.class, webhook); }
java
public Webhook updateWebhook(Webhook webhook) throws SmartsheetException { return this.updateResource("webhooks/" + webhook.getId(), Webhook.class, webhook); }
[ "public", "Webhook", "updateWebhook", "(", "Webhook", "webhook", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "updateResource", "(", "\"webhooks/\"", "+", "webhook", ".", "getId", "(", ")", ",", "Webhook", ".", "class", ",", "webhook", ")"...
Updates the webhooks specified in the URL. It mirrors to the following Smartsheet REST API method: PUT /webhooks/{webhookId} @param webhook the webhook to update @return the updated webhook resource. @throws SmartsheetException @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)
[ "Updates", "the", "webhooks", "specified", "in", "the", "URL", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/WebhookResourcesImpl.java#L126-L128
135,036
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/WebhookResourcesImpl.java
WebhookResourcesImpl.resetSharedSecret
public WebhookSharedSecret resetSharedSecret(long webhookId) throws SmartsheetException { HttpRequest request = createHttpRequest(this.getSmartsheet().getBaseURI().resolve("webhooks/" + webhookId + "/resetsharedsecret"), HttpMethod.POST); HttpResponse response = getSmartsheet().getHttpClient().request(request); WebhookSharedSecret secret = null; switch (response.getStatusCode()) { case 200: try { secret = this.smartsheet.getJsonSerializer().deserialize(WebhookSharedSecret.class, response.getEntity().getContent()); } catch (JsonParseException e) { throw new SmartsheetException(e); } catch (JsonMappingException e) { throw new SmartsheetException(e); } catch (IOException e) { throw new SmartsheetException(e); } break; default: handleError(response); } getSmartsheet().getHttpClient().releaseConnection(); return secret; }
java
public WebhookSharedSecret resetSharedSecret(long webhookId) throws SmartsheetException { HttpRequest request = createHttpRequest(this.getSmartsheet().getBaseURI().resolve("webhooks/" + webhookId + "/resetsharedsecret"), HttpMethod.POST); HttpResponse response = getSmartsheet().getHttpClient().request(request); WebhookSharedSecret secret = null; switch (response.getStatusCode()) { case 200: try { secret = this.smartsheet.getJsonSerializer().deserialize(WebhookSharedSecret.class, response.getEntity().getContent()); } catch (JsonParseException e) { throw new SmartsheetException(e); } catch (JsonMappingException e) { throw new SmartsheetException(e); } catch (IOException e) { throw new SmartsheetException(e); } break; default: handleError(response); } getSmartsheet().getHttpClient().releaseConnection(); return secret; }
[ "public", "WebhookSharedSecret", "resetSharedSecret", "(", "long", "webhookId", ")", "throws", "SmartsheetException", "{", "HttpRequest", "request", "=", "createHttpRequest", "(", "this", ".", "getSmartsheet", "(", ")", ".", "getBaseURI", "(", ")", ".", "resolve", ...
Resets the shared secret for the specified Webhook. For more information about how a shared secret is used, see Authenticating Callbacks. It mirrors to the following Smartsheet REST API method: POST /webhooks/{webhookId}/resetsharedsecret @param webhookId the webhook Id @return the Webhook shared secret @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
[ "Resets", "the", "shared", "secret", "for", "the", "specified", "Webhook", ".", "For", "more", "information", "about", "how", "a", "shared", "secret", "is", "used", "see", "Authenticating", "Callbacks", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/WebhookResourcesImpl.java#L162-L188
135,037
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/util/Util.java
Util.throwIfNull
public static void throwIfNull(Object obj1, Object obj2) { if(obj1 == null){ throw new IllegalArgumentException(); } if(obj2 == null){ throw new IllegalArgumentException(); } }
java
public static void throwIfNull(Object obj1, Object obj2) { if(obj1 == null){ throw new IllegalArgumentException(); } if(obj2 == null){ throw new IllegalArgumentException(); } }
[ "public", "static", "void", "throwIfNull", "(", "Object", "obj1", ",", "Object", "obj2", ")", "{", "if", "(", "obj1", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "obj2", "==", "null", ")", "{", "...
faster util method that avoids creation of array for two-arg cases
[ "faster", "util", "method", "that", "avoids", "creation", "of", "array", "for", "two", "-", "arg", "cases" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/util/Util.java#L36-L43
135,038
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java
SheetRowResourcesImpl.addRows
public List<Row> addRows(long sheetId, List<Row> rows) throws SmartsheetException { return this.postAndReceiveList("sheets/" + sheetId + "/rows", rows, Row.class); }
java
public List<Row> addRows(long sheetId, List<Row> rows) throws SmartsheetException { return this.postAndReceiveList("sheets/" + sheetId + "/rows", rows, Row.class); }
[ "public", "List", "<", "Row", ">", "addRows", "(", "long", "sheetId", ",", "List", "<", "Row", ">", "rows", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "postAndReceiveList", "(", "\"sheets/\"", "+", "sheetId", "+", "\"/rows\"", ",", "...
Insert rows to a sheet. It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/rows Exceptions: - IllegalArgumentException : if any argument 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) - ResourceNotFoundException : if the resource can not be found - 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 sheetId the sheet id @param rows the list of rows to create @return the created rows @throws SmartsheetException the smartsheet exception
[ "Insert", "rows", "to", "a", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java#L85-L87
135,039
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java
SheetRowResourcesImpl.getRow
public Row getRow(long sheetId, long rowId, EnumSet<RowInclusion> includes, EnumSet<ObjectExclusion> excludes) throws SmartsheetException { String path = "sheets/" + sheetId + "/rows/" + rowId; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); parameters.put("exclude", QueryUtil.generateCommaSeparatedList(excludes)); path += QueryUtil.generateUrl(null, parameters); return this.getResource(path, Row.class); }
java
public Row getRow(long sheetId, long rowId, EnumSet<RowInclusion> includes, EnumSet<ObjectExclusion> excludes) throws SmartsheetException { String path = "sheets/" + sheetId + "/rows/" + rowId; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); parameters.put("exclude", QueryUtil.generateCommaSeparatedList(excludes)); path += QueryUtil.generateUrl(null, parameters); return this.getResource(path, Row.class); }
[ "public", "Row", "getRow", "(", "long", "sheetId", ",", "long", "rowId", ",", "EnumSet", "<", "RowInclusion", ">", "includes", ",", "EnumSet", "<", "ObjectExclusion", ">", "excludes", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/...
Get a row. It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/rows/{rowId} Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - 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 sheetId the id of the sheet @param rowId the id of the row @param includes optional objects to include @param excludes optional objects to exclude @return the row (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Get", "a", "row", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java#L116-L126
135,040
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java
SheetRowResourcesImpl.updateRows
public List<Row> updateRows(long sheetId, List<Row> rows) throws SmartsheetException { return this.putAndReceiveList("sheets/" + sheetId + "/rows", rows, Row.class); }
java
public List<Row> updateRows(long sheetId, List<Row> rows) throws SmartsheetException { return this.putAndReceiveList("sheets/" + sheetId + "/rows", rows, Row.class); }
[ "public", "List", "<", "Row", ">", "updateRows", "(", "long", "sheetId", ",", "List", "<", "Row", ">", "rows", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "putAndReceiveList", "(", "\"sheets/\"", "+", "sheetId", "+", "\"/rows\"", ",", ...
Update rows. It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/rows Exceptions: IllegalArgumentException : if any argument 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 sheetId the id of the sheet @param rows the list of rows @return a list of rows @throws SmartsheetException the smartsheet exception
[ "Update", "rows", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java#L251-L253
135,041
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/util/StreamUtil.java
StreamUtil.readBytesFromStream
public static byte[] readBytesFromStream(InputStream source, int bufferSize) throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); copyContentIntoOutputStream(source, buffer, bufferSize, true); return buffer.toByteArray(); }
java
public static byte[] readBytesFromStream(InputStream source, int bufferSize) throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); copyContentIntoOutputStream(source, buffer, bufferSize, true); return buffer.toByteArray(); }
[ "public", "static", "byte", "[", "]", "readBytesFromStream", "(", "InputStream", "source", ",", "int", "bufferSize", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "buffer", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "copyContentIntoOutputStream"...
read all bytes from an InputStream with the specified buffer size; doesn't close input-stream @param source the input stream to consume @param bufferSize the buffer size to use when reading the stream @return the bytes read from 'is' @throws IOException if anything goes wrong reading from 'is'
[ "read", "all", "bytes", "from", "an", "InputStream", "with", "the", "specified", "buffer", "size", ";", "doesn", "t", "close", "input", "-", "stream" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/util/StreamUtil.java#L57-L61
135,042
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/util/StreamUtil.java
StreamUtil.copyContentIntoOutputStream
public static long copyContentIntoOutputStream(InputStream source, OutputStream target, int bufferSize, boolean readToEOF) throws IOException { byte[] tempBuf = new byte[Math.max(ONE_KB, bufferSize)]; // at least a 1k buffer long bytesWritten = 0; while (true) { int bytesRead = source.read(tempBuf); if (bytesRead < 0) { break; } target.write(tempBuf, 0, bytesRead); bytesWritten += bytesRead; if (!readToEOF) { // prevents us from reading more than 1 buffer worth break; } } return bytesWritten; }
java
public static long copyContentIntoOutputStream(InputStream source, OutputStream target, int bufferSize, boolean readToEOF) throws IOException { byte[] tempBuf = new byte[Math.max(ONE_KB, bufferSize)]; // at least a 1k buffer long bytesWritten = 0; while (true) { int bytesRead = source.read(tempBuf); if (bytesRead < 0) { break; } target.write(tempBuf, 0, bytesRead); bytesWritten += bytesRead; if (!readToEOF) { // prevents us from reading more than 1 buffer worth break; } } return bytesWritten; }
[ "public", "static", "long", "copyContentIntoOutputStream", "(", "InputStream", "source", ",", "OutputStream", "target", ",", "int", "bufferSize", ",", "boolean", "readToEOF", ")", "throws", "IOException", "{", "byte", "[", "]", "tempBuf", "=", "new", "byte", "["...
the real work-horse behind most of these methods @param source the source InputStream from which to read the data (not closed when done) @param target the target OutputStream to which to write the data (not closed when done) @param bufferSize the size of the transfer buffer to use @param readToEOF if we should read to end-of-file of the source (true) or just 1 buffer's worth (false) @throws IOException
[ "the", "real", "work", "-", "horse", "behind", "most", "of", "these", "methods" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/util/StreamUtil.java#L71-L89
135,043
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/util/StreamUtil.java
StreamUtil.cloneContent
public static InputStream cloneContent(InputStream source, int readbackSize, ByteArrayOutputStream target) throws IOException { if (source == null) { return null; } // if the source supports mark/reset then we read and then reset up to the read-back size if (source.markSupported()) { readbackSize = Math.max(TEN_KB, readbackSize); // at least 10 KB (minimal waste, handles those -1 ContentLength cases) source.mark(readbackSize); copyContentIntoOutputStream(source, target, readbackSize, false); source.reset(); return source; } else { copyContentIntoOutputStream(source, target, ONE_MB, true); byte[] fullContentBytes = target.toByteArray(); // if we can't reset the source we need to create a replacement stream so others can read the content return new ByteArrayInputStream(fullContentBytes); } }
java
public static InputStream cloneContent(InputStream source, int readbackSize, ByteArrayOutputStream target) throws IOException { if (source == null) { return null; } // if the source supports mark/reset then we read and then reset up to the read-back size if (source.markSupported()) { readbackSize = Math.max(TEN_KB, readbackSize); // at least 10 KB (minimal waste, handles those -1 ContentLength cases) source.mark(readbackSize); copyContentIntoOutputStream(source, target, readbackSize, false); source.reset(); return source; } else { copyContentIntoOutputStream(source, target, ONE_MB, true); byte[] fullContentBytes = target.toByteArray(); // if we can't reset the source we need to create a replacement stream so others can read the content return new ByteArrayInputStream(fullContentBytes); } }
[ "public", "static", "InputStream", "cloneContent", "(", "InputStream", "source", ",", "int", "readbackSize", ",", "ByteArrayOutputStream", "target", ")", "throws", "IOException", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "//...
used when you want to clone a InputStream's content and still have it appear "rewound" to the stream beginning @param source the stream around the contents we want to clone @param readbackSize the farthest we should read a resetable stream before giving up @param target an output stream into which we place a copy of the content read from source @return the source if it was resetable; a new stream rewound around the source data otherwise @throws IOException if any issues occur with the reading of bytes from the source stream
[ "used", "when", "you", "want", "to", "clone", "a", "InputStream", "s", "content", "and", "still", "have", "it", "appear", "rewound", "to", "the", "stream", "beginning" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/util/StreamUtil.java#L99-L116
135,044
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java
PassthroughResourcesImpl.getRequest
public String getRequest(String endpoint, HashMap<String, Object> parameters) throws SmartsheetException { return passthroughRequest(HttpMethod.GET, endpoint, null, parameters); }
java
public String getRequest(String endpoint, HashMap<String, Object> parameters) throws SmartsheetException { return passthroughRequest(HttpMethod.GET, endpoint, null, parameters); }
[ "public", "String", "getRequest", "(", "String", "endpoint", ",", "HashMap", "<", "String", ",", "Object", ">", "parameters", ")", "throws", "SmartsheetException", "{", "return", "passthroughRequest", "(", "HttpMethod", ".", "GET", ",", "endpoint", ",", "null", ...
Issue an HTTP GET request. @param endpoint the API endpoint @param parameters optional list of resource parameters @return a JSON response string @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
[ "Issue", "an", "HTTP", "GET", "request", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java#L60-L62
135,045
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java
PassthroughResourcesImpl.postRequest
public String postRequest(String endpoint, String payload, HashMap<String, Object> parameters) throws SmartsheetException { Util.throwIfNull(payload); return passthroughRequest(HttpMethod.POST, endpoint, payload, parameters); }
java
public String postRequest(String endpoint, String payload, HashMap<String, Object> parameters) throws SmartsheetException { Util.throwIfNull(payload); return passthroughRequest(HttpMethod.POST, endpoint, payload, parameters); }
[ "public", "String", "postRequest", "(", "String", "endpoint", ",", "String", "payload", ",", "HashMap", "<", "String", ",", "Object", ">", "parameters", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "payload", ")", ";", "return", ...
Issue an HTTP POST request. @param endpoint the API endpoint @param payload a JSON payload string @param parameters optional list of resource parameters @return a JSON response string @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
[ "Issue", "an", "HTTP", "POST", "request", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java#L78-L81
135,046
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java
PassthroughResourcesImpl.putRequest
public String putRequest(String endpoint, String payload, HashMap<String, Object> parameters) throws SmartsheetException { Util.throwIfNull(payload); return passthroughRequest(HttpMethod.PUT, endpoint, payload, parameters); }
java
public String putRequest(String endpoint, String payload, HashMap<String, Object> parameters) throws SmartsheetException { Util.throwIfNull(payload); return passthroughRequest(HttpMethod.PUT, endpoint, payload, parameters); }
[ "public", "String", "putRequest", "(", "String", "endpoint", ",", "String", "payload", ",", "HashMap", "<", "String", ",", "Object", ">", "parameters", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "payload", ")", ";", "return", ...
Issue an HTTP PUT request. @param endpoint the API endpoint @param payload a JSON payload string @param parameters optional list of resource parameters @return a JSON response string @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
[ "Issue", "an", "HTTP", "PUT", "request", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java#L97-L100
135,047
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java
PassthroughResourcesImpl.deleteRequest
public String deleteRequest(String endpoint) throws SmartsheetException { return passthroughRequest(HttpMethod.DELETE, endpoint, null, null); }
java
public String deleteRequest(String endpoint) throws SmartsheetException { return passthroughRequest(HttpMethod.DELETE, endpoint, null, null); }
[ "public", "String", "deleteRequest", "(", "String", "endpoint", ")", "throws", "SmartsheetException", "{", "return", "passthroughRequest", "(", "HttpMethod", ".", "DELETE", ",", "endpoint", ",", "null", ",", "null", ")", ";", "}" ]
Issue an HTTP DELETE request. @param endpoint the API endpoint @return a JSON response string @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
[ "Issue", "an", "HTTP", "DELETE", "request", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java#L114-L116
135,048
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/DiscussionCommentResourcesImpl.java
DiscussionCommentResourcesImpl.addCommentWithAttachment
public Comment addCommentWithAttachment(long sheetId, long discussionId, Comment comment, File file, String contentType) throws SmartsheetException, IOException{ String path = "sheets/" + sheetId + "/discussions/" + discussionId + "/comments"; Util.throwIfNull(sheetId, comment, file, contentType); return this.addCommentWithAttachment(path, comment, new FileInputStream(file), contentType, file.getName()); }
java
public Comment addCommentWithAttachment(long sheetId, long discussionId, Comment comment, File file, String contentType) throws SmartsheetException, IOException{ String path = "sheets/" + sheetId + "/discussions/" + discussionId + "/comments"; Util.throwIfNull(sheetId, comment, file, contentType); return this.addCommentWithAttachment(path, comment, new FileInputStream(file), contentType, file.getName()); }
[ "public", "Comment", "addCommentWithAttachment", "(", "long", "sheetId", ",", "long", "discussionId", ",", "Comment", "comment", ",", "File", "file", ",", "String", "contentType", ")", "throws", "SmartsheetException", ",", "IOException", "{", "String", "path", "="...
Add a comment to a discussion with an attachment. It mirrors to the following Smartsheet REST API method: POST /discussion/{discussionId}/comments @param sheetId the sheet id @param discussionId the dicussion id @param comment the comment to add @param file the file to be attached @param contentType the type of file @return the created comment @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 @throws IOException is there is any error with file
[ "Add", "a", "comment", "to", "a", "discussion", "with", "an", "attachment", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/DiscussionCommentResourcesImpl.java#L86-L91
135,049
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/DiscussionCommentResourcesImpl.java
DiscussionCommentResourcesImpl.updateComment
public Comment updateComment(long sheetId, Comment comment) throws SmartsheetException { return this.updateResource("sheets/" + sheetId + "/comments/" + comment.getId(), Comment.class, comment); }
java
public Comment updateComment(long sheetId, Comment comment) throws SmartsheetException { return this.updateResource("sheets/" + sheetId + "/comments/" + comment.getId(), Comment.class, comment); }
[ "public", "Comment", "updateComment", "(", "long", "sheetId", ",", "Comment", "comment", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "updateResource", "(", "\"sheets/\"", "+", "sheetId", "+", "\"/comments/\"", "+", "comment", ".", "getId", ...
Update the specified comment It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/comments/{commentId} @param sheetId the sheet id @param comment the new comment object @return the updated comment @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
[ "Update", "the", "specified", "comment" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/DiscussionCommentResourcesImpl.java#L112-L114
135,050
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/ImageUrlResourcesImpl.java
ImageUrlResourcesImpl.getImageUrls
public ImageUrlMap getImageUrls(List<ImageUrl> requestUrls) throws SmartsheetException { Util.throwIfNull(requestUrls); HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve("imageurls"), HttpMethod.POST); ByteArrayOutputStream baos = new ByteArrayOutputStream(); this.smartsheet.getJsonSerializer().serialize(requestUrls, baos); HttpEntity entity = new HttpEntity(); entity.setContentType("application/json"); entity.setContent(new ByteArrayInputStream(baos.toByteArray())); entity.setContentLength(baos.size()); request.setEntity(entity); HttpResponse response = this.smartsheet.getHttpClient().request(request); ImageUrlMap obj = null; switch (response.getStatusCode()) { case 200: try { obj = this.smartsheet.getJsonSerializer().deserialize(ImageUrlMap.class, response.getEntity().getContent()); } catch (JsonParseException e) { throw new SmartsheetException(e); } catch (JsonMappingException e) { throw new SmartsheetException(e); } catch (IOException e) { throw new SmartsheetException(e); } break; default: handleError(response); } smartsheet.getHttpClient().releaseConnection(); return obj; }
java
public ImageUrlMap getImageUrls(List<ImageUrl> requestUrls) throws SmartsheetException { Util.throwIfNull(requestUrls); HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve("imageurls"), HttpMethod.POST); ByteArrayOutputStream baos = new ByteArrayOutputStream(); this.smartsheet.getJsonSerializer().serialize(requestUrls, baos); HttpEntity entity = new HttpEntity(); entity.setContentType("application/json"); entity.setContent(new ByteArrayInputStream(baos.toByteArray())); entity.setContentLength(baos.size()); request.setEntity(entity); HttpResponse response = this.smartsheet.getHttpClient().request(request); ImageUrlMap obj = null; switch (response.getStatusCode()) { case 200: try { obj = this.smartsheet.getJsonSerializer().deserialize(ImageUrlMap.class, response.getEntity().getContent()); } catch (JsonParseException e) { throw new SmartsheetException(e); } catch (JsonMappingException e) { throw new SmartsheetException(e); } catch (IOException e) { throw new SmartsheetException(e); } break; default: handleError(response); } smartsheet.getHttpClient().releaseConnection(); return obj; }
[ "public", "ImageUrlMap", "getImageUrls", "(", "List", "<", "ImageUrl", ">", "requestUrls", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "requestUrls", ")", ";", "HttpRequest", "request", ";", "request", "=", "createHttpRequest", "(",...
Gets URLS that can be used to retieve the specified cell images. It mirrors to the following Smartsheet REST API method: POST /imageurls @param requestUrls array of requested Images ans sizes. @return the ImageUrlMap object (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws JSONSerializerException @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
[ "Gets", "URLS", "that", "can", "be", "used", "to", "retieve", "the", "specified", "cell", "images", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ImageUrlResourcesImpl.java#L78-L115
135,051
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/WorkspaceResourcesImpl.java
WorkspaceResourcesImpl.listWorkspaces
public PagedResult<Workspace> listWorkspaces(PaginationParameters parameters) throws SmartsheetException { String path = "workspaces"; if (parameters != null) { path += parameters.toQueryString(); } return this.listResourcesWithWrapper(path, Workspace.class); }
java
public PagedResult<Workspace> listWorkspaces(PaginationParameters parameters) throws SmartsheetException { String path = "workspaces"; if (parameters != null) { path += parameters.toQueryString(); } return this.listResourcesWithWrapper(path, Workspace.class); }
[ "public", "PagedResult", "<", "Workspace", ">", "listWorkspaces", "(", "PaginationParameters", "parameters", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"workspaces\"", ";", "if", "(", "parameters", "!=", "null", ")", "{", "path", "+=", "...
List all workspaces. It mirrors to the following Smartsheet REST API method: GET /workspaces Exceptions: - 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 parameters the object containing the pagination parameters @return all workspaces (note that empty list will be returned if there is none) @throws SmartsheetException the smartsheet exception
[ "List", "all", "workspaces", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/WorkspaceResourcesImpl.java#L97-L104
135,052
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/WorkspaceResourcesImpl.java
WorkspaceResourcesImpl.getWorkspace
public Workspace getWorkspace(long id, Boolean loadAll, EnumSet<SourceInclusion> includes) throws SmartsheetException { String path = "workspaces/" + id; // Add the parameters to a map and build the query string at the end HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); if (loadAll != null) { parameters.put("loadAll", Boolean.toString(loadAll)); } path += QueryUtil.generateUrl(null, parameters); return this.getResource(path, Workspace.class); }
java
public Workspace getWorkspace(long id, Boolean loadAll, EnumSet<SourceInclusion> includes) throws SmartsheetException { String path = "workspaces/" + id; // Add the parameters to a map and build the query string at the end HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); if (loadAll != null) { parameters.put("loadAll", Boolean.toString(loadAll)); } path += QueryUtil.generateUrl(null, parameters); return this.getResource(path, Workspace.class); }
[ "public", "Workspace", "getWorkspace", "(", "long", "id", ",", "Boolean", "loadAll", ",", "EnumSet", "<", "SourceInclusion", ">", "includes", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"workspaces/\"", "+", "id", ";", "// Add the parameter...
Get a workspace. It mirrors to the following Smartsheet REST API method: GET /workspace/{id} Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - 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 id the id @param loadAll load all contents in a workspace @param includes used to specify the optional objects to include @return the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Get", "a", "workspace", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/WorkspaceResourcesImpl.java#L132-L146
135,053
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/WorkspaceResourcesImpl.java
WorkspaceResourcesImpl.updateWorkspace
public Workspace updateWorkspace(Workspace workspace) throws SmartsheetException { return this.updateResource("workspaces/" + workspace.getId(), Workspace.class, workspace); }
java
public Workspace updateWorkspace(Workspace workspace) throws SmartsheetException { return this.updateResource("workspaces/" + workspace.getId(), Workspace.class, workspace); }
[ "public", "Workspace", "updateWorkspace", "(", "Workspace", "workspace", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "updateResource", "(", "\"workspaces/\"", "+", "workspace", ".", "getId", "(", ")", ",", "Workspace", ".", "class", ",", "w...
Update a workspace. It mirrors to the following Smartsheet REST API method: PUT /workspace/{id} Exceptions: - IllegalArgumentException : if any argument 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) - ResourceNotFoundException : if the resource can not be found - 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 workspace the workspace to update limited to the following attribute: * name (string) @return the updated workspace (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Update", "a", "workspace", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/WorkspaceResourcesImpl.java#L201-L203
135,054
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.listSheets
public PagedResult<Sheet> listSheets(EnumSet<SourceInclusion> includes, PaginationParameters pagination) throws SmartsheetException { return this.listSheets(includes, pagination, null); }
java
public PagedResult<Sheet> listSheets(EnumSet<SourceInclusion> includes, PaginationParameters pagination) throws SmartsheetException { return this.listSheets(includes, pagination, null); }
[ "public", "PagedResult", "<", "Sheet", ">", "listSheets", "(", "EnumSet", "<", "SourceInclusion", ">", "includes", ",", "PaginationParameters", "pagination", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "listSheets", "(", "includes", ",", "pag...
List all sheets. It mirrors to the following Smartsheet REST API method: GET /sheets @param includes the source inclusion @param pagination the object containing the pagination parameters @return A list of all sheets (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
[ "List", "all", "sheets", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L153-L155
135,055
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.listOrganizationSheets
@Deprecated public PagedResult<Sheet> listOrganizationSheets(PaginationParameters parameters) throws SmartsheetException { String path = "users/sheets"; if (parameters != null) { path += parameters.toQueryString(); } return this.listResourcesWithWrapper(path, Sheet.class); }
java
@Deprecated public PagedResult<Sheet> listOrganizationSheets(PaginationParameters parameters) throws SmartsheetException { String path = "users/sheets"; if (parameters != null) { path += parameters.toQueryString(); } return this.listResourcesWithWrapper(path, Sheet.class); }
[ "@", "Deprecated", "public", "PagedResult", "<", "Sheet", ">", "listOrganizationSheets", "(", "PaginationParameters", "parameters", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"users/sheets\"", ";", "if", "(", "parameters", "!=", "null", ")",...
List all sheets in the organization. It mirrors to the following Smartsheet REST API method: GET /users/sheets Exceptions: - 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 parameters the object containing the pagination parameters @return all sheets (note that empty list will be returned if there is none) @throws SmartsheetException the smartsheet exception
[ "List", "all", "sheets", "in", "the", "organization", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L190-L198
135,056
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.getSheet
public Sheet getSheet(long id, EnumSet<SheetInclusion> includes, EnumSet<ObjectExclusion> excludes, Set<Long> rowIds, Set<Integer> rowNumbers, Set<Long> columnIds, Integer pageSize, Integer page) throws SmartsheetException { return this.getSheet(id, includes, excludes, rowIds, rowNumbers, columnIds, pageSize, page, null, null); }
java
public Sheet getSheet(long id, EnumSet<SheetInclusion> includes, EnumSet<ObjectExclusion> excludes, Set<Long> rowIds, Set<Integer> rowNumbers, Set<Long> columnIds, Integer pageSize, Integer page) throws SmartsheetException { return this.getSheet(id, includes, excludes, rowIds, rowNumbers, columnIds, pageSize, page, null, null); }
[ "public", "Sheet", "getSheet", "(", "long", "id", ",", "EnumSet", "<", "SheetInclusion", ">", "includes", ",", "EnumSet", "<", "ObjectExclusion", ">", "excludes", ",", "Set", "<", "Long", ">", "rowIds", ",", "Set", "<", "Integer", ">", "rowNumbers", ",", ...
Get a sheet. It mirrors to the following Smartsheet REST API method: GET /sheet/{id} Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - 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 id the id @param includes used to specify the optional objects to include, currently DISCUSSIONS and ATTACHMENTS are supported. @param columnIds the column ids @param excludes the exclude parameters @param page the page number @param pageSize the page size @param rowIds the row ids @param rowNumbers the row numbers @return the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Get", "a", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L226-L228
135,057
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.getSheetAsPDF
public void getSheetAsPDF(long id, OutputStream outputStream, PaperSize paperSize) throws SmartsheetException { getSheetAsFile(id, paperSize, outputStream, "application/pdf"); }
java
public void getSheetAsPDF(long id, OutputStream outputStream, PaperSize paperSize) throws SmartsheetException { getSheetAsFile(id, paperSize, outputStream, "application/pdf"); }
[ "public", "void", "getSheetAsPDF", "(", "long", "id", ",", "OutputStream", "outputStream", ",", "PaperSize", "paperSize", ")", "throws", "SmartsheetException", "{", "getSheetAsFile", "(", "id", ",", "paperSize", ",", "outputStream", ",", "\"application/pdf\"", ")", ...
Get a sheet as a PDF file. It mirrors to the following Smartsheet REST API method: GET /sheet/{id} with "application/pdf" Accept HTTP header Exceptions: IllegalArgumentException : if outputStream 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) ResourceNotFoundException : if the resource can not be found 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 id the id @param outputStream the output stream to which the PDF file will be written. @param paperSize the optional paper size @return the sheet as pdf @throws SmartsheetException the smartsheet exception
[ "Get", "a", "sheet", "as", "a", "PDF", "file", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L363-L365
135,058
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.importCsv
public Sheet importCsv(String file, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException { return importFile("sheets/import", file,"text/csv", sheetName, headerRowIndex, primaryRowIndex); }
java
public Sheet importCsv(String file, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException { return importFile("sheets/import", file,"text/csv", sheetName, headerRowIndex, primaryRowIndex); }
[ "public", "Sheet", "importCsv", "(", "String", "file", ",", "String", "sheetName", ",", "Integer", "headerRowIndex", ",", "Integer", "primaryRowIndex", ")", "throws", "SmartsheetException", "{", "return", "importFile", "(", "\"sheets/import\"", ",", "file", ",", "...
Imports a sheet. It mirrors to the following Smartsheet REST API method: POST /sheets/import @param file path to the CSV file @param sheetName destination sheet name @param headerRowIndex index (0 based) of row to be used for column names @param primaryRowIndex index (0 based) of primary column @return the created sheet @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
[ "Imports", "a", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L435-L437
135,059
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.importCsvInFolder
public Sheet importCsvInFolder(long folderId, String file, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException { return importFile("folders/" + folderId + "/sheets/import", file,"text/csv", sheetName, headerRowIndex, primaryRowIndex); }
java
public Sheet importCsvInFolder(long folderId, String file, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException { return importFile("folders/" + folderId + "/sheets/import", file,"text/csv", sheetName, headerRowIndex, primaryRowIndex); }
[ "public", "Sheet", "importCsvInFolder", "(", "long", "folderId", ",", "String", "file", ",", "String", "sheetName", ",", "Integer", "headerRowIndex", ",", "Integer", "primaryRowIndex", ")", "throws", "SmartsheetException", "{", "return", "importFile", "(", "\"folder...
Imports a sheet in given folder. It mirrors to the following Smartsheet REST API method: POST /folders/{folderId}/sheets/import @param folderId the folder id @param file path to the CSV file @param sheetName destination sheet name @param headerRowIndex index (0 based) of row to be used for column names @param primaryRowIndex index (0 based) of primary column @return the created sheet @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
[ "Imports", "a", "sheet", "in", "given", "folder", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L533-L536
135,060
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.createSheetInWorkspace
public Sheet createSheetInWorkspace(long workspaceId, Sheet sheet) throws SmartsheetException { return this.createResource("workspaces/" + workspaceId + "/sheets", Sheet.class, sheet); }
java
public Sheet createSheetInWorkspace(long workspaceId, Sheet sheet) throws SmartsheetException { return this.createResource("workspaces/" + workspaceId + "/sheets", Sheet.class, sheet); }
[ "public", "Sheet", "createSheetInWorkspace", "(", "long", "workspaceId", ",", "Sheet", "sheet", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "createResource", "(", "\"workspaces/\"", "+", "workspaceId", "+", "\"/sheets\"", ",", "Sheet", ".", "...
Create a sheet in given workspace. It mirrors to the following Smartsheet REST API method: POST /workspace/{workspaceId}/sheets Exceptions: IllegalArgumentException : if any argument 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 workspace id @param sheet the sheet to create, limited to the following required attributes: * name (string) * columns (array of Column objects, limited to the following attributes) - title - primary - type - symbol - options @return the created sheet @throws SmartsheetException the smartsheet exception
[ "Create", "a", "sheet", "in", "given", "workspace", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L581-L583
135,061
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.importCsvInWorkspace
public Sheet importCsvInWorkspace(long workspaceId, String file, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException { return importFile("workspaces/" + workspaceId + "/sheets/import", file, "text/csv", sheetName, headerRowIndex, primaryRowIndex); }
java
public Sheet importCsvInWorkspace(long workspaceId, String file, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException { return importFile("workspaces/" + workspaceId + "/sheets/import", file, "text/csv", sheetName, headerRowIndex, primaryRowIndex); }
[ "public", "Sheet", "importCsvInWorkspace", "(", "long", "workspaceId", ",", "String", "file", ",", "String", "sheetName", ",", "Integer", "headerRowIndex", ",", "Integer", "primaryRowIndex", ")", "throws", "SmartsheetException", "{", "return", "importFile", "(", "\"...
Imports a sheet in given workspace. It mirrors to the following Smartsheet REST API method: POST /workspaces/{workspaceId}/sheets/import @param workspaceId the workspace id @param file path to the CSV file @param sheetName destination sheet name @param headerRowIndex index (0 based) of row to be used for column names @param primaryRowIndex index (0 based) of primary column @return the created sheet @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
[ "Imports", "a", "sheet", "in", "given", "workspace", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L634-L637
135,062
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.updatePublishStatus
public SheetPublish updatePublishStatus(long id, SheetPublish publish) throws SmartsheetException{ return this.updateResource("sheets/" + id + "/publish", SheetPublish.class, publish); }
java
public SheetPublish updatePublishStatus(long id, SheetPublish publish) throws SmartsheetException{ return this.updateResource("sheets/" + id + "/publish", SheetPublish.class, publish); }
[ "public", "SheetPublish", "updatePublishStatus", "(", "long", "id", ",", "SheetPublish", "publish", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "updateResource", "(", "\"sheets/\"", "+", "id", "+", "\"/publish\"", ",", "SheetPublish", ".", "c...
Sets the publish status of a sheet and returns the new status, including the URLs of any enabled publishings. It mirrors to the following Smartsheet REST API method: PUT /sheet/{sheetId}/publish Exceptions: - IllegalArgumentException : if any argument 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) - ResourceNotFoundException : if the resource can not be found - 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 id the id @param publish the SheetPublish object limited to the following attributes * readOnlyLiteEnabled * readOnlyFullEnabled * readWriteEnabled * icalEnabled @return the updated SheetPublish (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Sets", "the", "publish", "status", "of", "a", "sheet", "and", "returns", "the", "new", "status", "including", "the", "URLs", "of", "any", "enabled", "publishings", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L897-L899
135,063
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.importFile
private Sheet importFile(String path, String file, String contentType, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException { Util.throwIfNull(path, file, contentType); Util.throwIfEmpty(path, file, contentType); File f = new File(file); HashMap<String, Object> parameters = new HashMap(); if (sheetName == null) { sheetName = f.getName(); } parameters.put("sheetName", sheetName); parameters.put("headerRowIndex", headerRowIndex); parameters.put("primaryRowIndex", primaryRowIndex); path = QueryUtil.generateUrl(path, parameters); HttpRequest request = createHttpRequest(this.smartsheet.getBaseURI().resolve(path), HttpMethod.POST); request.getHeaders().put("Content-Disposition", "attachment"); request.getHeaders().put("Content-Type", contentType); InputStream is = null; try { is = new FileInputStream(f); } catch (FileNotFoundException e) { throw new SmartsheetException(e); } HttpEntity entity = new HttpEntity(); entity.setContentType(contentType); entity.setContent(is); entity.setContentLength(f.length()); request.setEntity(entity); Sheet obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeResult(Sheet.class, response.getEntity().getContent()).getResult(); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
java
private Sheet importFile(String path, String file, String contentType, String sheetName, Integer headerRowIndex, Integer primaryRowIndex) throws SmartsheetException { Util.throwIfNull(path, file, contentType); Util.throwIfEmpty(path, file, contentType); File f = new File(file); HashMap<String, Object> parameters = new HashMap(); if (sheetName == null) { sheetName = f.getName(); } parameters.put("sheetName", sheetName); parameters.put("headerRowIndex", headerRowIndex); parameters.put("primaryRowIndex", primaryRowIndex); path = QueryUtil.generateUrl(path, parameters); HttpRequest request = createHttpRequest(this.smartsheet.getBaseURI().resolve(path), HttpMethod.POST); request.getHeaders().put("Content-Disposition", "attachment"); request.getHeaders().put("Content-Type", contentType); InputStream is = null; try { is = new FileInputStream(f); } catch (FileNotFoundException e) { throw new SmartsheetException(e); } HttpEntity entity = new HttpEntity(); entity.setContentType(contentType); entity.setContent(is); entity.setContentLength(f.length()); request.setEntity(entity); Sheet obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeResult(Sheet.class, response.getEntity().getContent()).getResult(); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
[ "private", "Sheet", "importFile", "(", "String", "path", ",", "String", "file", ",", "String", "contentType", ",", "String", "sheetName", ",", "Integer", "headerRowIndex", ",", "Integer", "primaryRowIndex", ")", "throws", "SmartsheetException", "{", "Util", ".", ...
Internal function used by all of the import routines Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - 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 path endpoint for import @param file full path to file @param contentType content type of the file being imported (either CSV or XLSX) @param sheetName sheetName from caller (can be null) @param headerRowIndex headerRowIndex from caller (can be null) @param primaryRowIndex primaryRowIndex from caller (can be null) @return the new imported sheet @throws SmartsheetException
[ "Internal", "function", "used", "by", "all", "of", "the", "import", "routines" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L921-L968
135,064
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.moveSheet
public Sheet moveSheet(long sheetId, ContainerDestination containerDestination) throws SmartsheetException { String path = "sheets/" + sheetId + "/move"; return this.createResource(path, Sheet.class, containerDestination); }
java
public Sheet moveSheet(long sheetId, ContainerDestination containerDestination) throws SmartsheetException { String path = "sheets/" + sheetId + "/move"; return this.createResource(path, Sheet.class, containerDestination); }
[ "public", "Sheet", "moveSheet", "(", "long", "sheetId", ",", "ContainerDestination", "containerDestination", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", "+", "sheetId", "+", "\"/move\"", ";", "return", "this", ".", "createResourc...
Moves the specified Sheet to another location. It mirrors to the following Smartsheet REST API method: POST /folders/{folderId}/move 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 sheetId the folder id @param containerDestination describes the destination container @return the sheet @throws SmartsheetException the smartsheet exception
[ "Moves", "the", "specified", "Sheet", "to", "another", "location", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L1092-L1096
135,065
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/DiscussionAttachmentResources.java
DiscussionAttachmentResources.attachFile
public Attachment attachFile(long objectId, InputStream inputStream, String contentType, long contentLength, String fileName) { throw new UnsupportedOperationException("Attachments can only be attached to comments, not discussions."); }
java
public Attachment attachFile(long objectId, InputStream inputStream, String contentType, long contentLength, String fileName) { throw new UnsupportedOperationException("Attachments can only be attached to comments, not discussions."); }
[ "public", "Attachment", "attachFile", "(", "long", "objectId", ",", "InputStream", "inputStream", ",", "String", "contentType", ",", "long", "contentLength", ",", "String", "fileName", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Attachments can ...
Throws an UnsupportedOperationException.
[ "Throws", "an", "UnsupportedOperationException", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/DiscussionAttachmentResources.java#L76-L78
135,066
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java
SheetColumnResourcesImpl.listColumns
public PagedResult<Column> listColumns(long sheetId, EnumSet<ColumnInclusion> includes, PaginationParameters pagination) throws SmartsheetException { String path = "sheets/" + sheetId + "/columns"; HashMap<String, Object> parameters = new HashMap<String, Object>(); if (pagination != null) { parameters = pagination.toHashMap(); } parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); path += QueryUtil.generateUrl(null, parameters); return this.listResourcesWithWrapper(path, Column.class); }
java
public PagedResult<Column> listColumns(long sheetId, EnumSet<ColumnInclusion> includes, PaginationParameters pagination) throws SmartsheetException { String path = "sheets/" + sheetId + "/columns"; HashMap<String, Object> parameters = new HashMap<String, Object>(); if (pagination != null) { parameters = pagination.toHashMap(); } parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); path += QueryUtil.generateUrl(null, parameters); return this.listResourcesWithWrapper(path, Column.class); }
[ "public", "PagedResult", "<", "Column", ">", "listColumns", "(", "long", "sheetId", ",", "EnumSet", "<", "ColumnInclusion", ">", "includes", ",", "PaginationParameters", "pagination", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", ...
List columns of a given sheet. It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/columns Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found 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 sheetId the sheet id @param includes list of includes @param pagination the object containing the pagination parameters @return the columns (note that empty list will be returned if there is none) @throws SmartsheetException the smartsheet exception
[ "List", "columns", "of", "a", "given", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java#L72-L84
135,067
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java
SheetColumnResourcesImpl.addColumns
public List<Column> addColumns(long sheetId, List<Column> columns) throws SmartsheetException { return this.postAndReceiveList("sheets/" + sheetId + "/columns", columns, Column.class); }
java
public List<Column> addColumns(long sheetId, List<Column> columns) throws SmartsheetException { return this.postAndReceiveList("sheets/" + sheetId + "/columns", columns, Column.class); }
[ "public", "List", "<", "Column", ">", "addColumns", "(", "long", "sheetId", ",", "List", "<", "Column", ">", "columns", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "postAndReceiveList", "(", "\"sheets/\"", "+", "sheetId", "+", "\"/columns...
Add column to a sheet. It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/columns Exceptions: IllegalArgumentException : if any argument 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) ResourceNotFoundException : if the resource can not be found 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 sheetId the sheet id @param columns the list of columns object limited to the following attributes: * title * type * symbol (optional) * options (optional) - array of options * index (zero-based) * systemColumnType (optional) * autoNumberFormat (optional) @return the list of created columns @throws SmartsheetException the smartsheet exception
[ "Add", "column", "to", "a", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java#L107-L109
135,068
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java
SheetColumnResourcesImpl.updateColumn
public Column updateColumn(long sheetId, Column column) throws SmartsheetException { Util.throwIfNull(column); return this.updateResource("sheets/" + sheetId + "/columns/" + column.getId(), Column.class, column); }
java
public Column updateColumn(long sheetId, Column column) throws SmartsheetException { Util.throwIfNull(column); return this.updateResource("sheets/" + sheetId + "/columns/" + column.getId(), Column.class, column); }
[ "public", "Column", "updateColumn", "(", "long", "sheetId", ",", "Column", "column", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "column", ")", ";", "return", "this", ".", "updateResource", "(", "\"sheets/\"", "+", "sheetId", "+...
Update a column. It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/columns/{columnId} Exceptions: IllegalArgumentException : if any argument 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) ResourceNotFoundException : if the resource can not be found 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 sheetId the sheetId @param column the column to update limited to the following attributes: index (column's new index in the sheet), title, sheetId, type, options (optional), symbol (optional), systemColumnType (optional), autoNumberFormat (optional) @return the updated sheet (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Update", "a", "column", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java#L152-L155
135,069
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java
SheetColumnResourcesImpl.getColumn
public Column getColumn(long sheetId, long columnId, EnumSet<ColumnInclusion> includes) throws SmartsheetException { String path = "sheets/" + sheetId + "/columns/" + columnId; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); path = QueryUtil.generateUrl(path, parameters); return this.getResource(path, Column.class); }
java
public Column getColumn(long sheetId, long columnId, EnumSet<ColumnInclusion> includes) throws SmartsheetException { String path = "sheets/" + sheetId + "/columns/" + columnId; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); path = QueryUtil.generateUrl(path, parameters); return this.getResource(path, Column.class); }
[ "public", "Column", "getColumn", "(", "long", "sheetId", ",", "long", "columnId", ",", "EnumSet", "<", "ColumnInclusion", ">", "includes", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", "+", "sheetId", "+", "\"/columns/\"", "+",...
Gets the Column specified in the URL. It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/columns/{columnId} Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found 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 sheetId the sheet id @param columnId the column id @param includes list of includes @return the column (note that empty list will be returned if there is none) @throws SmartsheetException the smartsheet exception
[ "Gets", "the", "Column", "specified", "in", "the", "URL", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java#L176-L184
135,070
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/models/AbstractSheet.java
AbstractSheet.getColumnByIndex
public TColumn getColumnByIndex(int index) { if (columns == null) { return null; } TColumn result = null; for (TColumn column : columns) { if (column.getIndex() == index) { result = column; break; } } return result; }
java
public TColumn getColumnByIndex(int index) { if (columns == null) { return null; } TColumn result = null; for (TColumn column : columns) { if (column.getIndex() == index) { result = column; break; } } return result; }
[ "public", "TColumn", "getColumnByIndex", "(", "int", "index", ")", "{", "if", "(", "columns", "==", "null", ")", "{", "return", "null", ";", "}", "TColumn", "result", "=", "null", ";", "for", "(", "TColumn", "column", ":", "columns", ")", "{", "if", ...
Get a column by index. @param index the column index @return the column by index
[ "Get", "a", "column", "by", "index", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/models/AbstractSheet.java#L238-L251
135,071
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/models/AbstractSheet.java
AbstractSheet.setColumns
public AbstractSheet<TRow, TColumn, TCell> setColumns(List<TColumn> columns) { this.columns = columns; return this; }
java
public AbstractSheet<TRow, TColumn, TCell> setColumns(List<TColumn> columns) { this.columns = columns; return this; }
[ "public", "AbstractSheet", "<", "TRow", ",", "TColumn", ",", "TCell", ">", "setColumns", "(", "List", "<", "TColumn", ">", "columns", ")", "{", "this", ".", "columns", "=", "columns", ";", "return", "this", ";", "}" ]
Sets the columns for the sheet. @param columns the new columns
[ "Sets", "the", "columns", "for", "the", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/models/AbstractSheet.java#L309-L312
135,072
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/models/AbstractSheet.java
AbstractSheet.setRows
public AbstractSheet<TRow, TColumn, TCell> setRows(List<TRow> rows) { this.rows = rows; return this; }
java
public AbstractSheet<TRow, TColumn, TCell> setRows(List<TRow> rows) { this.rows = rows; return this; }
[ "public", "AbstractSheet", "<", "TRow", ",", "TColumn", ",", "TCell", ">", "setRows", "(", "List", "<", "TRow", ">", "rows", ")", "{", "this", ".", "rows", "=", "rows", ";", "return", "this", ";", "}" ]
Sets the rows for the sheet. @param rows the new rows
[ "Sets", "the", "rows", "for", "the", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/models/AbstractSheet.java#L328-L331
135,073
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/models/AbstractSheet.java
AbstractSheet.setDiscussions
public AbstractSheet<TRow, TColumn, TCell> setDiscussions(List<Discussion> discussions) { this.discussions = discussions; return this; }
java
public AbstractSheet<TRow, TColumn, TCell> setDiscussions(List<Discussion> discussions) { this.discussions = discussions; return this; }
[ "public", "AbstractSheet", "<", "TRow", ",", "TColumn", ",", "TCell", ">", "setDiscussions", "(", "List", "<", "Discussion", ">", "discussions", ")", "{", "this", ".", "discussions", "=", "discussions", ";", "return", "this", ";", "}" ]
Sets the discussions for the sheet. @param discussions the new discussions
[ "Sets", "the", "discussions", "for", "the", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/models/AbstractSheet.java#L366-L369
135,074
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/models/AbstractSheet.java
AbstractSheet.setAttachments
public AbstractSheet<TRow, TColumn, TCell> setAttachments(List<Attachment> attachments) { this.attachments = attachments; return this; }
java
public AbstractSheet<TRow, TColumn, TCell> setAttachments(List<Attachment> attachments) { this.attachments = attachments; return this; }
[ "public", "AbstractSheet", "<", "TRow", ",", "TColumn", ",", "TCell", ">", "setAttachments", "(", "List", "<", "Attachment", ">", "attachments", ")", "{", "this", ".", "attachments", "=", "attachments", ";", "return", "this", ";", "}" ]
Sets the attachments for the sheet. @param attachments the new attachments
[ "Sets", "the", "attachments", "for", "the", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/models/AbstractSheet.java#L385-L388
135,075
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/models/AbstractSheet.java
AbstractSheet.setEffectiveAttachmentOptions
public AbstractSheet<TRow, TColumn, TCell> setEffectiveAttachmentOptions(EnumSet<AttachmentType> effectiveAttachmentOptions) { this.effectiveAttachmentOptions = effectiveAttachmentOptions; return this; }
java
public AbstractSheet<TRow, TColumn, TCell> setEffectiveAttachmentOptions(EnumSet<AttachmentType> effectiveAttachmentOptions) { this.effectiveAttachmentOptions = effectiveAttachmentOptions; return this; }
[ "public", "AbstractSheet", "<", "TRow", ",", "TColumn", ",", "TCell", ">", "setEffectiveAttachmentOptions", "(", "EnumSet", "<", "AttachmentType", ">", "effectiveAttachmentOptions", ")", "{", "this", ".", "effectiveAttachmentOptions", "=", "effectiveAttachmentOptions", ...
Sets the effective attachment options. @param effectiveAttachmentOptions the effective attachment options
[ "Sets", "the", "effective", "attachment", "options", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/models/AbstractSheet.java#L571-L574
135,076
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/models/AbstractSheet.java
AbstractSheet.setFilters
public AbstractSheet<TRow, TColumn, TCell> setFilters(List<SheetFilter> filters) { this.filters = filters; return this; }
java
public AbstractSheet<TRow, TColumn, TCell> setFilters(List<SheetFilter> filters) { this.filters = filters; return this; }
[ "public", "AbstractSheet", "<", "TRow", ",", "TColumn", ",", "TCell", ">", "setFilters", "(", "List", "<", "SheetFilter", ">", "filters", ")", "{", "this", ".", "filters", "=", "filters", ";", "return", "this", ";", "}" ]
Sets the list of sheet filters for this sheet. @param filters the list of SheetFilters
[ "Sets", "the", "list", "of", "sheet", "filters", "for", "this", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/models/AbstractSheet.java#L626-L629
135,077
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/models/AbstractSheet.java
AbstractSheet.setCrossSheetReferences
public AbstractSheet<TRow, TColumn, TCell> setCrossSheetReferences(List<CrossSheetReference> crossSheetReferences) { this.crossSheetReferences = crossSheetReferences; return this; }
java
public AbstractSheet<TRow, TColumn, TCell> setCrossSheetReferences(List<CrossSheetReference> crossSheetReferences) { this.crossSheetReferences = crossSheetReferences; return this; }
[ "public", "AbstractSheet", "<", "TRow", ",", "TColumn", ",", "TCell", ">", "setCrossSheetReferences", "(", "List", "<", "CrossSheetReference", ">", "crossSheetReferences", ")", "{", "this", ".", "crossSheetReferences", "=", "crossSheetReferences", ";", "return", "th...
Sets the list of cross sheet references used by this sheet @param crossSheetReferences the cross sheet references
[ "Sets", "the", "list", "of", "cross", "sheet", "references", "used", "by", "this", "sheet" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/models/AbstractSheet.java#L700-L703
135,078
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java
DefaultHttpClient.createApacheRequest
public HttpRequestBase createApacheRequest(HttpRequest smartsheetRequest) { HttpRequestBase apacheHttpRequest; // Create Apache HTTP request based on the smartsheetRequest request type switch (smartsheetRequest.getMethod()) { case GET: apacheHttpRequest = new HttpGet(smartsheetRequest.getUri()); break; case POST: apacheHttpRequest = new HttpPost(smartsheetRequest.getUri()); break; case PUT: apacheHttpRequest = new HttpPut(smartsheetRequest.getUri()); break; case DELETE: apacheHttpRequest = new HttpDelete(smartsheetRequest.getUri()); break; default: throw new UnsupportedOperationException("Request method " + smartsheetRequest.getMethod() + " is not supported!"); } RequestConfig.Builder builder = RequestConfig.custom(); if (apacheHttpRequest.getConfig() != null) { builder = RequestConfig.copy(apacheHttpRequest.getConfig()); } builder.setRedirectsEnabled(true); RequestConfig config = builder.build(); apacheHttpRequest.setConfig(config); return apacheHttpRequest; }
java
public HttpRequestBase createApacheRequest(HttpRequest smartsheetRequest) { HttpRequestBase apacheHttpRequest; // Create Apache HTTP request based on the smartsheetRequest request type switch (smartsheetRequest.getMethod()) { case GET: apacheHttpRequest = new HttpGet(smartsheetRequest.getUri()); break; case POST: apacheHttpRequest = new HttpPost(smartsheetRequest.getUri()); break; case PUT: apacheHttpRequest = new HttpPut(smartsheetRequest.getUri()); break; case DELETE: apacheHttpRequest = new HttpDelete(smartsheetRequest.getUri()); break; default: throw new UnsupportedOperationException("Request method " + smartsheetRequest.getMethod() + " is not supported!"); } RequestConfig.Builder builder = RequestConfig.custom(); if (apacheHttpRequest.getConfig() != null) { builder = RequestConfig.copy(apacheHttpRequest.getConfig()); } builder.setRedirectsEnabled(true); RequestConfig config = builder.build(); apacheHttpRequest.setConfig(config); return apacheHttpRequest; }
[ "public", "HttpRequestBase", "createApacheRequest", "(", "HttpRequest", "smartsheetRequest", ")", "{", "HttpRequestBase", "apacheHttpRequest", ";", "// Create Apache HTTP request based on the smartsheetRequest request type", "switch", "(", "smartsheetRequest", ".", "getMethod", "("...
Create the Apache HTTP request. Override this function to inject additional haaders in the request or use a proxy. @param smartsheetRequest (request method and base URI come from here) @return the Apache HTTP request
[ "Create", "the", "Apache", "HTTP", "request", ".", "Override", "this", "function", "to", "inject", "additional", "haaders", "in", "the", "request", "or", "use", "a", "proxy", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java#L369-L399
135,079
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java
DefaultHttpClient.calcBackoff
public long calcBackoff(int previousAttempts, long totalElapsedTimeMillis, Error error) { long backoffMillis = (long)(Math.pow(2, previousAttempts) * 1000) + new Random().nextInt(1000); if(totalElapsedTimeMillis + backoffMillis > maxRetryTimeMillis) { logger.info("Elapsed time " + totalElapsedTimeMillis + " + backoff time " + backoffMillis + " exceeds max retry time " + maxRetryTimeMillis + ", exiting retry loop"); return -1; } return backoffMillis; }
java
public long calcBackoff(int previousAttempts, long totalElapsedTimeMillis, Error error) { long backoffMillis = (long)(Math.pow(2, previousAttempts) * 1000) + new Random().nextInt(1000); if(totalElapsedTimeMillis + backoffMillis > maxRetryTimeMillis) { logger.info("Elapsed time " + totalElapsedTimeMillis + " + backoff time " + backoffMillis + " exceeds max retry time " + maxRetryTimeMillis + ", exiting retry loop"); return -1; } return backoffMillis; }
[ "public", "long", "calcBackoff", "(", "int", "previousAttempts", ",", "long", "totalElapsedTimeMillis", ",", "Error", "error", ")", "{", "long", "backoffMillis", "=", "(", "long", ")", "(", "Math", ".", "pow", "(", "2", ",", "previousAttempts", ")", "*", "...
The backoff calculation routine. Uses exponential backoff. If the maximum elapsed time has expired, this calculation returns -1 causing the caller to fall out of the retry loop. @param previousAttempts @param totalElapsedTimeMillis @param error @return -1 to fall out of retry loop, positive number indicates backoff time
[ "The", "backoff", "calculation", "routine", ".", "Uses", "exponential", "backoff", ".", "If", "the", "maximum", "elapsed", "time", "has", "expired", "this", "calculation", "returns", "-", "1", "causing", "the", "caller", "to", "fall", "out", "of", "the", "re...
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java#L419-L429
135,080
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java
DefaultHttpClient.shouldRetry
public boolean shouldRetry(int previousAttempts, long totalElapsedTimeMillis, HttpResponse response) { String contentType = response.getEntity().getContentType(); if (contentType != null && !contentType.startsWith(JSON_MIME_TYPE)) { // it's not JSON; don't even try to parse it return false; } Error error; try { error = jsonSerializer.deserialize(Error.class, response.getEntity().getContent()); } catch (IOException e) { return false; } switch(error.getErrorCode()) { case 4001: /** Smartsheet.com is currently offline for system maintenance. Please check back again shortly. */ case 4002: /** Server timeout exceeded. Request has failed */ case 4003: /** Rate limit exceeded. */ case 4004: /** An unexpected error has occurred. Please retry your request. * If you encounter this error repeatedly, please contact api@smartsheet.com for assistance. */ break; default: return false; } long backoffMillis = calcBackoff(previousAttempts, totalElapsedTimeMillis, error); if(backoffMillis < 0) return false; logger.info("HttpError StatusCode=" + response.getStatusCode() + ": Retrying in " + backoffMillis + " milliseconds"); try { Thread.sleep(backoffMillis); } catch (InterruptedException e) { logger.warn("sleep interrupted", e); return false; } return true; }
java
public boolean shouldRetry(int previousAttempts, long totalElapsedTimeMillis, HttpResponse response) { String contentType = response.getEntity().getContentType(); if (contentType != null && !contentType.startsWith(JSON_MIME_TYPE)) { // it's not JSON; don't even try to parse it return false; } Error error; try { error = jsonSerializer.deserialize(Error.class, response.getEntity().getContent()); } catch (IOException e) { return false; } switch(error.getErrorCode()) { case 4001: /** Smartsheet.com is currently offline for system maintenance. Please check back again shortly. */ case 4002: /** Server timeout exceeded. Request has failed */ case 4003: /** Rate limit exceeded. */ case 4004: /** An unexpected error has occurred. Please retry your request. * If you encounter this error repeatedly, please contact api@smartsheet.com for assistance. */ break; default: return false; } long backoffMillis = calcBackoff(previousAttempts, totalElapsedTimeMillis, error); if(backoffMillis < 0) return false; logger.info("HttpError StatusCode=" + response.getStatusCode() + ": Retrying in " + backoffMillis + " milliseconds"); try { Thread.sleep(backoffMillis); } catch (InterruptedException e) { logger.warn("sleep interrupted", e); return false; } return true; }
[ "public", "boolean", "shouldRetry", "(", "int", "previousAttempts", ",", "long", "totalElapsedTimeMillis", ",", "HttpResponse", "response", ")", "{", "String", "contentType", "=", "response", ".", "getEntity", "(", ")", ".", "getContentType", "(", ")", ";", "if"...
Called when an API request fails to determine if it can retry the request. Calls calcBackoff to determine the time to wait in between retries. @param previousAttempts number of attempts (including this one) to execute request @param totalElapsedTimeMillis total time spent in millis for all previous (and this) attempt @param response the failed HttpResponse @return true if this request can be retried
[ "Called", "when", "an", "API", "request", "fails", "to", "determine", "if", "it", "can", "retry", "the", "request", ".", "Calls", "calcBackoff", "to", "determine", "the", "time", "to", "wait", "in", "between", "retries", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java#L440-L477
135,081
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java
DefaultHttpClient.setTraces
public void setTraces(Trace... traces) { this.traces.clear(); for (Trace trace : traces) { if (!trace.addReplacements(this.traces)) { this.traces.add(trace); } } }
java
public void setTraces(Trace... traces) { this.traces.clear(); for (Trace trace : traces) { if (!trace.addReplacements(this.traces)) { this.traces.add(trace); } } }
[ "public", "void", "setTraces", "(", "Trace", "...", "traces", ")", "{", "this", ".", "traces", ".", "clear", "(", ")", ";", "for", "(", "Trace", "trace", ":", "traces", ")", "{", "if", "(", "!", "trace", ".", "addReplacements", "(", "this", ".", "t...
set the traces for this client @param traces the fields to include in trace-logging
[ "set", "the", "traces", "for", "this", "client" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java#L508-L515
135,082
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/RowAttachmentResourcesImpl.java
RowAttachmentResourcesImpl.getAttachments
public PagedResult<Attachment> getAttachments(long sheetId, long rowId, PaginationParameters parameters) throws SmartsheetException { String path= "sheets/" + sheetId + "/rows/" + rowId + "/attachments"; if (parameters != null) { path += parameters.toQueryString(); } return this.listResourcesWithWrapper(path, Attachment.class); }
java
public PagedResult<Attachment> getAttachments(long sheetId, long rowId, PaginationParameters parameters) throws SmartsheetException { String path= "sheets/" + sheetId + "/rows/" + rowId + "/attachments"; if (parameters != null) { path += parameters.toQueryString(); } return this.listResourcesWithWrapper(path, Attachment.class); }
[ "public", "PagedResult", "<", "Attachment", ">", "getAttachments", "(", "long", "sheetId", ",", "long", "rowId", ",", "PaginationParameters", "parameters", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", "+", "sheetId", "+", "\"/ro...
Get row attachment. It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/rows/{rowId}/attachments Returns: the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found 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 sheetId the sheet id @param rowId the row id @param parameters the pagination parameters @return the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Get", "row", "attachment", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/RowAttachmentResourcesImpl.java#L88-L94
135,083
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/RowAttachmentResourcesImpl.java
RowAttachmentResourcesImpl.attachFile
public Attachment attachFile(long sheetId, long rowId, InputStream inputStream, String contentType, long contentLength, String attachmentName) throws SmartsheetException { Util.throwIfNull(inputStream, contentType); return super.attachFile("sheets/" + sheetId + "/rows/" + rowId + "/attachments", inputStream, contentType, contentLength, attachmentName); }
java
public Attachment attachFile(long sheetId, long rowId, InputStream inputStream, String contentType, long contentLength, String attachmentName) throws SmartsheetException { Util.throwIfNull(inputStream, contentType); return super.attachFile("sheets/" + sheetId + "/rows/" + rowId + "/attachments", inputStream, contentType, contentLength, attachmentName); }
[ "public", "Attachment", "attachFile", "(", "long", "sheetId", ",", "long", "rowId", ",", "InputStream", "inputStream", ",", "String", "contentType", ",", "long", "contentLength", ",", "String", "attachmentName", ")", "throws", "SmartsheetException", "{", "Util", "...
Attach file for simple upload. @param sheetId the sheet id @param rowId the row id @param contentType the content type @param contentLength the content length @param attachmentName the name of the attachment @return the attachment @throws FileNotFoundException the file not found exception @throws SmartsheetException the smartsheet exception @throws UnsupportedEncodingException the unsupported encoding exception
[ "Attach", "file", "for", "simple", "upload", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/RowAttachmentResourcesImpl.java#L135-L139
135,084
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetDiscussionResourcesImpl.java
SheetDiscussionResourcesImpl.createDiscussion
public Discussion createDiscussion(long sheetId, Discussion discussion) throws SmartsheetException{ Util.throwIfNull(sheetId, discussion); return this.createResource("sheets/" + sheetId + "/discussions", Discussion.class, discussion); }
java
public Discussion createDiscussion(long sheetId, Discussion discussion) throws SmartsheetException{ Util.throwIfNull(sheetId, discussion); return this.createResource("sheets/" + sheetId + "/discussions", Discussion.class, discussion); }
[ "public", "Discussion", "createDiscussion", "(", "long", "sheetId", ",", "Discussion", "discussion", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "sheetId", ",", "discussion", ")", ";", "return", "this", ".", "createResource", "(", ...
Create a discussion on a sheet. It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/discussions @param sheetId the sheet id @param discussion the discussion object @return the created discussion @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
[ "Create", "a", "discussion", "on", "a", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetDiscussionResourcesImpl.java#L71-L75
135,085
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetDiscussionResourcesImpl.java
SheetDiscussionResourcesImpl.createDiscussionWithAttachment
public Discussion createDiscussionWithAttachment(long sheetId, Discussion discussion, File file, String contentType) throws SmartsheetException, IOException{ Util.throwIfNull(discussion, file, contentType); String path = "sheets/" + sheetId + "/discussions"; return this.createDiscussionWithAttachment(path, discussion, new FileInputStream(file), contentType, file.getName()); }
java
public Discussion createDiscussionWithAttachment(long sheetId, Discussion discussion, File file, String contentType) throws SmartsheetException, IOException{ Util.throwIfNull(discussion, file, contentType); String path = "sheets/" + sheetId + "/discussions"; return this.createDiscussionWithAttachment(path, discussion, new FileInputStream(file), contentType, file.getName()); }
[ "public", "Discussion", "createDiscussionWithAttachment", "(", "long", "sheetId", ",", "Discussion", "discussion", ",", "File", "file", ",", "String", "contentType", ")", "throws", "SmartsheetException", ",", "IOException", "{", "Util", ".", "throwIfNull", "(", "dis...
Create a discussion with attachments on a sheet. It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/discussions @param sheetId the sheet id @param discussion the discussion object @param file the file to attach @param contentType the type of file @return the created discussion @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 @throws IOException is there is with file
[ "Create", "a", "discussion", "with", "attachments", "on", "a", "sheet", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetDiscussionResourcesImpl.java#L95-L100
135,086
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/http/RequestAndResponseData.java
RequestAndResponseData.of
public static RequestAndResponseData of(HttpRequestBase request, HttpEntitySnapshot requestEntity, HttpResponse response, HttpEntitySnapshot responseEntity, Set<Trace> traces) throws IOException { RequestData.Builder requestBuilder = new RequestData.Builder(); ResponseData.Builder responseBuilder = new ResponseData.Builder(); if (request != null) { requestBuilder.withCommand(request.getMethod() + " " + request.getURI()); boolean binaryBody = false; if (traces.contains(Trace.RequestHeaders) && request.getAllHeaders() != null) { requestBuilder.withHeaders(); for (Header header : request.getAllHeaders()) { String headerName = header.getName(); String headerValue = header.getValue(); if ("Authorization".equals(headerName) && headerValue.length() > 0) { headerValue = "Bearer ****" + headerValue.substring(Math.max(0, headerValue.length() - 4)); } else if ("Content-Disposition".equals(headerName)) { binaryBody = true; } requestBuilder.addHeader(headerName, headerValue); } } if (requestEntity != null) { if (traces.contains(Trace.RequestBody)) { requestBuilder.setBody(binaryBody ? binaryBody(requestEntity) : getContentAsText(requestEntity)); } else if (traces.contains(Trace.RequestBodySummary)) { requestBuilder.setBody(binaryBody ? binaryBody(requestEntity) : truncateAsNeeded(getContentAsText(requestEntity), TRUNCATE_LENGTH)); } } } if (response != null) { boolean binaryBody = false; responseBuilder.withStatus(response.getStatusText()); if (traces.contains(Trace.ResponseHeaders) && response.getHeaders() != null) { responseBuilder.withHeaders(); for (Map.Entry<String, String> header : response.getHeaders().entrySet()) { String headerName = header.getKey(); String headerValue = header.getValue(); if ("Content-Disposition".equals(headerName)) { binaryBody = true; } responseBuilder.addHeader(headerName, headerValue); } } if (responseEntity != null) { if (traces.contains(Trace.ResponseBody)) { responseBuilder.setBody(binaryBody ? binaryBody(responseEntity) : getContentAsText(responseEntity)); } else if (traces.contains(Trace.ResponseBodySummary)) { responseBuilder.setBody(binaryBody ? binaryBody(responseEntity) : truncateAsNeeded(getContentAsText(responseEntity), TRUNCATE_LENGTH)); } } } return new RequestAndResponseData(requestBuilder.build(), responseBuilder.build()); }
java
public static RequestAndResponseData of(HttpRequestBase request, HttpEntitySnapshot requestEntity, HttpResponse response, HttpEntitySnapshot responseEntity, Set<Trace> traces) throws IOException { RequestData.Builder requestBuilder = new RequestData.Builder(); ResponseData.Builder responseBuilder = new ResponseData.Builder(); if (request != null) { requestBuilder.withCommand(request.getMethod() + " " + request.getURI()); boolean binaryBody = false; if (traces.contains(Trace.RequestHeaders) && request.getAllHeaders() != null) { requestBuilder.withHeaders(); for (Header header : request.getAllHeaders()) { String headerName = header.getName(); String headerValue = header.getValue(); if ("Authorization".equals(headerName) && headerValue.length() > 0) { headerValue = "Bearer ****" + headerValue.substring(Math.max(0, headerValue.length() - 4)); } else if ("Content-Disposition".equals(headerName)) { binaryBody = true; } requestBuilder.addHeader(headerName, headerValue); } } if (requestEntity != null) { if (traces.contains(Trace.RequestBody)) { requestBuilder.setBody(binaryBody ? binaryBody(requestEntity) : getContentAsText(requestEntity)); } else if (traces.contains(Trace.RequestBodySummary)) { requestBuilder.setBody(binaryBody ? binaryBody(requestEntity) : truncateAsNeeded(getContentAsText(requestEntity), TRUNCATE_LENGTH)); } } } if (response != null) { boolean binaryBody = false; responseBuilder.withStatus(response.getStatusText()); if (traces.contains(Trace.ResponseHeaders) && response.getHeaders() != null) { responseBuilder.withHeaders(); for (Map.Entry<String, String> header : response.getHeaders().entrySet()) { String headerName = header.getKey(); String headerValue = header.getValue(); if ("Content-Disposition".equals(headerName)) { binaryBody = true; } responseBuilder.addHeader(headerName, headerValue); } } if (responseEntity != null) { if (traces.contains(Trace.ResponseBody)) { responseBuilder.setBody(binaryBody ? binaryBody(responseEntity) : getContentAsText(responseEntity)); } else if (traces.contains(Trace.ResponseBodySummary)) { responseBuilder.setBody(binaryBody ? binaryBody(responseEntity) : truncateAsNeeded(getContentAsText(responseEntity), TRUNCATE_LENGTH)); } } } return new RequestAndResponseData(requestBuilder.build(), responseBuilder.build()); }
[ "public", "static", "RequestAndResponseData", "of", "(", "HttpRequestBase", "request", ",", "HttpEntitySnapshot", "requestEntity", ",", "HttpResponse", "response", ",", "HttpEntitySnapshot", "responseEntity", ",", "Set", "<", "Trace", ">", "traces", ")", "throws", "IO...
factory method for creating a RequestAndResponseData object from request and response data with the specifid trace fields
[ "factory", "method", "for", "creating", "a", "RequestAndResponseData", "object", "from", "request", "and", "response", "data", "with", "the", "specifid", "trace", "fields" ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/http/RequestAndResponseData.java#L250-L304
135,087
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AbstractResources.java
AbstractResources.getResource
protected <T> T getResource(String path, Class<T> objectClass) throws SmartsheetException { Util.throwIfNull(path, objectClass); if(path.isEmpty()) { com.smartsheet.api.models.Error error = new com.smartsheet.api.models.Error(); error.setMessage("An empty path was provided."); throw new ResourceNotFoundException(error); } HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.GET); T obj = null; String content = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); InputStream inputStream = response.getEntity().getContent(); switch (response.getStatusCode()) { case 200: try { if (log.isInfoEnabled()) { ByteArrayOutputStream contentCopyStream = new ByteArrayOutputStream(); inputStream = StreamUtil.cloneContent(inputStream, response.getEntity().getContentLength(), contentCopyStream); content = StreamUtil.toUtf8StringOrHex(contentCopyStream, getResponseLogLength()); } obj = this.smartsheet.getJsonSerializer().deserialize(objectClass, inputStream); } catch (JsonParseException e) { log.info("failure parsing '{}'", content, e); throw new SmartsheetException(e); } catch (JsonMappingException e) { log.info("failure mapping '{}'", content, e); throw new SmartsheetException(e); } catch (IOException e) { log.info("failure loading '{}'", content, e); throw new SmartsheetException(e); } break; default: handleError(response); } } catch (JSONSerializerException jsx) { log.info("failed to parse '{}'", content, jsx); throw jsx; } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
java
protected <T> T getResource(String path, Class<T> objectClass) throws SmartsheetException { Util.throwIfNull(path, objectClass); if(path.isEmpty()) { com.smartsheet.api.models.Error error = new com.smartsheet.api.models.Error(); error.setMessage("An empty path was provided."); throw new ResourceNotFoundException(error); } HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.GET); T obj = null; String content = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); InputStream inputStream = response.getEntity().getContent(); switch (response.getStatusCode()) { case 200: try { if (log.isInfoEnabled()) { ByteArrayOutputStream contentCopyStream = new ByteArrayOutputStream(); inputStream = StreamUtil.cloneContent(inputStream, response.getEntity().getContentLength(), contentCopyStream); content = StreamUtil.toUtf8StringOrHex(contentCopyStream, getResponseLogLength()); } obj = this.smartsheet.getJsonSerializer().deserialize(objectClass, inputStream); } catch (JsonParseException e) { log.info("failure parsing '{}'", content, e); throw new SmartsheetException(e); } catch (JsonMappingException e) { log.info("failure mapping '{}'", content, e); throw new SmartsheetException(e); } catch (IOException e) { log.info("failure loading '{}'", content, e); throw new SmartsheetException(e); } break; default: handleError(response); } } catch (JSONSerializerException jsx) { log.info("failed to parse '{}'", content, jsx); throw jsx; } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
[ "protected", "<", "T", ">", "T", "getResource", "(", "String", "path", ",", "Class", "<", "T", ">", "objectClass", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "path", ",", "objectClass", ")", ";", "if", "(", "path", ".", ...
Get a resource from Smartsheet REST API. Parameters: - path : the relative path of the resource - objectClass : the resource object class Returns: the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). Exceptions: - InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found 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 <T> the generic type @param path the relative path of the resource. @param objectClass the object class @return the resource @throws SmartsheetException the smartsheet exception
[ "Get", "a", "resource", "from", "Smartsheet", "REST", "API", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L205-L251
135,088
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AbstractResources.java
AbstractResources.listResources
protected <T> List<T> listResources(String path, Class<T> objectClass) throws SmartsheetException { Util.throwIfNull(path, objectClass); Util.throwIfEmpty(path); HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.GET); List<T> obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeList(objectClass, response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
java
protected <T> List<T> listResources(String path, Class<T> objectClass) throws SmartsheetException { Util.throwIfNull(path, objectClass); Util.throwIfEmpty(path); HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.GET); List<T> obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeList(objectClass, response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
[ "protected", "<", "T", ">", "List", "<", "T", ">", "listResources", "(", "String", "path", ",", "Class", "<", "T", ">", "objectClass", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "path", ",", "objectClass", ")", ";", "Util...
List resources using Smartsheet REST API. Exceptions: IllegalArgumentException : if any argument is null, or path is empty string 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 <T> the generic type @param path the relative path of the resource collections @param objectClass the resource object class @return the resources @throws SmartsheetException if an error occurred during the operation
[ "List", "resources", "using", "Smartsheet", "REST", "API", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L444-L468
135,089
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AbstractResources.java
AbstractResources.deleteResource
protected <T> void deleteResource(String path, Class<T> objectClass) throws SmartsheetException { Util.throwIfNull(path, objectClass); Util.throwIfEmpty(path); HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.DELETE); try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: this.smartsheet.getJsonSerializer().deserializeResult(objectClass, response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } }
java
protected <T> void deleteResource(String path, Class<T> objectClass) throws SmartsheetException { Util.throwIfNull(path, objectClass); Util.throwIfEmpty(path); HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.DELETE); try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: this.smartsheet.getJsonSerializer().deserializeResult(objectClass, response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } }
[ "protected", "<", "T", ">", "void", "deleteResource", "(", "String", "path", ",", "Class", "<", "T", ">", "objectClass", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "path", ",", "objectClass", ")", ";", "Util", ".", "throwIf...
Delete a resource from Smartsheet REST API. Exceptions: IllegalArgumentException : if any argument is null, or path is empty string InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found 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 <T> the generic type @param path the relative path of the resource @param objectClass the resource object class @throws SmartsheetException the smartsheet exception
[ "Delete", "a", "resource", "from", "Smartsheet", "REST", "API", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L529-L549
135,090
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AbstractResources.java
AbstractResources.deleteListResources
protected <T> List<T> deleteListResources(String path, Class<T> objectClass) throws SmartsheetException { Util.throwIfNull(path, objectClass); Util.throwIfEmpty(path); Result<List<T>> obj = null; HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.DELETE); try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeListResult(objectClass, response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj.getResult(); }
java
protected <T> List<T> deleteListResources(String path, Class<T> objectClass) throws SmartsheetException { Util.throwIfNull(path, objectClass); Util.throwIfEmpty(path); Result<List<T>> obj = null; HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.DELETE); try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeListResult(objectClass, response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj.getResult(); }
[ "protected", "<", "T", ">", "List", "<", "T", ">", "deleteListResources", "(", "String", "path", ",", "Class", "<", "T", ">", "objectClass", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "path", ",", "objectClass", ")", ";", ...
Delete resources and return a list from Smartsheet REST API. Exceptions: IllegalArgumentException : if any argument is null, or path is empty string InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found 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 <T> the generic type @param path the relative path of the resource @param objectClass the resource object class @return List of ids deleted @throws SmartsheetException the smartsheet exception
[ "Delete", "resources", "and", "return", "a", "list", "from", "Smartsheet", "REST", "API", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L569-L590
135,091
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AbstractResources.java
AbstractResources.postAndReceiveList
protected <T, S> List<S> postAndReceiveList(String path, T objectToPost, Class<S> objectClassToReceive) throws SmartsheetException { Util.throwIfNull(path, objectToPost, objectClassToReceive); Util.throwIfEmpty(path); HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.POST); ByteArrayOutputStream objectBytesStream = new ByteArrayOutputStream(); this.smartsheet.getJsonSerializer().serialize(objectToPost, objectBytesStream); HttpEntity entity = new HttpEntity(); entity.setContentType("application/json"); entity.setContent(new ByteArrayInputStream(objectBytesStream.toByteArray())); entity.setContentLength(objectBytesStream.size()); request.setEntity(entity); List<S> obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeListResult(objectClassToReceive, response.getEntity().getContent()).getResult(); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
java
protected <T, S> List<S> postAndReceiveList(String path, T objectToPost, Class<S> objectClassToReceive) throws SmartsheetException { Util.throwIfNull(path, objectToPost, objectClassToReceive); Util.throwIfEmpty(path); HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.POST); ByteArrayOutputStream objectBytesStream = new ByteArrayOutputStream(); this.smartsheet.getJsonSerializer().serialize(objectToPost, objectBytesStream); HttpEntity entity = new HttpEntity(); entity.setContentType("application/json"); entity.setContent(new ByteArrayInputStream(objectBytesStream.toByteArray())); entity.setContentLength(objectBytesStream.size()); request.setEntity(entity); List<S> obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeListResult(objectClassToReceive, response.getEntity().getContent()).getResult(); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
[ "protected", "<", "T", ",", "S", ">", "List", "<", "S", ">", "postAndReceiveList", "(", "String", "path", ",", "T", "objectToPost", ",", "Class", "<", "S", ">", "objectClassToReceive", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", ...
Post an object to Smartsheet REST API and receive a list of objects from response. Parameters: - path : the relative path of the resource collections - objectToPost : the object to post - objectClassToReceive : the resource object class to receive Returns: the object list Exceptions: IllegalArgumentException : if any argument is null, or path is empty string 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 <T> the generic type @param <S> the generic type @param path the path @param objectToPost the object to post @param objectClassToReceive the object class to receive @return the list @throws SmartsheetException the smartsheet exception
[ "Post", "an", "object", "to", "Smartsheet", "REST", "API", "and", "receive", "a", "list", "of", "objects", "from", "response", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L616-L647
135,092
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AbstractResources.java
AbstractResources.postAndReceiveRowObject
protected CopyOrMoveRowResult postAndReceiveRowObject(String path, CopyOrMoveRowDirective objectToPost) throws SmartsheetException { Util.throwIfNull(path, objectToPost); Util.throwIfEmpty(path); HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.POST); ByteArrayOutputStream objectBytesStream = new ByteArrayOutputStream(); this.smartsheet.getJsonSerializer().serialize(objectToPost, objectBytesStream); HttpEntity entity = new HttpEntity(); entity.setContentType("application/json"); entity.setContent(new ByteArrayInputStream(objectBytesStream.toByteArray())); entity.setContentLength(objectBytesStream.size()); request.setEntity(entity); CopyOrMoveRowResult obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeCopyOrMoveRow( response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
java
protected CopyOrMoveRowResult postAndReceiveRowObject(String path, CopyOrMoveRowDirective objectToPost) throws SmartsheetException { Util.throwIfNull(path, objectToPost); Util.throwIfEmpty(path); HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.POST); ByteArrayOutputStream objectBytesStream = new ByteArrayOutputStream(); this.smartsheet.getJsonSerializer().serialize(objectToPost, objectBytesStream); HttpEntity entity = new HttpEntity(); entity.setContentType("application/json"); entity.setContent(new ByteArrayInputStream(objectBytesStream.toByteArray())); entity.setContentLength(objectBytesStream.size()); request.setEntity(entity); CopyOrMoveRowResult obj = null; try { HttpResponse response = this.smartsheet.getHttpClient().request(request); switch (response.getStatusCode()) { case 200: obj = this.smartsheet.getJsonSerializer().deserializeCopyOrMoveRow( response.getEntity().getContent()); break; default: handleError(response); } } finally { smartsheet.getHttpClient().releaseConnection(); } return obj; }
[ "protected", "CopyOrMoveRowResult", "postAndReceiveRowObject", "(", "String", "path", ",", "CopyOrMoveRowDirective", "objectToPost", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "path", ",", "objectToPost", ")", ";", "Util", ".", "throwI...
Post an object to Smartsheet REST API and receive a CopyOrMoveRowResult object from response. Parameters: - path : the relative path of the resource collections - objectToPost : the object to post - Returns: the object Exceptions: IllegalArgumentException : if any argument is null, or path is empty string 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 path the path @param objectToPost the object to post @return the result object @throws SmartsheetException the smartsheet exception
[ "Post", "an", "object", "to", "Smartsheet", "REST", "API", "and", "receive", "a", "CopyOrMoveRowResult", "object", "from", "response", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L669-L700
135,093
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AbstractResources.java
AbstractResources.attachFile
public <T> Attachment attachFile(String url, T t, String partName, InputStream inputstream, String contentType, String attachmentName) throws SmartsheetException { Util.throwIfNull(inputstream, contentType); Attachment attachment = null; final String boundary = "----" + System.currentTimeMillis() ; CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost uploadFile = createHttpPost(this.getSmartsheet().getBaseURI().resolve(url)); try { uploadFile.setHeader("Content-Type", "multipart/form-data; boundary=" + boundary); } catch (Exception e) { throw new RuntimeException(e); } MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setBoundary(boundary); builder.addTextBody(partName, this.getSmartsheet().getJsonSerializer().serialize(t), ContentType.APPLICATION_JSON); builder.addBinaryBody("file", inputstream, ContentType.create(contentType), attachmentName); org.apache.http.HttpEntity multipart = builder.build(); uploadFile.setEntity(multipart); try { CloseableHttpResponse response = httpClient.execute(uploadFile); org.apache.http.HttpEntity responseEntity = response.getEntity(); attachment = this.getSmartsheet().getJsonSerializer().deserializeResult(Attachment.class, responseEntity.getContent()).getResult(); } catch (Exception e) { throw new RuntimeException(e); } return attachment; }
java
public <T> Attachment attachFile(String url, T t, String partName, InputStream inputstream, String contentType, String attachmentName) throws SmartsheetException { Util.throwIfNull(inputstream, contentType); Attachment attachment = null; final String boundary = "----" + System.currentTimeMillis() ; CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost uploadFile = createHttpPost(this.getSmartsheet().getBaseURI().resolve(url)); try { uploadFile.setHeader("Content-Type", "multipart/form-data; boundary=" + boundary); } catch (Exception e) { throw new RuntimeException(e); } MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setBoundary(boundary); builder.addTextBody(partName, this.getSmartsheet().getJsonSerializer().serialize(t), ContentType.APPLICATION_JSON); builder.addBinaryBody("file", inputstream, ContentType.create(contentType), attachmentName); org.apache.http.HttpEntity multipart = builder.build(); uploadFile.setEntity(multipart); try { CloseableHttpResponse response = httpClient.execute(uploadFile); org.apache.http.HttpEntity responseEntity = response.getEntity(); attachment = this.getSmartsheet().getJsonSerializer().deserializeResult(Attachment.class, responseEntity.getContent()).getResult(); } catch (Exception e) { throw new RuntimeException(e); } return attachment; }
[ "public", "<", "T", ">", "Attachment", "attachFile", "(", "String", "url", ",", "T", "t", ",", "String", "partName", ",", "InputStream", "inputstream", ",", "String", "contentType", ",", "String", "attachmentName", ")", "throws", "SmartsheetException", "{", "U...
Create a multipart upload request. @param url the url @param t the object to create @param partName the name of the part @param inputstream the file inputstream @param contentType the type of the file to be attached @return the http request @throws UnsupportedEncodingException the unsupported encoding exception
[ "Create", "a", "multipart", "upload", "request", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L829-L862
135,094
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AbstractResources.java
AbstractResources.copyStream
@Deprecated // replace with StreamUtil.copyContentIntoOutputStream() private static void copyStream(InputStream input, OutputStream output) throws IOException { byte[] buffer = new byte[BUFFER_SIZE]; int len; while ((len = input.read(buffer)) != -1) { output.write(buffer, 0, len); } }
java
@Deprecated // replace with StreamUtil.copyContentIntoOutputStream() private static void copyStream(InputStream input, OutputStream output) throws IOException { byte[] buffer = new byte[BUFFER_SIZE]; int len; while ((len = input.read(buffer)) != -1) { output.write(buffer, 0, len); } }
[ "@", "Deprecated", "// replace with StreamUtil.copyContentIntoOutputStream()", "private", "static", "void", "copyStream", "(", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "["...
Copy stream. @param input the input @param output the output @throws IOException Signals that an I/O exception has occurred.
[ "Copy", "stream", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L972-L979
135,095
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java
ShareResourcesImpl.listShares
public PagedResult<Share> listShares(long objectId, PaginationParameters pagination) throws SmartsheetException { return this.listShares(objectId, pagination, false); }
java
public PagedResult<Share> listShares(long objectId, PaginationParameters pagination) throws SmartsheetException { return this.listShares(objectId, pagination, false); }
[ "public", "PagedResult", "<", "Share", ">", "listShares", "(", "long", "objectId", ",", "PaginationParameters", "pagination", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "listShares", "(", "objectId", ",", "pagination", ",", "false", ")", "...
List shares of a given object. It mirrors to the following Smartsheet REST API method: GET /workspace/{id}/shares GET /sheet/{id}/shares GET /sights/{id}/shares GET /reports/{id}/shares Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found 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 objectId the id of the object to share. @param pagination the pagination parameters @param includeWorkspaceShares include workspace shares in enumeration @return the shares (note that empty list will be returned if there is none) @throws SmartsheetException the smartsheet exception
[ "List", "shares", "of", "a", "given", "object", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java#L75-L77
135,096
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java
ShareResourcesImpl.getShare
public Share getShare(long objectId, String shareId) throws SmartsheetException{ return this.getResource(getMasterResourceType() + "/" + objectId + "/shares/" + shareId, Share.class); }
java
public Share getShare(long objectId, String shareId) throws SmartsheetException{ return this.getResource(getMasterResourceType() + "/" + objectId + "/shares/" + shareId, Share.class); }
[ "public", "Share", "getShare", "(", "long", "objectId", ",", "String", "shareId", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "getResource", "(", "getMasterResourceType", "(", ")", "+", "\"/\"", "+", "objectId", "+", "\"/shares/\"", "+", ...
Get a Share. It mirrors to the following Smartsheet REST API method: GET /workspaces/{workspaceId}/shares/{shareId} GET /sheets/{sheetId}/shares/{shareId} GET /sights/{sightId}/shares GET /reports/{reportId}/shares Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found 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 objectId the ID of the object to share @param shareId the ID of the share @return the share (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Get", "a", "Share", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java#L117-L119
135,097
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java
ShareResourcesImpl.shareTo
public List<Share> shareTo(long objectId, List<Share> shares, Boolean sendEmail) throws SmartsheetException { String path = getMasterResourceType() + "/" + objectId + "/shares"; if (sendEmail != null){ path += "?sendEmail=" + sendEmail; } return this.postAndReceiveList(path, shares, Share.class); }
java
public List<Share> shareTo(long objectId, List<Share> shares, Boolean sendEmail) throws SmartsheetException { String path = getMasterResourceType() + "/" + objectId + "/shares"; if (sendEmail != null){ path += "?sendEmail=" + sendEmail; } return this.postAndReceiveList(path, shares, Share.class); }
[ "public", "List", "<", "Share", ">", "shareTo", "(", "long", "objectId", ",", "List", "<", "Share", ">", "shares", ",", "Boolean", "sendEmail", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "getMasterResourceType", "(", ")", "+", "\"/\"",...
Shares the object with the specified Users and Groups. It mirrors to the following Smartsheet REST API method: POST /workspaces/{id}/shares POST /sheets/{id}/shares POST /sights/{id}/shares POST /reports/{reportId}/shares Exceptions: IllegalArgumentException : if multiShare 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) ResourceNotFoundException : if the resource can not be found 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 objectId the ID of the object to share @param shares list of share objects @param sendEmail whether to send email @return the created shares @throws SmartsheetException the smartsheet exception
[ "Shares", "the", "object", "with", "the", "specified", "Users", "and", "Groups", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java#L145-L151
135,098
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java
ShareResourcesImpl.deleteShare
public void deleteShare(long objectId, String shareId) throws SmartsheetException { this.deleteResource(getMasterResourceType() + "/" + objectId + "/shares/" + shareId, Share.class); }
java
public void deleteShare(long objectId, String shareId) throws SmartsheetException { this.deleteResource(getMasterResourceType() + "/" + objectId + "/shares/" + shareId, Share.class); }
[ "public", "void", "deleteShare", "(", "long", "objectId", ",", "String", "shareId", ")", "throws", "SmartsheetException", "{", "this", ".", "deleteResource", "(", "getMasterResourceType", "(", ")", "+", "\"/\"", "+", "objectId", "+", "\"/shares/\"", "+", "shareI...
Delete a share. It mirrors to the following Smartsheet REST API method: DELETE /workspaces/{workspaceId}/shares/{shareId} DELETE /sheets/{sheetId}/shares/{shareId} DELETE /sights/{sheetId}/shares/{shareId} DELETE /reports/{reportId}/shares/{shareId} Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found 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 objectId the ID of the object to share @param shareId the ID of the share to delete @throws SmartsheetException the smartsheet exception
[ "Delete", "a", "share", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java#L199-L201
135,099
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/ReportResourcesImpl.java
ReportResourcesImpl.updatePublishStatus
public ReportPublish updatePublishStatus(long id, ReportPublish reportPublish) throws SmartsheetException{ return this.updateResource("reports/" + id + "/publish", ReportPublish.class, reportPublish); }
java
public ReportPublish updatePublishStatus(long id, ReportPublish reportPublish) throws SmartsheetException{ return this.updateResource("reports/" + id + "/publish", ReportPublish.class, reportPublish); }
[ "public", "ReportPublish", "updatePublishStatus", "(", "long", "id", ",", "ReportPublish", "reportPublish", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "updateResource", "(", "\"reports/\"", "+", "id", "+", "\"/publish\"", ",", "ReportPublish", ...
Sets the publish status of a report and returns the new status, including the URLs of any enabled publishing. It mirrors to the following Smartsheet REST API method: PUT /reports/{id}/publish Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - 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 id the ID of the report @param publish the ReportPublish object @return the updated ReportPublish (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
[ "Sets", "the", "publish", "status", "of", "a", "report", "and", "returns", "the", "new", "status", "including", "the", "URLs", "of", "any", "enabled", "publishing", "." ]
f60e264412076271f83b65889ef9b891fad83df8
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ReportResourcesImpl.java#L300-L302