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 SDK doc with externalId usage

Kiran Kec5189b17ec4
diff --git a/apps/docs/sdks/typescript/links/create-many.mdx b/apps/docs/sdks/typescript/links/create-many.mdx
index 50ded17efe..4b7819ed7b 100644
--- a/apps/docs/sdks/typescript/links/create-many.mdx
+++ b/apps/docs/sdks/typescript/links/create-many.mdx
@@ -22,6 +22,11 @@ import LinkResponse from "/snippets/link-response.mdx";
generated.
</ParamField>
+<ParamField body="externalId" type="string | null">
+ This is the ID of the link in your database. If set, it can be used to
+ identify the link in the future.
+</ParamField>
+
<ParamField body="prefix" type="string">
The prefix of the short link slug for randomly-generated keys (e.g. if prefix
is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if
@@ -119,6 +124,7 @@ await dub.links.createMany([
id: "clv3u86ej0008y9nm1f1yto2w",
domain: "dub.sh",
key: "FTC1AXj",
+ externalId: "123",
url: "https://www.google.com",
archived: false,
expiresAt: null,
@@ -138,6 +144,7 @@ await dub.links.createMany([
id: "clv3u86ej000ay9nm55qgbh5r",
domain: "dub.sh",
key: "B6qpMch",
+ externalId: "123",
url: "https://github.com",
archived: false,
expiresAt: null,
diff --git a/apps/docs/sdks/typescript/links/create.mdx b/apps/docs/sdks/typescript/links/create.mdx
index 6dcf89a732..f0a78070b4 100644
--- a/apps/docs/sdks/typescript/links/create.mdx
+++ b/apps/docs/sdks/typescript/links/create.mdx
@@ -22,6 +22,11 @@ import LinkResponse from "/snippets/link-response.mdx";
generated.
</ParamField>
+<ParamField body="externalId" type="string | null">
+ This is the ID of the link in your database. If set, it can be used to
+ identify the link in the future.
+</ParamField>
+
<ParamField body="prefix" type="string">
The prefix of the short link slug for randomly-generated keys (e.g. if prefix
is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if
@@ -113,6 +118,7 @@ await dub.links.create({
id: 'clv3o9p9q000au1h0mc7r6l63',
domain: 'dub.sh',
key: 'e7qzMuI',
+ externalId: "123",
url: 'https://www.google.com',
archived: false,
expiresAt: null,
diff --git a/apps/docs/sdks/typescript/links/delete.mdx b/apps/docs/sdks/typescript/links/delete.mdx
index 21612300e8..f35f67f7b6 100644
--- a/apps/docs/sdks/typescript/links/delete.mdx
+++ b/apps/docs/sdks/typescript/links/delete.mdx
@@ -8,6 +8,7 @@ description: "Delete a link for the authenticated workspace."
<ParamField body="linkId" type="string" required>
The id of the link to delete. You can get this via the `links.get` method.
+ Alternatively, you can use your `externalId` prefixed with `ext_`.
</ParamField>
## Response
@@ -19,7 +20,11 @@ description: "Delete a link for the authenticated workspace."
<RequestExample>
```ts
+// Delete a link by linkId
await dub.links.delete("clv3o9p9q000au1h0mc7r6l63");
+
+// Delete a link by externalId
+await dub.links.delete("ext_123");
```
</RequestExample>
diff --git a/apps/docs/sdks/typescript/links/get.mdx b/apps/docs/sdks/typescript/links/get.mdx
index d43d494a86..b7418af8fc 100644
--- a/apps/docs/sdks/typescript/links/get.mdx
+++ b/apps/docs/sdks/typescript/links/get.mdx
@@ -22,7 +22,7 @@ import LinkResponse from "/snippets/link-response.mdx";
</ParamField>
<ParamField body="externalId" type="string">
- This is the ID of the link in the your database. Must be prefixed with `ext_`.
+ This is the ID of the link in the your database. Must be prefixed with `ext_`
when provided.
</ParamField>
@@ -59,6 +59,7 @@ await dub.links.get({
id: 'clv3o9p9q000au1h0mc7r6l63',
domain: 'dub.sh',
key: 'e7qzMuI',
+ externalId: "123",
url: 'https://www.google.com',
archived: false,
expiresAt: null,
diff --git a/apps/docs/sdks/typescript/links/list.mdx b/apps/docs/sdks/typescript/links/list.mdx
index e6c237a71d..c3d65cba76 100644
--- a/apps/docs/sdks/typescript/links/list.mdx
+++ b/apps/docs/sdks/typescript/links/list.mdx
@@ -78,6 +78,7 @@ await dub.links.list({
id: "clv3o9p9q000au1h0mc7r6l63",
domain: "dub.sh",
key: "e7qzMuI",
+ externalId: "123",
url: "https://www.google.com",
archived: false,
expiresAt: null,
diff --git a/apps/docs/sdks/typescript/links/update.mdx b/apps/docs/sdks/typescript/links/update.mdx
index a5d35218a6..40d4ce7e76 100644
--- a/apps/docs/sdks/typescript/links/update.mdx
+++ b/apps/docs/sdks/typescript/links/update.mdx
@@ -20,6 +20,11 @@ import LinkResponse from "/snippets/link-response.mdx";
The short link slug.
</ParamField>
+<ParamField body="externalId" type="string | null">
+ This is the ID of the link in your database. If set, it can be used to
+ identify the link in the future.
+</ParamField>
+
<ParamField body="prefix" type="string">
The prefix of the short link slug for randomly-generated keys (e.g. if prefix
is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if
@@ -97,9 +102,15 @@ import LinkResponse from "/snippets/link-response.mdx";
<RequestExample>
```ts
+// Update a link linkId
await dub.links.update("clv3o9p9q000au1h0mc7r6l63", {
tagIds: ["clv3j1h7o00032u1ngo8luv84"],
});
+
+// Update a link externalId
+await dub.links.update("ext_123", {
+ tagIds: ["clv3j1h7o00032u1ngo8luv84"],
+});
```
</RequestExample>
@@ -111,6 +122,7 @@ await dub.links.update("clv3o9p9q000au1h0mc7r6l63", {
id: 'clv3o9p9q000au1h0mc7r6l63',
domain: 'dub.sh',
key: 'e7qzMuI',
+ externalId: "123",
url: 'https://www.google.com',
archived: false,
expiresAt: null,
diff --git a/apps/docs/snippets/link-response.mdx b/apps/docs/snippets/link-response.mdx
index 5e7b6ac85d..5b33ec3e6b 100644
--- a/apps/docs/snippets/link-response.mdx
+++ b/apps/docs/snippets/link-response.mdx
@@ -12,6 +12,12 @@
generated.
</ResponseField>
+<ResponseField name="externalId" type="string | null" required>
+ This is the ID of the link in your database. If set, it can be used to
+ identify the link in the future. Must be prefixed with `ext_` when provided to
+ `links.get`, `links.update`, and `links.delete` methods.
+</ResponseField>
+
<ResponseField name="url" type="string" required>
The destination URL of the short link.
</ResponseField>