(gates)
- create - Create Gate
- list - List Gates
- get - Read Gate
- updatePartial - Partially Update Gates
- update - Fully Update Gates
- delete - Delete Gates
- getRules - Read Gate Rules
- updateRules - Update list of Gate Rules
- addRules - Add Multiple Gate Rule
- updateRule - Update Gate Rules
- deleteRule - Delete Gate Rules
- addRule - Add Gate Rule
- launch - Launch Gate
- disable - Disable Gate
- enable - Enable Gate
- archive - Archive Gate
- loadPulse - Load Pulse Gate
- getOverride - Get Gate Override
- updateOverride - Update Gate Overrides
- addOverride - Add Gate Overrides
- removeOverride - Delete Gate Overrides
Create Gate
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.create({
gateCreateDto: {
isEnabled: false,
description: "helpful summary of what this gate does",
rules: [
{
name: "All Conditions",
passPercentage: 10,
conditions: [
{
type: "public",
},
{
targetValue: [
111,
222,
],
operator: "any",
type: "user_id",
},
{
targetValue: [
@outlook.com,
@gmail.com,
],
operator: "str_contains_any",
type: "email",
},
{
targetValue: 31,
operator: "gt",
field: "age",
type: "custom_field",
},
{
targetValue: "1.1.1",
operator: "version_gt",
type: "app_version",
},
{
targetValue: "[\"Android\",\"Chrome\"]",
operator: "any",
type: "browser_name",
},
{
targetValue: 94.0.4606.81,94.0.4606.92,
operator: "any",
type: "browser_version",
},
{
targetValue: [
Android,
Windows,
],
operator: "none",
type: "os_name",
},
{
targetValue: "11.0.0",
operator: "version_lte",
type: "os_version",
},
{
targetValue: [
NZ,
US,
],
operator: "any",
type: "country",
},
{
targetValue: "my_gate_2",
type: "passes_gate",
},
{
targetValue: "my_gate_2",
type: "fails_gate",
},
{
targetValue: 1643070357193,
operator: "after",
type: "time",
},
{
targetValue: [
"production",
],
operator: "any",
type: "environment_tier",
},
{
targetValue: "growth_org",
type: "passes_segment",
},
{
targetValue: "growth_org",
type: "fails_segment",
},
{
targetValue: 1.1.1.1,8.8.8.8,
operator: "any",
type: "ip_address",
},
],
},
],
tags: [
"<value>",
],
idType: "userID",
targetApps: "[\"my_app\"]",
team: "team",
monitoringMetrics: [
{
name: "dau",
type: "user",
},
],
name: "a_verbose_gate",
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesCreate } from "statsig/funcs/gatesCreate.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 gatesCreate(statsig, {
gateCreateDto: {
isEnabled: false,
description: "helpful summary of what this gate does",
rules: [
{
name: "All Conditions",
passPercentage: 10,
conditions: [
{
type: "public",
},
{
targetValue: [
"111",
"222",
],
operator: "any",
type: "user_id",
},
{
targetValue: "[\"@outlook.com\",\"@gmail.com\"]",
operator: "str_contains_any",
type: "email",
},
{
targetValue: 31,
operator: "gt",
field: "age",
type: "custom_field",
},
{
targetValue: "1.1.1",
operator: "version_gt",
type: "app_version",
},
{
targetValue: Android,Chrome,
operator: "any",
type: "browser_name",
},
{
targetValue: 94.0.4606.81,94.0.4606.92,
operator: "any",
type: "browser_version",
},
{
targetValue: Android,Windows,
operator: "none",
type: "os_name",
},
{
targetValue: "11.0.0",
operator: "version_lte",
type: "os_version",
},
{
targetValue: "[\"NZ\",\"US\"]",
operator: "any",
type: "country",
},
{
targetValue: "my_gate_2",
type: "passes_gate",
},
{
targetValue: "my_gate_2",
type: "fails_gate",
},
{
targetValue: 1643070357193,
operator: "after",
type: "time",
},
{
targetValue: "[\"production\"]",
operator: "any",
type: "environment_tier",
},
{
targetValue: "growth_org",
type: "passes_segment",
},
{
targetValue: "growth_org",
type: "fails_segment",
},
{
targetValue: 1.1.1.1,8.8.8.8,
operator: "any",
type: "ip_address",
},
],
},
],
tags: [
"<value>",
],
idType: "userID",
targetApps: [
"my_app",
],
team: "team",
monitoringMetrics: [
{
name: "dau",
type: "user",
},
],
name: "a_verbose_gate",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenCreateRequest | ✔️ | 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.ConsoleV1GatesControllerGenCreateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
List Gates
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.list({
tags: {
"singleTag": {
"value": "tag1",
},
"multipleTags": {
"value": [
"tag1",
"tag2",
],
},
},
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 { gatesList } from "statsig/funcs/gatesList.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 gatesList(statsig, {
tags: {
"singleTag": {
"value": "tag1",
},
"multipleTags": {
"value": [
"tag1",
"tag2",
],
},
},
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.ConsoleV1GatesControllerGenListRequest | ✔️ | 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.ConsoleV1GatesControllerGenListResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1GatesControllerGenListResponseBody | 403 | application/json |
errors.SDKError | 4xx-5xx | / |
Read Gate
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.get({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesGet } from "statsig/funcs/gatesGet.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 gatesGet(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.ConsoleV1GatesControllerGenReadRequest | ✔️ | 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.ConsoleV1GatesControllerGenReadResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Partially Update Gates
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.updatePartial({
id: "<id>",
gatePartialUpdateDto: {
description: "Updated the description of the gate",
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesUpdatePartial } from "statsig/funcs/gatesUpdatePartial.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 gatesUpdatePartial(statsig, {
id: "<id>",
gatePartialUpdateDto: {
description: "Updated the description of the gate",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenPartialUpdateRequest | ✔️ | 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.ConsoleV1GatesControllerGenPartialUpdateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Fully Update Gates
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.update({
id: "<id>",
gateFullUpdateDto: {
isEnabled: false,
description: "Updated Gate Description",
rules: [
{
name: "All Conditions",
passPercentage: 10,
conditions: [
{
targetValue: 111,222,
operator: "any",
type: "user_id",
},
{
targetValue: [
"@outlook.com",
"@gmail.com",
],
operator: "str_contains_any",
type: "email",
},
{
targetValue: 31,
operator: "gt",
field: "age",
type: "custom_field",
},
{
targetValue: "1.1.1",
operator: "version_gt",
type: "app_version",
},
{
targetValue: "[\"Android\",\"Chrome\"]",
operator: "any",
type: "browser_name",
},
{
targetValue: [
"94.0.4606.81",
"94.0.4606.92",
],
operator: "any",
type: "browser_version",
},
{
targetValue: [
Android,
Windows,
],
operator: "none",
type: "os_name",
},
{
targetValue: "11.0.0",
operator: "version_lte",
type: "os_version",
},
{
targetValue: "[\"NZ\",\"US\"]",
operator: "any",
type: "country",
},
{
targetValue: production,
operator: "any",
type: "environment_tier",
},
{
targetValue: "growth_org",
type: "passes_segment",
},
{
targetValue: "growth_org",
type: "fails_segment",
},
{
targetValue: [
1.1.1.1,
8.8.8.8,
],
operator: "any",
type: "ip_address",
},
{
targetValue: "[\"31\"]",
operator: "any",
customID: "userID",
type: "unit_id",
},
],
},
],
tags: [
"★ Core",
],
type: "TEMPORARY",
idType: "stableID",
targetApps: [
"<value>",
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesUpdate } from "statsig/funcs/gatesUpdate.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 gatesUpdate(statsig, {
id: "<id>",
gateFullUpdateDto: {
isEnabled: false,
description: "Updated Gate Description",
rules: [
{
name: "All Conditions",
passPercentage: 10,
conditions: [
{
targetValue: [
111,
222,
],
operator: "any",
type: "user_id",
},
{
targetValue: [
@outlook.com,
@gmail.com,
],
operator: "str_contains_any",
type: "email",
},
{
targetValue: 31,
operator: "gt",
field: "age",
type: "custom_field",
},
{
targetValue: "1.1.1",
operator: "version_gt",
type: "app_version",
},
{
targetValue: [
Android,
Chrome,
],
operator: "any",
type: "browser_name",
},
{
targetValue: 94.0.4606.81,94.0.4606.92,
operator: "any",
type: "browser_version",
},
{
targetValue: [
"Android",
"Windows",
],
operator: "none",
type: "os_name",
},
{
targetValue: "11.0.0",
operator: "version_lte",
type: "os_version",
},
{
targetValue: [
NZ,
US,
],
operator: "any",
type: "country",
},
{
targetValue: [
"production",
],
operator: "any",
type: "environment_tier",
},
{
targetValue: "growth_org",
type: "passes_segment",
},
{
targetValue: "growth_org",
type: "fails_segment",
},
{
targetValue: "[\"1.1.1.1\",\"8.8.8.8\"]",
operator: "any",
type: "ip_address",
},
{
targetValue: 31,
operator: "any",
customID: "userID",
type: "unit_id",
},
],
},
],
tags: [
"★ Core",
],
type: "TEMPORARY",
idType: "stableID",
targetApps: [
"<value>",
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenFullUpdateRequest | ✔️ | 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.ConsoleV1GatesControllerGenFullUpdateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Delete Gates
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.delete({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesDelete } from "statsig/funcs/gatesDelete.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 gatesDelete(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.ConsoleV1GatesControllerGenRemoveRequest | ✔️ | 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.ConsoleV1GatesControllerGenRemoveResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Read Gate Rules
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.getRules({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesGetRules } from "statsig/funcs/gatesGetRules.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 gatesGetRules(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.ConsoleV1GatesControllerGenReadRulesRequest | ✔️ | 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.ConsoleV1GatesControllerGenReadRulesResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Update list of Gate Rules
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.updateRules({
id: "<id>",
multiRuleUpdateDto: {
rules: [
{
name: "All Conditions",
passPercentage: 10,
conditions: [
{
targetValue: [
0,
],
operator: "any",
field: "string",
customID: "string",
type: "user_id",
},
],
environments: [
"string",
],
id: "38ttpCpzrQFTMKcqFKk02l:10.00:1",
baseID: "38ttpCpzrQFTMKcqFKk02l",
},
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesUpdateRules } from "statsig/funcs/gatesUpdateRules.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 gatesUpdateRules(statsig, {
id: "<id>",
multiRuleUpdateDto: {
rules: [
{
name: "All Conditions",
passPercentage: 10,
conditions: [
{
targetValue: [
"0",
],
operator: "any",
field: "string",
customID: "string",
type: "user_id",
},
],
environments: [
"string",
],
id: "38ttpCpzrQFTMKcqFKk02l:10.00:1",
baseID: "38ttpCpzrQFTMKcqFKk02l",
},
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenMultiRuleUpdateRequest | ✔️ | 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.ConsoleV1GatesControllerGenMultiRuleUpdateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Add Multiple Gate Rule
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.addRules({
id: "<id>",
multiRuleDto: {
rules: [
{
name: "<value>",
passPercentage: 8990.96,
conditions: [
{
type: "passes_gate",
},
],
},
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesAddRules } from "statsig/funcs/gatesAddRules.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 gatesAddRules(statsig, {
id: "<id>",
multiRuleDto: {
rules: [
{
name: "<value>",
passPercentage: 7545.19,
conditions: [
{
type: "browser_name",
},
],
},
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenMultiRuleAddRequest | ✔️ | 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.ConsoleV1GatesControllerGenMultiRuleAddResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Update all given rules. It does NOT create or delete if you add more rules and remove rules in the rules object.
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.updateRule({
id: "<id>",
ruleID: "<value>",
ruleUpdateDto: {
name: "All Conditions",
passPercentage: 10,
conditions: [
{
targetValue: "[\"35sClJFs8l0y5uRQhDwUDo\"]",
operator: "any",
type: "user_id",
},
],
environments: [
"staging",
],
id: "38ttpCpzrQFTMKcqFKk02l:10.00:1",
baseID: "38ttpCpzrQFTMKcqFKk02l",
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesUpdateRule } from "statsig/funcs/gatesUpdateRule.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 gatesUpdateRule(statsig, {
id: "<id>",
ruleID: "<value>",
ruleUpdateDto: {
name: "All Conditions",
passPercentage: 10,
conditions: [
{
targetValue: 35sClJFs8l0y5uRQhDwUDo,
operator: "any",
type: "user_id",
},
],
environments: [
"staging",
],
id: "38ttpCpzrQFTMKcqFKk02l:10.00:1",
baseID: "38ttpCpzrQFTMKcqFKk02l",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenRuleUpdateRequest | ✔️ | 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.ConsoleV1GatesControllerGenRuleUpdateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Delete Gate Rules
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.deleteRule({
id: "<id>",
ruleID: "<value>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesDeleteRule } from "statsig/funcs/gatesDeleteRule.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 gatesDeleteRule(statsig, {
id: "<id>",
ruleID: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenRuleDeleteRequest | ✔️ | 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.ConsoleV1GatesControllerGenRuleDeleteResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Add Gate Rule
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.addRule({
id: "<id>",
ruleDto: {
name: "<value>",
passPercentage: 9050.54,
conditions: [
{
type: "time",
},
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesAddRule } from "statsig/funcs/gatesAddRule.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 gatesAddRule(statsig, {
id: "<id>",
ruleDto: {
name: "<value>",
passPercentage: 8690.57,
conditions: [
{
type: "fails_segment",
},
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenRuleAddRequest | ✔️ | 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.ConsoleV1GatesControllerGenRuleAddResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Launch Gate
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.launch({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesLaunch } from "statsig/funcs/gatesLaunch.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 gatesLaunch(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.ConsoleV1GatesControllerGenLaunchRequest | ✔️ | 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.ConsoleV1GatesControllerGenLaunchResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Disable Gate
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.disable({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesDisable } from "statsig/funcs/gatesDisable.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 gatesDisable(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.ConsoleV1GatesControllerGenDisableRequest | ✔️ | 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.ConsoleV1GatesControllerGenDisableResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Enable Gate
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.enable({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesEnable } from "statsig/funcs/gatesEnable.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 gatesEnable(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.ConsoleV1GatesControllerGenEnableRequest | ✔️ | 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.ConsoleV1GatesControllerGenEnableResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Archive Gate
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.archive({
id: "<id>",
archiveSchemaDto: {},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesArchive } from "statsig/funcs/gatesArchive.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 gatesArchive(statsig, {
id: "<id>",
archiveSchemaDto: {},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenArchiveRequest | ✔️ | 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.ConsoleV1GatesControllerGenArchiveResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Load Pulse Gate
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.loadPulse({
id: "<id>",
echidnaGateLoadPulseQueryDto: {
ruleId: "<value>",
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesLoadPulse } from "statsig/funcs/gatesLoadPulse.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 gatesLoadPulse(statsig, {
id: "<id>",
echidnaGateLoadPulseQueryDto: {
ruleId: "<value>",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GatesControllerGenLoadPulseRequest | ✔️ | 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.ConsoleV1GatesControllerGenLoadPulseResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Get Gate Override
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.getOverride({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesGetOverride } from "statsig/funcs/gatesGetOverride.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 gatesGetOverride(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.ConsoleV1GateOverridesControllerGenReadRequest | ✔️ | 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.ConsoleV1GateOverridesControllerGenReadResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Update Gate Overrides
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.updateOverride({
id: "<id>",
updateOverridesContractDto: {
passingUserIDs: [
"user123",
"user456",
],
failingUserIDs: [
"user789",
"user012",
],
passingCustomIDs: [
"custom123",
],
failingCustomIDs: [
"custom456",
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesUpdateOverride } from "statsig/funcs/gatesUpdateOverride.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 gatesUpdateOverride(statsig, {
id: "<id>",
updateOverridesContractDto: {
environmentOverrides: [
{
environment: "staging",
unitID: "unit123",
passingIDs: [
"id1",
"id2",
],
failingIDs: [
"id3",
"id4",
],
},
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GateOverridesControllerGenUpdateRequest | ✔️ | 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.ConsoleV1GateOverridesControllerGenUpdateResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Add Gate Overrides
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.addOverride({
id: "<id>",
updateOverridesContractDto: {
passingUserIDs: [
"user123",
"user456",
],
failingUserIDs: [
"user789",
"user012",
],
passingCustomIDs: [
"custom123",
],
failingCustomIDs: [
"custom456",
],
},
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesAddOverride } from "statsig/funcs/gatesAddOverride.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 gatesAddOverride(statsig, {
id: "<id>",
updateOverridesContractDto: {
passingUserIDs: [
"user123",
"user456",
],
failingUserIDs: [
"user789",
"user012",
],
passingCustomIDs: [
"custom123",
],
failingCustomIDs: [
"custom456",
],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ConsoleV1GateOverridesControllerGenAddRequest | ✔️ | 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.ConsoleV1GateOverridesControllerGenAddResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Delete Gate Overrides
import { Statsig } from "statsig";
const statsig = new Statsig({
statsigApiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await statsig.gates.removeOverride({
id: "<id>",
});
// Handle the result
console.log(result)
}
run();
The standalone function version of this method:
import { StatsigCore } from "statsig/core.js";
import { gatesRemoveOverride } from "statsig/funcs/gatesRemoveOverride.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 gatesRemoveOverride(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.ConsoleV1GateOverridesControllerGenRemoveRequest | ✔️ | 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.ConsoleV1GateOverridesControllerGenRemoveResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |