Skip to content

Latest commit

 

History

History
212 lines (149 loc) · 16.9 KB

README.md

File metadata and controls

212 lines (149 loc) · 16.9 KB

Storage

Overview

Available Operations

getStorageStoresById

Get a store

Example Usage

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

const vercel = new Vercel();

async function run() {
  const result = await vercel.storage.getStorageStoresById({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore();

async function run() {
  const res = await storageGetStorageStoresById(vercel, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("storageGetStorageStoresById failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

createStorageStoresBlob

Create a Blob store

Example Usage

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

const vercel = new Vercel();

async function run() {
  const result = await vercel.storage.createStorageStoresBlob();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore();

async function run() {
  const res = await storageCreateStorageStoresBlob(vercel);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("storageCreateStorageStoresBlob failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

deleteStorageStoresBlobById

Delete a Blob store

Example Usage

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

const vercel = new Vercel();

async function run() {
  const result = await vercel.storage.deleteStorageStoresBlobById({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore();

async function run() {
  const res = await storageDeleteStorageStoresBlobById(vercel, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("storageDeleteStorageStoresBlobById failed:", res.error);
  }
}

run();

Parameters

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

Errors

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