Skip to content

Latest commit

 

History

History
1398 lines (1036 loc) · 94.1 KB

File metadata and controls

1398 lines (1036 loc) · 94.1 KB

DynamicConfigs

(dynamicConfigs)

Available Operations

create

Create Dynamic Config

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.create({
    dynamicConfigCreateDto: {
      idType: "userID",
      name: "<value>",
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { dynamicConfigsCreate } from "statsig/funcs/dynamicConfigsCreate.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 dynamicConfigsCreate(statsig, {
    dynamicConfigCreateDto: {
      idType: "userID",
      name: "<value>",
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenCreateRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenCreateResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1DynamicConfigControllerGenCreateResponseBody 400 application/json
errors.ConsoleV1DynamicConfigControllerGenCreateDynamicConfigsResponseBody 401 application/json
errors.ConsoleV1DynamicConfigControllerGenCreateDynamicConfigsResponseResponseBody 403 application/json
errors.SDKError 4xx-5xx /

list

List Dynamic Configs

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.list({
    tags: {
    "singleTag": {
      "value": "tag1",
    },
    "multipleTags": {
      "value": [
        "tag1",
        "tag2",
      ],
    },
  },
    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 { dynamicConfigsList } from "statsig/funcs/dynamicConfigsList.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 dynamicConfigsList(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();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenListRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenListResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1DynamicConfigControllerGenListResponseBody 404 application/json
errors.SDKError 4xx-5xx /

get

Get Dynamic Config

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.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 { dynamicConfigsGet } from "statsig/funcs/dynamicConfigsGet.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 dynamicConfigsGet(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.ConsoleV1DynamicConfigControllerGenReadRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenReadResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1DynamicConfigControllerGenReadResponseBody 401 application/json
errors.ConsoleV1DynamicConfigControllerGenReadDynamicConfigsResponseBody 404 application/json
errors.SDKError 4xx-5xx /

updatePartial

Partially Update Dynamic Config

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.updatePartial({
    id: "<id>",
    dynamicConfigPartialUpdateDto: {
      description: "helpful summary of what this dynamic config does",
      idType: "userID",
      tags: [
        "a tag",
      ],
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { dynamicConfigsUpdatePartial } from "statsig/funcs/dynamicConfigsUpdatePartial.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 dynamicConfigsUpdatePartial(statsig, {
    id: "<id>",
    dynamicConfigPartialUpdateDto: {
      description: "helpful summary of what this dynamic config does",
      idType: "userID",
      tags: [
        "a tag",
      ],
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenPartialUpdateRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenPartialUpdateResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1DynamicConfigControllerGenPartialUpdateResponseBody 401 application/json
errors.ConsoleV1DynamicConfigControllerGenPartialUpdateDynamicConfigsResponseBody 404 application/json
errors.SDKError 4xx-5xx /

updateFull

Fully Update Dynamic Config

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.updateFull({
    id: "<id>",
    dynamicConfigFullUpdateDto: {
      description: "helpful summary of what this dynamic config does",
      rules: [
        {
          name: "<value>",
          passPercentage: 6693.63,
          conditions: [
            {
              type: "fails_gate",
            },
          ],
        },
      ],
      idType: "userID",
      tags: [
        "a tag",
      ],
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { dynamicConfigsUpdateFull } from "statsig/funcs/dynamicConfigsUpdateFull.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 dynamicConfigsUpdateFull(statsig, {
    id: "<id>",
    dynamicConfigFullUpdateDto: {
      description: "helpful summary of what this dynamic config does",
      rules: [
        {
          name: "<value>",
          passPercentage: 2413.36,
          conditions: [
            {
              type: "environment_tier",
            },
          ],
        },
      ],
      idType: "userID",
      tags: [
        "a tag",
      ],
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenFullUpdateRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenFullUpdateResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1DynamicConfigControllerGenFullUpdateResponseBody 400 application/json
errors.ConsoleV1DynamicConfigControllerGenFullUpdateDynamicConfigsResponseBody 401 application/json
errors.ConsoleV1DynamicConfigControllerGenFullUpdateDynamicConfigsResponseResponseBody 403 application/json
errors.SDKError 4xx-5xx /

delete

Delete Dynamic Config

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.delete({
    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 { dynamicConfigsDelete } from "statsig/funcs/dynamicConfigsDelete.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 dynamicConfigsDelete(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.ConsoleV1DynamicConfigControllerGenRemoveRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenRemoveResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1DynamicConfigControllerGenRemoveResponseBody 401 application/json
errors.ConsoleV1DynamicConfigControllerGenRemoveDynamicConfigsResponseBody 404 application/json
errors.SDKError 4xx-5xx /

getRules

Get Dynamic Config Rules

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.getRules({
    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 { dynamicConfigsGetRules } from "statsig/funcs/dynamicConfigsGetRules.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 dynamicConfigsGetRules(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.ConsoleV1DynamicConfigControllerGenReadRulesRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenReadRulesResponseBody>

Errors

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

addRules

Add Dynamic Config Rules

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.addRules({
    id: "<id>",
    multiDynamicConfigRuleAddDto: {
      rules: [
        {
          name: "<value>",
          passPercentage: 8990.96,
          conditions: [
            {
              type: "passes_gate",
            },
          ],
        },
      ],
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { dynamicConfigsAddRules } from "statsig/funcs/dynamicConfigsAddRules.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 dynamicConfigsAddRules(statsig, {
    id: "<id>",
    multiDynamicConfigRuleAddDto: {
      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();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenMultiRuleAddRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenMultiRuleAddResponseBody>

Errors

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

updateRules

Update List of Dynamic Config Rules

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.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();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { dynamicConfigsUpdateRules } from "statsig/funcs/dynamicConfigsUpdateRules.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 dynamicConfigsUpdateRules(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();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenMultiRuleUpdateRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenMultiRuleUpdateResponseBody>

Errors

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

getRule

Get Specific Dynamic Config Rule

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.getRule({
    id: "<id>",
    ruleId: "<value>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { dynamicConfigsGetRule } from "statsig/funcs/dynamicConfigsGetRule.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 dynamicConfigsGetRule(statsig, {
    id: "<id>",
    ruleId: "<value>",
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenReadRuleRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenReadRuleResponseBody>

Errors

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

updateRule

Update Dynamic Config Rule

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.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();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { dynamicConfigsUpdateRule } from "statsig/funcs/dynamicConfigsUpdateRule.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 dynamicConfigsUpdateRule(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();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenRuleUpdateRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenRuleUpdateResponseBody>

Errors

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

deleteRule

Delete Dynamic Config Rule

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.deleteRule({
    id: "<id>",
    ruleId: "<value>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { dynamicConfigsDeleteRule } from "statsig/funcs/dynamicConfigsDeleteRule.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 dynamicConfigsDeleteRule(statsig, {
    id: "<id>",
    ruleId: "<value>",
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenRuleDeleteRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenRuleDeleteResponseBody>

Errors

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

disable

Disable Dynamic Config

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.disable({
    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 { dynamicConfigsDisable } from "statsig/funcs/dynamicConfigsDisable.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 dynamicConfigsDisable(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.ConsoleV1DynamicConfigControllerGenDisableRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenDisableResponseBody>

Errors

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

enable

Enable Dynamic Config

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.enable({
    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 { dynamicConfigsEnable } from "statsig/funcs/dynamicConfigsEnable.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 dynamicConfigsEnable(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.ConsoleV1DynamicConfigControllerGenEnableRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenEnableResponseBody>

Errors

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

addRule

Add Dynamic Config Rule

Example Usage

import { Statsig } from "statsig";

const statsig = new Statsig({
  statsigApiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await statsig.dynamicConfigs.addRule({
    id: "<id>",
    dynamicConfigRuleAddDto: {
      name: "<value>",
      passPercentage: 9050.54,
      conditions: [
        {
          type: "time",
        },
      ],
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { dynamicConfigsAddRule } from "statsig/funcs/dynamicConfigsAddRule.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 dynamicConfigsAddRule(statsig, {
    id: "<id>",
    dynamicConfigRuleAddDto: {
      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();

Parameters

Parameter Type Required Description
request operations.ConsoleV1DynamicConfigControllerGenRuleAddRequest ✔️ 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.ConsoleV1DynamicConfigControllerGenRuleAddResponseBody>

Errors

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