mirror of
https://github.com/LukeHagar/dub-node.git
synced 2025-12-06 04:19:37 +00:00
563 lines
16 KiB
YAML
563 lines
16 KiB
YAML
overlay: 1.0.0
|
|
info:
|
|
title: CodeSamples overlay for typescript target
|
|
version: 0.0.0
|
|
actions:
|
|
- target: $["paths"]["/analytics/top_urls"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getTopURLs"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.topUrls({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/tags"]["post"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "createTag"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.create({
|
|
tag: "<value>",
|
|
});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/links/count"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getLinksCount"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.count({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/analytics/timeseries"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getTimeseriesAnalytics"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.timeseries({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/analytics/browser"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getBrowserAnalytics"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.browsers({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/tags"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getTags"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.list({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/metatags"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getMetatags"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.get({
|
|
url: "https://dub.co",
|
|
});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/links/{linkId}"]["patch"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "updateLink"
|
|
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const linkId = \"<value>\";\n const requestBody = {\n url: \"https://google/com\",\n };\n \n const result = await dub.update(linkId, requestBody);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
|
|
- target: $["paths"]["/analytics/clicks"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getClicksAnalytics"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.clicks({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/workspaces"]["post"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "createWorkspace"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.create({
|
|
name: "<value>",
|
|
slug: "<value>",
|
|
});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/domains/{slug}/transfer"]["post"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "transferDomain"
|
|
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n const requestBody = {\n newWorkspaceId: \"<value>\",\n };\n \n const result = await dub.transfer(slug, requestBody);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
|
|
- target: $["paths"]["/analytics/country"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getCountryAnalytics"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.countries({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/analytics/city"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getCityAnalytics"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.cities({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/workspaces"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getWorkspaces"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.list();
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/domains/{slug}/primary"]["post"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "setPrimaryDomain"
|
|
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n \n const result = await dub.setPrimary(slug);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
|
|
- target: $["paths"]["/analytics/os"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getOSAnalytics"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.os({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/domains"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "listDomains"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.list({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/domains/{slug}"]["delete"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "deleteDomain"
|
|
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n \n const result = await dub.delete(slug);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
|
|
- target: $["paths"]["/links"]["post"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "createLink"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.create({
|
|
url: "https://google/com",
|
|
});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/links/bulk"]["post"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "bulkCreateLinks"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.createMany([
|
|
{
|
|
url: "https://google/com",
|
|
},
|
|
]);
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/analytics/referer"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getRefererAnalytics"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.referers({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/analytics/top_links"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getTopLinks"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.topLinks({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/links"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getLinks"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.list({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/links/info"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getLinkInfo"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.get({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/links/{linkId}"]["delete"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "deleteLink"
|
|
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const linkId = \"<value>\";\n \n const result = await dub.delete(linkId);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
|
|
- target: $["paths"]["/domains/{slug}"]["patch"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "updateDomain"
|
|
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n const requestBody = {};\n \n const result = await dub.update(slug, requestBody);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
|
|
- target: $["paths"]["/qr"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getQRCode"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.get({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/workspaces/{idOrSlug}"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getWorkspace"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.get({
|
|
idOrSlug: "<value>",
|
|
});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/domains"]["post"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "addDomain"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.add({
|
|
slug: "acme.com",
|
|
});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- target: $["paths"]["/analytics/device"]["get"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "getDeviceAnalytics"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.devices({});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|