Skip to content

Latest commit

 

History

History
447 lines (325 loc) · 33.8 KB

README.md

File metadata and controls

447 lines (325 loc) · 33.8 KB

MetricSources

(metricSources)

Available Operations

  • create - Create Metric Source
  • get - Read Metric Source
  • delete - Delete Metric Source
  • update - Update Metric Source
  • list - List metric source

create

Create Metric Source

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.metricSources.create({
    metricSourceCreationContractDto: {
      name: "<value>",
      sql: "<value>",
      timestampColumn: "<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 { metricSourcesCreate } from "statsig/funcs/metricSourcesCreate.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 metricSourcesCreate(statsig, {
    metricSourceCreationContractDto: {
      name: "<value>",
      sql: "<value>",
      timestampColumn: "<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.ConsoleV1MetricsControllerGenCreateMetricSourceRequest ✔️ 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.ConsoleV1MetricsControllerGenCreateMetricSourceResponseBody>

Errors

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

get

Read Metric Source

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.metricSources.get({
    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 { metricSourcesGet } from "statsig/funcs/metricSourcesGet.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 metricSourcesGet(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.ConsoleV1MetricsControllerGenReadMetricSourceRequest ✔️ 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.ConsoleV1MetricsControllerGenReadMetricSourceResponseBody>

Errors

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

delete

Delete Metric Source

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.metricSources.delete({
    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 { metricSourcesDelete } from "statsig/funcs/metricSourcesDelete.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 metricSourcesDelete(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.ConsoleV1MetricsControllerGenDeleteMetricSourceRequest ✔️ 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.ConsoleV1MetricsControllerGenDeleteMetricSourceResponseBody>

Errors

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

update

Update Metric Source

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.metricSources.update({
    name: "<value>",
    metricSourceUpdateContractDto: {
      sql: "<value>",
      timestampColumn: "<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 { metricSourcesUpdate } from "statsig/funcs/metricSourcesUpdate.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 metricSourcesUpdate(statsig, {
    name: "<value>",
    metricSourceUpdateContractDto: {
      sql: "<value>",
      timestampColumn: "<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.ConsoleV1MetricsControllerUpdateMetricSourceRequest ✔️ 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.ConsoleV1MetricsControllerUpdateMetricSourceResponseBody>

Errors

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

list

List metric source

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.metricSources.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 { metricSourcesList } from "statsig/funcs/metricSourcesList.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 metricSourcesList(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.ConsoleV1MetricsControllerGenListMetricSourcesRequest ✔️ 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.ConsoleV1MetricsControllerGenListMetricSourcesResponseBody>

Errors

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