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.

docs: add domain

Kiran K1522732a48bb
diff --git a/apps/docs/mint.json b/apps/docs/mint.json
index ca2b537ec2..1b69e2e8bf 100644
--- a/apps/docs/mint.json
+++ b/apps/docs/mint.json
@@ -182,7 +182,6 @@
"group": "Domains",
"pages": [
"sdks/typescript/domains/add",
- "sdks/typescript/domains/update",
"sdks/typescript/domains/delete",
"sdks/typescript/domains/list",
"sdks/typescript/domains/setPrimary",
diff --git a/apps/docs/sdks/typescript/domains/add.mdx b/apps/docs/sdks/typescript/domains/add.mdx
index 22985be8b9..9fb506d28e 100644
--- a/apps/docs/sdks/typescript/domains/add.mdx
+++ b/apps/docs/sdks/typescript/domains/add.mdx
@@ -47,8 +47,10 @@ import DomainResponse from "/snippets/domain-response.mdx";
<RequestExample>
```ts
-await dub.tags.create({
- tag: "news",
+await dub.domains.add({
+ slug: "acme.com",
+ primary: true,
+ expiredUrl: "https://acme.com/expired",
});
```
@@ -58,9 +60,15 @@ await dub.tags.create({
```ts
{
- id: "clv3j1h7o00032u1ngo8luv84",
- name: "news",
- color: "blue"
+ slug: "acme.com",
+ verified: false,
+ primary: true,
+ archived: false,
+ placeholder: "https://dub.co/help/article/what-is-dub",
+ expiredUrl: "https://acme.com/expired",
+ target: null,
+ type: "redirect",
+ clicks: 0
}
```
diff --git a/apps/docs/sdks/typescript/domains/update.mdx b/apps/docs/sdks/typescript/domains/update.mdx
index e69de29bb2..92326dcc95 100644
--- a/apps/docs/sdks/typescript/domains/update.mdx
+++ b/apps/docs/sdks/typescript/domains/update.mdx
@@ -0,0 +1,75 @@
+---
+title: "Update"
+"og:title": "Edit a domain - TypeScript SDK"
+description: "Edit a domain for the authenticated workspace."
+---
+
+import DomainResponse from "/snippets/domain-response.mdx";
+
+## Arguments
+
+<ParamField body="slug" type="string">
+ 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.domains.add({
+ slug: "acme.com",
+ primary: true,
+ expiredUrl: "https://acme.com/expired",
+});
+```
+
+</RequestExample>
+
+<ResponseExample>
+
+```ts
+{
+ slug: "acme.com",
+ verified: false,
+ primary: true,
+ archived: false,
+ placeholder: "https://dub.co/help/article/what-is-dub",
+ expiredUrl: "https://acme.com/expired",
+ target: null,
+ type: "redirect",
+ clicks: 0
+}
+```
+
+</ResponseExample>
diff --git a/apps/web/lib/openapi/domains/add-domain.ts b/apps/web/lib/openapi/domains/add-domain.ts
index 3588496cb9..455dc47c54 100644
--- a/apps/web/lib/openapi/domains/add-domain.ts
+++ b/apps/web/lib/openapi/domains/add-domain.ts
@@ -19,7 +19,7 @@ export const addDomain: ZodOpenApiOperationObject = {
},
},
responses: {
- "200": {
+ "201": {
description: "The domain was added.",
content: {
"application/json": {