Skip to content

Latest commit

 

History

History
255 lines (181 loc) · 19.3 KB

README.md

File metadata and controls

255 lines (181 loc) · 19.3 KB

Events

(events)

Available Operations

  • list - List Events
  • getMetrics - Get metrics using event name
  • get - Get specific events

list

List Events

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.events.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 { eventsList } from "statsig/funcs/eventsList.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 eventsList(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.ConsoleV1EventsControllerGenListRequest ✔️ 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.ConsoleV1EventsControllerGenListResponseBody>

Errors

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

getMetrics

Get metrics using event name

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.events.getMetrics({
    eventName: "<value>",
    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 { eventsGetMetrics } from "statsig/funcs/eventsGetMetrics.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 eventsGetMetrics(statsig, {
    eventName: "<value>",
    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.ConsoleV1EventsControllerGenListMetricsByEventRequest ✔️ 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.ConsoleV1EventsControllerGenListMetricsByEventResponseBody>

Errors

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

get

Get specific events

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.events.get({
    eventName: "<value>",
    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 { eventsGet } from "statsig/funcs/eventsGet.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 eventsGet(statsig, {
    eventName: "<value>",
    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.ConsoleV1EventsControllerGenListSpecificEventRequest ✔️ 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.ConsoleV1EventsControllerGenListSpecificEventResponseBody>

Errors

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