mirror of
https://github.com/LukeHagar/dub-node.git
synced 2025-12-09 20:37:49 +00:00
* fix: infer optional arguments in SDK methods This change enables a flag that will cause the generator to infer when request and security arguments of SDK methods should be treated as optional. The rule is: if all fields of a request or security type are optional then an argument of that type will be marked as optional in methods. * chore: regenerate sdk
657 lines
16 KiB
YAML
657 lines
16 KiB
YAML
overlay: 1.0.0
|
|
info:
|
|
title: CodeSamples overlay for typescript target
|
|
version: 0.0.0
|
|
actions:
|
|
- 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/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"]["/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/{slug}"]["patch"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "updateDomain"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.update("acme.com", {});
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- 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"]["/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"]["/domains/{slug}"]["delete"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "deleteDomain"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.delete("acme.com");
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
- 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"]["/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"]["/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"]["/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}/transfer"]["post"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "transferDomain"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.transfer("acme.com", {
|
|
newWorkspaceId: "<value>",
|
|
});
|
|
|
|
// 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}"]["patch"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "updateLink"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.update("<value>", {
|
|
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"]["/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"]["/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"]["/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"]["/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"]["/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/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"]["/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"]["/domains/{slug}/primary"]["post"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "setPrimaryDomain"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.setPrimary("acme.com");
|
|
|
|
// 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"]["/links/{linkId}"]["delete"]
|
|
update:
|
|
"x-codeSamples":
|
|
- "lang": "typescript"
|
|
"label": "deleteLink"
|
|
"source": |-
|
|
import { Dub } from "dub";
|
|
|
|
const dub = new Dub({
|
|
token: "DUB_API_KEY",
|
|
workspaceId: "<value>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await dub.delete("<value>");
|
|
|
|
// 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();
|
|
- 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();
|