sentioxyz / api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sentio API

npm version Release

Setup

pnpm add @sentio/api

Usage

Example 1: get project list

import { Configuration, WebApi } from "@sentio/api";

const config = new Configuration({
  apiKey: process.env.SENTIO_API_KEY,
});
const api = new WebApi(config);
const projects = await api.getProjectList();
console.log(projects);

Example 2: insight query

import { Configuration, WebApi, DataApi } from "@sentio/api";

const config = new Configuration({
  apiKey: process.env.SENTIO_API_KEY,
});

const dataApi = new DataApi(config);
const res = await dataApi.query({
  owner: "sentio",
  slug: "coinbase",
  body: {
    timeRange: {
      start: "now-30d",
      end: "now",
      step: 3600,
      timezone: "America/Los_Angeles",
    },
    limit: 20,
    queries: [
      {
        metricsQuery: {
          query: "cbETH_price",
          alias: "",
          id: "a",
          labelSelector: {},
          aggregate: null,
          functions: [],
          disabled: false,
        },
        dataSource: "METRICS",
        sourceName: "",
      },
    ],
    formulas: [],
    cachePolicy: {
      noCache: false,
      cacheTtlSecs: 1296000,
      cacheRefreshTtlSecs: 1800,
    },
  },
});

Documentation

Sentio API Reference

About

License:Apache License 2.0


Languages

Language:TypeScript 99.7%Language:JavaScript 0.2%Language:Starlark 0.1%Language:Shell 0.0%