Package org.scribe.model

Examples of org.scribe.model.OAuthRequest


     * @return metadata of target file
     *
     * @see Entry
     */
    public Entry move(String from, String to) {
        OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_MOVE_URL);
        request.addQuerystringParameter("root", "dropbox");
        request.addQuerystringParameter("from_path", encode(from));
        request.addQuerystringParameter("to_path", encode(to));

        service.signRequest(accessToken, request);
        String content = checkMove(request.send()).getBody();

        return Json.parse(content, Entry.class);
    }
View Full Code Here


     * Delete the specified file.
     *
     * @param path to delete
     */
    public void delete(String path) {
        OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_DELETE_URL);
        request.addQuerystringParameter("root", "dropbox");
        request.addQuerystringParameter("path", encode(path));

        service.signRequest(accessToken, request);
        checkDelete(request.send());
    }
View Full Code Here

     * @return metadata of created folder
     *
     * @see Entry
     */
    public Entry createFolder(String path) {
        OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_CREATE_FOLDER_URL);
        request.addQuerystringParameter("root", "dropbox");
        request.addQuerystringParameter("path", encode(path));

        service.signRequest(accessToken, request);
        String content = checkCreateFolder(request.send()).getBody();

        return Json.parse(content, Entry.class);
    }
View Full Code Here

     * @param path of target folder
     *
     * @throws IOException iff exception while accessing file
     */
    public void putFile(File file, String path) throws IOException {
        OAuthRequest request = new OAuthRequest(Verb.POST, FILES_URL + encode(path));
        Multipart.attachFile(file, request);
        service.signRequest(accessToken, request);

        checkFiles(request.send());
    }
View Full Code Here

     * @param path to download
     *
     * @return special objects that provides different ways to access file
     */
    public EntryDownload getFile(String path) {
        OAuthRequest request = new OAuthRequest(Verb.GET, FILES_URL + encode(path));
        service.signRequest(accessToken, request);

        Response response = checkFiles(request.send());

        return new EntryDownload(response, path);
    }
View Full Code Here

     * @param format of thumbnail
     *
     * @return special objects that provides different ways to access thumbnail
     */
    public ThumbnailDownload getThumbnail(String path, ThumbnailSize size, ThumbnailFormat format) {
        OAuthRequest request = new OAuthRequest(Verb.GET, THUMBNAILS_URL + encode(path));

        if (size != THUMBNAIL_SIZE) {
            request.addQuerystringParameter("size", size.toString());
        }

        if (format != THUMBNAIL_FORMAT) {
            request.addQuerystringParameter("format", format.toString());
        }

        service.signRequest(accessToken, request);
        Response response = checkThumbnails(request.send());

        return new ThumbnailDownload(response, path, size, format);
    }
View Full Code Here

    return this.service.getAccessToken(t, v);
  }

  public UserInfo getUserInfo(Token accessToken) throws BaasBoxSocialException{

    OAuthRequest request = buildOauthRequestForUserInfo(accessToken);

    this.service.signRequest(accessToken, request);
    Response response = request.send();
    return extractUserInfo(response);
  }
View Full Code Here

    return null;
  }

  @Override
  protected OAuthRequest buildOauthRequestForUserInfo(Token accessToken) {
    return new OAuthRequest(Verb.GET, userInfoUrl());
  }
View Full Code Here

  @Override
  public UserInfo getUserInfo(Token accessToken) throws BaasBoxSocialException{
    this.secret=accessToken.getSecret();
    this.token=accessToken.getToken();
   
    OAuthRequest request = buildOauthRequestForUserInfo(accessToken);

    this.service.signRequest(accessToken, request);
    Response response = null;
    try {
      response = request.send();
    }catch(Exception e){
      //swallow
    }
    return extractUserInfo(response);
  }
View Full Code Here

 
 
  @Override
  protected OAuthRequest buildOauthRequestForUserInfo(Token accessToken) {
    return new OAuthRequest(Verb.GET, userInfoUrl());
  }
View Full Code Here

TOP

Related Classes of org.scribe.model.OAuthRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.