Skip to content

Latest commit

 

History

History
806 lines (586 loc) · 58.7 KB

README.md

File metadata and controls

806 lines (586 loc) · 58.7 KB

Autotunes

(autotunes)

Available Operations

create

Create Autotune

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.autotunes.create({
    autotuneCreateDto: {
      variants: [
        {
          name: "<value>",
          json: "<value>",
        },
      ],
      successEvent: "<value>",
      explorationWindow: "24",
      attributionWindow: "2hrs",
      winnerThreshold: "98%",
      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 { autotunesCreate } from "statsig/funcs/autotunesCreate.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 autotunesCreate(statsig, {
    autotuneCreateDto: {
      variants: [
        {
          name: "<value>",
          json: "<value>",
        },
      ],
      successEvent: "<value>",
      explorationWindow: "24hr",
      attributionWindow: "2",
      winnerThreshold: "80%",
      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.ConsoleV1AutotunesControllerGenCreateRequest ✔️ 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.ConsoleV1AutotunesControllerGenCreateResponseBody>

Errors

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

list

List Autotune

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.autotunes.list({
    limit: 10,
    page: 1,
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { autotunesList } from "statsig/funcs/autotunesList.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 autotunesList(statsig, {
    limit: 10,
    page: 1,
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

read

Read Autotune

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.autotunes.read({
    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 { autotunesRead } from "statsig/funcs/autotunesRead.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 autotunesRead(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.ConsoleV1AutotunesControllerGenReadRequest ✔️ 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.ConsoleV1AutotunesControllerGenReadResponseBody>

Errors

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

partialUpdate

Update selected properties of the experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.autotunes.partialUpdate({
    id: "<id>",
    autotunePartialUpdateDto: {},
  });

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

run();

Standalone function

The standalone function version of this method:

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

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Object Status Code Content Type
errors.ConsoleV1AutotunesControllerGenPartialUpdateResponseBody 400 application/json
errors.ConsoleV1AutotunesControllerGenPartialUpdateAutotunesResponseBody 401 application/json
errors.ConsoleV1AutotunesControllerGenPartialUpdateAutotunesResponseResponseBody 404 application/json
errors.SDKError 4xx-5xx /

fullUpdate

Update all properties of the experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.autotunes.fullUpdate({
    id: "<id>",
    autotuneFullUpdateDto: {
      description: "helpful summary of what this Autotune is",
      variants: [
        {
          name: "red",
          json: {
          "foo": "boo",
        },
        },
        {
          name: "blue",
          json: {
  
        },
        },
      ],
      successEvent: "purchase_item",
      successEventValue: "",
      explorationWindow: "1hr",
      attributionWindow: "2hrs",
      winnerThreshold: "99%",
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { autotunesFullUpdate } from "statsig/funcs/autotunesFullUpdate.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 autotunesFullUpdate(statsig, {
    id: "<id>",
    autotuneFullUpdateDto: {
      description: "helpful summary of what this Autotune is",
      variants: [
        {
          name: "red",
          json: {
          "foo": "boo",
        },
        },
        {
          name: "blue",
          json: {
  
        },
        },
      ],
      successEvent: "purchase_item",
      successEventValue: "",
      explorationWindow: "1hr",
      attributionWindow: "2hrs",
      winnerThreshold: "99%",
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

delete

Delete Autotune

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.autotunes.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 { autotunesDelete } from "statsig/funcs/autotunesDelete.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 autotunesDelete(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.ConsoleV1AutotunesControllerGenRemoveRequest ✔️ 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.ConsoleV1AutotunesControllerGenRemoveResponseBody>

Errors

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

start

Start Autotune Experiment

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.autotunes.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 { autotunesStart } from "statsig/funcs/autotunesStart.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 autotunesStart(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.ConsoleV1AutotunesControllerGenStartRequest ✔️ 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.ConsoleV1AutotunesControllerGenStartResponseBody>

Errors

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

makeDecision

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.autotunes.makeDecision({
    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 { autotunesMakeDecision } from "statsig/funcs/autotunesMakeDecision.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 autotunesMakeDecision(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.ConsoleV1AutotunesControllerGenMakeDecisionRequest ✔️ 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.ConsoleV1AutotunesControllerGenMakeDecisionResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1AutotunesControllerGenMakeDecisionResponseBody 400 application/json
errors.ConsoleV1AutotunesControllerGenMakeDecisionAutotunesResponseBody 401 application/json
errors.ConsoleV1AutotunesControllerGenMakeDecisionAutotunesResponseResponseBody 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.autotunes.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 { autotunesReset } from "statsig/funcs/autotunesReset.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 autotunesReset(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.ConsoleV1AutotunesControllerGenResetRequest ✔️ 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.ConsoleV1AutotunesControllerGenResetResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1AutotunesControllerGenResetResponseBody 400 application/json
errors.ConsoleV1AutotunesControllerGenResetAutotunesResponseBody 401 application/json
errors.ConsoleV1AutotunesControllerGenResetAutotunesResponseResponseBody 404 application/json
errors.SDKError 4xx-5xx /