Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ func (p *githubPlugin) createBranch(req *plugin.Request, res *plugin.Response) {
projectID := req.Caller.ProjectID
taskID := req.PathParam("taskId")

type bodyT struct {
type createBranchBody struct {
RepoID string `json:"repo_id"`
BranchName string `json:"branch_name"`
SourceBranch string `json:"source_branch"`
}
b, err := plugin.JSONBody[bodyT](req)
b, err := plugin.JSONBody[createBranchBody](req)
if err != nil || b.RepoID == "" || b.BranchName == "" {
apiError(res, 400, "BAD_REQUEST", "repo_id and branch_name are required")
return
Expand Down Expand Up @@ -113,11 +113,11 @@ func (p *githubPlugin) linkBranchToTask(req *plugin.Request, res *plugin.Respons
projectID := req.Caller.ProjectID
taskID := req.PathParam("taskId")

type bodyT struct {
type linkBranchToTaskBody struct {
RepoID string `json:"repo_id"`
BranchName string `json:"branch_name"`
}
b, err := plugin.JSONBody[bodyT](req)
b, err := plugin.JSONBody[linkBranchToTaskBody](req)
if err != nil || b.RepoID == "" || b.BranchName == "" {
apiError(res, 400, "BAD_REQUEST", "repo_id and branch_name are required")
return
Expand Down
8 changes: 4 additions & 4 deletions backend/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ func (p *githubPlugin) getIntegration(req *plugin.Request, res *plugin.Response)
func (p *githubPlugin) setToken(req *plugin.Request, res *plugin.Response) {
projectID := req.Caller.ProjectID

type bodyT struct {
type setTokenBody struct {
Token string `json:"token"`
}
b, err := plugin.JSONBody[bodyT](req)
b, err := plugin.JSONBody[setTokenBody](req)
if err != nil || b.Token == "" {
apiError(res, 400, "BAD_REQUEST", "token is required")
return
Expand Down Expand Up @@ -277,11 +277,11 @@ func (p *githubPlugin) listRepositories(req *plugin.Request, res *plugin.Respons
func (p *githubPlugin) linkRepository(req *plugin.Request, res *plugin.Response) {
projectID := req.Caller.ProjectID

type bodyT struct {
type linkRepositoryBody struct {
Owner string `json:"owner"`
RepoName string `json:"repo_name"`
}
b, err := plugin.JSONBody[bodyT](req)
b, err := plugin.JSONBody[linkRepositoryBody](req)
if err != nil || b.Owner == "" || b.RepoName == "" {
apiError(res, 400, "BAD_REQUEST", "owner and repo_name are required")
return
Expand Down
16 changes: 8 additions & 8 deletions backend/pull_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ func (p *githubPlugin) linkPRToTask(req *plugin.Request, res *plugin.Response) {
projectID := req.Caller.ProjectID
taskID := req.PathParam("taskId")

type bodyT struct {
type linkPRToTaskBody struct {
RepoID string `json:"repo_id"`
PRNumber int `json:"pr_number"`
}
b, err := plugin.JSONBody[bodyT](req)
b, err := plugin.JSONBody[linkPRToTaskBody](req)
if err != nil || b.RepoID == "" || b.PRNumber == 0 {
apiError(res, 400, "BAD_REQUEST", "repo_id and pr_number are required")
return
Expand Down Expand Up @@ -210,14 +210,14 @@ func (p *githubPlugin) createPullRequest(req *plugin.Request, res *plugin.Respon
projectID := req.Caller.ProjectID
taskID := req.PathParam("taskId")

type bodyT struct {
type createPullRequestBody struct {
RepoID string `json:"repo_id"`
Title string `json:"title"`
HeadBranch string `json:"head_branch"`
BaseBranch string `json:"base_branch"`
Body string `json:"body"`
}
b, err := plugin.JSONBody[bodyT](req)
b, err := plugin.JSONBody[createPullRequestBody](req)
if err != nil || b.RepoID == "" || b.Title == "" || b.HeadBranch == "" || b.BaseBranch == "" {
apiError(res, 400, "BAD_REQUEST", "repo_id, title, head_branch, and base_branch are required")
return
Expand Down Expand Up @@ -563,10 +563,10 @@ func (p *githubPlugin) addPullRequestComment(req *plugin.Request, res *plugin.Re
taskID := req.PathParam("taskId")
prID := req.PathParam("prId")

type bodyT struct {
type addPullRequestCommentBody struct {
Body string `json:"body"`
}
b, err := plugin.JSONBody[bodyT](req)
b, err := plugin.JSONBody[addPullRequestCommentBody](req)
if err != nil || b.Body == "" {
apiError(res, 400, "BAD_REQUEST", "body is required")
return
Expand Down Expand Up @@ -603,11 +603,11 @@ func (p *githubPlugin) createReview(req *plugin.Request, res *plugin.Response) {
taskID := req.PathParam("taskId")
prID := req.PathParam("prId")

type bodyT struct {
type createReviewBody struct {
Event string `json:"event"`
Body string `json:"body"`
}
b, err := plugin.JSONBody[bodyT](req)
b, err := plugin.JSONBody[createReviewBody](req)
if err != nil {
apiError(res, 400, "BAD_REQUEST", "event is required")
return
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "com.paca.github",
"displayName": "GitHub Integration",
"description": "Integrates GitHub repositories, pull requests, and branches with Paca projects and tasks.",
"version": "0.3.4",
"version": "0.3.5",
"minCoreVersion": "v0.13.3",
"capabilities": ["repository"],
"permissions": ["db.read", "db.write"],
Expand Down
Loading