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.

domains doc wip

Kiran Ka48142d9add8
diff --git a/apps/docs/mint.json b/apps/docs/mint.json
index 3f276a6d77..ca2b537ec2 100644
--- a/apps/docs/mint.json
+++ b/apps/docs/mint.json
@@ -30,7 +30,7 @@
"name": "Dashboard",
"url": "https://app.dub.co"
},
- "openapi": "https://api.dub.co",
+ "openapi": "http://api.localhost:8888",
"tabs": [
{
"name": "API Reference",
@@ -166,10 +166,6 @@
"sdks/typescript/analytics/top-urls"
]
},
- {
- "group": "Tags",
- "pages": ["sdks/typescript/tags/create", "sdks/typescript/tags/list"]
- },
{
"group": "Workspaces",
"pages": [
@@ -177,6 +173,25 @@
"sdks/typescript/workspaces/get",
"sdks/typescript/workspaces/list"
]
+ },
+ {
+ "group": "Tags",
+ "pages": ["sdks/typescript/tags/create", "sdks/typescript/tags/list"]
+ },
+ {
+ "group": "Domains",
+ "pages": [
+ "sdks/typescript/domains/add",
+ "sdks/typescript/domains/update",
+ "sdks/typescript/domains/delete",
+ "sdks/typescript/domains/list",
+ "sdks/typescript/domains/setPrimary",
+ "sdks/typescript/domains/transfer"
+ ]
+ },
+ {
+ "group": "Metatags",
+ "pages": ["sdks/typescript/metatags/get"]
}
]
}
diff --git a/apps/docs/sdks/typescript/analytics/browsers.mdx b/apps/docs/sdks/typescript/analytics/browsers.mdx
index 72e378b169..d83277bf50 100644
--- a/apps/docs/sdks/typescript/analytics/browsers.mdx
+++ b/apps/docs/sdks/typescript/analytics/browsers.mdx
@@ -15,11 +15,11 @@ import AnalyticsArguments from "/snippets/analytics-arguments.mdx";
## Response
-<ResponseField name="browser" type="string" required="true">
+<ResponseField name="browser" type="string" required>
The name of the browser
</ResponseField>
-<ResponseField name="clicks" type="number" required="true">
+<ResponseField name="clicks" type="number" required>
The number of clicks from this browser
</ResponseField>
diff --git a/apps/docs/sdks/typescript/analytics/cities.mdx b/apps/docs/sdks/typescript/analytics/cities.mdx
index 2bacf0f081..6d9b4b18c8 100644
--- a/apps/docs/sdks/typescript/analytics/cities.mdx
+++ b/apps/docs/sdks/typescript/analytics/cities.mdx
@@ -15,15 +15,15 @@ import AnalyticsArguments from "/snippets/analytics-arguments.mdx";
## Response
-<ResponseField name="city" type="string" required="true">
+<ResponseField name="city" type="string" required>
The name of the city
</ResponseField>
-<ResponseField name="country" type="string" required="true">
+<ResponseField name="country" type="string" required>
The 2-letter country code: [https://d.to/geo](https://d.to/geo)
</ResponseField>
-<ResponseField name="clicks" type="number" required="true">
+<ResponseField name="clicks" type="number" required>
The number of clicks from this city
</ResponseField>
diff --git a/apps/docs/sdks/typescript/analytics/countries.mdx b/apps/docs/sdks/typescript/analytics/countries.mdx
index d7404fb207..a0eea279c3 100644
--- a/apps/docs/sdks/typescript/analytics/countries.mdx
+++ b/apps/docs/sdks/typescript/analytics/countries.mdx
@@ -15,11 +15,11 @@ import AnalyticsArguments from "/snippets/analytics-arguments.mdx";
## Response
-<ResponseField name="country" type="string" required="true">
+<ResponseField name="country" type="string" required>
The 2-letter country code: [https://d.to/geo](https://d.to/geo)
</ResponseField>
-<ResponseField name="clicks" type="number" required="true">
+<ResponseField name="clicks" type="number" required>
The number of clicks from this country
</ResponseField>
diff --git a/apps/docs/sdks/typescript/analytics/devices.mdx b/apps/docs/sdks/typescript/analytics/devices.mdx
index 476ef10392..ec36df0ece 100644
--- a/apps/docs/sdks/typescript/analytics/devices.mdx
+++ b/apps/docs/sdks/typescript/analytics/devices.mdx
@@ -15,11 +15,11 @@ import AnalyticsArguments from "/snippets/analytics-arguments.mdx";
## Response
-<ResponseField name="device" type="string" required="true">
+<ResponseField name="device" type="string" required>
The name of the device
</ResponseField>
-<ResponseField name="clicks" type="number" required="true">
+<ResponseField name="clicks" type="number" required>
The number of clicks from this device
</ResponseField>
diff --git a/apps/docs/sdks/typescript/analytics/os.mdx b/apps/docs/sdks/typescript/analytics/os.mdx
index 2bc49a802e..98b81f0f09 100644
--- a/apps/docs/sdks/typescript/analytics/os.mdx
+++ b/apps/docs/sdks/typescript/analytics/os.mdx
@@ -15,11 +15,11 @@ import AnalyticsArguments from "/snippets/analytics-arguments.mdx";
## Response
-<ResponseField name="os" type="string" required="true">
+<ResponseField name="os" type="string" required>
The name of the OS
</ResponseField>
-<ResponseField name="clicks" type="number" required="true">
+<ResponseField name="clicks" type="number" required>
The number of clicks from this OS
</ResponseField>
diff --git a/apps/docs/sdks/typescript/analytics/referers.mdx b/apps/docs/sdks/typescript/analytics/referers.mdx
index b7c2ebc46d..78cc0ef4db 100644
--- a/apps/docs/sdks/typescript/analytics/referers.mdx
+++ b/apps/docs/sdks/typescript/analytics/referers.mdx
@@ -15,11 +15,11 @@ import AnalyticsArguments from "/snippets/analytics-arguments.mdx";
## Response
-<ResponseField name="referer" type="string" required="true">
+<ResponseField name="referer" type="string" required>
The name of the referer. If unknown, this will be `(direct)`
</ResponseField>
-<ResponseField name="clicks" type="number" required="true">
+<ResponseField name="clicks" type="number" required>
The number of clicks from this referer
</ResponseField>
diff --git a/apps/docs/sdks/typescript/analytics/timeseries.mdx b/apps/docs/sdks/typescript/analytics/timeseries.mdx
index d02cf3e6a0..148a3851ab 100644
--- a/apps/docs/sdks/typescript/analytics/timeseries.mdx
+++ b/apps/docs/sdks/typescript/analytics/timeseries.mdx
@@ -15,11 +15,11 @@ import AnalyticsArguments from "/snippets/analytics-arguments.mdx";
## Response
-<ResponseField name="start" type="string" required="true">
+<ResponseField name="start" type="string" required>
The starting timestamp of the interval
</ResponseField>
-<ResponseField name="clicks" type="number" required="true">
+<ResponseField name="clicks" type="number" required>
The number of clicks in the interval
</ResponseField>
diff --git a/apps/docs/sdks/typescript/analytics/top-links.mdx b/apps/docs/sdks/typescript/analytics/top-links.mdx
index 4fd2152823..f7a3fc1c8a 100644
--- a/apps/docs/sdks/typescript/analytics/top-links.mdx
+++ b/apps/docs/sdks/typescript/analytics/top-links.mdx
@@ -15,11 +15,11 @@ import AnalyticsArguments from "/snippets/analytics-arguments.mdx";
## Response
-<ResponseField name="link" type="string" required="true">
+<ResponseField name="link" type="string" required>
The unique ID of the short link
</ResponseField>
-<ResponseField name="clicks" type="number" required="true">
+<ResponseField name="clicks" type="number" required>
The number of clicks from this link
</ResponseField>
diff --git a/apps/docs/sdks/typescript/analytics/top-urls.mdx b/apps/docs/sdks/typescript/analytics/top-urls.mdx
index 4121c44523..1d0db44ebd 100644
--- a/apps/docs/sdks/typescript/analytics/top-urls.mdx
+++ b/apps/docs/sdks/typescript/analytics/top-urls.mdx
@@ -15,11 +15,11 @@ import AnalyticsArguments from "/snippets/analytics-arguments.mdx";
## Response
-<ResponseField name="url" type="string" required="true">
+<ResponseField name="url" type="string" required>
The destination URL
</ResponseField>
-<ResponseField name="clicks" type="number" required="true">
+<ResponseField name="clicks" type="number" required>
The number of clicks from this URL
</ResponseField>
diff --git a/apps/docs/sdks/typescript/domains/add.mdx b/apps/docs/sdks/typescript/domains/add.mdx
new file mode 100644
index 0000000000..22985be8b9
--- /dev/null
+++ b/apps/docs/sdks/typescript/domains/add.mdx
@@ -0,0 +1,67 @@
+---
+title: "Add"
+"og:title": "Add a domain - TypeScript SDK"
+description: "Add a domain to the authenticated workspace."
+---
+
+import DomainResponse from "/snippets/domain-response.mdx";
+
+## Arguments
+
+<ParamField body="slug" type="string" required>
+ Name of the domain.
+</ParamField>
+
+<ParamField body="type" type="enum<string>" default="redirect">
+ The type of redirect to use for this domain.
+ <enum>
+ <value>redirect</value>
+ <value>rewrite</value>
+ </enum>
+</ParamField>
+
+<ParamField body="target" type="string | null">
+ The page your users will get redirected to when they visit your domain.
+</ParamField>
+
+<ParamField body="expiredUrl" type="string | null">
+ Redirect users to a specific URL when any link under this domain has expired.
+</ParamField>
+
+<ParamField body="archived" type="boolean" default={false}>
+ Whether to archive this domain. false will unarchive a previously archived
+ domain.
+</ParamField>
+
+<ParamField
+ body="placeholder"
+ type="string | null"
+ default="https://dub.co/help/article/what-is-dub"
+>
+ Provide context to your teammates in the link creation modal by showing them
+ an example of a link to be shortened.
+</ParamField>
+
+<DomainResponse />
+
+<RequestExample>
+
+```ts
+await dub.tags.create({
+ tag: "news",
+});
+```
+
+</RequestExample>
+
+<ResponseExample>
+
+```ts
+{
+ id: "clv3j1h7o00032u1ngo8luv84",
+ name: "news",
+ color: "blue"
+}
+```
+
+</ResponseExample>
diff --git a/apps/docs/sdks/typescript/domains/delete.mdx b/apps/docs/sdks/typescript/domains/delete.mdx
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/apps/docs/sdks/typescript/domains/list.mdx b/apps/docs/sdks/typescript/domains/list.mdx
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/apps/docs/sdks/typescript/domains/setPrimary.mdx b/apps/docs/sdks/typescript/domains/setPrimary.mdx
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/apps/docs/sdks/typescript/domains/transfer.mdx b/apps/docs/sdks/typescript/domains/transfer.mdx
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/apps/docs/sdks/typescript/domains/update.mdx b/apps/docs/sdks/typescript/domains/update.mdx
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/apps/docs/sdks/typescript/metatags/get.mdx b/apps/docs/sdks/typescript/metatags/get.mdx
new file mode 100644
index 0000000000..2c92217ff7
--- /dev/null
+++ b/apps/docs/sdks/typescript/metatags/get.mdx
@@ -0,0 +1,47 @@
+---
+title: "Get"
+"og:title": "Retrieve the metatags for a URL - TypeScript SDK"
+description: "Retrieve the metatags for a URL."
+---
+
+## Arguments
+
+<ParamField body="url" type="string" required>
+ The URL to retrieve metatags for.
+</ParamField>
+
+## Response
+
+<ResponseField name="title" type="string | null" required>
+ The meta title tag for the URL.
+</ResponseField>
+
+<ResponseField name="id" type="string | null" required>
+ The meta description tag for the URL.
+</ResponseField>
+
+<ResponseField name="id" type="string | null" required>
+ The OpenGraph image for the URL.
+</ResponseField>
+
+<RequestExample>
+
+```ts
+await dub.metatags.get({
+ url: "https://dub.co",
+});
+```
+
+</RequestExample>
+
+<ResponseExample>
+
+```ts
+{
+ title: 'Dub.co - Link Management for Modern Marketing Teams',
+ description: 'Dub.co is the open-source link management infrastructure ...',
+ image: 'https://assets.dub.co/thumbnail.jpg'
+}
+```
+
+</ResponseExample>
diff --git a/apps/docs/snippets/domain-response.mdx b/apps/docs/snippets/domain-response.mdx
new file mode 100644
index 0000000000..2f70ff959a
--- /dev/null
+++ b/apps/docs/snippets/domain-response.mdx
@@ -0,0 +1,44 @@
+## Response
+
+<ParamField body="slug" type="string" required>
+ The domain name.
+</ParamField>
+
+<ParamField body="verified" type="boolean" default={false} required>
+ Whether the domain is verified.
+</ParamField>
+
+<ParamField body="primary" type="boolean" default={false} required>
+ Whether the domain is the primary domain for the workspace.
+</ParamField>
+
+<ParamField body="archived" type="boolean" default={false} required>
+ Whether the domain is archived.
+</ParamField>
+
+<ParamField
+ body="placeholder"
+ type="string"
+ default="https://dub.co/help/article/what-is-dub"
+ required
+>
+ Provide context to your teammates in the link creation modal by showing them
+ an example of a link to be shortened.
+</ParamField>
+
+<ParamField body="expiredUrl" type="string | null" required>
+ The URL to redirect to when a link under this domain has expired.
+</ParamField>
+
+<ParamField body="target" type="string | null" required>
+ The page your users will get redirected to when they visit your domain.
+</ParamField>
+
+<ParamField body="type" type="enum<string>" required>
+ The type of redirect to use for this domain. Available values are `redirect`
+ and `rewrite`.
+</ParamField>
+
+<ParamField body="clicks" type="number" default={0} required>
+ The number of clicks on the domain.
+</ParamField>
diff --git a/apps/web/lib/openapi/metatags/index.ts b/apps/web/lib/openapi/metatags/index.ts
index 9546c56cf9..018c79f137 100644
--- a/apps/web/lib/openapi/metatags/index.ts
+++ b/apps/web/lib/openapi/metatags/index.ts
@@ -6,9 +6,17 @@ const getMetatags: ZodOpenApiOperationObject = {
operationId: "getMetatags",
"x-speakeasy-name-override": "get",
summary: "Retrieve the metatags for a URL",
- description: "Retrieve the metatags for a URL",
+ description:
+ "Retrieve the metatags for a URL.",
requestParams: {
- query: getUrlQuerySchema,
+ query: getUrlQuerySchema.merge(
+ z.object({
+ url: z.string().openapi({
+ example: "https://dub.co",
+ description: "The URL to retrieve metatags for.",
+ }),
+ }),
+ ),
},
responses: {
"200": {
@@ -18,20 +26,23 @@ const getMetatags: ZodOpenApiOperationObject = {
schema: z.object({
title: z
.string()
- .describe("The meta title tag for the URL")
+ .nullable()
+ .describe("The meta title tag for the URL.")
.openapi({
example: "Dub.co - Link Management for Modern Marketing Teams",
}),
description: z
.string()
- .describe("The meta description tag for the URL")
+ .nullable()
+ .describe("The meta description tag for the URL.")
.openapi({
example:
"Dub.co is the open-source link management infrastructure ...",
}),
image: z
.string()
- .describe("The OpenGraph image for the URL")
+ .nullable()
+ .describe("The OpenGraph image for the URL.")
.openapi({ example: "https://assets.dub.co/thumbnail.jpg" }),
}),
},