(deployments)
Deployments
- getEvents - Get deployment events
- get - Get a deployment by ID or URL
- create - Create a new deployment
- cancel - Cancel a deployment
- uploadFile - Upload Deployment Files
- listAliases - List Deployment Aliases
- listFiles - List Deployment Files
- getFileContents - Get Deployment File Contents
- list - List deployments
- delete - Delete a Deployment
Get the build logs of a deployment by deployment ID and build ID. It can work as an infinite stream of logs or as a JSON endpoint depending on the input parameters.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.deployments.getEvents({
idOrUrl: "dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsGetEvents } from "@simplesagar/vercel/funcs/deploymentsGetEvents.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 deploymentsGetEvents(vercel, {
idOrUrl: "dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.GetDeploymentEventsRequest | ✔️ | 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<models.GetDeploymentEventsResponse>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
Retrieves information for a deployment either by supplying its ID (id
property) or Hostname (url
property). Additional details will be included when the authenticated user or team is an owner of the deployment.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.deployments.get("dpl_89qyp1cskzkLrVicDaZoDbjyHuDJ");
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsGet } from "@simplesagar/vercel/funcs/deploymentsGet.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 deploymentsGet(vercel, "dpl_89qyp1cskzkLrVicDaZoDbjyHuDJ");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
idOrUrl |
string | ✔️ | The unique identifier or hostname of the deployment. | [object Object] |
withGitRepoInfo |
string | ➖ | Whether to add in gitRepo information. | [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. |
Promise<models.GetDeploymentResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
Create a new deployment with all the required and intended data. If the deployment is not a git deployment, all files must be provided with the request, either referenced or inlined. Additionally, a deployment id can be specified to redeploy a previous deployment.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.deployments.create({});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsCreate } from "@simplesagar/vercel/funcs/deploymentsCreate.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 deploymentsCreate(vercel, {});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.CreateDeploymentRequest | ✔️ | 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<models.CreateDeploymentResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
This endpoint allows you to cancel a deployment which is currently building, by supplying its id
in the URL.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.deployments.cancel("dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd");
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsCancel } from "@simplesagar/vercel/funcs/deploymentsCancel.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 deploymentsCancel(vercel, "dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
string | ✔️ | The unique identifier of the deployment. | [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. |
Promise<models.CancelDeploymentResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
Before you create a deployment you need to upload the required files for that deployment. To do it, you need to first upload each file to this endpoint. Once that's completed, you can create a new deployment with the uploaded files. The file content must be placed inside the body of the request. In the case of a successful response you'll receive a status code 200 with an empty body.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.deployments.uploadFile({});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsUploadFile } from "@simplesagar/vercel/funcs/deploymentsUploadFile.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 deploymentsUploadFile(vercel, {});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.UploadFileRequest | ✔️ | 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<models.UploadFileResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
Retrieves all Aliases for the Deployment with the given ID. The authenticated user or team must own the deployment.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.deployments.listAliases("dpl_FjvFJncQHQcZMznrUm9EoB8sFuPa");
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsListAliases } from "@simplesagar/vercel/funcs/deploymentsListAliases.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 deploymentsListAliases(vercel, "dpl_FjvFJncQHQcZMznrUm9EoB8sFuPa");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
string | ✔️ | The ID of the deployment the aliases should be listed for | [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. |
Promise<models.ListDeploymentAliasesResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
Allows to retrieve the file structure of a deployment by supplying the deployment unique identifier.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.deployments.listFiles("<id>");
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsListFiles } from "@simplesagar/vercel/funcs/deploymentsListFiles.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 deploymentsListFiles(vercel, "<id>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The unique deployment identifier |
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. |
Promise<models.FileTree[]>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
Allows to retrieve the content of a file by supplying the file identifier and the deployment unique identifier. The response body will contain a JSON response containing the contents of the file encoded as base64.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await vercel.deployments.getFileContents({
id: "<id>",
fileId: "<value>",
});
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsGetFileContents } from "@simplesagar/vercel/funcs/deploymentsGetFileContents.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 deploymentsGetFileContents(vercel, {
id: "<id>",
fileId: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.GetDeploymentFileContentsRequest | ✔️ | 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<void>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
List deployments under the authenticated user or team. If a deployment hasn't finished uploading (is incomplete), the url
property will have a value of null
.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.deployments.list({});
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsList } from "@simplesagar/vercel/funcs/deploymentsList.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 deploymentsList(vercel, {});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.GetDeploymentsRequest | ✔️ | 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<models.GetDeploymentsResponse>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
This API allows you to delete a deployment, either by supplying its id
in the URL or the url
of the deployment as a query parameter. You can obtain the ID, for example, by listing all deployments.
import { Vercel } from "@simplesagar/vercel";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.deployments.delete("dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd");
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { VercelCore } from "@simplesagar/vercel/core.js";
import { deploymentsDelete } from "@simplesagar/vercel/funcs/deploymentsDelete.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 deploymentsDelete(vercel, "dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
string | ✔️ | The ID of the deployment to be deleted | [object Object] |
url |
string | ➖ | A Deployment or Alias URL. In case it is passed, the ID will be ignored | [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. |
Promise<models.DeleteDeploymentResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |