Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Add bulk update links to openapi

Steven Tey3097cc4d13e0
diff --git a/apps/web/lib/openapi/links/create-bulk-link.ts b/apps/web/lib/openapi/links/bulk-create-links.ts
similarity index 93%
rename from apps/web/lib/openapi/links/create-bulk-link.ts
rename to apps/web/lib/openapi/links/bulk-create-links.ts
index dda67a4125..e230c0bc4c 100644
--- a/apps/web/lib/openapi/links/create-bulk-link.ts
+++ b/apps/web/lib/openapi/links/bulk-create-links.ts
@@ -4,7 +4,7 @@ import { LinkSchema, createLinkBodySchema } from "@/lib/zod/schemas/links";
import { ZodOpenApiOperationObject } from "zod-openapi";
import { workspaceParamsSchema } from "../request";
-export const createBulkLink: ZodOpenApiOperationObject = {
+export const bulkCreateLinks: ZodOpenApiOperationObject = {
operationId: "bulkCreateLinks",
"x-speakeasy-name-override": "createMany",
summary: "Bulk create links",
diff --git a/apps/web/lib/openapi/links/bulk-update-links.ts b/apps/web/lib/openapi/links/bulk-update-links.ts
new file mode 100644
index 0000000000..9429b9eb7c
--- /dev/null
+++ b/apps/web/lib/openapi/links/bulk-update-links.ts
@@ -0,0 +1,32 @@
+import { openApiErrorResponses } from "@/lib/openapi/responses";
+import z from "@/lib/zod";
+import { LinkSchema, bulkUpdateLinksBodySchema } from "@/lib/zod/schemas/links";
+import { ZodOpenApiOperationObject } from "zod-openapi";
+
+export const bulkUpdateLinks: ZodOpenApiOperationObject = {
+ operationId: "bulkUpdateLinks",
+ "x-speakeasy-name-override": "updateMany",
+ summary: "Bulk update links with the same data",
+ description:
+ "Bulk update up to 100 links with the same data for the authenticated workspace.",
+ requestBody: {
+ content: {
+ "application/json": {
+ schema: bulkUpdateLinksBodySchema,
+ },
+ },
+ },
+ responses: {
+ "200": {
+ description: "The updated links",
+ content: {
+ "application/json": {
+ schema: z.array(LinkSchema),
+ },
+ },
+ },
+ ...openApiErrorResponses,
+ },
+ tags: ["Links"],
+ security: [{ token: [] }],
+};
diff --git a/apps/web/lib/openapi/links/index.ts b/apps/web/lib/openapi/links/index.ts
index 6d174ec688..7d52c2bd6d 100644
--- a/apps/web/lib/openapi/links/index.ts
+++ b/apps/web/lib/openapi/links/index.ts
@@ -1,6 +1,7 @@
import { ZodOpenApiPathsObject } from "zod-openapi";
-import { createBulkLink } from "./create-bulk-link";
+import { bulkCreateLinks } from "./bulk-create-links";
+import { bulkUpdateLinks } from "./bulk-update-links";
import { createLink } from "./create-link";
import { deleteLink } from "./delete-link";
import { getLinkInfo } from "./get-link-info";
@@ -25,7 +26,8 @@ export const linksPaths: ZodOpenApiPathsObject = {
delete: deleteLink,
},
"/links/bulk": {
- post: createBulkLink,
+ post: bulkCreateLinks,
+ patch: bulkUpdateLinks,
},
"/links/upsert": {
put: upsertLink,