public GitHubDeployKey getDeployKey(final String user, final String repo, final int id) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("user", user); uriVariables.put("repo", repo); uriVariables.put("id", id); return getRestTemplate().getForObject(buildRepoUri("/keys/{id}", uriVariables), GitHubDeployKey.class); }
public List<GitHubDeployKey> getDeployKeys(final String user, final String repo) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("user", user); uriVariables.put("repo", repo); return asList(getRestTemplate().getForObject(buildRepoUri("/keys", uriVariables), GitHubDeployKey[].class)); }
@Override public GitHubWebhook getWebhook(final String user, final String repo, final String id) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("user", user); uriVariables.put("repo", repo); uriVariables.put("id", id); return getRestTemplate().getForObject(buildRepoUri("/hooks/{id}", uriVariables), GitHubWebhook.class); }
public GitHubRepo getRepository(final String user, final String repo) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("user", user); uriVariables.put("repo", repo); return getRestTemplate().getForObject(buildRepoUri("", uriVariables), GitHubRepo.class); }
@Override public List<GitHubWebhook> getWebhooks(final String user, final String repo) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("user", user); uriVariables.put("repo", repo); return asList(getRestTemplate().getForObject(buildRepoUri("/hooks", uriVariables), GitHubWebhook[].class)); }
public void deleteDeployKey(final String owner, final String repo, final int id) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("user", owner); uriVariables.put("repo", repo); uriVariables.put("id", id); getRestTemplate().delete(buildRepoUri("/keys/{id}")); }
@Override public void deleteWebhook(final String user, final String repo, final String id) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("user", user); uriVariables.put("repo", repo); uriVariables.put("id", id); getRestTemplate().delete(buildRepoUri("/hooks/{id}", uriVariables)); }
@Override public GitHubWebhook addWebhook(final String user, final String repo, final Object request) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("user", user); uriVariables.put("repo", repo); return getRestTemplate().postForObject(buildRepoUri("/hooks", uriVariables), request, GitHubWebhook.class); }
public GitHubDeployKey addDeployKey(final String owner, final String repo, final String title, final String key) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("user", owner); uriVariables.put("repo", repo); AddDeployKeyRequest request = new AddDeployKeyRequest(title, key); return getRestTemplate().postForObject(buildRepoUri("/keys", uriVariables), request, GitHubDeployKey.class); }