aboutsummaryrefslogtreecommitdiffstats
path: root/packages/open-api/lib
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-05-18 19:12:27 +0000
committerMohamed Bassem <me@mbassem.com>2025-05-18 19:12:27 +0000
commita5ae67c241d8cdd452acd4d98800ec61740c041f (patch)
treef04929b1b27000564d108f25918c6e70fe651fb6 /packages/open-api/lib
parent053d1a905ed6cef71151d168351f22b35ddca986 (diff)
downloadkarakeep-a5ae67c241d8cdd452acd4d98800ec61740c041f.tar.zst
feat(api): Expose the endpoint to create a new tag
Diffstat (limited to 'packages/open-api/lib')
-rw-r--r--packages/open-api/lib/tags.ts33
1 files changed, 32 insertions, 1 deletions
diff --git a/packages/open-api/lib/tags.ts b/packages/open-api/lib/tags.ts
index b8136741..0a4f62cb 100644
--- a/packages/open-api/lib/tags.ts
+++ b/packages/open-api/lib/tags.ts
@@ -6,7 +6,9 @@ import { z } from "zod";
import { zSortOrder } from "@karakeep/shared/types/bookmarks";
import {
+ zCreateTagRequestSchema,
zGetTagResponseSchema,
+ zTagBasicSchema,
zUpdateTagRequestSchema,
} from "@karakeep/shared/types/tags";
@@ -57,6 +59,35 @@ registry.registerPath({
});
registry.registerPath({
+ method: "post",
+ path: "/tags",
+ description: "Create a new tag",
+ summary: "Create a new tag",
+ tags: ["Tags"],
+ security: [{ [BearerAuth.name]: [] }],
+ request: {
+ body: {
+ description: "The data to create the tag with.",
+ content: {
+ "application/json": {
+ schema: zCreateTagRequestSchema,
+ },
+ },
+ },
+ },
+ responses: {
+ 201: {
+ description: "The created tag",
+ content: {
+ "application/json": {
+ schema: zTagBasicSchema,
+ },
+ },
+ },
+ },
+});
+
+registry.registerPath({
method: "get",
path: "/tags/{tagId}",
description: "Get tag by its id",
@@ -135,7 +166,7 @@ registry.registerPath({
description: "The updated tag",
content: {
"application/json": {
- schema: TagSchema,
+ schema: zTagBasicSchema,
},
},
},