Skip to content

Latest commit

 

History

History
621 lines (451 loc) · 44.9 KB

README.md

File metadata and controls

621 lines (451 loc) · 44.9 KB

Layers

(layers)

Available Operations

create

Create a Layer

Example Usage

import { Statsig } from "statsig";

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

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

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { layersCreate } from "statsig/funcs/layersCreate.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 layersCreate(statsig, {
    layerCreateContractDto: {
      name: "<value>",
      idType: "<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.ConsoleV1LayersControllerGenCreateRequest ✔️ 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.ConsoleV1LayersControllerGenCreateResponseBody>

Errors

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

list

Get Layers

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.layers.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 { layersList } from "statsig/funcs/layersList.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 layersList(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.ConsoleV1LayersControllerGenListRequest ✔️ 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.ConsoleV1LayersControllerGenListResponseBody>

Errors

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

get

Get one layer

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.layers.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 { layersGet } from "statsig/funcs/layersGet.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 layersGet(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.ConsoleV1LayersControllerGenReadRequest ✔️ 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.ConsoleV1LayersControllerGenReadResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1LayersControllerGenReadResponseBody 400 application/json
errors.ConsoleV1LayersControllerGenReadLayersResponseBody 401 application/json
errors.ConsoleV1LayersControllerGenReadLayersResponseResponseBody 404 application/json
errors.SDKError 4xx-5xx /

partialUpdate

Partially update a layer

Example Usage

import { Statsig } from "statsig";

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

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

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

run();

Standalone function

The standalone function version of this method:

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

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

update

Update a layer

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.layers.update({
    id: "<id>",
    layerFullUpdateContractDto: {
      description: "Synchronised 3rd generation matrix",
      parameters: [
        {
          name: "<value>",
          type: "string",
        defaultValue: 7084.55,
        },
      ],
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { layersUpdate } from "statsig/funcs/layersUpdate.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 layersUpdate(statsig, {
    id: "<id>",
    layerFullUpdateContractDto: {
      description: "Monitored zero defect benchmark",
      parameters: [
        {
          name: "<value>",
          type: "string",
        defaultValue: 8965.01,
        },
      ],
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

remove

Delete a layer

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.layers.remove({
    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 { layersRemove } from "statsig/funcs/layersRemove.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 layersRemove(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.ConsoleV1LayersControllerGenRemoveRequest ✔️ 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.ConsoleV1LayersControllerGenRemoveResponseBody>

Errors

Error Object Status Code Content Type
errors.ConsoleV1LayersControllerGenRemoveResponseBody 400 application/json
errors.ConsoleV1LayersControllerGenRemoveLayersResponseBody 401 application/json
errors.ConsoleV1LayersControllerGenRemoveLayersResponseResponseBody 404 application/json
errors.SDKError 4xx-5xx /

listExperiments

Lineage: List Experiment related to Layer

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.layers.listExperiments({
    id: "<id>",
    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 { layersListExperiments } from "statsig/funcs/layersListExperiments.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 layersListExperiments(statsig, {
    id: "<id>",
    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.ConsoleV1LayerExperimentsControllerGenListRequest ✔️ 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.ConsoleV1LayerExperimentsControllerGenListResponseBody>

Errors

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