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 TypeScript SDK documentation

Kiran K34d7c515f724
diff --git a/apps/docs/mint.json b/apps/docs/mint.json
index 71ce648450..1b1b5b9b4b 100644
--- a/apps/docs/mint.json
+++ b/apps/docs/mint.json
@@ -127,6 +127,7 @@
{
"group": "TypeScript",
"pages": [
+ "sdks/typescript/overview",
{
"group": "Links",
"pages": [
diff --git a/apps/docs/sdks/overview.mdx b/apps/docs/sdks/overview.mdx
index dbcc1b1890..7decd677a8 100644
--- a/apps/docs/sdks/overview.mdx
+++ b/apps/docs/sdks/overview.mdx
@@ -8,7 +8,7 @@ description: "Open-source client libraries for the Dub.co API"
<Card
title="TypeScript"
icon="github"
- href="/sdks/typescript"
+ href="/sdks/typescript/overview"
color="#333333"
>
TypeScript SDK for Dub.co API
diff --git a/apps/docs/sdks/typescript.mdx b/apps/docs/sdks/typescript.mdx
deleted file mode 100644
index 1c0f45f8e8..0000000000
--- a/apps/docs/sdks/typescript.mdx
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: "TypeScript"
-"og:title": "Open-source libraries & SDKs for Dub.co API"
-description: "Open-source client libraries for the Dub.co API"
----
\ No newline at end of file
diff --git a/apps/docs/sdks/typescript/overview.mdx b/apps/docs/sdks/typescript/overview.mdx
new file mode 100644
index 0000000000..dc76f76965
--- /dev/null
+++ b/apps/docs/sdks/typescript/overview.mdx
@@ -0,0 +1,66 @@
+---
+title: "Overview"
+description: "TypeScript SDK for Dub.co"
+---
+
+## Install
+
+<Tabs>
+ <Tab title="npm">
+
+ ```bash
+ npm install dub
+ ```
+
+ </Tab>
+
+ <Tab title="pnpm">
+
+ ```bash
+ pnpm add dub
+ ```
+
+ </Tab>
+
+ <Tab title="yarn">
+
+ ```bash
+ yarn add dub
+ ```
+
+ </Tab>
+</Tabs>
+
+## Options
+
+The SDK constructor accepts an options object with the following properties:
+
+<ParamField body="token" type="string" required>
+ The API token for the Dub.co API. You can create your token from the [Dub.co
+ dashboard](https://app.dub.co/settings/tokens).
+</ParamField>
+
+<ParamField body="workspaceId" type="string" required>
+ The id of the workspace you want to interact with. [Learn how to get your
+ Workspace ID on Dub?](https://dub.co/help/article/how-to-get-workspace-id)
+</ParamField>
+
+<ParamField body="projectSlug" type="string">
+ The slug of the project you want to interact with. `projectSlug` is
+ deprecated, use `workspaceId` instead.
+</ParamField>
+
+## Usage
+
+```typescript
+import { Dub } from "dub";
+
+const dub = new Dub({
+ token: "DUB_API_KEY",
+ workspaceId: "ws_clugls3...",
+});
+
+await dub.links.create({
+ url: "https://google/com",
+});
+```
\ No newline at end of file