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

Examples of com.github.api.v2.services.constant.GitHubApiUrls.GitHubApiUrlBuilder


  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#forkGist(java.lang.String)
   */
  @Override
  public void forkGist(String gistId) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.DELETE_GIST_URL);
    String apiUrl = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
    Map<String, String> parameters = new HashMap<String, String>();
    callApiPost(apiUrl, parameters, 201);
  }
View Full Code Here


  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#isGistStarred(java.lang.String)
   */
  @Override
  public boolean isGistStarred(String gistId) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.IS_GIST_STARRED_URL);
    String apiUrl = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
    try {
      callApiGet(apiUrl, 204);
      return true;
    } catch (Exception e) {}
    return false;
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#starGist(java.lang.String)
   */
  @Override
  public void starGist(String gistId) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.STAR_GIST_URL);
    String apiUrl = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
    Map<String, String> parameters = new HashMap<String, String>();
    callApiPost(apiUrl, parameters, 201);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#unstarGist(java.lang.String)
   */
  @Override
  public void unstarGist(String gistId) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.UNSTAR_GIST_URL);
    String apiUrl = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
    callApiDelete(apiUrl, 204);
  }
View Full Code Here

   * @see com.github.api.v2.services.GistService#updateGist(java.lang.String, java.lang.String, java.util.Map)
   */
  @Override
  public Gist updateGist(String gistId, String description,
      Map<String, String> contents) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.UPDATE_GIST_URL);
    String apiUrl = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
    Gist gist = new Gist();
    gist.setDescription(description);
    for (String filename : contents.keySet()) {
      File file = new File();
      file.setFilename(filename);
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#createGistComment(java.lang.String, java.lang.String)
   */
  @Override
  public Comment createGistComment(String gistId, String commentText) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.CREATE_GIST_COMMENT_URL);
    String apiUrl = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
    Comment comment = new Comment();
    comment.setBody(commentText);
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(comment), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 201));
        return unmarshall(new TypeToken<Comment>(){}, json);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#deleteGistComment(java.lang.String)
   */
  @Override
  public void deleteGistComment(String commentId) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.DELETE_GIST_COMMENT_URL);
    String apiUrl = builder.withField(ParameterNames.COMMENT_ID, commentId).buildUrl();
    callApiDelete(apiUrl, 200);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#getGistComment(java.lang.String)
   */
  @Override
  public Comment getGistComment(String commentId) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.GET_GIST_COMMENT_URL);
        String                apiUrl  = builder.withField(ParameterNames.COMMENT_ID, commentId).buildUrl();
        JsonObject json = unmarshall(callApiGet(apiUrl));
        return unmarshall(new TypeToken<Comment>(){}, json);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#getGistComments(java.lang.String)
   */
  @Override
  public List<Comment> getGistComments(String gistId) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.GET_GIST_COMMENTS_URL);
        String                apiUrl  = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
        JsonElement json = unmarshallArray(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<Comment>>(){}, json);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#updateGistComment(java.lang.String, java.lang.String)
   */
  @Override
  public Comment updateGistComment(String commentId, String commentText) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.UPDATE_GIST_COMMENT_URL);
    String apiUrl = builder.withField(ParameterNames.COMMENT_ID, commentId).buildUrl();
    Comment comment = new Comment();
    comment.setBody(commentText);
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(comment), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 200));
        return unmarshall(new TypeToken<Comment>(){}, json);
  }
View Full Code Here

TOP

Related Classes of com.github.api.v2.services.constant.GitHubApiUrls.GitHubApiUrlBuilder

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.