Package com.atlassian.bamboo.plugins.git
Class GitHubAccessor
java.lang.Object
com.atlassian.bamboo.plugins.git.GitHubAccessor
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
protected static class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionGitHubAccessor
(String username, String password, String apiBaseUrl, com.atlassian.plugins.whitelist.OutboundWhitelist outboundWhitelist) -
Method Summary
Modifier and TypeMethodDescriptionboolean
commentOnCommit
(String commitId, VcsRepositoryData repositoryData, String message) protected GitHubAccessor.HttpResponse
void
deleteComment
(String repo, String commentId) getBranches
(String userRepo) getCommentIds
(String repo, String commitId) getCommits
(String repo) getPullRequests
(VcsRepositoryData repositoryData) protected GitHubAccessor.HttpResponse
getStringFromUrl
(String url) Get a string from a given URL.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 -
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
-
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
-