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.UserService#unfollowUser(java.lang.String)
   */
  @Override
  public void unfollowUser(String userName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.UNFOLLOW_USER_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).buildUrl();
    callApiPost(apiUrl, new HashMap<String, String>());
  }
View Full Code Here


  /* (non-Javadoc)
   * @see com.github.api.v2.services.UserService#getUserOrganizations(java.lang.String)
   */
  @Override
  public List<Organization> getUserOrganizations(String userName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.GET_USER_ORGANIZATIONS);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).buildUrl();
        JsonObject json = unmarshall(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<List<Organization>>(){}, json.get("organizations"));
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.UserService#updateUser(com.github.api.v2.schema.User)
   */
  @Override
  public void updateUser(User user) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.UserApiUrls.UPDATE_USER_URL);
    String userName = (user.getUsername() == null) ? user.getLogin() : user.getUsername();
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).buildUrl();
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put("values[" + ParameterNames.NAME + "]", user.getName());
        parameters.put("values[" + ParameterNames.EMAIL + "]", user.getEmail());
        parameters.put("values[" + ParameterNames.BLOG + "]", user.getBlog());
        parameters.put("values[" + ParameterNames.COMPANY + "]", user.getCompany());
View Full Code Here

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

  /* (non-Javadoc)
   * @see com.github.api.v2.services.RepositoryService#addDeployKey(java.lang.String, java.lang.String, java.lang.String)
   */
  @Override
  public List<Key> addDeployKey(String repositoryName, String title, String key) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.ADD_DEPLOY_KEY_URL);
        String                apiUrl  = builder.withField(ParameterNames.REPOSITORY_NAME, repositoryName).buildUrl();
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ParameterNames.TITLE, title);
        parameters.put(ParameterNames.KEY, key);
        JsonObject json = unmarshall(callApiPost(apiUrl, parameters));
       
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.RepositoryService#changeVisibility(java.lang.String, com.github.api.v2.schema.Repository.Visibility)
   */
  @Override
  public void changeVisibility(String repositoryName, Visibility visibility) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.CHANGE_VISIBILITY_URL);
        String                apiUrl  = builder.withField(ParameterNames.REPOSITORY_NAME, repositoryName).withFieldEnum(ParameterNames.VISIBILITY, visibility).buildUrl();
        JsonObject json = unmarshall(callApiPost(apiUrl, new HashMap<String, String>()));
       
        unmarshall(new TypeToken<Repository>(){}, json.get("repository"));
  }
View Full Code Here

   * @see com.github.api.v2.services.RepositoryService#createRepository(java.lang.String, java.lang.String, java.lang.String, com.github.api.v2.schema.Repository.Visibility)
   */
  @Override
  public Repository createRepository(String name, String description,
      String homePage, Visibility visibility) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.CREATE_REPOSITORY_URL);
        String                apiUrl  = builder.buildUrl();
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ParameterNames.NAME, name);
        parameters.put(ParameterNames.DESCRIPTION, description);
        parameters.put(ParameterNames.HOME_PAGE, homePage);
        parameters.put(ParameterNames.PUBLIC, ((visibility == Visibility.PUBLIC)? "1" : "0"));
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.RepositoryService#deleteRepository(java.lang.String)
   */
  @Override
  public void deleteRepository(String repositoryName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.DELETE_REPOSITORY_URL);
        String                apiUrl  = builder.withField(ParameterNames.REPOSITORY_NAME, repositoryName).buildUrl();
        JsonObject json = unmarshall(callApiPost(apiUrl, new HashMap<String, String>()));
        if (json.has("delete_token")) {
          Map<String, String> parameters = new HashMap<String, String>();
          parameters.put(ParameterNames.DELETE_TOKEN, json.get("delete_token").getAsString());
          callApiPost(apiUrl, parameters);
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.RepositoryService#forkRepository(java.lang.String, java.lang.String)
   */
  @Override
  public Repository forkRepository(String userName, String repositoryName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.FORK_REPOSITORY_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).buildUrl();
        JsonObject json = unmarshall(callApiPost(apiUrl, new HashMap<String, String>()));
        return unmarshall(new TypeToken<Repository>(){}, json.get("repository"));
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.github.api.v2.services.RepositoryService#getBranches(java.lang.String, java.lang.String)
   */
  @Override
  public Map<String, String> getBranches(String userName, String repositoryName) {
    GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.RepositoryApiUrls.GET_BRANCHES_URL);
        String                apiUrl  = builder.withField(ParameterNames.USER_NAME, userName).withField(ParameterNames.REPOSITORY_NAME, repositoryName).buildUrl();
        JsonObject json = unmarshall(callApiGet(apiUrl));
       
        return unmarshall(new TypeToken<Map<String, String>>(){}, json.get("branches"));
  }
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.