Package com.atlassian.bamboo.plugins.git
Class GitHubAccessor
java.lang.Object
com.atlassian.bamboo.plugins.git.GitHubAccessor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
protected static class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGitHubAccessor
(String username, String password, String apiBaseUrl, com.atlassian.plugins.whitelist.OutboundWhitelist outboundWhitelist) -
Method Summary
Modifier and TypeMethodDescriptionboolean
commentOnCommit
(String commitId, VcsRepositoryData repositoryData, String message) createWebhook
(@NotNull String owner, @NotNull String repo, @NotNull String bambooEntrypoint) protected GitHubAccessor.HttpResponse
void
deleteComment
(String repo, String commentId) void
destroyWebhook
(@NotNull String owner, @NotNull String repo, @NotNull String webhookId) getBranches
(String userRepo) getCommentIds
(String repo, String commitId) getCommits
(String repo) getCommits
(String owner, String repo) getPullRequests
(VcsRepositoryData repositoryData) protected GitHubAccessor.HttpResponse
getStringFromUrl
(String url) Get a string from a given URL.getWebhooks
(@NotNull String owner, @NotNull String repo) protected GitHubAccessor.HttpResponse
boolean
sendBuildStatus
(String commitId, VcsRepositoryData repositoryData, Map<String, String> payload) static String
transformBaseUrlToApiUrl
(@Nullable String baseUrl)
-
Field Details
-
GITHUB_API_BASE_URL
- See Also:
-
-
Constructor Details
-
GitHubAccessor
-
-
Method Details
-
getAccessibleRepositories
public Iterable<String> getAccessibleRepositories() throws IOException, GitHubAccessor.GitHubException -
getAccessibleRepositoriesAndBranches
public Map<String,Iterable<String>> getAccessibleRepositoriesAndBranches() throws IOException, GitHubAccessor.GitHubException -
getBranches
public Iterable<String> getBranches(String userRepo) throws IOException, GitHubAccessor.GitHubException -
getWebhooks
public Iterable<GithubWebhookDto> getWebhooks(@NotNull @NotNull String owner, @NotNull @NotNull String repo) throws IOException, GitHubAccessor.GitHubException -
createWebhook
public GithubWebhookDto createWebhook(@NotNull @NotNull String owner, @NotNull @NotNull String repo, @NotNull @NotNull String bambooEntrypoint) throws GitHubAccessor.GitHubException - Throws:
GitHubAccessor.GitHubException
-
destroyWebhook
public void destroyWebhook(@NotNull @NotNull String owner, @NotNull @NotNull String repo, @NotNull @NotNull String webhookId) throws GitHubAccessor.GitHubException - Throws:
GitHubAccessor.GitHubException
-
getUserOrganisations
-
getUserRepositories
-
getOrganisationRepositories
public Iterable<String> getOrganisationRepositories(String org) throws IOException, GitHubAccessor.GitHubException -
commentOnCommit
public boolean commentOnCommit(String commitId, VcsRepositoryData repositoryData, String message) throws RepositoryException, GitHubAccessor.GitHubException -
sendBuildStatus
public boolean sendBuildStatus(String commitId, VcsRepositoryData repositoryData, Map<String, String> payload) throws RepositoryException, GitHubAccessor.GitHubException -
getPullRequests
public List<GithubPullRequestDto> getPullRequests(VcsRepositoryData repositoryData) throws IOException, GitHubAccessor.GitHubException -
getCommits
-
getCommits
public List<String> getCommits(String owner, String repo) throws IOException, GitHubAccessor.GitHubException -
getCommentIds
public List<String> getCommentIds(String repo, String commitId) throws IOException, GitHubAccessor.GitHubException -
deleteComment
public void deleteComment(String repo, String commentId) throws IOException, GitHubAccessor.GitHubException -
getStringFromUrl
Get a string from a given URL.- Parameters:
url
- url to GET from.- Returns:
- a Pair of String (response body) and a map of response headers.
- Throws:
IOException
- if a problem occurred in the IO layer.
-
post
protected GitHubAccessor.HttpResponse post(@NotNull @NotNull String url, @NotNull @NotNull String payload, @Nullable @Nullable Multimap<String, String> headers) throws IOException- Throws:
IOException
-
delete
protected GitHubAccessor.HttpResponse delete(@NotNull @NotNull String url, @Nullable @Nullable Multimap<String, String> headers) throws IOException- Throws:
IOException
-
transformBaseUrlToApiUrl
-