Files
dub-node/docs/sdks/domains/README.md
2024-04-19 11:28:50 +05:30

25 KiB
Raw Blame History

Domains

(domains)

Available Operations

list

Retrieve a list of domains associated with the authenticated workspace.

Example Usage

import { Dub } from "dub";

const dub = new Dub({
  token: "DUB_API_KEY",
  workspaceId: "<value>",
});

async function run() {
  const result = await dub.domains.list({});

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.ListDomainsRequest ✔️ 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<operations.ListDomainsResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

add

Add a domain to the authenticated workspace.

Example Usage

import { Dub } from "dub";

const dub = new Dub({
  token: "DUB_API_KEY",
  workspaceId: "<value>",
});

async function run() {
  const result = await dub.domains.add({
    slug: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.AddDomainRequestBody ✔️ 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<operations.AddDomainResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

delete

Delete a domain from a workspace.

Example Usage

import { Dub } from "dub";

const dub = new Dub({
  token: "DUB_API_KEY",
  workspaceId: "<value>",
});

async function run() {
  const result = await dub.domains.delete({
    slug: "acme.com",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.DeleteDomainRequest ✔️ 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<operations.DeleteDomainResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

update

Edit a domain for the authenticated workspace.

Example Usage

import { Dub } from "dub";

const dub = new Dub({
  token: "DUB_API_KEY",
  workspaceId: "<value>",
});

async function run() {
  const result = await dub.domains.update({
    slug: "acme.com",
    requestBody: {},
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.EditDomainRequest ✔️ 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<operations.EditDomainResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

setPrimary

Set a domain as primary for the authenticated workspace.

Example Usage

import { Dub } from "dub";

const dub = new Dub({
  token: "DUB_API_KEY",
  workspaceId: "<value>",
});

async function run() {
  const result = await dub.domains.setPrimary({
    slug: "acme.com",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.SetPrimaryDomainRequest ✔️ 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<operations.SetPrimaryDomainResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

transfer

Transfer a domain to another workspace within the authenticated account.

Example Usage

import { Dub } from "dub";

const dub = new Dub({
  token: "DUB_API_KEY",
  workspaceId: "<value>",
});

async function run() {
  const result = await dub.domains.transfer({
    slug: "acme.com",
    requestBody: {
      newWorkspaceId: "<value>",
    },
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.TransferDomainRequest ✔️ 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<operations.TransferDomainResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /