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

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


   * @see com.github.api.v2.services.RepositoryService#unwatchRepository(java.lang.String, java.lang.String)
   */
  @Override
  public void unwatchRepository(String userName, String repositoryName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.UNWATCH_REPOSITORY_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).buildUrl();
        unmarshall(callApiPost(apiUrl, new HashMap<String, String>()));
  }

  /* (non-Javadoc)
   * @see com.github.api.v2.services.RepositoryService#updateRepository(com.github.api.v2.schema.Repository)
View Full Code Here


   * @see com.github.api.v2.services.RepositoryService#updateRepository(com.github.api.v2.schema.Repository)
   */
  @Override
  public void updateRepository(Repository repository) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.UPDATE_REPOSITORY_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, repository.getOwner()).withField(ParameterNames.REPOSITORY_NAME, repository.getName()).buildUrl();
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put("values[" + ParameterNames.DESCRIPTION + "]", repository.getDescription());
        parameters.put("values[" + ParameterNames.HOME_PAGE + "]", repository.getHomepage());
        parameters.put("values[" + ParameterNames.HAS_WIKI + "]", String.valueOf(repository.isHasWiki()));
        parameters.put("values[" + ParameterNames.HAS_ISSUES + "]", String.valueOf(repository.isHasIssues()));
View Full Code Here

   * @see com.github.api.v2.services.RepositoryService#watchRepository(java.lang.String, java.lang.String)
   */
  @Override
  public void watchRepository(String userName, String repositoryName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.WATCH_REPOSITORY_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).buildUrl();
        unmarshall(callApiPost(apiUrl, new HashMap<String, String>()));
  }
 
  /* (non-Javadoc)
   * @see com.github.api.v2.services.RepositoryService#getRepositoryArchive(java.lang.String, java.lang.String, java.lang.String)
View Full Code Here

   * @see com.github.api.v2.services.RepositoryService#getRepositoryArchive(java.lang.String, java.lang.String, java.lang.String)
   */
  @Override
  public ZipInputStream getRepositoryArchive(String userName, String repositoryName, String branchName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.GET_REPOSITORY_ARCHIVE_URL);
      String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).withField(ParameterNames.BRANCH, branchName).buildUrl();
      return new ZipInputStream(callApiGet(apiUrl));
  }
}
View Full Code Here

   * @see com.github.api.v2.services.GistService#getGist(java.lang.String)
   */
  @Override
  public Gist getGist(String gistId) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.GET_GIST_URL);
        String                apiUrl  = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
        JsonObject json = unmarshall(callApiGet(apiUrl));
        return unmarshall(new TypeToken<Gist>(){}, json);
  }

  /* (non-Javadoc)
 
View Full Code Here

   * @see com.github.api.v2.services.GistService#getGistContent(java.lang.String, java.lang.String)
   */
  @Override
  public InputStream getGistContent(String gistId, String fileName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.GET_GIST_CONTENT_URL);
        String                apiUrl  = builder.withField(ParameterNames.GIST_ID, gistId).withField(ParameterNames.FILE_NAME, fileName).buildUrl();
        return callApiGet(apiUrl);
  }

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#getUserGists(java.lang.String)
View Full Code Here

   * @see com.github.api.v2.services.GistService#getUserGists(java.lang.String)
   */
  @Override
  public List<Gist> getUserGists(String userName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.GET_USER_GISTS_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).buildUrl();
        JsonElement json = unmarshallArray(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<Gist>>(){}, json);
  }

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();
View Full Code Here

   * @see com.github.api.v2.services.GistService#deleteGist(java.lang.String)
   */
  @Override
  public void deleteGist(String gistId) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.DELETE_GIST_URL);
    String apiUrl = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
    callApiDelete(apiUrl, 200);
  }

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#forkGist(java.lang.String)
View Full Code Here

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

  /* (non-Javadoc)
 
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.