Skip to content

Latest commit

 

History

History
155 lines (104 loc) · 10.5 KB

README.md

File metadata and controls

155 lines (104 loc) · 10.5 KB

User

(user)

Overview

User

Available Operations

getAuthUser

Retrieves information related to the currently authenticated User.

Example Usage

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

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

async function run() {
  const result = await vercel.user.getAuthUser();
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { userGetAuthUser } from "@simplesagar/vercel/funcs/userGetAuthUser.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 userGetAuthUser(vercel);

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
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.GetAuthUserResponseBody>

Errors

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

requestDelete

Initiates the deletion process for the currently authenticated User, by sending a deletion confirmation email. The email contains a link that the user needs to visit in order to proceed with the deletion process.

Example Usage

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

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

async function run() {
  const result = await vercel.user.requestDelete();
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@simplesagar/vercel/core.js";
import { userRequestDelete } from "@simplesagar/vercel/funcs/userRequestDelete.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 userRequestDelete(vercel);

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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