Package com.github.api.v2.services.constant.GitHubApiUrls

Examples of com.github.api.v2.services.constant.GitHubApiUrls.GitHubApiUrlBuilder.buildUrl()


   * @see com.github.api.v2.services.UserService#addEmail(java.lang.String)
   */
  @Override
  public void addEmail(String email) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.ADD_EMAIL_URL);
        String                apiUrl  = builder.buildUrl();
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ParameterNames.EMAIL, email);
    callApiPost(apiUrl, parameters);
  }

View Full Code Here


   * @see com.github.api.v2.services.UserService#addKey(java.lang.String, java.lang.String)
   */
  @Override
  public void addKey(String title, String key) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.ADD_KEY_URL);
        String                apiUrl  = builder.buildUrl();
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ParameterNames.TITLE, title);
        parameters.put(ParameterNames.KEY, key);
    callApiPost(apiUrl, parameters);
  }
View Full Code Here

   * @see com.github.api.v2.services.UserService#getCurrentUser()
   */
  @Override
  public User getCurrentUser() {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.GET_CURRENT_USER_URL);
        String                apiUrl  = builder.buildUrl();
        JsonObject json = unmarshall(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<User>(){}, json.get("user"));
  }

View Full Code Here

   * @see com.github.api.v2.services.UserService#getEmails()
   */
  @Override
  public List<String> getEmails() {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.GET_EMAILS_URL);
        String                apiUrl  = builder.buildUrl();
        JsonObject json = unmarshall(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<String>>(){}, json.get("emails"));
  }

View Full Code Here

   * @see com.github.api.v2.services.UserService#getKeys()
   */
  @Override
  public List<Key> getKeys() {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.GET_KEYS_URL);
        String                apiUrl  = builder.buildUrl();
        JsonObject json = unmarshall(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<Key>>(){}, json.get("public_keys"));
  }

View Full Code Here

   * @see com.github.api.v2.services.UserService#removeEmail(java.lang.String)
   */
  @Override
  public void removeEmail(String email) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.REMOVE_EMAIL_URL);
        String                apiUrl  = builder.buildUrl();
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ParameterNames.EMAIL, email);
    callApiPost(apiUrl, parameters);
  }

View Full Code Here

   * @see com.github.api.v2.services.UserService#removeKey(java.lang.String)
   */
  @Override
  public void removeKey(String id) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.REMOVE_KEY_URL);
        String                apiUrl  = builder.buildUrl();
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ParameterNames.ID, id);
    callApiPost(apiUrl, parameters);
  }

View Full Code Here

     */
    @Override
  public String getAuthorizationUrl(String callBackUrl) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.OAuthUrls.AUTHORIZE_URL);
    builder.withParameter(ParameterNames.CLIENT_ID, clientId).withParameter(ParameterNames.REDIRECT_URI, callBackUrl);
    return builder.buildUrl();
  }
   
  /* (non-Javadoc)
   * @see com.google.code.facebook.graph.client.oauth.FacebookOAuthService#getAuthorizationUrl(java.lang.String, java.util.Set)
   */
 
View Full Code Here

  public String getAuthorizationUrl(String callBackUrl,
      Set<Scope> permissions) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.OAuthUrls.AUTHORIZE_URL);
    builder.withParameter(ParameterNames.CLIENT_ID, clientId).withParameter(ParameterNames.REDIRECT_URI, callBackUrl);
    builder.withParameterEnumSet(ParameterNames.SCOPE, permissions, ",");
    return builder.buildUrl();
  }

    /* (non-Javadoc)
     * @see com.google.code.facebook.graph.client.oauth.FacebookOAuthService#getAccessToken(java.lang.String, java.lang.String)
     */
 
View Full Code Here

        builder.withParameter(ParameterNames.CLIENT_ID, clientId);
        builder.withParameter(ParameterNames.CLIENT_SECRET, secret);
        builder.withParameter(ParameterNames.REDIRECT_URI, callBackUrl);
        builder.withParameter(ParameterNames.CODE, code);
       
      String response = convertStreamToString(callApiGet(builder.buildUrl()));
      Matcher matcher = ApplicationConstants.ACCESS_TOKEN_PATTERN.matcher(response);
      if (matcher.find()) {
              return matcher.group(1);
            } else {
              throw new GitHubException(response);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.