From 79de7f9f5bff98f7d4c86ee44d82dcf1acab9571 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Thu, 11 Apr 2024 19:41:55 -0400 Subject: [PATCH 1/3] expose list integrations api --- backend/src/lib/api-docs/constants.ts | 3 +++ backend/src/server/routes/v1/project-router.ts | 10 ++++++++-- .../integrations/list-project-integrations.mdx | 4 ++++ docs/mint.json | 3 ++- 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 docs/api-reference/endpoints/integrations/list-project-integrations.mdx diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts index fd51119f1..e005aee4c 100644 --- a/backend/src/lib/api-docs/constants.ts +++ b/backend/src/lib/api-docs/constants.ts @@ -551,5 +551,8 @@ export const INTEGRATION = { }, DELETE: { integrationId: "The ID of the integration object." + }, + LIST_INTEGRATION: { + workspaceId: "The ID of the project to list integrations for." } }; diff --git a/backend/src/server/routes/v1/project-router.ts b/backend/src/server/routes/v1/project-router.ts index a4df0416e..3be0e886d 100644 --- a/backend/src/server/routes/v1/project-router.ts +++ b/backend/src/server/routes/v1/project-router.ts @@ -7,7 +7,7 @@ import { UserEncryptionKeysSchema, UsersSchema } from "@app/db/schemas"; -import { INTEGRATION_AUTH, PROJECTS } from "@app/lib/api-docs"; +import { INTEGRATION, INTEGRATION_AUTH, PROJECTS } from "@app/lib/api-docs"; import { readLimit, writeLimit } from "@app/server/config/rateLimiter"; import { verifyAuth } from "@app/server/plugins/auth/verify-auth"; import { AuthMode } from "@app/services/auth/auth-type"; @@ -326,8 +326,14 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => { rateLimit: readLimit }, schema: { + description: "List integrations for a project.", + security: [ + { + bearerAuth: [] + } + ], params: z.object({ - workspaceId: z.string().trim() + workspaceId: z.string().trim().describe(INTEGRATION.LIST_INTEGRATION.workspaceId) }), response: { 200: z.object({ diff --git a/docs/api-reference/endpoints/integrations/list-project-integrations.mdx b/docs/api-reference/endpoints/integrations/list-project-integrations.mdx new file mode 100644 index 000000000..ee652961c --- /dev/null +++ b/docs/api-reference/endpoints/integrations/list-project-integrations.mdx @@ -0,0 +1,4 @@ +--- +title: "List project integrations" +openapi: "GET /api/v1/workspace/{workspaceId}/integrations" +--- diff --git a/docs/mint.json b/docs/mint.json index 4ab246f83..47c8561ab 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -519,7 +519,8 @@ "api-reference/endpoints/integrations/delete-auth-by-id", "api-reference/endpoints/integrations/create", "api-reference/endpoints/integrations/update", - "api-reference/endpoints/integrations/delete" + "api-reference/endpoints/integrations/delete", + "api-reference/endpoints/integrations/list-project-integrations" ] }, { From 51928ddb47b779928dd5dd5e75a08d7195000680 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Fri, 12 Apr 2024 02:15:11 +0200 Subject: [PATCH 2/3] Fix: OpenAPI doc descriptions structure --- backend/src/lib/api-docs/constants.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts index e005aee4c..90098a7b6 100644 --- a/backend/src/lib/api-docs/constants.ts +++ b/backend/src/lib/api-docs/constants.ts @@ -141,6 +141,12 @@ export const PROJECTS = { }, ROLLBACK_TO_SNAPSHOT: { secretSnapshotId: "The ID of the snapshot to rollback to." + }, + LIST_INTEGRATION: { + workspaceId: "The ID of the project to list integrations for." + }, + LIST_INTEGRATION_AUTHORIZATION: { + workspaceId: "The ID of the project to list integration auths for." } } as const; @@ -502,11 +508,8 @@ export const INTEGRATION_AUTH = { url: "", namespace: "", refreshToken: "The refresh token for integration authorization." - }, - LIST_AUTHORIZATION: { - workspaceId: "The ID of the project to list integration auths for." } -}; +} as const; export const INTEGRATION = { CREATE: { @@ -551,8 +554,5 @@ export const INTEGRATION = { }, DELETE: { integrationId: "The ID of the integration object." - }, - LIST_INTEGRATION: { - workspaceId: "The ID of the project to list integrations for." } }; From 44c736facdfa19d8f70c9e18218802e90dfaa8c0 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Fri, 12 Apr 2024 02:15:23 +0200 Subject: [PATCH 3/3] Fix: Updated descriptions --- backend/src/server/routes/v1/project-router.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/server/routes/v1/project-router.ts b/backend/src/server/routes/v1/project-router.ts index 3be0e886d..489e95322 100644 --- a/backend/src/server/routes/v1/project-router.ts +++ b/backend/src/server/routes/v1/project-router.ts @@ -7,7 +7,7 @@ import { UserEncryptionKeysSchema, UsersSchema } from "@app/db/schemas"; -import { INTEGRATION, INTEGRATION_AUTH, PROJECTS } from "@app/lib/api-docs"; +import { PROJECTS } from "@app/lib/api-docs"; import { readLimit, writeLimit } from "@app/server/config/rateLimiter"; import { verifyAuth } from "@app/server/plugins/auth/verify-auth"; import { AuthMode } from "@app/services/auth/auth-type"; @@ -333,7 +333,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => { } ], params: z.object({ - workspaceId: z.string().trim().describe(INTEGRATION.LIST_INTEGRATION.workspaceId) + workspaceId: z.string().trim().describe(PROJECTS.LIST_INTEGRATION.workspaceId) }), response: { 200: z.object({ @@ -376,7 +376,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => { } ], params: z.object({ - workspaceId: z.string().trim().describe(INTEGRATION_AUTH.LIST_AUTHORIZATION.workspaceId) + workspaceId: z.string().trim().describe(PROJECTS.LIST_INTEGRATION_AUTHORIZATION.workspaceId) }), response: { 200: z.object({