Skip to content

Commit ce1fd24

Browse files
authored
Merge pull request #6 from Paca-AI/chore/update-api-routes
fix: update GitHub API paths to include project ID and upgrade plugin…
2 parents 9b6ed2d + 6b900e9 commit ce1fd24

6 files changed

Lines changed: 30 additions & 30 deletions

File tree

backend/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module github.com/Paca-AI/first-party/github
33
go 1.24
44

55
require (
6-
github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.6
6+
github.com/Paca-AI/plugin-sdk-go v0.2.0
77
github.com/google/uuid v1.6.0
88
)

backend/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.6 h1:XN5rln12wkqfhiDg3Ds98WZhX1oiGqWDBRHWoE03wYY=
2-
github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.6/go.mod h1:5WeC6cSEf2wM1ovICZbDaVky9oi5id/Qpdfc5LDAQnw=
1+
github.com/Paca-AI/plugin-sdk-go v0.2.0 h1:Fur6p+OQoC5imq7qmvaQtJnZ3SRVRskx8KcT/rqFHj4=
2+
github.com/Paca-AI/plugin-sdk-go v0.2.0/go.mod h1:5WeC6cSEf2wM1ovICZbDaVky9oi5id/Qpdfc5LDAQnw=
33
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
44
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=

frontend/bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"devDependencies": {
1919
"@originjs/vite-plugin-federation": "^1.3.6",
20-
"@paca-ai/plugin-sdk-react": "^0.1.0",
20+
"@paca-ai/plugin-sdk-react": "^0.2.0",
2121
"@types/react": "^19.2.0",
2222
"@types/react-dom": "^19.2.0",
2323
"typescript": "^5.8.3",

frontend/src/github-api.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,26 +128,26 @@ export const taskBranchesKey = (projectId: string, taskId: string) =>
128128
export async function getGitHubIntegration(
129129
api: PluginApiClient,
130130
): Promise<GitHubIntegration> {
131-
return api.pluginGet<GitHubIntegration>(PLUGIN_ID, "/github");
131+
return api.pluginGet<GitHubIntegration>(PLUGIN_ID, `/projects/${api.projectId}/github`);
132132
}
133133

134134
export async function setGitHubToken(
135135
api: PluginApiClient,
136136
token: string,
137137
): Promise<GitHubIntegration> {
138-
return api.pluginPost<GitHubIntegration>(PLUGIN_ID, "/github/token", {
138+
return api.pluginPost<GitHubIntegration>(PLUGIN_ID, `/projects/${api.projectId}/github/token`, {
139139
token,
140140
});
141141
}
142142

143143
export async function deleteGitHubToken(api: PluginApiClient): Promise<void> {
144-
return api.pluginDelete(PLUGIN_ID, "/github/token");
144+
return api.pluginDelete(PLUGIN_ID, `/projects/${api.projectId}/github/token`);
145145
}
146146

147147
export async function listAccessibleRepos(
148148
api: PluginApiClient,
149149
): Promise<AccessibleRepo[]> {
150-
return api.pluginGet<AccessibleRepo[]>(PLUGIN_ID, "/github/repositories");
150+
return api.pluginGet<AccessibleRepo[]>(PLUGIN_ID, `/projects/${api.projectId}/github/repositories`);
151151
}
152152

153153
export async function linkRepository(
@@ -157,7 +157,7 @@ export async function linkRepository(
157157
): Promise<LinkedRepository> {
158158
return api.pluginPost<LinkedRepository>(
159159
PLUGIN_ID,
160-
"/github/linked-repositories",
160+
`/projects/${api.projectId}/github/linked-repositories`,
161161
{ owner, repo_name: repoName },
162162
);
163163
}
@@ -167,7 +167,7 @@ export async function listLinkedRepositories(
167167
): Promise<LinkedRepository[]> {
168168
return api.pluginGet<LinkedRepository[]>(
169169
PLUGIN_ID,
170-
"/github/linked-repositories",
170+
`/projects/${api.projectId}/github/linked-repositories`,
171171
);
172172
}
173173

@@ -177,7 +177,7 @@ export async function unlinkRepository(
177177
): Promise<void> {
178178
return api.pluginDelete(
179179
PLUGIN_ID,
180-
`/github/linked-repositories/${repoId}`,
180+
`/projects/${api.projectId}/github/linked-repositories/${repoId}`,
181181
);
182182
}
183183

@@ -187,7 +187,7 @@ export async function listTaskPRs(
187187
): Promise<PullRequest[]> {
188188
return api.pluginGet<PullRequest[]>(
189189
PLUGIN_ID,
190-
`/tasks/${taskId}/github/pull-requests`,
190+
`/projects/${api.projectId}/tasks/${taskId}/github/pull-requests`,
191191
);
192192
}
193193

@@ -199,7 +199,7 @@ export async function linkPRToTask(
199199
): Promise<PullRequest> {
200200
return api.pluginPost<PullRequest>(
201201
PLUGIN_ID,
202-
`/tasks/${taskId}/github/pull-requests`,
202+
`/projects/${api.projectId}/tasks/${taskId}/github/pull-requests`,
203203
{ repo_id: repoId, pr_number: prNumber },
204204
);
205205
}
@@ -211,7 +211,7 @@ export async function unlinkPRFromTask(
211211
): Promise<void> {
212212
return api.pluginDelete(
213213
PLUGIN_ID,
214-
`/tasks/${taskId}/github/pull-requests/${prId}`,
214+
`/projects/${api.projectId}/tasks/${taskId}/github/pull-requests/${prId}`,
215215
);
216216
}
217217

@@ -221,7 +221,7 @@ export async function listTaskBranches(
221221
): Promise<TaskBranch[]> {
222222
return api.pluginGet<TaskBranch[]>(
223223
PLUGIN_ID,
224-
`/tasks/${taskId}/github/branches`,
224+
`/projects/${api.projectId}/tasks/${taskId}/github/branches`,
225225
);
226226
}
227227

@@ -234,7 +234,7 @@ export async function createBranch(
234234
): Promise<CreateBranchResult> {
235235
return api.pluginPost<CreateBranchResult>(
236236
PLUGIN_ID,
237-
`/tasks/${taskId}/github/branches`,
237+
`/projects/${api.projectId}/tasks/${taskId}/github/branches`,
238238
{ repo_id: repoId, branch_name: branchName, source_branch: sourceBranch },
239239
);
240240
}

plugin.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"routes": [
1111
{
1212
"method": "GET",
13-
"path": "/github",
13+
"path": "/projects/:projectId/github",
1414
"middlewares": [
1515
{ "name": "optionalAuthn" },
1616
{ "name": "requireFreshPassword" },
@@ -23,7 +23,7 @@
2323
},
2424
{
2525
"method": "POST",
26-
"path": "/github/token",
26+
"path": "/projects/:projectId/github/token",
2727
"middlewares": [
2828
{ "name": "optionalAuthn" },
2929
{ "name": "requireFreshPassword" },
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"method": "DELETE",
39-
"path": "/github/token",
39+
"path": "/projects/:projectId/github/token",
4040
"middlewares": [
4141
{ "name": "optionalAuthn" },
4242
{ "name": "requireFreshPassword" },
@@ -49,7 +49,7 @@
4949
},
5050
{
5151
"method": "GET",
52-
"path": "/github/repositories",
52+
"path": "/projects/:projectId/github/repositories",
5353
"middlewares": [
5454
{ "name": "optionalAuthn" },
5555
{ "name": "requireFreshPassword" },
@@ -62,7 +62,7 @@
6262
},
6363
{
6464
"method": "GET",
65-
"path": "/github/linked-repositories",
65+
"path": "/projects/:projectId/github/linked-repositories",
6666
"middlewares": [
6767
{ "name": "optionalAuthn" },
6868
{ "name": "requireFreshPassword" },
@@ -75,7 +75,7 @@
7575
},
7676
{
7777
"method": "POST",
78-
"path": "/github/linked-repositories",
78+
"path": "/projects/:projectId/github/linked-repositories",
7979
"middlewares": [
8080
{ "name": "optionalAuthn" },
8181
{ "name": "requireFreshPassword" },
@@ -88,7 +88,7 @@
8888
},
8989
{
9090
"method": "DELETE",
91-
"path": "/github/linked-repositories/:repoId",
91+
"path": "/projects/:projectId/github/linked-repositories/:repoId",
9292
"middlewares": [
9393
{ "name": "optionalAuthn" },
9494
{ "name": "requireFreshPassword" },
@@ -101,7 +101,7 @@
101101
},
102102
{
103103
"method": "GET",
104-
"path": "/tasks/:taskId/github/pull-requests",
104+
"path": "/projects/:projectId/tasks/:taskId/github/pull-requests",
105105
"middlewares": [
106106
{ "name": "optionalAuthn" },
107107
{ "name": "requireFreshPassword" },
@@ -114,7 +114,7 @@
114114
},
115115
{
116116
"method": "POST",
117-
"path": "/tasks/:taskId/github/pull-requests",
117+
"path": "/projects/:projectId/tasks/:taskId/github/pull-requests",
118118
"middlewares": [
119119
{ "name": "optionalAuthn" },
120120
{ "name": "requireFreshPassword" },
@@ -127,7 +127,7 @@
127127
},
128128
{
129129
"method": "DELETE",
130-
"path": "/tasks/:taskId/github/pull-requests/:prId",
130+
"path": "/projects/:projectId/tasks/:taskId/github/pull-requests/:prId",
131131
"middlewares": [
132132
{ "name": "optionalAuthn" },
133133
{ "name": "requireFreshPassword" },
@@ -140,7 +140,7 @@
140140
},
141141
{
142142
"method": "POST",
143-
"path": "/tasks/:taskId/github/branches",
143+
"path": "/projects/:projectId/tasks/:taskId/github/branches",
144144
"middlewares": [
145145
{ "name": "optionalAuthn" },
146146
{ "name": "requireFreshPassword" },
@@ -153,7 +153,7 @@
153153
},
154154
{
155155
"method": "GET",
156-
"path": "/tasks/:taskId/github/branches",
156+
"path": "/projects/:projectId/tasks/:taskId/github/branches",
157157
"middlewares": [
158158
{ "name": "optionalAuthn" },
159159
{ "name": "requireFreshPassword" },

0 commit comments

Comments
 (0)