Class GithubGraphQLController
java.lang.Object
edu.ucsb.cs156.frontiers.controllers.ApiController
edu.ucsb.cs156.frontiers.controllers.GithubGraphQLController
@RequestMapping("/api/github/graphql/")
@RestController
public class GithubGraphQLController
extends ApiController
-
Constructor Summary
ConstructorsConstructorDescriptionGithubGraphQLController(GithubGraphQLService gitHubGraphQLService, CourseRepository courseRepository, JobService jobService, CommitRepository commitRepository, StatefulBeanToCsvBuilderFactory statefulBeanToCsvBuilderFactory, BranchRepository branchRepository) -
Method Summary
Modifier and TypeMethodDescriptionReturn default branch name for a given repository.org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody> getCommitsCsv(Long courseId, Instant start, Instant end, Boolean skipMergeCommits, @Valid List<BranchId> branches) getDefaultBranchName(Long courseId, String owner, String repo) Return default branch name for a given repository.loadCommitHistory(Long courseId, @Valid List<BranchId> branches) Returns a job to load the commit data of a number of branchesMethods inherited from class edu.ucsb.cs156.frontiers.controllers.ApiController
doesCurrentUserHaveRole, genericMessage, getCurrentUser, handleEntityNotFoundException, handleIllegalArgument, handleNoLinkedOrgException, handleUnsupportedOperation, handleValidationException, isCurrentUserAdmin
-
Constructor Details
-
GithubGraphQLController
public GithubGraphQLController(@Autowired GithubGraphQLService gitHubGraphQLService, @Autowired CourseRepository courseRepository, JobService jobService, CommitRepository commitRepository, StatefulBeanToCsvBuilderFactory statefulBeanToCsvBuilderFactory, BranchRepository branchRepository)
-
-
Method Details
-
getDefaultBranchName
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @GetMapping("defaultBranchName") public String getDefaultBranchName(Long courseId, String owner, String repo) throws Exception Return default branch name for a given repository.- Parameters:
courseId- the id of the course whose installation is being used for credentailsowner- the owner of the repositoryrepo- the name of the repository- Returns:
- the default branch name
- Throws:
Exception
-
getCommits
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @GetMapping("commits") public String getCommits(Long courseId, String owner, String repo, String branch, Integer first, @RequestParam(name="after",required=false) String after) throws Exception Return default branch name for a given repository.- Parameters:
courseId- the id of the course whose installation is being used for credentailsowner- the owner of the repositoryrepo- the name of the repository- Returns:
- the default branch name
- Throws:
Exception
-
loadCommitHistory
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @PostMapping("history") public Job loadCommitHistory(Long courseId, @Valid @RequestBody @Valid List<BranchId> branches) throws Exception Returns a job to load the commit data of a number of branches- Parameters:
courseId- the id of the course whose installation is being used for credentialsbranches- the list of branches to load- Returns:
- the job identifier
- Throws:
Exception
-
getCommitsCsv
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @PostMapping(value="csv", produces="text/csv") public org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody> getCommitsCsv(Long courseId, Instant start, Instant end, Boolean skipMergeCommits, @Valid @RequestBody @Valid List<BranchId> branches) throws Exception - Throws:
Exception
-