Class GithubGraphQLService
java.lang.Object
edu.ucsb.cs156.frontiers.services.GithubGraphQLService
-
Constructor Summary
ConstructorsConstructorDescriptionGithubGraphQLService(org.springframework.web.client.RestClient.Builder builder, JwtService jwtService, com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper, DownloadedCommitRepository downloadedCommitRepository) -
Method Summary
Modifier and TypeMethodDescriptionvoiddownloadCommitHistory(DownloadRequest downloadRequest) getCommits(Course course, String owner, String repo, String branch, Instant since, Instant until, int size, String cursor) Retrieves the commit history for a specified branch of a GitHub repository within a given time range.getDefaultBranchName(Course course, String owner, String repo) Retrieves the name of the default branch for a given GitHub repository.
-
Constructor Details
-
GithubGraphQLService
public GithubGraphQLService(org.springframework.web.client.RestClient.Builder builder, JwtService jwtService, com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper, DownloadedCommitRepository downloadedCommitRepository)
-
-
Method Details
-
getDefaultBranchName
public String getDefaultBranchName(Course course, String owner, String repo) throws com.fasterxml.jackson.core.JsonProcessingException, NoSuchAlgorithmException, InvalidKeySpecException, NoLinkedOrganizationException Retrieves the name of the default branch for a given GitHub repository.- Parameters:
owner- The owner (username or organization) of the repository.repo- The name of the repository.- Returns:
- A Mono emitting the default branch name, or an empty Mono if not found.
- Throws:
com.fasterxml.jackson.core.JsonProcessingExceptionNoSuchAlgorithmExceptionInvalidKeySpecExceptionNoLinkedOrganizationException
-
getCommits
public String getCommits(Course course, String owner, String repo, String branch, int first, String after) throws com.fasterxml.jackson.core.JsonProcessingException, NoSuchAlgorithmException, InvalidKeySpecException, NoLinkedOrganizationException - Throws:
com.fasterxml.jackson.core.JsonProcessingExceptionNoSuchAlgorithmExceptionInvalidKeySpecExceptionNoLinkedOrganizationException
-
getCommits
public String getCommits(Course course, String owner, String repo, String branch, Instant since, Instant until, int size, String cursor) throws com.fasterxml.jackson.core.JsonProcessingException, NoSuchAlgorithmException, InvalidKeySpecException, NoLinkedOrganizationException Retrieves the commit history for a specified branch of a GitHub repository within a given time range.- Parameters:
course- The course entity, used to fetch the associated GitHub installation token.owner- The owner of the GitHub repository.repo- The name of the GitHub repository.branch- The branch of the repository for which the commit history is retrieved.since- The start time for fetching commits (inclusive). Optional. Can be null.until- The end time for fetching commits (exclusive). Optional. Can be null.size- The maximum number of commits to retrieve in one request.cursor- The pagination cursor pointing to the start of the commit history to fetch. Optional. Can be null.- Returns:
- A JSON string representing the commit history and associated metadata.
- Throws:
NoLinkedOrganizationException- If no linked organization exists for the specified course.com.fasterxml.jackson.core.JsonProcessingExceptionNoSuchAlgorithmExceptionInvalidKeySpecException
-
downloadCommitHistory
public void downloadCommitHistory(DownloadRequest downloadRequest) throws NoSuchAlgorithmException, InvalidKeySpecException, com.fasterxml.jackson.core.JsonProcessingException - Throws:
NoSuchAlgorithmExceptionInvalidKeySpecExceptioncom.fasterxml.jackson.core.JsonProcessingException
-