- list - Retrieve a list of folders
- create - Create a folder
- delete - Delete a folder
- update - Update a folder
Retrieve a list of folders for the authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.folders.list();
console.log(result);
}
run();The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { foldersList } from "dub/funcs/foldersList.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 foldersList(dub);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("foldersList failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListFoldersRequest | ✔️ | 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.FolderSchema[]>
| 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 | */* |
Create a folder for the authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.folders.create();
console.log(result);
}
run();The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { foldersCreate } from "dub/funcs/foldersCreate.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 foldersCreate(dub);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("foldersCreate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CreateFolderRequestBody | ✔️ | 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.FolderSchema>
| 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 folder from the workspace. All existing links will still work, but they will no longer be associated with this folder.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.folders.delete("<id>");
console.log(result);
}
run();The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { foldersDelete } from "dub/funcs/foldersDelete.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 foldersDelete(dub, "<id>");
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("foldersDelete failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | ✔️ | The ID of the folder to delete. |
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.DeleteFolderResponseBody>
| 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 folder in the workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.folders.update("<id>");
console.log(result);
}
run();The standalone function version of this method:
import { DubCore } from "dub/core.js";
import { foldersUpdate } from "dub/funcs/foldersUpdate.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 foldersUpdate(dub, "<id>");
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("foldersUpdate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | ✔️ | The ID of the folder to update. |
requestBody |
operations.UpdateFolderRequestBody | ➖ | 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.FolderSchema>
| 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 | */* |