Skip to content

Latest commit

 

History

History
240 lines (166 loc) · 24.2 KB

README.md

File metadata and controls

240 lines (166 loc) · 24.2 KB

ProjectDomains

(projectDomains)

Overview

Available Operations

  • get - Get a project domain
  • update - Update a project domain
  • delete - Remove a domain from a project

get

Get project domain by project id/name and domain name.

Example Usage

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

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

async function run() {
  const result = await vercel.projectDomains.get("<value>", "www.example.com");
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { projectDomainsGet } from "@simplesagar/vercel/funcs/projectDomainsGet.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 projectDomainsGet(vercel, "<value>", "www.example.com");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description Example
idOrName string ✔️ The unique project identifier or the project name
domain string ✔️ The project domain name [object Object]
teamId string The Team identifier to perform the request on behalf of.
slug string The Team slug to perform the request on behalf of.
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.GetProjectDomainResponseBody>

Errors

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

update

Update a project domain's configuration, including the name, git branch and redirect of the domain.

Example Usage

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

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

async function run() {
  const result = await vercel.projectDomains.update({
    idOrName: "<value>",
    domain: "www.example.com",
  });
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { projectDomainsUpdate } from "@simplesagar/vercel/funcs/projectDomainsUpdate.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 projectDomainsUpdate(vercel, {
    idOrName: "<value>",
    domain: "www.example.com",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

delete

Remove a domain from a project by passing the domain name and by specifying the project by either passing the project id or name in the URL.

Example Usage

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

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

async function run() {
  const result = await vercel.projectDomains.delete("<value>", "www.example.com");
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { projectDomainsDelete } from "@simplesagar/vercel/funcs/projectDomainsDelete.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 projectDomainsDelete(vercel, "<value>", "www.example.com");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description Example
idOrName string ✔️ The unique project identifier or the project name
domain string ✔️ The project domain name [object Object]
teamId string The Team identifier to perform the request on behalf of.
slug string The Team slug to perform the request on behalf of.
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.RemoveProjectDomainResponseBody>

Errors

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