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.

update mintlify docs

Steven Tey9ffabab02509
diff --git a/apps/docs/api-reference/endpoint/retrieve-a-workspace.mdx b/apps/docs/api-reference/endpoint/retrieve-a-workspace.mdx
index 7840314660..05d60958e3 100644
--- a/apps/docs/api-reference/endpoint/retrieve-a-workspace.mdx
+++ b/apps/docs/api-reference/endpoint/retrieve-a-workspace.mdx
@@ -1,5 +1,5 @@
---
-openapi: get /workspaces/{workspaceId}
+openapi: get /workspaces/{idOrSlug}
og:title: "Get workspace info with the Dub.co API - API Reference"
description: Retrieve a workspace for the authenticated user.
---
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/route.ts
index 5edd2bd62b..50e50ae37e 100644
--- a/apps/web/app/api/workspaces/[idOrSlug]/route.ts
+++ b/apps/web/app/api/workspaces/[idOrSlug]/route.ts
@@ -8,7 +8,7 @@ import { DEFAULT_REDIRECTS, validSlugRegex } from "@dub/utils";
import slugify from "@sindresorhus/slugify";
import { NextResponse } from "next/server";
-const updateProjectSchema = z.object({
+const updateWorkspaceSchema = z.object({
name: z.string().min(1).max(32).optional(),
slug: z
.string()
@@ -37,7 +37,7 @@ export const GET = withAuth(async ({ workspace, headers }) => {
export const PUT = withAuth(
async ({ req, workspace }) => {
try {
- const { name, slug } = await updateProjectSchema.parseAsync(
+ const { name, slug } = await updateWorkspaceSchema.parseAsync(
await req.json(),
);
diff --git a/apps/web/app/api/workspaces/route.ts b/apps/web/app/api/workspaces/route.ts
index 6970e86f44..db6fa183fa 100644
--- a/apps/web/app/api/workspaces/route.ts
+++ b/apps/web/app/api/workspaces/route.ts
@@ -18,7 +18,7 @@ import {
import slugify from "@sindresorhus/slugify";
import { NextResponse } from "next/server";
-const createProjectSchema = z.object({
+const createWorkspaceSchema = z.object({
name: z.string().min(1).max(32),
slug: z
.string()
@@ -64,7 +64,7 @@ export const GET = withSession(async ({ session }) => {
});
export const POST = withSession(async ({ req, session }) => {
- const { name, slug, domain } = await createProjectSchema.parseAsync(
+ const { name, slug, domain } = await createWorkspaceSchema.parseAsync(
await req.json(),
);
diff --git a/apps/web/lib/openapi/index.ts b/apps/web/lib/openapi/index.ts
index 8b4f8f821e..6462516a70 100644
--- a/apps/web/lib/openapi/index.ts
+++ b/apps/web/lib/openapi/index.ts
@@ -1,14 +1,14 @@
import { ZodOpenApiObject } from "zod-openapi";
import { LinkSchema } from "@/lib/zod/schemas/links";
-import { ProjectSchema } from "@/lib/zod/schemas/projects";
import { TagSchema } from "@/lib/zod/schemas/tags";
+import { WorkspaceSchema } from "@/lib/zod/schemas/workspaces";
import { API_DOMAIN } from "@dub/utils";
import { analyticsPaths } from "./analytics";
import { linksPaths } from "./links";
-import { projectsPaths } from "./projects";
import { qrCodePaths } from "./qr";
import { tagsPaths } from "./tags";
+import { workspacesPaths } from "./workspaces";
export const openApiObject: ZodOpenApiObject = {
openapi: "3.0.3",
@@ -37,13 +37,13 @@ export const openApiObject: ZodOpenApiObject = {
...linksPaths,
...qrCodePaths,
...analyticsPaths,
- ...projectsPaths,
+ ...workspacesPaths,
...tagsPaths,
},
components: {
schemas: {
LinkSchema,
- ProjectSchema,
+ WorkspaceSchema,
TagSchema,
},
securitySchemes: {
diff --git a/apps/web/lib/openapi/projects/index.ts b/apps/web/lib/openapi/projects/index.ts
deleted file mode 100644
index 03078678e0..0000000000
--- a/apps/web/lib/openapi/projects/index.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { ZodOpenApiPathsObject } from "zod-openapi";
-
-import { getProjectInfo } from "./get-project-info";
-import { getProjects } from "./get-projects";
-
-export const projectsPaths: ZodOpenApiPathsObject = {
- "/workspaces": {
- get: getProjects,
- },
- "/workspaces/{workspaceId}": {
- get: getProjectInfo,
- },
-};
diff --git a/apps/web/lib/openapi/projects/get-project-info.ts b/apps/web/lib/openapi/workspaces/get-workspace-info.ts
similarity index 71%
rename from apps/web/lib/openapi/projects/get-project-info.ts
rename to apps/web/lib/openapi/workspaces/get-workspace-info.ts
index 5220fa05a6..385dd39602 100644
--- a/apps/web/lib/openapi/projects/get-project-info.ts
+++ b/apps/web/lib/openapi/workspaces/get-workspace-info.ts
@@ -2,15 +2,15 @@ import { ZodOpenApiOperationObject } from "zod-openapi";
import { openApiErrorResponses } from "@/lib/openapi/responses";
import z from "@/lib/zod";
-import { ProjectSchema } from "@/lib/zod/schemas/projects";
+import { WorkspaceSchema } from "@/lib/zod/schemas/workspaces";
-export const getProjectInfo: ZodOpenApiOperationObject = {
+export const getWorkspaceInfo: ZodOpenApiOperationObject = {
operationId: "getWorkspace",
summary: "Retrieve a workspace",
description: "Retrieve a workspace for the authenticated user.",
requestParams: {
path: z.object({
- workspaceId: z.string().describe("The ID of the workspace to retrieve."),
+ idOrSlug: z.string().describe("The ID or slug of the workspace."),
}),
},
responses: {
@@ -18,7 +18,7 @@ export const getProjectInfo: ZodOpenApiOperationObject = {
description: "The retrieved workspace",
content: {
"application/json": {
- schema: ProjectSchema,
+ schema: WorkspaceSchema,
},
},
},
diff --git a/apps/web/lib/openapi/projects/get-projects.ts b/apps/web/lib/openapi/workspaces/get-workspaces.ts
similarity index 76%
rename from apps/web/lib/openapi/projects/get-projects.ts
rename to apps/web/lib/openapi/workspaces/get-workspaces.ts
index 1b11caa6bc..972c4a7394 100644
--- a/apps/web/lib/openapi/projects/get-projects.ts
+++ b/apps/web/lib/openapi/workspaces/get-workspaces.ts
@@ -2,9 +2,9 @@ import { ZodOpenApiOperationObject } from "zod-openapi";
import { openApiErrorResponses } from "@/lib/openapi/responses";
import z from "@/lib/zod";
-import { ProjectSchema } from "@/lib/zod/schemas/projects";
+import { WorkspaceSchema } from "@/lib/zod/schemas/workspaces";
-export const getProjects: ZodOpenApiOperationObject = {
+export const getWorkspaces: ZodOpenApiOperationObject = {
operationId: "getWorkspaces",
summary: "Retrieve a list of workspaces",
description: "Retrieve a list of workspaces for the authenticated user.",
@@ -13,7 +13,7 @@ export const getProjects: ZodOpenApiOperationObject = {
description: "A list of workspaces",
content: {
"application/json": {
- schema: z.array(ProjectSchema),
+ schema: z.array(WorkspaceSchema),
},
},
},
diff --git a/apps/web/lib/openapi/workspaces/index.ts b/apps/web/lib/openapi/workspaces/index.ts
new file mode 100644
index 0000000000..7c43479950
--- /dev/null
+++ b/apps/web/lib/openapi/workspaces/index.ts
@@ -0,0 +1,13 @@
+import { ZodOpenApiPathsObject } from "zod-openapi";
+
+import { getWorkspaceInfo } from "./get-workspace-info";
+import { getWorkspaces } from "./get-workspaces";
+
+export const workspacesPaths: ZodOpenApiPathsObject = {
+ "/workspaces": {
+ get: getWorkspaces,
+ },
+ "/workspaces/{idOrSlug}": {
+ get: getWorkspaceInfo,
+ },
+};
diff --git a/apps/web/lib/zod/schemas/projects.ts b/apps/web/lib/zod/schemas/workspaces.ts
similarity index 98%
rename from apps/web/lib/zod/schemas/projects.ts
rename to apps/web/lib/zod/schemas/workspaces.ts
index eb0ec8fbc1..06d494f78a 100644
--- a/apps/web/lib/zod/schemas/projects.ts
+++ b/apps/web/lib/zod/schemas/workspaces.ts
@@ -1,7 +1,7 @@
import z from "@/lib/zod";
import { planSchema, roleSchema } from ".";
-export const ProjectSchema = z
+export const WorkspaceSchema = z
.object({
id: z.string().describe("The unique ID of the workspace."),
name: z.string().describe("The name of the workspace."),