Skip to content

Latest commit

 

History

History
1631 lines (1197 loc) · 121 KB

README.md

File metadata and controls

1631 lines (1197 loc) · 121 KB

Experiments

(experiments)

Available Operations

create

Create Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.create({
    experimentCreateDto: {
      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 { experimentsCreate } from "statsig/funcs/experimentsCreate.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 experimentsCreate(statsig, {
    experimentCreateDto: {
      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.ConsoleV1ExperimentsControllerGenCreateRequest ✔️ 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.ConsoleV1ExperimentsControllerGenCreateResponseBody>

Errors

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

list

List Experiments

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.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 { experimentsList } from "statsig/funcs/experimentsList.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 experimentsList(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.ConsoleV1ExperimentsControllerGenListRequest ✔️ 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.ConsoleV1ExperimentsControllerGenListResponseBody>

Errors

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

get

Get Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.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 { experimentsGet } from "statsig/funcs/experimentsGet.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 experimentsGet(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.ConsoleV1ExperimentsControllerGenReadRequest ✔️ 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.ConsoleV1ExperimentsControllerGenReadResponseBody>

Errors

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

updatePartial

Partially Update Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.updatePartial({
    id: "<id>",
    experimentPartialUpdateDto: {},
  });

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

run();

Standalone function

The standalone function version of this method:

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

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

updateFull

Fully Update Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.updateFull({
    id: "<id>",
    experimentFullUpdateDto: {
      description: "Programmable dynamic interface",
      idType: "<value>",
      hypothesis: "<value>",
      groups: [
        {
          name: "<value>",
          size: 1865.53,
          parameterValues: {
            "key": "<value>",
          },
        },
      ],
      allocation: 2413.36,
      targetingGateID: "<value>",
      bonferroniCorrection: false,
      defaultConfidenceInterval: "90",
      status: "abandoned",
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { experimentsUpdateFull } from "statsig/funcs/experimentsUpdateFull.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 experimentsUpdateFull(statsig, {
    id: "<id>",
    experimentFullUpdateDto: {
      description: "Organized national attitude",
      idType: "<value>",
      hypothesis: "<value>",
      groups: [
        {
          name: "<value>",
          size: 3361.08,
          parameterValues: {
            "key": "<value>",
          },
        },
      ],
      allocation: 2036.7,
      targetingGateID: "<value>",
      bonferroniCorrection: false,
      defaultConfidenceInterval: "80",
      status: "abandoned",
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

delete

Deleted Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.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 { experimentsDelete } from "statsig/funcs/experimentsDelete.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 experimentsDelete(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.ConsoleV1ExperimentsControllerGenRemoveRequest ✔️ 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.ConsoleV1ExperimentsControllerGenRemoveResponseBody>

Errors

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

start

Start Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.start({
    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 { experimentsStart } from "statsig/funcs/experimentsStart.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 experimentsStart(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.ConsoleV1ExperimentsControllerGenStartRequest ✔️ 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.ConsoleV1ExperimentsControllerGenStartResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1ExperimentsControllerGenStartResponseBody 400 application/json
errors.ConsoleV1ExperimentsControllerGenStartExperimentsResponseBody 401 application/json
errors.ConsoleV1ExperimentsControllerGenStartExperimentsResponseResponseBody 404 application/json
errors.SDKError 4xx-5xx /

finishEarly

Finish Experiment Early

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.finishEarly({
    id: "<id>",
    experimentStatusUpdateDto: {
      id: "experiment123",
      decisionReason: "Your reason for stopping early",
      removeTargeting: false,
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { experimentsFinishEarly } from "statsig/funcs/experimentsFinishEarly.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 experimentsFinishEarly(statsig, {
    id: "<id>",
    experimentStatusUpdateDto: {
      id: "experiment123",
      decisionReason: "Your reason for stopping early",
      removeTargeting: false,
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Object Status Code Content Type
errors.ConsoleV1ExperimentsControllerGenMakeDecisionResponseBody 400 application/json
errors.ConsoleV1ExperimentsControllerGenMakeDecisionExperimentsResponseBody 401 application/json
errors.ConsoleV1ExperimentsControllerGenMakeDecisionExperimentsResponseResponseBody 404 application/json
errors.SDKError 4xx-5xx /

reset

Reset Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.reset({
    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 { experimentsReset } from "statsig/funcs/experimentsReset.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 experimentsReset(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.ConsoleV1ExperimentsControllerGenResetRequest ✔️ 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.ConsoleV1ExperimentsControllerGenResetResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1ExperimentsControllerGenResetResponseBody 400 application/json
errors.ConsoleV1ExperimentsControllerGenResetExperimentsResponseBody 401 application/json
errors.ConsoleV1ExperimentsControllerGenResetExperimentsResponseResponseBody 404 application/json
errors.SDKError 4xx-5xx /

abandon

Abandon Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.abandon({
    id: "<id>",
    experimentStatusUpdateDto: {
      id: "experiment123",
      decisionReason: "Your reason for stopping early",
      removeTargeting: false,
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { experimentsAbandon } from "statsig/funcs/experimentsAbandon.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 experimentsAbandon(statsig, {
    id: "<id>",
    experimentStatusUpdateDto: {
      id: "experiment123",
      decisionReason: "Your reason for stopping early",
      removeTargeting: false,
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Object Status Code Content Type
errors.ConsoleV1ExperimentsControllerGenAbandonResponseBody 400 application/json
errors.ConsoleV1ExperimentsControllerGenAbandonExperimentsResponseBody 401 application/json
errors.ConsoleV1ExperimentsControllerGenAbandonExperimentsResponseResponseBody 404 application/json
errors.SDKError 4xx-5xx /

archive

Archive Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.archive({
    id: "<id>",
    experimentArchiveDto: {
      archiveReason: "The experiment is no longer needed",
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { experimentsArchive } from "statsig/funcs/experimentsArchive.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 experimentsArchive(statsig, {
    id: "<id>",
    experimentArchiveDto: {
      archiveReason: "The experiment is no longer needed",
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

unarchive

Unarchive Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.unarchive({
    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 { experimentsUnarchive } from "statsig/funcs/experimentsUnarchive.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 experimentsUnarchive(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.ConsoleV1ExperimentsControllerGenUnarchiveRequest ✔️ 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.ConsoleV1ExperimentsControllerGenUnarchiveResponseBody>

Errors

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

updateAssignmentSource

Post Assignment Source

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.updateAssignmentSource({
    name: "<value>",
    assignmentSourceQueryUpdateDto: {
      sql: "<value>",
      timestampColumn: "<value>",
      experimentIDColumn: "<value>",
      groupIDColumn: "<value>",
      idTypeMapping: [
        {
          statsigUnitID: "<value>",
          column: "<value>",
        },
      ],
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { experimentsUpdateAssignmentSource } from "statsig/funcs/experimentsUpdateAssignmentSource.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 experimentsUpdateAssignmentSource(statsig, {
    name: "<value>",
    assignmentSourceQueryUpdateDto: {
      sql: "<value>",
      timestampColumn: "<value>",
      experimentIDColumn: "<value>",
      groupIDColumn: "<value>",
      idTypeMapping: [
        {
          statsigUnitID: "<value>",
          column: "<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.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryRequest ✔️ 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.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryResponseBody 400 application/json
errors.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryExperimentsResponseBody 401 application/json
errors.ConsoleV1ExperimentsControllerGenUpdateAssignmentSourceQueryExperimentsResponseResponseBody 404 application/json
errors.SDKError 4xx-5xx /

deleteAssignmentSource

Delete Assignment Source

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.deleteAssignmentSource({
    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 { experimentsDeleteAssignmentSource } from "statsig/funcs/experimentsDeleteAssignmentSource.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 experimentsDeleteAssignmentSource(statsig, {
    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.ConsoleV1ExperimentsControllerGenRemoveAssignmentSourceRequest ✔️ 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.ConsoleV1ExperimentsControllerGenRemoveAssignmentSourceResponseBody>

Errors

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

getOverrides

Get Experiment Overrides

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.getOverrides({
    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 { experimentsGetOverrides } from "statsig/funcs/experimentsGetOverrides.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 experimentsGetOverrides(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.ConsoleV1ExperimentOverridesControllerGenReadRequest ✔️ 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.ConsoleV1ExperimentOverridesControllerGenReadResponseBody>

Errors

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

updateOverrides

Update Experiment Overrides

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.updateOverrides({
    id: "<id>",
    experimentOverridesDto: {
      overrides: [
        {
          type: "segment",
          id: "<id>",
          groupID: "<value>",
        },
      ],
      userIDOverrides: [
        {
          groupID: "<value>",
          ids: [
            "<value>",
          ],
        },
      ],
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { experimentsUpdateOverrides } from "statsig/funcs/experimentsUpdateOverrides.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 experimentsUpdateOverrides(statsig, {
    id: "<id>",
    experimentOverridesDto: {
      overrides: [
        {
          type: "gate",
          id: "<id>",
          groupID: "<value>",
        },
      ],
      userIDOverrides: [
        {
          groupID: "<value>",
          ids: [
            "<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.ConsoleV1ExperimentOverridesControllerUpdateRequest ✔️ 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.ConsoleV1ExperimentOverridesControllerUpdateResponseBody>

Errors

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

partialUpdateOverrides

Partially Update Experiment Overrides

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.partialUpdateOverrides({
    id: "<id>",
    experimentOverridesDto: {
      overrides: [
        {
          type: "gate",
          id: "<id>",
          groupID: "<value>",
        },
      ],
      userIDOverrides: [
        {
          groupID: "<value>",
          ids: [
            "<value>",
          ],
        },
      ],
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { experimentsPartialUpdateOverrides } from "statsig/funcs/experimentsPartialUpdateOverrides.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 experimentsPartialUpdateOverrides(statsig, {
    id: "<id>",
    experimentOverridesDto: {
      overrides: [
        {
          type: "segment",
          id: "<id>",
          groupID: "<value>",
        },
      ],
      userIDOverrides: [
        {
          groupID: "<value>",
          ids: [
            "<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.ConsoleV1ExperimentOverridesControllerAddRequest ✔️ 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.ConsoleV1ExperimentOverridesControllerAddResponseBody>

Errors

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

getExposureCount

Get Exposure Count for Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.experiments.getExposureCount({
    experimentName: "<value>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { experimentsGetExposureCount } from "statsig/funcs/experimentsGetExposureCount.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 experimentsGetExposureCount(statsig, {
    experimentName: "<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.ConsoleV1ExposuresControllerExposureCountRequest ✔️ 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<components.ExposureCountDto>

Errors

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