(users)
List Users
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.users.list({
limit: 10,
page: 1,
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { usersList } from "statsig/funcs/usersList.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await usersList(statsig, {
limit: 10,
page: 1,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1UsersControllerGenListRequest | ✔️ | 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<operations.ConsoleV1UsersControllerGenListResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1UsersControllerGenListResponseBody | 400 | application/json |
errors.ConsoleV1UsersControllerGenListUsersResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
Get user by id
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.users.get({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { usersGet } from "statsig/funcs/usersGet.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await usersGet(statsig, {
id: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1UsersControllerGenReadRequest | ✔️ | 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<operations.ConsoleV1UsersControllerGenReadResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1UsersControllerGenReadResponseBody | 400 | application/json |
errors.ConsoleV1UsersControllerGenReadUsersResponseBody | 401 | application/json |
errors.ConsoleV1UsersControllerGenReadUsersResponseResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Update user
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.users.update({
id: "<id>",
userUpdateDto: {},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { usersUpdate } from "statsig/funcs/usersUpdate.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await usersUpdate(statsig, {
id: "<id>",
userUpdateDto: {},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1UsersControllerUpdateRequest | ✔️ | 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<operations.ConsoleV1UsersControllerUpdateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1UsersControllerUpdateResponseBody | 400 | application/json |
errors.ConsoleV1UsersControllerUpdateUsersResponseBody | 401 | application/json |
errors.ConsoleV1UsersControllerUpdateUsersResponseResponseBody | 403 | application/json |
errors.ConsoleV1UsersControllerUpdateUsersResponse404ResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Invite user
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.users.invite({
userInvitesDto: {
role: "<value>",
emails: [
"[email protected]",
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { usersInvite } from "statsig/funcs/usersInvite.js";
// Use `StatsigCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const statsig = new StatsigCore({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await usersInvite(statsig, {
userInvitesDto: {
role: "<value>",
emails: [
"[email protected]",
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1UsersControllerInviteUsersRequest | ✔️ | 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<operations.ConsoleV1UsersControllerInviteUsersResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1UsersControllerInviteUsersResponseBody | 400 | application/json |
errors.ConsoleV1UsersControllerInviteUsersUsersResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |