Skip to content

Latest commit

 

History

History
342 lines (244 loc) · 25.8 KB

README.md

File metadata and controls

342 lines (244 loc) · 25.8 KB

Users

(users)

Available Operations

list

List Users

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.ConsoleV1UsersControllerGenListResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1UsersControllerGenListResponseBody 400 application/json
errors.ConsoleV1UsersControllerGenListUsersResponseBody 401 application/json
errors.SDKError 4xx-5xx /

get

Get user by id

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.ConsoleV1UsersControllerGenReadResponseBody>

Errors

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

Update user

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.ConsoleV1UsersControllerUpdateResponseBody>

Errors

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

Invite user

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.ConsoleV1UsersControllerInviteUsersResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1UsersControllerInviteUsersResponseBody 400 application/json
errors.ConsoleV1UsersControllerInviteUsersUsersResponseBody 401 application/json
errors.SDKError 4xx-5xx /