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.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


   *            the url format
   *
   * @return the git hub api url builder
   */
  protected GitHubApiUrlBuilder createGitHubApiUrlBuilder(String urlFormat) {
    return new GitHubApiUrlBuilder(urlFormat);
  }
View Full Code Here

  /* (non-Javadoc)
   * @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);
  }
View Full Code Here

  /* (non-Javadoc)
   * @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);
  }
View Full Code Here

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

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#getOwnedGists()
   */
  @Override
  public List<Gist> getOwnedGists() {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.GET_OWNED_GISTS_URL);
        String                apiUrl  = builder.buildUrl();
        JsonElement json = unmarshallArray(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<Gist>>(){}, json);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#getPublicGists()
   */
  @Override
  public List<Gist> getPublicGists() {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.GET_PUBLIC_GISTS_URL);
        String                apiUrl  = builder.buildUrl();
        JsonElement json = unmarshallArray(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<Gist>>(){}, json);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.GistService#getStarredGists()
   */
  @Override
  public List<Gist> getStarredGists() {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.GET_STARRED_GISTS_URL);
        String                apiUrl  = builder.buildUrl();
        JsonElement json = unmarshallArray(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<Gist>>(){}, json);
  }
View Full Code Here

   * @see com.github.api.v2.services.GistService#createGist(java.lang.String, java.lang.String, com.github.api.v2.schema.Gist.Visibility, java.util.Map)
   */
  @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

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