Skip to content

Latest commit

 

History

History
502 lines (379 loc) · 36.5 KB

File metadata and controls

502 lines (379 loc) · 36.5 KB

Aliases

Overview

Available Operations

listDeploymentAliases

Retrieves all Aliases for the Deployment with the given ID. The authenticated user or team must own the deployment.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.aliases.listDeploymentAliases({
    id: "dpl_FjvFJncQHQcZMznrUm9EoB8sFuPa",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { aliasesListDeploymentAliases } from "@vercel/sdk/funcs/aliasesListDeploymentAliases.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await aliasesListDeploymentAliases(vercel, {
    id: "dpl_FjvFJncQHQcZMznrUm9EoB8sFuPa",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aliasesListDeploymentAliases failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.ListDeploymentAliasesRequest ✔️ 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.

Response

Promise<models.ListDeploymentAliasesResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

assignAlias

Creates a new alias for the deployment with the given deployment ID. The authenticated user or team must own this deployment. If the desired alias is already assigned to another deployment, then it will be removed from the old deployment and assigned to the new one.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.aliases.assignAlias({
    id: "dpl_FjvFJncQHQcZMznrUm9EoB8sFuPa",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      alias: "my-alias.vercel.app",
      redirect: null,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { aliasesAssignAlias } from "@vercel/sdk/funcs/aliasesAssignAlias.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await aliasesAssignAlias(vercel, {
    id: "dpl_FjvFJncQHQcZMznrUm9EoB8sFuPa",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      alias: "my-alias.vercel.app",
      redirect: null,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aliasesAssignAlias failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.AssignAliasRequest ✔️ 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.

Response

Promise<models.AssignAliasResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

listAliases

Retrieves a list of aliases for the authenticated User or Team. When domain is provided, only aliases for that domain will be returned. When projectId is provided, it will only return the given project aliases.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.aliases.listAliases({
    domain: "my-test-domain.com",
    from: 1540095775951,
    limit: 10,
    projectId: "prj_12HKQaOmR5t5Uy6vdcQsNIiZgHGB",
    since: 1540095775941,
    until: 1540095775951,
    rollbackDeploymentId: "dpl_XXX",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { aliasesListAliases } from "@vercel/sdk/funcs/aliasesListAliases.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await aliasesListAliases(vercel, {
    domain: "my-test-domain.com",
    from: 1540095775951,
    limit: 10,
    projectId: "prj_12HKQaOmR5t5Uy6vdcQsNIiZgHGB",
    since: 1540095775941,
    until: 1540095775951,
    rollbackDeploymentId: "dpl_XXX",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aliasesListAliases failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.ListAliasesRequest ✔️ 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.

Response

Promise<models.ListAliasesResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getAlias

Retrieves an Alias for the given host name or alias ID.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.aliases.getAlias({
    from: 1540095775951,
    idOrAlias: "example.vercel.app",
    projectId: "prj_12HKQaOmR5t5Uy6vdcQsNIiZgHGB",
    since: 1540095775941,
    until: 1540095775951,
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { aliasesGetAlias } from "@vercel/sdk/funcs/aliasesGetAlias.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await aliasesGetAlias(vercel, {
    from: 1540095775951,
    idOrAlias: "example.vercel.app",
    projectId: "prj_12HKQaOmR5t5Uy6vdcQsNIiZgHGB",
    since: 1540095775941,
    until: 1540095775951,
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aliasesGetAlias failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetAliasRequest ✔️ 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.

Response

Promise<models.GetAliasResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

deleteAlias

Delete an Alias with the specified ID.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.aliases.deleteAlias({
    aliasId: "2WjyKQmM8ZnGcJsPWMrHRHrE",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { aliasesDeleteAlias } from "@vercel/sdk/funcs/aliasesDeleteAlias.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await aliasesDeleteAlias(vercel, {
    aliasId: "2WjyKQmM8ZnGcJsPWMrHRHrE",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aliasesDeleteAlias failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.DeleteAliasRequest ✔️ 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.

Response

Promise<models.DeleteAliasResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

patchUrlProtectionBypass

Update the protection bypass for the alias or deployment URL (used for user access & comment access for deployments). Used as shareable links and user scoped access for Vercel Authentication and also to allow external (logged in) people to comment on previews for Preview Comments (next-live-mode).

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.aliases.patchUrlProtectionBypass({
    id: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { aliasesPatchUrlProtectionBypass } from "@vercel/sdk/funcs/aliasesPatchUrlProtectionBypass.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await aliasesPatchUrlProtectionBypass(vercel, {
    id: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aliasesPatchUrlProtectionBypass failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.PatchUrlProtectionBypassRequest ✔️ 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.

Response

Promise<{ [k: string]: any }>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*