cn.com.believer.songyuanframework.openapi.storage.box
Interface BoxExternalAPI

All Known Implementing Classes:
SimpleBoxImpl

public interface BoxExternalAPI

Author:
Jimmy

Method Summary
 AddToMyBoxResponse addToMyBox(AddToMyBoxRequest addToMyBoxRequest)
          This method copies a file publicly shared by someone to a user's mybox.
 AddToTagResponse addToTag(AddToTagRequest addToTagRequest)
          This method adds file or folder to tags list.
 CreateFolderResponse createFolder(CreateFolderRequest createFolderRequest)
          This method creates a new folder.
 DeleteResponse delete(DeleteRequest deleteRequest)
          This method deletes a file or folder.
 DownloadResponse download(DownloadRequest downloadRequest)
          download a file.
 ExportTagsResponse exportTags(ExportTagsRequest exportTagsRequest)
          This method returns all the user's tags.
 GetAccountTreeResponse getAccountTree(GetAccountTreeRequest getAccountTreeRequest)
          This method is used to get a user's files and folders tree.
 GetAuthTokenResponse getAuthToken(GetAuthTokenRequest getAuthTokenRequest)
          This method is used in the authorization process.
 GetFileInfoResponse getFileInfo(GetFileInfoRequest getFileInfoRequest)
          This method gets file info.
 GetFriendsResponse getFriends(GetFriendsRequest getFriendsRequest)
          This method is used to retrieve a list of freinds.
 GetTicketResponse getTicket(GetTicketRequest getTicketRequest)
          This method is used in the authorization process.
 LogoutResponse logout(LogoutRequest logoutRequest)
          This method is used to logout a user.
 MoveResponse move(MoveRequest moveRequest)
          This method moves a file or folder to another folder.
 PrivateShareResponse privateShare(PrivateShareRequest privateShareRequest)
          This method privately shares a file or folder with another user(s).
 PublicShareResponse publicShare(PublicShareRequest publicShareRequest)
          This method publicly shares a file or folder.
 PublicUnshareResponse publicUnshare(PublicUnshareRequest publicUnshareRequest)
          This method unshares a shared file or folder.
 RegisterNewUserResponse registerNewUser(RegisterNewUserRequest registerNewUserRequest)
          This method is used to register a user.
 RenameResponse rename(RenameRequest renameRequest)
          This method renames a file or folder.
 RequestFriendsResponse requestFriends(RequestFriendsRequest requestFriendsRequest)
          This method requests new friends to be added to your network.
 SetDescriptionResponse setDescription(SetDescriptionRequest setDescriptionRequest)
          This method sets a description to a file or folder.
 UploadResponse upload(UploadRequest uploadRequest)
          upload files.
 VerifyRegistrationEmailResponse verifyRegistrationEmail(VerifyRegistrationEmailRequest verifyRegistrationEmailRequest)
          This method is used to verify user registration email .
 

Method Detail

getAuthToken

GetAuthTokenResponse getAuthToken(GetAuthTokenRequest getAuthTokenRequest)
                                  throws java.io.IOException,
                                         BoxException
This method is used in the authorization process. You should call this method after the user has authorized themself on box.net site. Pass ticket that you get when called get_ticket method. On a successful result, method will return 'get_auth_token_ok' as status, auth_token to use in other method calls, and user struct which describes logged user. Request.

Parameters:
getAuthTokenRequest - request object
Returns:
getAuthTokenResponse response object
Throws:
java.io.IOException - io exception
BoxException - box exception

getTicket

GetTicketResponse getTicket(GetTicketRequest getTicketRequest)
                            throws java.io.IOException,
                                   BoxException
This method is used in the authorization process.

Parameters:
getTicketRequest - request object
Returns:
getTicketResponse response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

logout

LogoutResponse logout(LogoutRequest logoutRequest)
                      throws java.io.IOException,
                             BoxException
This method is used to logout a user. On successful logout method will return 'logout_ok' as status. If logout wasn't successful, then status filed can be: 'invalid_auth_token' when auth_token is invalid.

Parameters:
logoutRequest - request object
Returns:
LogoutResponse object
Throws:
java.io.IOException - io exception
BoxException - box exception

registerNewUser

RegisterNewUserResponse registerNewUser(RegisterNewUserRequest registerNewUserRequest)
                                        throws java.io.IOException,
                                               BoxException
This method is used to register a user. Upon a successful registration, the status param will be 'successful_register'. If registration wasn't successful, status field can be: 'e_register', 'email_invalid', 'email_already_registered', 'application_restricted'.

Parameters:
registerNewUserRequest - request object
Returns:
response object
Throws:
java.io.IOException - io exception
BoxException - box exception

verifyRegistrationEmail

VerifyRegistrationEmailResponse verifyRegistrationEmail(VerifyRegistrationEmailRequest verifyRegistrationEmailRequest)
                                                        throws java.io.IOException,
                                                               BoxException
This method is used to verify user registration email . Upon a not used and right registration email, the status param will be 'email_ok'. Else status field can be: 'email_invalid', 'email_already_registered', 'application_restricted'.

Parameters:
verifyRegistrationEmailRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

getAccountTree

GetAccountTreeResponse getAccountTree(GetAccountTreeRequest getAccountTreeRequest)
                                      throws java.io.IOException,
                                             BoxException
This method is used to get a user's files and folders tree. 'folder_id' param defines root folder from which the tree begins. 'params' is array of string where you can set additional parameters, which are: onelevel - make a tree of one level depth, so you will get only files and folders stored in folder which folder_id you have provided. nofiles - include folders only in result tree, no files. nozip - do not zip tree xml. On successful result you will receive 'listing_ok' as status and base64 encoded zipped tree xml. So you have to decode the received tree, then unzip it (if you haven't set 'nozip' param) and you will get xml like this: (note that updatedand createdare UNIX timestamps in PST).

Parameters:
getAccountTreeRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

exportTags

ExportTagsResponse exportTags(ExportTagsRequest exportTagsRequest)
                              throws java.io.IOException,
                                     BoxException
This method returns all the user's tags. On successful a result, you will receive 'export_tags_ok' and tag_xml will be base64 encoded tags xml. After decoding tag_xml you will get xml like this: music mp3 If the result wasn't successful, status field can be: not_logged_id, application_restricted.

Parameters:
exportTagsRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

createFolder

CreateFolderResponse createFolder(CreateFolderRequest createFolderRequest)
                                  throws java.io.IOException,
                                         BoxException
This method creates a new folder. 'parent_id' param is the id of a folder in which a new folder will be created, 'name' param is the name of a new folder. Set 'share' to 1 if you want to share a folder publicly. On a successful result, the status will be 'create_ok'. If the result wasn't successful, status field can be: 'e_no_parent_folder', 'not_logged_in', 'application_r'stricted'.

Parameters:
createFolderRequest - request object
Returns:
response object
Throws:
java.io.IOException - io exception
BoxException - box exception

move

MoveResponse move(MoveRequest moveRequest)
                  throws java.io.IOException,
                         BoxException
This method moves a file or folder to another folder. 'target' param can be either 'file' or 'folder' depending on what do you want to move, 'target_id' is the id of a file or folder to be moved, 'destination_id' is the destination folder id. On a successful result, status will be 's_move_node'. If the result wasn't successful, status field can be: 'e_move_node', 'not_logged_in', 'application_restricted'.

Parameters:
moveRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

rename

RenameResponse rename(RenameRequest renameRequest)
                      throws java.io.IOException,
                             BoxException
This method renames a file or folder. 'target' param can be either 'file' or 'folder' depending on what you want to rename, 'target_id' is the id of a file or folder to be renamed, 'new_name' is the new name for a file or folder. On a successful result, status will be 's_rename_node'. If result wasn't successful, stat's field can be: 'e_rename_node', 'not_logged_in', 'application_restricted'.

Parameters:
renameRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

delete

DeleteResponse delete(DeleteRequest deleteRequest)
                      throws java.io.IOException,
                             BoxException
This method deletes a file or folder. 'target' param can be either 'file' or 'folder' depending on what you want to delete, 'target_id' is id of a file or folder to be deleted. On a successful result, the status will be 's_delete_node'. If the result wasn't successful, status field can be: 'e_delete_node', 'not_logged_in', 'application_restricted'.

Parameters:
deleteRequest - request object
Returns:
response object
Throws:
java.io.IOException - io exception
BoxException - box exception

publicShare

PublicShareResponse publicShare(PublicShareRequest publicShareRequest)
                                throws java.io.IOException,
                                       BoxException
This method publicly shares a file or folder. 'target' param should be either 'file' or 'folder', 'target_id' is id of the file or folder to be shared. 'password' param is to protect sharing with a password, 'emails' params is array of emails to notify about a new share, 'message' param is some message to be included in a notification email. On a successful result, the status will be 'share_ok' and 'public_name' param will be a unique identifier of a publicly shared file or folder. If the result wasn't successful, the status field can be: 'share_error', 'wrong_node', 'not_logged_in', 'application_restricted'.

Parameters:
publicShareRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

publicUnshare

PublicUnshareResponse publicUnshare(PublicUnshareRequest publicUnshareRequest)
                                    throws java.io.IOException,
                                           BoxException
This method unshares a shared file or folder. 'target' param shoud be either 'file' or 'folder', 'target_id' is id of a file or folder to be unshared. On a successful result, the status will be 'unshare_ok'. If the result wasn't successful, the status field can be: 'unshare_error', 'wrong_node', 'not_logged_in', 'application_restricted'.

Parameters:
publicUnshareRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

privateShare

PrivateShareResponse privateShare(PrivateShareRequest privateShareRequest)
                                  throws java.io.IOException,
                                         BoxException
This method privately shares a file or folder with another user(s). 'target' param should be either 'file' or 'folder', 'target_id' is the id of the file or folder to be shared. 'emails' params is an array of emails of users' to share files with. if 'notify' param is true, then a notification email will be sent to users, 'message' param is a message to be included in the notification email. Note: currently only files can be shared privately. On a successful result, the status will be 'private_share_ok'. If the result wasn't successful, the status field can be: 'private_share_error', 'wrong_node', 'not_logged_in', 'application_restricted'.

Parameters:
privateShareRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

addToMyBox

AddToMyBoxResponse addToMyBox(AddToMyBoxRequest addToMyBoxRequest)
                              throws java.io.IOException,
                                     BoxException
This method copies a file publicly shared by someone to a user's mybox. 'file_id' and 'public_name' params identify a publicly shared file, you should provide either file_id or public name (like '31nhke0ahp') as a parameter. 'folder_id' is the id of a user's folder, where files are to be copied. On a successful result, the status will be 'addtomybox_ok'. If the result wasn't successful, the status field can be: 'addtomybox_error', 'not_logged_id', 'application_restricted', 's_link_exists'.

Parameters:
addToMyBoxRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

addToTag

AddToTagResponse addToTag(AddToTagRequest addToTagRequest)
                          throws java.io.IOException,
                                 BoxException
This method adds file or folder to tags list. 'target' param can be either 'file' or 'folder' depending on what do you want to add, 'target_id' is the id of a file or folder to be added, 'tags' array of tags where target will be added. On successful a result, you will receive 'addtotag_ok'. If the result wasn't successful, status field can be: addtotag_error.

Parameters:
addToTagRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

getFileInfo

GetFileInfoResponse getFileInfo(GetFileInfoRequest getFileInfoRequest)
                                throws java.io.IOException,
                                       BoxException
This method gets file info. 'file_id' param should contain valid if of user file. On successful a result, you will receive status 's_get_file_info' and file info in 'info'. If the result wasn't successful, status field can be: e_access_denied.

Parameters:
getFileInfoRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

setDescription

SetDescriptionResponse setDescription(SetDescriptionRequest setDescriptionRequest)
                                      throws java.io.IOException,
                                             BoxException
This method sets a description to a file or folder. 'target' can be a 'file' or 'folder', 'target_id' - id of file or folder, description - string that should be set as description. On successful a result, you will receive status 's_set_description'. If the result wasn't successful, status field can be: e_set_description.

Parameters:
setDescriptionRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

getFriends

GetFriendsResponse getFriends(GetFriendsRequest getFriendsRequest)
                              throws java.io.IOException,
                                     BoxException
This method is used to retrieve a list of freinds. 'params' is an array of the string where you can set additional parameters, which are: nozip - do not zip tree xml. On a successful result you will receive 's_get_friends' as the status and base64 encoded (and zipped) friends xml. Friends xml looks like this: ......

Parameters:
getFriendsRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

requestFriends

RequestFriendsResponse requestFriends(RequestFriendsRequest requestFriendsRequest)
                                      throws java.io.IOException,
                                             BoxException
This method requests new friends to be added to your network. 'emails' - array of emails. 'message' - text message that you want to send to freinds. 'params' is an array of string where you can set additional parameters, which are: box_auto_subscribe - subscribe to public boxes of inveted users. no_email - don't send emails to invited users. On a successful result, you will receive status 's_request_friends'. If the result wasn't successful, status field can be: e_request_friends.

Parameters:
requestFriendsRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

download

DownloadResponse download(DownloadRequest downloadRequest)
                          throws java.io.IOException,
                                 BoxException
download a file.

Parameters:
downloadRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception

upload

UploadResponse upload(UploadRequest uploadRequest)
                      throws java.io.IOException,
                             BoxException
upload files.

Parameters:
uploadRequest - request object
Returns:
response object
Throws:
java.io.IOException - IO exception
BoxException - box exception