From 140f5d7cc2843ebb2102055d339efb125390350a Mon Sep 17 00:00:00 2001 From: xHyroM Date: Sat, 3 Jun 2023 18:32:47 +0200 Subject: [PATCH] feat(docs/discord-experiments-api): add stats docs --- {src/pages/docs => docs}/config.ts | 4 ++ docs/discord-experiments-api/stats.md | 44 +++++++++++++++++++ src/components/widgets/docs/LeftSidebar.astro | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) rename {src/pages/docs => docs}/config.ts (86%) create mode 100644 docs/discord-experiments-api/stats.md diff --git a/src/pages/docs/config.ts b/docs/config.ts similarity index 86% rename from src/pages/docs/config.ts rename to docs/config.ts index 4cff113..03f62ae 100644 --- a/src/pages/docs/config.ts +++ b/docs/config.ts @@ -23,5 +23,9 @@ export const docs: Docs = { text: "Eligible", link: "/docs/discord-experiments-api/eligible", }, + { + text: "Stats", + link: "/docs/discord-experiments-api/stats", + } ], }; diff --git a/docs/discord-experiments-api/stats.md b/docs/discord-experiments-api/stats.md new file mode 100644 index 0000000..e6b9c1c --- /dev/null +++ b/docs/discord-experiments-api/stats.md @@ -0,0 +1,44 @@ +--- +title: Stats +description: Get stats from the API +--- + +# Stats + +This section of the documentation will cover how to get stats from the API. + +Accessible on [https://api.discord-experiments.xhyrom.dev/v2/stats](https://api.discord-experiments.xhyrom.dev/v2/stats) + +## Stats Object + +Represents stats of the API + +**Stats Structure:** +| field | type | description | +| ----- | --------------------------- | -------------------------- | +| total | integer | Total sum of experiments | +| kind | [kind object](#kind-object) | Sum of experiments by kind | + +## Kind Object + +Represents number of experiments by kind + +**Kind Structure:** + +| field | type | description | +| ------- | ------- | ------------------------ | +| guild | integer | Sum of guild experiments | +| user | integer | Sum of user experiments | +| other * | integer | Sum of other experiments | + +* Other experiments are experiments that are not guild or user specific. This will be always 0, because there are no other experiments. + +## Fetching stats + +You can fetch stats from the API by sending a GET request to [https://api.discord-experiments.xhyrom.dev/v2/stats](https://api.discord-experiments.xhyrom.dev/v2/stats) + +``` +GET https://api.discord-experiments.xhyrom.dev/v2/stats +``` + +Returns a [stats object](#stats-object) diff --git a/src/components/widgets/docs/LeftSidebar.astro b/src/components/widgets/docs/LeftSidebar.astro index 63a575f..5ca26b6 100644 --- a/src/components/widgets/docs/LeftSidebar.astro +++ b/src/components/widgets/docs/LeftSidebar.astro @@ -1,5 +1,5 @@ --- -import { docs, type Sidebar } from "@pages/docs/config"; +import { docs, type Sidebar } from "@docs/config"; const { currentPage } = Astro.props; const currentPageMatch = currentPage.slice(1);