(metricSources)
- create - Create Metric Source
- get - Read Metric Source
- delete - Delete Metric Source
- update - Update Metric Source
- list - List metric source
Create Metric Source
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();
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();
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. |
Promise<operations.ConsoleV1MetricsControllerGenCreateMetricSourceResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1MetricsControllerGenCreateMetricSourceResponseBody | 400 | application/json |
errors.ConsoleV1MetricsControllerGenCreateMetricSourceMetricSourcesResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
Read Metric Source
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();
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();
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. |
Promise<operations.ConsoleV1MetricsControllerGenReadMetricSourceResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1MetricsControllerGenReadMetricSourceResponseBody | 400 | application/json |
errors.ConsoleV1MetricsControllerGenReadMetricSourceMetricSourcesResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
Delete Metric Source
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();
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();
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. |
Promise<operations.ConsoleV1MetricsControllerGenDeleteMetricSourceResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1MetricsControllerGenDeleteMetricSourceResponseBody | 400 | application/json |
errors.ConsoleV1MetricsControllerGenDeleteMetricSourceMetricSourcesResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
Update Metric Source
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();
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();
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. |
Promise<operations.ConsoleV1MetricsControllerUpdateMetricSourceResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1MetricsControllerUpdateMetricSourceResponseBody | 400 | application/json |
errors.ConsoleV1MetricsControllerUpdateMetricSourceMetricSourcesResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
List metric source
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();
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();
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. |
Promise<operations.ConsoleV1MetricsControllerGenListMetricSourcesResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.ConsoleV1MetricsControllerGenListMetricSourcesResponseBody | 400 | application/json |
errors.ConsoleV1MetricsControllerGenListMetricSourcesMetricSourcesResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |