(links)
- create - Create a new link
- list - Retrieve a list of links
- count - Retrieve links count
- get - Retrieve a link
- update - Update a link
- delete - Delete a link
- createMany - Bulk create links
- updateMany - Bulk update links
- deleteMany - Bulk delete links
- upsert - Upsert a link
Create a new link for the authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.create();
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksCreate } from "dub/funcs/linksCreate.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksCreate(dub);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateLinkRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LinkSchema>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Retrieve a paginated list of links for the authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.list();
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksList } from "dub/funcs/linksList.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksList(dub);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetLinksRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetLinksResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Retrieve the number of links for the authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.count();
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksCount } from "dub/funcs/linksCount.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksCount(dub);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetLinksCountRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<number>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Retrieve the info for a link.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.get();
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksGet } from "dub/funcs/linksGet.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksGet(dub);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetLinkInfoRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LinkSchema>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Update a link for the authenticated workspace. If there's no change, returns it as it is.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.update("<value>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksUpdate } from "dub/funcs/linksUpdate.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksUpdate(dub, "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
linkId |
string | ✔️ | The id of the link to update. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_ . |
requestBody |
operations.UpdateLinkRequestBody | ➖ | N/A |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LinkSchema>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Delete a link for the authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.delete("<value>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksDelete } from "dub/funcs/linksDelete.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksDelete(dub, "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
linkId |
string | ✔️ | The id of the link to delete. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_ . |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.DeleteLinkResponseBody>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Bulk create up to 100 links for the authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.createMany();
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksCreateMany } from "dub/funcs/linksCreateMany.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksCreateMany(dub);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.RequestBody[] | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LinkSchema[]>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Bulk update up to 100 links with the same data for the authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.updateMany();
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksUpdateMany } from "dub/funcs/linksUpdateMany.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksUpdateMany(dub);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.BulkUpdateLinksRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LinkSchema[]>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Bulk delete up to 100 links for the authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.deleteMany({
linkIds: [
"clux0rgak00011...",
"clux0rgak00022...",
],
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksDeleteMany } from "dub/funcs/linksDeleteMany.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksDeleteMany(dub, {
linkIds: [
"clux0rgak00011...",
"clux0rgak00022...",
],
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.BulkDeleteLinksRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.BulkDeleteLinksResponseBody>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Upsert a link for the authenticated workspace by its URL. If a link with the same URL already exists, return it (or update it if there are any changes). Otherwise, a new link will be created.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.links.upsert();
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { linksUpsert } from "dub/funcs/linksUpsert.js";
// Use `DubCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dub = new DubCore({
token: "DUB_API_KEY",
});
async function run() {
const res = await linksUpsert(dub);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UpsertLinkRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LinkSchema>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |