(user)
User
- getAuthUser - Get the User
- requestDelete - Delete User Account
Retrieves information related to the currently authenticated User.
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();
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();
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. |
Promise<models.GetAuthUserResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |
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.
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();
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();
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. |
Promise<models.RequestDeleteResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
models.SDKError | 4xx-5xx | / |