Package com.github.api.v2.services

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


  /* (non-Javadoc)
   * @see com.github.api.v2.services.RepositoryService#searchRepositories(java.lang.String, int)
   */
  @Override
  public List<Repository> searchRepositories(String query, int pageNumber) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.SEARCH_REPOSITORIES_URL);
        String                apiUrl  = builder.withField(ParameterNames.KEYWORD, query).withParameter(ParameterNames.START_PAGE, String.valueOf(pageNumber)).buildUrl();
        JsonObject json = unmarshall(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<Repository>>(){}, json.get("repositories"));
  }
View Full Code Here


   * @see com.github.api.v2.services.RepositoryService#searchRepositories(java.lang.String, com.github.api.v2.schema.Language, int)
   */
  @Override
  public List<Repository> searchRepositories(String query, Language language,
      int pageNumber) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.SEARCH_REPOSITORIES_URL);
        String                apiUrl  = builder.withField(ParameterNames.KEYWORD, query).withParameterEnum(ParameterNames.LANGUAGE, language).withParameter(ParameterNames.START_PAGE, String.valueOf(pageNumber)).buildUrl();
        JsonObject json = unmarshall(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<Repository>>(){}, json.get("repositories"));
  }
View Full Code Here

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

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

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

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

   * Creates a new GitHubService object.
   *
   * @return the commit service
   */
    public CommitService createCommitService() {
      return new CommitServiceImpl();
    }
View Full Code Here

   * Creates a new GitHubService object.
   *
   * @return the feed service
   */
    public FeedService createFeedService() {
      return new FeedServiceImpl();     
    }
View Full Code Here

TOP

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

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.