Links
(links)
Available Operations
- list - Retrieve a list of links
- create - Create a new link
- count - Retrieve the number of links
- get - Retrieve a link
- update - Edit a link
- delete - Delete a link
- createMany - Bulk create links
list
Retrieve a list of links for the authenticated workspace. The list will be paginated and the provided query parameters allow filtering the returned links.
Example Usage
import { Dub } from "dub";
async function run() {
const sdk = new Dub({
token: "<YOUR_BEARER_TOKEN_HERE>",
workspaceId: "<value>",
});
const result = await sdk.links.list({
tagIds: [
"<value>",
],
});
// Handle the result
console.log(result)
}
run();
Parameters
| 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. |
Response
Promise<components.LinkSchema[]>
Errors
| Error Object | 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 | / |
create
Create a new link for the authenticated workspace.
Example Usage
import { Dub } from "dub";
async function run() {
const sdk = new Dub({
token: "<YOUR_BEARER_TOKEN_HERE>",
workspaceId: "<value>",
});
const result = await sdk.links.create({
url: "http://limp-pastry.org",
tagIds: "<value>",
geo: {},
});
// Handle the result
console.log(result)
}
run();
Parameters
| 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. |
Response
Promise<components.LinkSchema>
Errors
| Error Object | 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 | / |
count
Retrieve the number of links for the authenticated workspace. The provided query parameters allow filtering the returned links.
Example Usage
import { Dub } from "dub";
import { One } from "dub/models/operations";
async function run() {
const sdk = new Dub({
token: "<YOUR_BEARER_TOKEN_HERE>",
workspaceId: "<value>",
});
const result = await sdk.links.count({
tagIds: "<value>",
groupBy: One.Domain,
});
// Handle the result
console.log(result)
}
run();
Parameters
| 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. |
Response
Promise<number>
Errors
| Error Object | 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 | / |
get
Retrieve the info for a link from their domain and key.
Example Usage
import { Dub } from "dub";
async function run() {
const sdk = new Dub({
token: "<YOUR_BEARER_TOKEN_HERE>",
workspaceId: "<value>",
});
const result = await sdk.links.get({
domain: "ringed-blow.name",
key: "<key>",
});
// Handle the result
console.log(result)
}
run();
Parameters
| 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. |
Response
Promise<components.LinkSchema>
Errors
| Error Object | 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
Edit a link for the authenticated workspace.
Example Usage
import { Dub } from "dub";
async function run() {
const sdk = new Dub({
token: "<YOUR_BEARER_TOKEN_HERE>",
workspaceId: "<value>",
});
const linkId = "<value>";
const requestBody = {
url: "https://alarming-nondisclosure.com",
tagIds: "<value>",
geo: {},
};
const result = await sdk.links.update(linkId, requestBody);
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
linkId |
string | ✔️ | The id of the link to edit. You can get this via the getLinkInfo endpoint. |
requestBody |
operations.EditLinkRequestBody | ➖ | 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. |
Response
Promise<components.LinkSchema>
Errors
| Error Object | 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
Delete a link for the authenticated workspace.
Example Usage
import { Dub } from "dub";
async function run() {
const sdk = new Dub({
token: "<YOUR_BEARER_TOKEN_HERE>",
workspaceId: "<value>",
});
const linkId = "<value>";
const result = await sdk.links.delete(linkId);
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
linkId |
string | ✔️ | The id of the link to delete. You can get this via the getLinkInfo endpoint. |
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. |
Response
Promise<operations.DeleteLinkResponseBody>
Errors
| Error Object | 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 | / |
createMany
Bulk create up to 100 links for the authenticated workspace.
Example Usage
import { Dub } from "dub";
async function run() {
const sdk = new Dub({
token: "<YOUR_BEARER_TOKEN_HERE>",
workspaceId: "<value>",
});
const result = await sdk.links.createMany([
{
url: "https://positive-plane.info",
tagIds: [
"<value>",
],
geo: {},
},
]);
// Handle the result
console.log(result)
}
run();
Parameters
| 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. |
Response
Promise<components.LinkSchema[]>
Errors
| Error Object | 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 | / |