Package com.spotify.github.v3.clients
Class RepositoryClient
- java.lang.Object
-
- com.spotify.github.v3.clients.RepositoryClient
-
public class RepositoryClient extends Object
Repository API client
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<CommitComparison>
compareCommits(String base, String head)
Compare two commits content.ChecksClient
createChecksApiClient()
Create a checks API clientCompletableFuture<Comment>
createComment(String sha, String body)
Create a comment for a given issue number.GithubAppClient
createGithubAppClient()
Create Github App API clientIssueClient
createIssueClient()
Create an issue API client.PullRequestClient
createPullRequestClient()
Create a pull request API client.CompletableFuture<Void>
createWebhook(WebhookCreate request, boolean ignoreExisting)
Create a webhook.CompletableFuture<Void>
deleteComment(int id)
Delete a comment for a given id.CompletableFuture<Void>
editComment(int id, String body)
Edit a comment for a given id.CompletableFuture<Branch>
getBranch(String branch)
Get a specific branch.CompletableFuture<Comment>
getComment(int id)
Get a specific comment.CompletableFuture<Commit>
getCommit(String sha)
Get a repository commit.CompletableFuture<CommitStatus>
getCommitStatus(String ref)
Get status for a given commit.CompletableFuture<Content>
getFileContent(String path)
Get repository contents of a file.CompletableFuture<Content>
getFileContent(String path, String ref)
Get repository contents of a file.CompletableFuture<List<FolderContent>>
getFolderContent(String path)
Get repository contents of a folder.CompletableFuture<List<FolderContent>>
getFolderContent(String path, String ref)
Get repository contents of a folder.CompletableFuture<Repository>
getRepository()
Get information about this repository.CompletableFuture<Tree>
getTree(String sha)
Get a repository tree.CompletableFuture<List<CommitItem>>
listCommits()
List repository commits.CompletableFuture<List<Status>>
listCommitStatuses(String sha)
List statuses for a specific ref.CompletableFuture<Void>
setCommitStatus(String sha, RepositoryCreateStatus request)
Set status for a given commit.
-
-
-
Method Detail
-
createIssueClient
public IssueClient createIssueClient()
Create an issue API client.- Returns:
- issue API client
-
createPullRequestClient
public PullRequestClient createPullRequestClient()
Create a pull request API client.- Returns:
- pull request API client
-
createGithubAppClient
public GithubAppClient createGithubAppClient()
Create Github App API client- Returns:
- Github App API client
-
createChecksApiClient
public ChecksClient createChecksApiClient()
Create a checks API client- Returns:
- repository API client
-
getRepository
public CompletableFuture<Repository> getRepository()
Get information about this repository.- Returns:
- repository information
-
createWebhook
public CompletableFuture<Void> createWebhook(WebhookCreate request, boolean ignoreExisting)
Create a webhook.- Parameters:
request
- create requestignoreExisting
- if true hook exists errors will be ignored
-
setCommitStatus
public CompletableFuture<Void> setCommitStatus(String sha, RepositoryCreateStatus request)
Set status for a given commit.- Parameters:
sha
- the commit sha to set the status forrequest
- The body of the request to sent to github to create a commit status
-
getCommitStatus
public CompletableFuture<CommitStatus> getCommitStatus(String ref)
Get status for a given commit.- Parameters:
ref
- ref can be a sha, branch or tag name
-
listCommitStatuses
public CompletableFuture<List<Status>> listCommitStatuses(String sha)
List statuses for a specific ref.- Parameters:
sha
- the commit sha to list the statuses for
-
listCommits
public CompletableFuture<List<CommitItem>> listCommits()
List repository commits.- Returns:
- commits
-
getCommit
public CompletableFuture<Commit> getCommit(String sha)
Get a repository commit.- Parameters:
sha
- commit sha- Returns:
- commit
-
getTree
public CompletableFuture<Tree> getTree(String sha)
Get a repository tree.- Parameters:
sha
- commit sha- Returns:
- tree
-
getFileContent
public CompletableFuture<Content> getFileContent(String path)
Get repository contents of a file.- Parameters:
path
- path to a file- Returns:
- content
-
getFileContent
public CompletableFuture<Content> getFileContent(String path, String ref)
Get repository contents of a file.- Parameters:
path
- path to a fileref
- name of the commit/branch/tag- Returns:
- content
-
getFolderContent
public CompletableFuture<List<FolderContent>> getFolderContent(String path)
Get repository contents of a folder.- Parameters:
path
- path to a folder- Returns:
- content
-
createComment
public CompletableFuture<Comment> createComment(String sha, String body)
Create a comment for a given issue number.- Parameters:
sha
- the commit sha to create the comment onbody
- comment content- Returns:
- the Comment that was just created
-
getComment
public CompletableFuture<Comment> getComment(int id)
Get a specific comment.- Parameters:
id
- comment id- Returns:
- a comment
-
getFolderContent
public CompletableFuture<List<FolderContent>> getFolderContent(String path, String ref)
Get repository contents of a folder.- Parameters:
path
- path to a folderref
- name of the commit/branch/tag- Returns:
- content
-
compareCommits
public CompletableFuture<CommitComparison> compareCommits(String base, String head)
Compare two commits content.- Parameters:
base
- the base commithead
- the head commit- Returns:
- a CommitComparison object
-
getBranch
public CompletableFuture<Branch> getBranch(String branch)
Get a specific branch.- Parameters:
branch
- the branch name- Returns:
- a Branch
-
deleteComment
public CompletableFuture<Void> deleteComment(int id)
Delete a comment for a given id.- Parameters:
id
- the commit id to be deleted
-
editComment
public CompletableFuture<Void> editComment(int id, String body)
Edit a comment for a given id.- Parameters:
id
- the commit id to be editedbody
- comment content
-
-