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, OrganizationLinkerService organizationLinkerService, CourseRepository courseRepository, JobService jobService) -
Method Summary
Modifier and TypeMethodDescriptionReturn commits for a given repository.getDefaultBasePermission(Long courseId) Return default base permission for the GitHub organization associated with a course.getDefaultBranchName(Long courseId, String owner, String repo) Return default branch name for a given repository.Methods inherited from class edu.ucsb.cs156.frontiers.controllers.ApiController
doesCurrentUserHaveRole, genericMessage, getCurrentUser, handleDuplicateGroupException, handleEntityNotFoundException, handleIllegalArgument, handleNoLinkedOrgException, handleUnsupportedOperation, handleValidationException, isCurrentUserAdmin
-
Constructor Details
-
GithubGraphQLController
public GithubGraphQLController(@Autowired GithubGraphQLService gitHubGraphQLService, @Autowired OrganizationLinkerService organizationLinkerService, @Autowired CourseRepository courseRepository, JobService jobService)
-
-
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
-
getDefaultBasePermission
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @GetMapping("defaultbasepermission") public String getDefaultBasePermission(Long courseId) throws Exception Return default base permission for the GitHub organization associated with a course.- Parameters:
courseId- the id of the course whose installation is being used for credentials- Returns:
- the default base permission
- Throws:
Exception
-
getCommits
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @GetMapping("commits") public String getCommits(Long courseId, String owner, String repo, String branch, Integer first, String after) throws Exception Return commits 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 repositorybranch- the branch namefirst- the number of commits to fetchafter- pagination cursor- Returns:
- commits as JSON
- Throws:
Exception
-