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 domains sdk methods to docs

Kiran Kc2e147cdf8c8
diff --git a/apps/docs/mint.json b/apps/docs/mint.json
index 83f4a27ce8..78ed778a58 100644
--- a/apps/docs/mint.json
+++ b/apps/docs/mint.json
@@ -174,6 +174,17 @@
"sdks/typescript/workspaces/list"
]
},
+ {
+ "group": "Domains",
+ "pages": [
+ "sdks/typescript/domains/add",
+ "sdks/typescript/domains/update",
+ "sdks/typescript/domains/delete",
+ "sdks/typescript/domains/list",
+ "sdks/typescript/domains/set-primary",
+ "sdks/typescript/domains/transfer"
+ ]
+ },
{
"group": "Tags",
"pages": ["sdks/typescript/tags/create", "sdks/typescript/tags/list"]
diff --git a/apps/docs/sdks/typescript/domains/add.mdx b/apps/docs/sdks/typescript/domains/add.mdx
index baeccd4644..b6e16309e8 100644
--- a/apps/docs/sdks/typescript/domains/add.mdx
+++ b/apps/docs/sdks/typescript/domains/add.mdx
@@ -9,7 +9,7 @@ import DomainResponse from "/snippets/domain-response.mdx";
## Arguments
<ParamField body="slug" type="string" required>
- Name of the domain.
+ Name of the domain. Eg. `acme.com`.
</ParamField>
<ParamField body="type" type="enum<string>" default="redirect">
@@ -49,8 +49,6 @@ import DomainResponse from "/snippets/domain-response.mdx";
```ts
await dub.domains.add({
slug: "acme.com",
- primary: true,
- expiredUrl: "https://acme.com/expired",
});
```
@@ -65,7 +63,7 @@ await dub.domains.add({
primary: true,
archived: false,
placeholder: "https://dub.co/help/article/what-is-dub",
- expiredUrl: "https://acme.com/expired",
+ expiredUrl: null,
target: null,
type: "redirect",
clicks: 0
diff --git a/apps/docs/sdks/typescript/domains/delete.mdx b/apps/docs/sdks/typescript/domains/delete.mdx
index 72ce6a30a3..2ad7c9a35e 100644
--- a/apps/docs/sdks/typescript/domains/delete.mdx
+++ b/apps/docs/sdks/typescript/domains/delete.mdx
@@ -1,5 +1,35 @@
---
title: "Delete"
"og:title": "dub.domains.delete - Delete a domain - TypeScript SDK"
-description: "Delete a domain from a workspace."
+description: "Delete a domain from a workspace. It cannot be undone. This will also delete all the links associated with the domain."
---
+
+## Arguments
+
+<ParamField body="slug" type="string" required>
+ Name of the domain. Eg. `acme.com`.
+</ParamField>
+
+## Response
+
+<ResponseField name="slug" type="string" required>
+ Name of the domain that was deleted.
+</ResponseField>
+
+<RequestExample>
+
+```ts
+await dub.domains.delete("acme.com");
+```
+
+</RequestExample>
+
+<ResponseExample>
+
+```ts
+{
+ slug: "acme.com";
+}
+```
+
+</ResponseExample>
diff --git a/apps/docs/sdks/typescript/domains/list.mdx b/apps/docs/sdks/typescript/domains/list.mdx
index 8cf89fbfe2..b492491c86 100644
--- a/apps/docs/sdks/typescript/domains/list.mdx
+++ b/apps/docs/sdks/typescript/domains/list.mdx
@@ -3,3 +3,39 @@ title: "List"
"og:title": "dub.domains.list - Retrieve a list of domains - TypeScript SDK"
description: "Retrieve a list of domains associated with the authenticated workspace."
---
+
+import DomainResponse from "/snippets/domain-response.mdx";
+
+## Arguments
+
+No arguments.
+
+<DomainResponse />
+
+<RequestExample>
+
+```ts
+await dub.domains.list({});
+```
+
+</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: "https://acme.com/home",
+ type: "redirect",
+ clicks: 0,
+ },
+];
+```
+
+</ResponseExample>
diff --git a/apps/docs/sdks/typescript/domains/set-primary.mdx b/apps/docs/sdks/typescript/domains/set-primary.mdx
index 742ea65cb8..d213cb233e 100644
--- a/apps/docs/sdks/typescript/domains/set-primary.mdx
+++ b/apps/docs/sdks/typescript/domains/set-primary.mdx
@@ -3,3 +3,39 @@ title: "Set Primary"
"og:title": "dub.domains.setPrimary - Set a domain as primary - TypeScript SDK"
description: "Set a domain as primary for the authenticated workspace."
---
+
+import DomainResponse from "/snippets/domain-response.mdx";
+
+## Arguments
+
+<ParamField body="slug" type="string" required>
+ Name of the domain to set as primary. Eg. `acme.com`.
+</ParamField>
+
+<DomainResponse />
+
+<RequestExample>
+
+```ts
+await dub.domains.setPrimary("acme.com");
+```
+
+</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: "https://acme.com/home",
+ type: "redirect",
+ clicks: 0,
+}
+```
+
+</ResponseExample>
diff --git a/apps/docs/sdks/typescript/domains/transfer.mdx b/apps/docs/sdks/typescript/domains/transfer.mdx
index be65ea6096..f3fe3d0dbc 100644
--- a/apps/docs/sdks/typescript/domains/transfer.mdx
+++ b/apps/docs/sdks/typescript/domains/transfer.mdx
@@ -1,5 +1,47 @@
---
-title: "transfer"
+title: "Transfer"
"og:title": "dub.domains.transfer - Transfer a domain - TypeScript SDK"
description: "Transfer a domain to another workspace within the authenticated account."
---
+
+import DomainResponse from "/snippets/domain-response.mdx";
+
+## Arguments
+
+<ParamField body="slug" type="string">
+ Name of the domain to transfer. Eg. `acme.com`.
+</ParamField>
+
+<ParamField body="newWorkspaceId" type="string">
+ The ID of the new workspace to transfer the domain to.
+</ParamField>
+
+<DomainResponse />
+
+<RequestExample>
+
+```ts
+await dub.domains.transfer("acme.com", {
+ newWorkspaceId: "ws_clv3mw4qb00008tvuw86c53db",
+});
+```
+
+</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: "https://acme.com/home",
+ type: "redirect",
+ clicks: 0,
+}
+```
+
+</ResponseExample>
diff --git a/apps/docs/sdks/typescript/domains/update.mdx b/apps/docs/sdks/typescript/domains/update.mdx
index 3b98a014bb..9e915953fa 100644
--- a/apps/docs/sdks/typescript/domains/update.mdx
+++ b/apps/docs/sdks/typescript/domains/update.mdx
@@ -2,4 +2,74 @@
title: "Update"
"og:title": "dub.domains.update - Edit a domain - TypeScript SDK"
description: "Edit a domain for the authenticated workspace."
----
\ No newline at end of file
+---
+
+import DomainResponse from "/snippets/domain-response.mdx";
+
+## Arguments
+
+<ParamField body="slug" type="string">
+ Name of the domain. If provided, the existing domain will be updated with the
+ new domain. Eg. `acme.com`.
+</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.update("acme.com", {
+ expiredUrl: "https://acme.com/expired",
+ target: "https://acme.com/home",
+});
+```
+
+</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: "https://acme.com/home",
+ type: "redirect",
+ clicks: 0
+}
+```
+
+</ResponseExample>
diff --git a/apps/web/lib/openapi/domains/delete-domain.ts b/apps/web/lib/openapi/domains/delete-domain.ts
index d863bf40b6..0fab418ec7 100644
--- a/apps/web/lib/openapi/domains/delete-domain.ts
+++ b/apps/web/lib/openapi/domains/delete-domain.ts
@@ -8,7 +8,8 @@ export const deleteDomain: ZodOpenApiOperationObject = {
"x-speakeasy-name-override": "delete",
"x-speakeasy-max-method-params": 1,
summary: "Delete a domain",
- description: "Delete a domain from a workspace.",
+ description:
+ "Delete a domain from a workspace. It cannot be undone. This will also delete all the links associated with the domain.",
requestParams: {
query: workspaceParamsSchema,
path: DomainSchema.pick({ slug: true }),