Package com.github.api.v2.services

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


  @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);
      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


    IssueService service = factory.createIssueService();
    List<Issue> issues = service.searchIssues("facebook", "tornado", Issue.State.OPEN, "type");
    for (Issue issue : issues) {
      printResult(issue);
    }
    Issue issue = service.getIssue("facebook", "tornado", 1);
    printResult(issue);
  }
View Full Code Here

  @Override
  public void closeIssue(String userName, String repositoryName,
      int issueNumber) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.IssueApiUrls.UPDATE_ISSUE_URL);
    String apiUrl = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).withField(ParameterNames.ISSUE_NUMBER, String.valueOf(issueNumber)).buildUrl();
    Issue issue = new Issue();
    issue.setState(Issue.State.CLOSED);
        callApiMethod(apiUrl, marshall(issue), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 200);
  }
View Full Code Here

  @Override
  public Issue createIssue(String userName, String repositoryName,
      String title, String body) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.IssueApiUrls.CREATE_ISSUE_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).buildUrl();
    Issue issue = new Issue();
    issue.setTitle(title);
    issue.setBody(body);
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(issue), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 201));
        return unmarshall(new TypeToken<Issue>(){}, json);
  }
View Full Code Here

  @Override
  public void reopenIssue(String userName, String repositoryName,
      int issueNumber) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.IssueApiUrls.UPDATE_ISSUE_URL);
    String apiUrl = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).withField(ParameterNames.ISSUE_NUMBER, String.valueOf(issueNumber)).buildUrl();
    Issue issue = new Issue();
    issue.setState(Issue.State.OPEN);
        callApiMethod(apiUrl, marshall(issue), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 200);
  }
View Full Code Here

  @Override
  public Issue updateIssue(String userName, String repositoryName,
      int issueNumber, String title, String body) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.IssueApiUrls.UPDATE_ISSUE_URL);
    String apiUrl = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).withField(ParameterNames.ISSUE_NUMBER, String.valueOf(issueNumber)).buildUrl();
    Issue issue = new Issue();
    issue.setTitle(title);
    issue.setBody(body);
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(issue), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 200));
        return unmarshall(new TypeToken<Issue>(){}, json);
  }
View Full Code Here

  @Override
  public Issue updateIssue(String userName, String repositoryName,
      int issueNumber, String title, String body, State state) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.IssueApiUrls.UPDATE_ISSUE_URL);
    String apiUrl = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).withField(ParameterNames.ISSUE_NUMBER, String.valueOf(issueNumber)).buildUrl();
    Issue issue = new Issue();
    issue.setTitle(title);
    issue.setBody(body);
    issue.setState(state);
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(issue), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 200));
        return unmarshall(new TypeToken<Issue>(){}, json);
  }
View Full Code Here

    JobService service = factory.createJobService();
    List<Job> jobs = service.searchJobs("python", "new york");
    for (Job job : jobs) {
      printResult(job);
    }
    Job job = service.getJob("82eeae34-65ff-11e0-99be-a34ef36756d3");
    printResult(job);
  }
View Full Code Here

  @Override
  public Label addLabel(String userName, String repositoryName, String label,
      String color) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.IssueApiUrls.ADD_LABEL_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).buildUrl();
        Label bean = new Label();
        bean.setName(label);
        bean.setColor(color);
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(bean), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 201));
       
        return unmarshall(new TypeToken<Label>(){}, json);
  }
View Full Code Here

  @Override
  public Label updateLabel(String userName, String repositoryName,
      String labelId, String label, String color) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.IssueApiUrls.UPDATE_LABEL_URL);
    String apiUrl = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).withField(ParameterNames.LABEL_ID, labelId).buildUrl();
    Label bean = new Label();
    bean.setName(label);
    bean.setColor(color);
        JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(bean), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 200));
        return unmarshall(new TypeToken<Label>(){}, json);
  }
View Full Code Here

TOP

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

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.