idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
150,500 | public BoxLock lock ( Date expiresAt , boolean isDownloadPrevented ) { String queryString = new QueryStringBuilder ( ) . appendParam ( "fields" , "lock" ) . toString ( ) ; URL url = FILE_URL_TEMPLATE . buildWithQuery ( this . getAPI ( ) . getBaseURL ( ) , queryString , this . getID ( ) ) ; BoxAPIRequest request = new B... | Locks a file . |
150,501 | public void unlock ( ) { String queryString = new QueryStringBuilder ( ) . appendParam ( "fields" , "lock" ) . toString ( ) ; URL url = FILE_URL_TEMPLATE . buildWithQuery ( this . getAPI ( ) . getBaseURL ( ) , queryString , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "PUT"... | Unlocks a file . |
150,502 | public Metadata updateMetadata ( Metadata metadata ) { String scope ; if ( metadata . getScope ( ) . equals ( Metadata . GLOBAL_METADATA_SCOPE ) ) { scope = Metadata . GLOBAL_METADATA_SCOPE ; } else { scope = Metadata . ENTERPRISE_METADATA_SCOPE ; } URL url = METADATA_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseU... | Updates the file metadata . |
150,503 | public BoxFileUploadSession . Info createUploadSession ( long fileSize ) { URL url = UPLOAD_SESSION_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseUploadURL ( ) , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "POST" ) ; request . addHeader ( "Content-Type" , "applicatio... | Creates an upload session to create a new version of a file in chunks . This will first verify that the version can be created and then open a session for uploading pieces of the file . |
150,504 | public static EventLog getEnterpriseEvents ( BoxAPIConnection api , Date after , Date before , BoxEvent . Type ... types ) { return getEnterpriseEvents ( api , null , after , before , ENTERPRISE_LIMIT , types ) ; } | Gets all the enterprise events that occurred within a specified date range . |
150,505 | public BoxStoragePolicy . Info getInfo ( String ... fields ) { QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) ; } URL url = STORAGE_POLICY_WITH_ID_URL_TEMPLATE . buildWithQuery ( this . getAPI ( ) . getBaseURL ( ) , builder . toString (... | Gets information for a Box Storage Policy with optional fields . |
150,506 | public BoxFile . Info upload ( BoxAPIConnection boxApi , String folderId , InputStream stream , URL url , String fileName , long fileSize ) throws InterruptedException , IOException { BoxFileUploadSession . Info session = this . createUploadSession ( boxApi , folderId , url , fileName , fileSize ) ; return this . uploa... | Uploads a new large file . |
150,507 | public String generateDigest ( InputStream stream ) { MessageDigest digest = null ; try { digest = MessageDigest . getInstance ( DIGEST_ALGORITHM_SHA1 ) ; } catch ( NoSuchAlgorithmException ae ) { throw new BoxAPIException ( "Digest algorithm not found" , ae ) ; } DigestInputStream dis = new DigestInputStream ( stream ... | Generates the Base64 encoded SHA - 1 hash for content available in the stream . It can be used to calculate the hash of a file . |
150,508 | public void setPermissions ( Permissions permissions ) { if ( this . permissions == permissions ) { return ; } this . removeChildObject ( "permissions" ) ; this . permissions = permissions ; this . addChildObject ( "permissions" , permissions ) ; } | Sets the permissions associated with this shared link . |
150,509 | public void deleteFolder ( String folderID ) { URL url = FOLDER_INFO_URL_TEMPLATE . build ( this . api . getBaseURL ( ) , folderID ) ; BoxAPIRequest request = new BoxAPIRequest ( this . api , url , "DELETE" ) ; BoxAPIResponse response = request . send ( ) ; response . disconnect ( ) ; } | Permanently deletes a trashed folder . |
150,510 | public BoxFolder . Info getFolderInfo ( String folderID ) { URL url = FOLDER_INFO_URL_TEMPLATE . build ( this . api . getBaseURL ( ) , folderID ) ; BoxAPIRequest request = new BoxAPIRequest ( this . api , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject jsonObject = JsonObj... | Gets information about a trashed folder . |
150,511 | public BoxFolder . Info getFolderInfo ( String folderID , String ... fields ) { String queryString = new QueryStringBuilder ( ) . appendParam ( "fields" , fields ) . toString ( ) ; URL url = FOLDER_INFO_URL_TEMPLATE . buildWithQuery ( this . api . getBaseURL ( ) , queryString , folderID ) ; BoxAPIRequest request = new ... | Gets information about a trashed folder that s limited to a list of specified fields . |
150,512 | public BoxFolder . Info restoreFolder ( String folderID ) { URL url = RESTORE_FOLDER_URL_TEMPLATE . build ( this . api . getBaseURL ( ) , folderID ) ; BoxAPIRequest request = new BoxAPIRequest ( this . api , url , "POST" ) ; JsonObject requestJSON = new JsonObject ( ) . add ( "" , "" ) ; request . setBody ( requestJSON... | Restores a trashed folder back to its original location . |
150,513 | public BoxFolder . Info restoreFolder ( String folderID , String newName , String newParentID ) { JsonObject requestJSON = new JsonObject ( ) ; if ( newName != null ) { requestJSON . add ( "name" , newName ) ; } if ( newParentID != null ) { JsonObject parent = new JsonObject ( ) ; parent . add ( "id" , newParentID ) ; ... | Restores a trashed folder to a new location with a new name . |
150,514 | public void deleteFile ( String fileID ) { URL url = FILE_INFO_URL_TEMPLATE . build ( this . api . getBaseURL ( ) , fileID ) ; BoxAPIRequest request = new BoxAPIRequest ( this . api , url , "DELETE" ) ; BoxAPIResponse response = request . send ( ) ; response . disconnect ( ) ; } | Permanently deletes a trashed file . |
150,515 | public BoxFile . Info getFileInfo ( String fileID ) { URL url = FILE_INFO_URL_TEMPLATE . build ( this . api . getBaseURL ( ) , fileID ) ; BoxAPIRequest request = new BoxAPIRequest ( this . api , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject jsonObject = JsonObject . read... | Gets information about a trashed file . |
150,516 | public BoxFile . Info getFileInfo ( String fileID , String ... fields ) { String queryString = new QueryStringBuilder ( ) . appendParam ( "fields" , fields ) . toString ( ) ; URL url = FILE_INFO_URL_TEMPLATE . buildWithQuery ( this . api . getBaseURL ( ) , queryString , fileID ) ; BoxAPIRequest request = new BoxAPIRequ... | Gets information about a trashed file that s limited to a list of specified fields . |
150,517 | public BoxFile . Info restoreFile ( String fileID ) { URL url = RESTORE_FILE_URL_TEMPLATE . build ( this . api . getBaseURL ( ) , fileID ) ; BoxAPIRequest request = new BoxAPIRequest ( this . api , url , "POST" ) ; JsonObject requestJSON = new JsonObject ( ) . add ( "" , "" ) ; request . setBody ( requestJSON . toStrin... | Restores a trashed file back to its original location . |
150,518 | public BoxFile . Info restoreFile ( String fileID , String newName , String newParentID ) { JsonObject requestJSON = new JsonObject ( ) ; if ( newName != null ) { requestJSON . add ( "name" , newName ) ; } if ( newParentID != null ) { JsonObject parent = new JsonObject ( ) ; parent . add ( "id" , newParentID ) ; reques... | Restores a trashed file to a new location with a new name . |
150,519 | public Iterator < BoxItem . Info > iterator ( ) { URL url = GET_ITEMS_URL . build ( this . api . getBaseURL ( ) ) ; return new BoxItemIterator ( this . api , url ) ; } | Returns an iterator over the items in the trash . |
150,520 | public static MetadataTemplate createMetadataTemplate ( BoxAPIConnection api , String scope , String templateKey , String displayName , boolean hidden , List < Field > fields ) { JsonObject jsonObject = new JsonObject ( ) ; jsonObject . add ( "scope" , scope ) ; jsonObject . add ( "displayName" , displayName ) ; jsonOb... | Creates new metadata template . |
150,521 | private static JsonObject getFieldJsonObject ( Field field ) { JsonObject fieldObj = new JsonObject ( ) ; fieldObj . add ( "type" , field . getType ( ) ) ; fieldObj . add ( "key" , field . getKey ( ) ) ; fieldObj . add ( "displayName" , field . getDisplayName ( ) ) ; String fieldDesc = field . getDescription ( ) ; if (... | Gets the JsonObject representation of the given field object . |
150,522 | public static MetadataTemplate updateMetadataTemplate ( BoxAPIConnection api , String scope , String template , List < FieldOperation > fieldOperations ) { JsonArray array = new JsonArray ( ) ; for ( FieldOperation fieldOperation : fieldOperations ) { JsonObject jsonObject = getFieldOperationJsonObject ( fieldOperation... | Updates the schema of an existing metadata template . |
150,523 | public static void deleteMetadataTemplate ( BoxAPIConnection api , String scope , String template ) { URL url = METADATA_TEMPLATE_URL_TEMPLATE . build ( api . getBaseURL ( ) , scope , template ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , "DELETE" ) ; request . send ( ) ; } | Deletes the schema of an existing metadata template . |
150,524 | private static JsonObject getFieldOperationJsonObject ( FieldOperation fieldOperation ) { JsonObject jsonObject = new JsonObject ( ) ; jsonObject . add ( "op" , fieldOperation . getOp ( ) . toString ( ) ) ; String fieldKey = fieldOperation . getFieldKey ( ) ; if ( fieldKey != null ) { jsonObject . add ( "fieldKey" , fi... | Gets the JsonObject representation of the Field Operation . |
150,525 | private static JsonArray getJsonArray ( List < String > keys ) { JsonArray array = new JsonArray ( ) ; for ( String key : keys ) { array . add ( key ) ; } return array ; } | Gets the Json Array representation of the given list of strings . |
150,526 | public static MetadataTemplate getMetadataTemplateByID ( BoxAPIConnection api , String templateID ) { URL url = METADATA_TEMPLATE_BY_ID_URL_TEMPLATE . build ( api . getBaseURL ( ) , templateID ) ; BoxAPIRequest request = new BoxAPIRequest ( api , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . ... | Geta the specified metadata template by its ID . |
150,527 | public boolean clearParameters ( ) { this . query = null ; this . fields = null ; this . scope = null ; this . fileExtensions = null ; this . createdRange = null ; this . updatedRange = null ; this . sizeRange = null ; this . ownerUserIds = null ; this . ancestorFolderIds = null ; this . contentTypes = null ; this . ty... | Clears the Parameters before performing a new search . |
150,528 | private boolean isNullOrEmpty ( Object paramValue ) { boolean isNullOrEmpty = false ; if ( paramValue == null ) { isNullOrEmpty = true ; } if ( paramValue instanceof String ) { if ( ( ( String ) paramValue ) . trim ( ) . equalsIgnoreCase ( "" ) ) { isNullOrEmpty = true ; } } else if ( paramValue instanceof List ) { ret... | Checks String to see if the parameter is null . |
150,529 | private JsonArray formatBoxMetadataFilterRequest ( ) { JsonArray boxMetadataFilterRequestArray = new JsonArray ( ) ; JsonObject boxMetadataFilter = new JsonObject ( ) . add ( "templateKey" , this . metadataFilter . getTemplateKey ( ) ) . add ( "scope" , this . metadataFilter . getScope ( ) ) . add ( "filters" , this . ... | Add BoxMetaDataFilter to the JsonArray boxMetadataFilterRequestArray . |
150,530 | private String listToCSV ( List < String > list ) { String csvStr = "" ; for ( String item : list ) { csvStr += "," + item ; } return csvStr . length ( ) > 1 ? csvStr . substring ( 1 ) : csvStr ; } | Concat a List into a CSV String . |
150,531 | public QueryStringBuilder getQueryParameters ( ) { QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( this . isNullOrEmpty ( this . query ) && this . metadataFilter == null ) { throw new BoxAPIException ( "BoxSearchParameters requires either a search query or Metadata filter to be set." ) ; } if ( ! this . ... | Get the Query Paramaters to be used for search request . |
150,532 | public JsonObject getJsonObject ( ) { JsonObject obj = new JsonObject ( ) ; obj . add ( "field" , this . field ) ; obj . add ( "value" , this . value ) ; return obj ; } | Get the JSON representation of the metadata field filter . |
150,533 | public static BoxAPIConnection restore ( String clientID , String clientSecret , String state ) { BoxAPIConnection api = new BoxAPIConnection ( clientID , clientSecret ) ; api . restore ( state ) ; return api ; } | Restores a BoxAPIConnection from a saved state . |
150,534 | public static URL getAuthorizationURL ( String clientID , URI redirectUri , String state , List < String > scopes ) { URLTemplate template = new URLTemplate ( AUTHORIZATION_URL ) ; QueryStringBuilder queryBuilder = new QueryStringBuilder ( ) . appendParam ( "client_id" , clientID ) . appendParam ( "response_type" , "co... | Return the authorization URL which is used to perform the authorization_code based OAuth2 flow . |
150,535 | public void authenticate ( String authCode ) { URL url = null ; try { url = new URL ( this . tokenURL ) ; } catch ( MalformedURLException e ) { assert false : "An invalid token URL indicates a bug in the SDK." ; throw new RuntimeException ( "An invalid token URL indicates a bug in the SDK." , e ) ; } String urlParamete... | Authenticates the API connection by obtaining access and refresh tokens using the auth code that was obtained from the first half of OAuth . |
150,536 | public boolean needsRefresh ( ) { boolean needsRefresh ; this . refreshLock . readLock ( ) . lock ( ) ; long now = System . currentTimeMillis ( ) ; long tokenDuration = ( now - this . lastRefresh ) ; needsRefresh = ( tokenDuration >= this . expires - REFRESH_EPSILON ) ; this . refreshLock . readLock ( ) . unlock ( ) ; ... | Determines if this connection s access token has expired and needs to be refreshed . |
150,537 | public void refresh ( ) { this . refreshLock . writeLock ( ) . lock ( ) ; if ( ! this . canRefresh ( ) ) { this . refreshLock . writeLock ( ) . unlock ( ) ; throw new IllegalStateException ( "The BoxAPIConnection cannot be refreshed because it doesn't have a " + "refresh token." ) ; } URL url = null ; try { url = new U... | Refresh s this connection s access token using its refresh token . |
150,538 | public void restore ( String state ) { JsonObject json = JsonObject . readFrom ( state ) ; String accessToken = json . get ( "accessToken" ) . asString ( ) ; String refreshToken = json . get ( "refreshToken" ) . asString ( ) ; long lastRefresh = json . get ( "lastRefresh" ) . asLong ( ) ; long expires = json . get ( "e... | Restores a saved connection state into this BoxAPIConnection . |
150,539 | public ScopedToken getLowerScopedToken ( List < String > scopes , String resource ) { assert ( scopes != null ) ; assert ( scopes . size ( ) > 0 ) ; URL url = null ; try { url = new URL ( this . getTokenURL ( ) ) ; } catch ( MalformedURLException e ) { assert false : "An invalid refresh URL indicates a bug in the SDK."... | Get a lower - scoped token restricted to a resource for the list of scopes that are passed . |
150,540 | public String save ( ) { JsonObject state = new JsonObject ( ) . add ( "accessToken" , this . accessToken ) . add ( "refreshToken" , this . refreshToken ) . add ( "lastRefresh" , this . lastRefresh ) . add ( "expires" , this . expires ) . add ( "userAgent" , this . userAgent ) . add ( "tokenURL" , this . tokenURL ) . a... | Saves the state of this connection to a string so that it can be persisted and restored at a later time . |
150,541 | public Info getInfo ( String ... fields ) { QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) ; } URL url = DEVICE_PIN_URL_TEMPLATE . buildWithQuery ( this . getAPI ( ) . getBaseURL ( ) , builder . toString ( ) , this . getID ( ) ) ; BoxAP... | Gets information about the device pin . |
150,542 | public void delete ( ) { URL url = DEVICE_PIN_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "DELETE" ) ; BoxAPIResponse response = request . send ( ) ; response . disconnect ( ) ; } | Deletes the device pin . |
150,543 | public void forceApply ( String conflictResolution ) { URL url = FORCE_METADATA_CASCADE_POLICIES_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "POST" ) ; JsonObject requestJSON = new JsonObject ( ) . add ( "confli... | If a policy already exists on a folder this will apply that policy to all existing files and sub folders within the target folder . |
150,544 | public BoxTaskAssignment . Info addAssignment ( BoxUser assignTo ) { JsonObject taskJSON = new JsonObject ( ) ; taskJSON . add ( "type" , "task" ) ; taskJSON . add ( "id" , this . getID ( ) ) ; JsonObject assignToJSON = new JsonObject ( ) ; assignToJSON . add ( "id" , assignTo . getID ( ) ) ; JsonObject requestJSON = n... | Adds a new assignment to this task . |
150,545 | public List < BoxTaskAssignment . Info > getAssignments ( ) { URL url = GET_ASSIGNMENTS_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; Jso... | Gets any assignments for this task . |
150,546 | public Iterable < BoxTaskAssignment . Info > getAllAssignments ( String ... fields ) { final QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) ; } return new Iterable < BoxTaskAssignment . Info > ( ) { public Iterator < BoxTaskAssignment .... | Gets an iterable of all the assignments of this task . |
150,547 | public String getPendingChanges ( ) { JsonObject jsonObject = this . getPendingJSONObject ( ) ; if ( jsonObject == null ) { return null ; } return jsonObject . toString ( ) ; } | Gets a JSON string containing any pending changes to this object that can be sent back to the Box API . |
150,548 | void update ( JsonObject jsonObject ) { for ( JsonObject . Member member : jsonObject ) { if ( member . getValue ( ) . isNull ( ) ) { continue ; } this . parseJSONMember ( member ) ; } this . clearPendingChanges ( ) ; } | Updates this BoxJSONObject using the information in a JSON object . |
150,549 | private JsonObject getPendingJSONObject ( ) { for ( Map . Entry < String , BoxJSONObject > entry : this . children . entrySet ( ) ) { BoxJSONObject child = entry . getValue ( ) ; JsonObject jsonObject = child . getPendingJSONObject ( ) ; if ( jsonObject != null ) { if ( this . pendingChanges == null ) { this . pendingC... | Gets a JsonObject containing any pending changes to this object that can be sent back to the Box API . |
150,550 | public void addHeader ( String key , String value ) { if ( key . equals ( "As-User" ) ) { for ( int i = 0 ; i < this . headers . size ( ) ; i ++ ) { if ( this . headers . get ( i ) . getKey ( ) . equals ( "As-User" ) ) { this . headers . remove ( i ) ; } } } if ( key . equals ( "X-Box-UA" ) ) { throw new IllegalArgumen... | Adds an HTTP header to this request . |
150,551 | public void setBody ( String body ) { byte [ ] bytes = body . getBytes ( StandardCharsets . UTF_8 ) ; this . bodyLength = bytes . length ; this . body = new ByteArrayInputStream ( bytes ) ; } | Sets the request body to the contents of a String . |
150,552 | public BoxAPIResponse send ( ProgressListener listener ) { if ( this . api == null ) { this . backoffCounter . reset ( BoxGlobalSettings . getMaxRequestAttempts ( ) ) ; } else { this . backoffCounter . reset ( this . api . getMaxRequestAttempts ( ) ) ; } while ( this . backoffCounter . getAttemptsRemaining ( ) > 0 ) { ... | Sends this request while monitoring its progress and returns a BoxAPIResponse containing the server s response . |
150,553 | protected void writeBody ( HttpURLConnection connection , ProgressListener listener ) { if ( this . body == null ) { return ; } connection . setDoOutput ( true ) ; try { OutputStream output = connection . getOutputStream ( ) ; if ( listener != null ) { output = new ProgressOutputStream ( output , listener , this . body... | Writes the body of this request to an HttpURLConnection . |
150,554 | public static BoxLegalHoldPolicy . Info createOngoing ( BoxAPIConnection api , String name , String description ) { URL url = ALL_LEGAL_HOLD_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , "POST" ) ; JsonObject requestJSON = new JsonObject ( ) . add ( "policy_na... | Creates a new ongoing Legal Hold Policy . |
150,555 | public Iterable < BoxLegalHoldAssignment . Info > getAssignments ( String ... fields ) { return this . getAssignments ( null , null , DEFAULT_LIMIT , fields ) ; } | Returns iterable containing assignments for this single legal hold policy . |
150,556 | public Iterable < BoxLegalHoldAssignment . Info > getAssignments ( String type , String id , int limit , String ... fields ) { QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( type != null ) { builder . appendParam ( "assign_to_type" , type ) ; } if ( id != null ) { builder . appendParam ( "assign_to_id" ... | Returns iterable containing assignments for this single legal hold policy . Parameters can be used to filter retrieved assignments . |
150,557 | public Iterable < BoxFileVersionLegalHold . Info > getFileVersionHolds ( int limit , String ... fields ) { QueryStringBuilder queryString = new QueryStringBuilder ( ) . appendParam ( "policy_id" , this . getID ( ) ) ; if ( fields . length > 0 ) { queryString . appendParam ( "fields" , fields ) ; } URL url = LIST_OF_FIL... | Returns iterable with all non - deleted file version legal holds for this legal hold policy . |
150,558 | public static Iterable < BoxFileVersionRetention . Info > getAll ( BoxAPIConnection api , String ... fields ) { return getRetentions ( api , new QueryFilter ( ) , fields ) ; } | Retrieves all file version retentions . |
150,559 | public static Iterable < BoxFileVersionRetention . Info > getRetentions ( final BoxAPIConnection api , QueryFilter filter , String ... fields ) { filter . addFields ( fields ) ; return new BoxResourceIterable < BoxFileVersionRetention . Info > ( api , ALL_RETENTIONS_URL_TEMPLATE . buildWithQuery ( api . getBaseURL ( ) ... | Retrieves all file version retentions matching given filters as an Iterable . |
150,560 | public boolean verify ( String signatureVersion , String signatureAlgorithm , String primarySignature , String secondarySignature , String webHookPayload , String deliveryTimestamp ) { if ( ! SUPPORTED_VERSIONS . contains ( signatureVersion ) ) { return false ; } BoxSignatureAlgorithm algorithm = BoxSignatureAlgorithm ... | Verifies given web - hook information . |
150,561 | private boolean verify ( String key , BoxSignatureAlgorithm actualAlgorithm , String actualSignature , String webHookPayload , String deliveryTimestamp ) { if ( actualSignature == null ) { return false ; } byte [ ] actual = Base64 . decode ( actualSignature ) ; byte [ ] expected = this . signRaw ( actualAlgorithm , key... | Verifies a provided signature . |
150,562 | public PartialCollection < BoxItem . Info > searchRange ( long offset , long limit , final BoxSearchParameters bsp ) { QueryStringBuilder builder = bsp . getQueryParameters ( ) . appendParam ( "limit" , limit ) . appendParam ( "offset" , offset ) ; URL url = SEARCH_URL_TEMPLATE . buildWithQuery ( this . getAPI ( ) . ge... | Searches all descendant folders using a given query and query parameters . |
150,563 | public static BoxAPIConnection getTransactionConnection ( String accessToken , String scope ) { return BoxTransactionalAPIConnection . getTransactionConnection ( accessToken , scope , null ) ; } | Request a scoped transactional token . |
150,564 | public static BoxAPIConnection getTransactionConnection ( String accessToken , String scope , String resource ) { BoxAPIConnection apiConnection = new BoxAPIConnection ( accessToken ) ; URL url ; try { url = new URL ( apiConnection . getTokenURL ( ) ) ; } catch ( MalformedURLException e ) { assert false : "An invalid t... | Request a scoped transactional token for a particular resource . |
150,565 | public static BoxItem . Info getSharedItem ( BoxAPIConnection api , String sharedLink ) { return getSharedItem ( api , sharedLink , null ) ; } | Gets an item that was shared with a shared link . |
150,566 | public static BoxItem . Info getSharedItem ( BoxAPIConnection api , String sharedLink , String password ) { BoxAPIConnection newAPI = new SharedLinkAPIConnection ( api , sharedLink , password ) ; URL url = SHARED_ITEM_URL_TEMPLATE . build ( newAPI . getBaseURL ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( newAPI ... | Gets an item that was shared with a password - protected shared link . |
150,567 | protected BoxWatermark getWatermark ( URLTemplate itemUrl , String ... fields ) { URL watermarkUrl = itemUrl . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) ; } URL url ... | Used to retrieve the watermark for the item . If the item does not have a watermark applied to it a 404 Not Found will be returned by API . |
150,568 | protected BoxWatermark applyWatermark ( URLTemplate itemUrl , String imprint ) { URL watermarkUrl = itemUrl . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; URL url = WATERMARK_URL_TEMPLATE . build ( watermarkUrl . toString ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url... | Used to apply or update the watermark for the item . |
150,569 | protected void removeWatermark ( URLTemplate itemUrl ) { URL watermarkUrl = itemUrl . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; URL url = WATERMARK_URL_TEMPLATE . build ( watermarkUrl . toString ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "DELETE" ) ; BoxAPIResp... | Removes a watermark from the item . If the item did not have a watermark applied to it a 404 Not Found will be returned by API . |
150,570 | private void parseJSON ( JsonObject jsonObject ) { for ( JsonObject . Member member : jsonObject ) { JsonValue value = member . getValue ( ) ; if ( value . isNull ( ) ) { continue ; } try { String memberName = member . getName ( ) ; if ( memberName . equals ( "id" ) ) { this . versionID = value . asString ( ) ; } else ... | Method used to update fields with values received from API . |
150,571 | public void download ( OutputStream output , ProgressListener listener ) { URL url = CONTENT_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . fileID , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "GET" ) ; BoxAPIResponse response = request . send ( ) ; Inp... | Downloads this version of the file to a given OutputStream while reporting the progress to a ProgressListener . |
150,572 | public void promote ( ) { URL url = VERSION_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . fileID , "current" ) ; JsonObject jsonObject = new JsonObject ( ) ; jsonObject . add ( "type" , "file_version" ) ; jsonObject . add ( "id" , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( t... | Promotes this version of the file to be the latest version . |
150,573 | public static BoxUser . Info createAppUser ( BoxAPIConnection api , String name ) { return createAppUser ( api , name , new CreateUserParams ( ) ) ; } | Provisions a new app user in an enterprise using Box Developer Edition . |
150,574 | public static BoxUser . Info createAppUser ( BoxAPIConnection api , String name , CreateUserParams params ) { params . setIsPlatformAccessOnly ( true ) ; return createEnterpriseUser ( api , null , name , params ) ; } | Provisions a new app user in an enterprise with additional user information using Box Developer Edition . |
150,575 | public static BoxUser . Info createEnterpriseUser ( BoxAPIConnection api , String login , String name ) { return createEnterpriseUser ( api , login , name , null ) ; } | Provisions a new user in an enterprise . |
150,576 | public static BoxUser . Info createEnterpriseUser ( BoxAPIConnection api , String login , String name , CreateUserParams params ) { JsonObject requestJSON = new JsonObject ( ) ; requestJSON . add ( "login" , login ) ; requestJSON . add ( "name" , name ) ; if ( params != null ) { if ( params . getRole ( ) != null ) { re... | Provisions a new user in an enterprise with additional user information . |
150,577 | public static BoxUser getCurrentUser ( BoxAPIConnection api ) { URL url = GET_ME_URL . build ( api . getBaseURL ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( api , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject jsonObject = JsonObject . readFrom ( response . getJSON... | Gets the current user . |
150,578 | public static Iterable < BoxUser . Info > getAllEnterpriseUsers ( final BoxAPIConnection api , final String filterTerm , final String ... fields ) { return getUsersInfoForType ( api , filterTerm , null , null , fields ) ; } | Returns an iterable containing all the enterprise users that matches the filter and specifies which child fields to retrieve from the API . |
150,579 | public static Iterable < BoxUser . Info > getAppUsersByExternalAppUserID ( final BoxAPIConnection api , final String externalAppUserId , final String ... fields ) { return getUsersInfoForType ( api , null , null , externalAppUserId , fields ) ; } | Gets any app users that has an exact match with the externalAppUserId term . |
150,580 | private static Iterable < BoxUser . Info > getUsersInfoForType ( final BoxAPIConnection api , final String filterTerm , final String userType , final String externalAppUserId , final String ... fields ) { return new Iterable < BoxUser . Info > ( ) { public Iterator < BoxUser . Info > iterator ( ) { QueryStringBuilder b... | Helper method to abstract out the common logic from the various users methods . |
150,581 | public BoxUser . Info getInfo ( String ... fields ) { URL url ; if ( fields . length > 0 ) { String queryString = new QueryStringBuilder ( ) . appendParam ( "fields" , fields ) . toString ( ) ; url = USER_URL_TEMPLATE . buildWithQuery ( this . getAPI ( ) . getBaseURL ( ) , queryString , this . getID ( ) ) ; } else { ur... | Gets information about this user . |
150,582 | public Collection < BoxGroupMembership . Info > getMemberships ( ) { BoxAPIConnection api = this . getAPI ( ) ; URL url = USER_MEMBERSHIPS_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( api , url , "GET" ) ; BoxJSONResponse response = ( BoxJS... | Gets information about all of the group memberships for this user . Does not support paging . |
150,583 | public Iterable < BoxGroupMembership . Info > getAllMemberships ( String ... fields ) { final QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) ; } return new Iterable < BoxGroupMembership . Info > ( ) { public Iterator < BoxGroupMembershi... | Gets information about all of the group memberships for this user as iterable with paging support . |
150,584 | public EmailAlias addEmailAlias ( String email , boolean isConfirmed ) { URL url = EMAIL_ALIASES_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "POST" ) ; JsonObject requestJSON = new JsonObject ( ) . add ( "email"... | Adds a new email alias to this user s account and confirms it without user interaction . This functionality is only available for enterprise admins . |
150,585 | public void deleteEmailAlias ( String emailAliasID ) { URL url = EMAIL_ALIAS_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) , emailAliasID ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "DELETE" ) ; BoxAPIResponse response = request . send ( ) ; response . discon... | Deletes an email alias from this user s account . |
150,586 | public Collection < EmailAlias > getEmailAliases ( ) { URL url = EMAIL_ALIASES_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject r... | Gets a collection of all the email aliases for this user . |
150,587 | public void delete ( boolean notifyUser , boolean force ) { String queryString = new QueryStringBuilder ( ) . appendParam ( "notify" , String . valueOf ( notifyUser ) ) . appendParam ( "force" , String . valueOf ( force ) ) . toString ( ) ; URL url = USER_URL_TEMPLATE . buildWithQuery ( this . getAPI ( ) . getBaseURL (... | Deletes a user from an enterprise account . |
150,588 | public InputStream getAvatar ( ) { URL url = USER_AVATAR_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "GET" ) ; BoxAPIResponse response = request . send ( ) ; return response . getBody ( ) ; } | Retrieves the avatar of a user as an InputStream . |
150,589 | public static Info inviteUserToEnterprise ( BoxAPIConnection api , String userLogin , String enterpriseID ) { URL url = INVITE_CREATION_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , "POST" ) ; JsonObject body = new JsonObject ( ) ; JsonObject enterprise = new ... | Invite a user to an enterprise . |
150,590 | private static JsonArray toJsonArray ( Collection < String > values ) { JsonArray array = new JsonArray ( ) ; for ( String value : values ) { array . add ( value ) ; } return array ; } | Helper function to create JsonArray from collection . |
150,591 | public void setBody ( String body ) { super . setBody ( body ) ; this . jsonValue = JsonValue . readFrom ( body ) ; } | Sets the body of this request to a given JSON string . |
150,592 | public Info changeMessage ( String newMessage ) { Info newInfo = new Info ( ) ; newInfo . setMessage ( newMessage ) ; URL url = COMMENT_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "PUT" ) ; request . setBody ( n... | Changes the message of this comment . |
150,593 | public BoxComment . Info reply ( String message ) { JsonObject itemJSON = new JsonObject ( ) ; itemJSON . add ( "type" , "comment" ) ; itemJSON . add ( "id" , this . getID ( ) ) ; JsonObject requestJSON = new JsonObject ( ) ; requestJSON . add ( "item" , itemJSON ) ; if ( BoxComment . messageContainsMention ( message )... | Replies to this comment with another message . |
150,594 | public void put ( String key , String value ) { synchronized ( this . cache ) { this . cache . put ( key , value ) ; } } | Add an entry to the cache . |
150,595 | public URL buildWithQuery ( String base , String queryString , Object ... values ) { String urlString = String . format ( base + this . template , values ) + queryString ; URL url = null ; try { url = new URL ( urlString ) ; } catch ( MalformedURLException e ) { assert false : "An invalid URL template indicates a bug i... | Build a URL with Query String and URL Parameters . |
150,596 | public BoxFileUploadSessionPart uploadPart ( InputStream stream , long offset , int partSize , long totalSizeOfFile ) { URL uploadPartURL = this . sessionInfo . getSessionEndpoints ( ) . getUploadPartEndpoint ( ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , uploadPartURL , HttpMethod . PUT ) ; requ... | Uploads chunk of a stream to an open upload session . |
150,597 | public BoxFileUploadSessionPart uploadPart ( byte [ ] data , long offset , int partSize , long totalSizeOfFile ) { URL uploadPartURL = this . sessionInfo . getSessionEndpoints ( ) . getUploadPartEndpoint ( ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , uploadPartURL , HttpMethod . PUT ) ; request .... | Uploads bytes to an open upload session . |
150,598 | public BoxFileUploadSessionPartList listParts ( int offset , int limit ) { URL listPartsURL = this . sessionInfo . getSessionEndpoints ( ) . getListPartsEndpoint ( ) ; URLTemplate template = new URLTemplate ( listPartsURL . toString ( ) ) ; QueryStringBuilder builder = new QueryStringBuilder ( ) ; builder . appendParam... | Returns a list of all parts that have been uploaded to an upload session . |
150,599 | public BoxFile . Info commit ( String digest , List < BoxFileUploadSessionPart > parts , Map < String , String > attributes , String ifMatch , String ifNoneMatch ) { URL commitURL = this . sessionInfo . getSessionEndpoints ( ) . getCommitEndpoint ( ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , c... | Commit an upload session after all parts have been uploaded creating the new file or the version . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.