Automatically generated Openapi-fetch (Axios) client for XRAY/Graph Stats.
To install the client with Yarn, run:
yarn add xray-graph-output-stats-client
To install the client with NPM, run:
npm i xray-graph-output-stats-client
import StatsClient from "xray-graph-output-stats-client"
const client = StatsClient("https://graph.xray.app/output/stats")
const app = async () => {
const tip = await client.GET("/total-supply")
if (tip.data) {
console.log(tip.data)
}
if (tip.error) {
console.error(tip.error)
}
}
app()
Headers
import StatsClient from "xray-graph-output-stats-client"
const baseUrl = "https://graph.xray.app/output/stats"
const headers = {} // rest headers
const client = StatsClient(baseUrl, headers)
const app = async () => {
const health = await client.GET("/total-supply", {
headers: { "Content-Type": "application/json" }, // one shot headers
})
console.log(health.data)
}
app()
Request Cancellation (AbortSignal)
import StatsClient from "xray-graph-output-stats-client"
const client = StatsClient("https://graph.xray.app/output/stats")
const app = async () => {
const abortController = new AbortController()
setTimeout(() => {
abortController.abort() // cancel request
console.log('Aborted!')
}, 200)
const tip = await client.GET("/total-supply", {
signal: abortController.signal,
})
}
app()
Updating Schema
Run schema update:
yarn schema
- XRAY/Graph Stats — https://graph.xray.app/output/stats
Managed by XRAY/Network (XRAY/Graph, Cloudflare WAF & Load Balancer)
https://graph.xray.app/output/stats