Package com.github.api.v2.services

Examples of com.github.api.v2.services.OAuthServiceTest


  @Override
  public Comment addIssueComment(String userName, String repositoryName,
      int issueNumber, String comment) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.IssueApiUrls.ADD_ISSUE_COMMENT_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).withField(ParameterNames.ISSUE_NUMBER, String.valueOf(issueNumber)).buildUrl();
    Comment bean = new Comment();
    bean.setBody(comment);
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(bean), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 201));
        return unmarshall(new TypeToken<Comment>(){}, json);
  }
View Full Code Here


  @Override
  public Comment updateIssueComment(String userName, String repositoryName,
      String commentId, String comment) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.IssueApiUrls.UPDATE_ISSUE_COMMENT_URL);
    String apiUrl = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).withField(ParameterNames.COMMENT_ID, commentId).buildUrl();
    Comment bean = new Comment();
    bean.setBody(comment);
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(bean), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 200));
        return unmarshall(new TypeToken<Comment>(){}, json);
  }
View Full Code Here

   */
  @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

   */
  @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

    List<Commit> commits = service.getCommits("facebook", "tornado", Repository.MASTER, "setup.py");
    System.out.println(commits.size());
    for (Commit commit : commits) {
      printResult(commit);
    }
    Commit commit = service.getCommit("facebook", "tornado", "7b80c2f4db226d6fa3a7");
    printResult(commit);
  }
View Full Code Here

   *            the arguments
   */
  public static void main(String[] args) {
    GitHubServiceFactory factory = GitHubServiceFactory.newInstance();
    FeedService service = factory.createFeedService();
    Feed feed = service.getPublicUserFeed("apache", 10);
    printResult(feed);
  }
View Full Code Here

    String apiUrl = builder.withField(ParameterNames.USER_NAME, userName).buildUrl();
    Gist gist = new Gist();
    gist.setDescription(description);
    gist.setVisibility(visibility);
    for (String filename : contents.keySet()) {
      File file = new File();
      file.setFilename(filename);
      file.setContent(contents.get(filename));
     
      gist.getFiles().put(filename, file);
    }
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(gist), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 201));
        return unmarshall(new TypeToken<Gist>(){}, json);
View Full Code Here

    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);
      file.setContent(contents.get(filename));
     
      gist.getFiles().put(filename, file);
    }
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(gist), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 200));
        return unmarshall(new TypeToken<Gist>(){}, json);
View Full Code Here

   *            the arguments
   */
  public static void main(String[] args) {
    GitHubServiceFactory factory = GitHubServiceFactory.newInstance();
    GistService service = factory.createGistService();
    Gist gist = service.getGist("289179");
    printResult(gist);
    System.out.println(convertStreamToString(service.getGistContent("289179", "TimeZoneDSTUtil.java")));
  }
View Full Code Here

  @Override
  public Gist createGist(String userName, String description, Visibility visibility,
      Map<String, String> contents) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.CREATE_GIST_URL);
    String apiUrl = builder.withField(ParameterNames.USER_NAME, userName).buildUrl();
    Gist gist = new Gist();
    gist.setDescription(description);
    gist.setVisibility(visibility);
    for (String filename : contents.keySet()) {
      File file = new File();
      file.setFilename(filename);
      file.setContent(contents.get(filename));
     
      gist.getFiles().put(filename, file);
    }
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(gist), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 201));
        return unmarshall(new TypeToken<Gist>(){}, json);
  }
View Full Code Here

TOP

Related Classes of com.github.api.v2.services.OAuthServiceTest

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.