Skip to content

Latest commit

 

History

History
87 lines (61 loc) · 6.39 KB

README.md

File metadata and controls

87 lines (61 loc) · 6.39 KB

Reports

(reports)

Available Operations

  • list - Get Reports

list

Get Reports

Example Usage

import { Statsig } from "statsig";

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

async function run() {
  const result = await statsig.reports.list({
    type: "first_exposures",
    date: "2022-10-31T00:00:00Z",
  });

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

run();

Standalone function

The standalone function version of this method:

import { StatsigCore } from "statsig/core.js";
import { reportsList } from "statsig/funcs/reportsList.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 reportsList(statsig, {
    type: "first_exposures",
    date: "2022-10-31T00:00:00Z",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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