From 2401511b46d93315db0dfbc68b94651940be44a7 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Tue, 4 Apr 2023 18:36:45 +0200 Subject: [PATCH 1/5] Test new API format --- {reference => docs}/OpenAPI.yml | 0 docs/index.html | 17 + docs/openapi.md | 784 -------------------------------- 3 files changed, 17 insertions(+), 784 deletions(-) rename {reference => docs}/OpenAPI.yml (100%) create mode 100644 docs/index.html delete mode 100644 docs/openapi.md diff --git a/reference/OpenAPI.yml b/docs/OpenAPI.yml similarity index 100% rename from reference/OpenAPI.yml rename to docs/OpenAPI.yml diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..3948e3b --- /dev/null +++ b/docs/index.html @@ -0,0 +1,17 @@ + + + + + + +OpenAPI Petstore +
+ + \ No newline at end of file diff --git a/docs/openapi.md b/docs/openapi.md deleted file mode 100644 index ac0ea52..0000000 --- a/docs/openapi.md +++ /dev/null @@ -1,784 +0,0 @@ ---- -title: ToneAPI v1.0 -language_tabs: - - javascript: JavaScript -language_clients: - - javascript: request. -toc_footers: [] -includes: [] -search: true -highlight_theme: darkula -headingLevel: 2 - ---- - - - -

ToneAPI v1.0

- -> Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu. - -Stats tracking API for Titanfall 2 Northstar - -Base URLs: - -* https://tone.sleepycat.date/v1 - -Web: Legonzaur -License: The Unlicense - -# Authentication - -- HTTP Authentication, scheme: basic - -

Default

- -## get-server-list - - - -> Code samples - -```javascript - -const headers = { - 'Accept':'application/json' -}; - -fetch('https://tone.sleepycat.date/v1/client/servers', -{ - method: 'GET', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -`GET /client/servers` - -*List of servers* - -An array containing the list of servers as objects - -> Example responses - -> OK - -```json -[ - { - "id": 1, - "name": "fvnknoots 7v7" - } -] -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|Inline| - -

Response Schema

- -Status Code **200** - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|» Server|object|false|none|none| -|»» id|integer|false|none|none| -|»» name|string|false|none|none| - - - -## get-client-weapons - - - -> Code samples - -```javascript - -const headers = { - 'Accept':'application/json' -}; - -fetch('https://tone.sleepycat.date/v1/client/weapons', -{ - method: 'GET', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -`GET /client/weapons` - -*Statistics for all weapons* - -A JSON Object with weapon IDs as key and weapon data as value - -> Body parameter - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|server|query|number|false|Fetch data for specific server| -|player|query|number|false|Fetch data for specific player| - -> Example responses - -> OK - -```json -{ - "hemlock": { - "max_kill_distance": 0, - "avg_kill_distance": 0, - "kills": 0 - }, - "lstar": { - "max_kill_distance": 0, - "avg_kill_distance": 0, - "kills": 0 - } -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|Inline| - -

Response Schema

- -Status Code **200** - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|» hemlock|object|false|none|none| -|»» max_kill_distance|integer|false|none|none| -|»» avg_kill_distance|number|false|none|none| -|»» kills|integer|false|none|none| - - - -## get-client-weapons-weaponId - - - -> Code samples - -```javascript - -const headers = { - 'Accept':'application/json' -}; - -fetch('https://tone.sleepycat.date/v1/client/weapons/{weaponId}', -{ - method: 'GET', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -`GET /client/weapons/{weaponId}` - -*Statistics for a single weapon* - -Data for a specific weapon - -> Body parameter - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|server|query|number|false|Fetch data for specific server| -|player|query|number|false|Fetch data for specific player| -|weaponId|path|string|true|ID of a weapon| - -> Example responses - -> 200 Response - -```json -{ - "max_kill_distance": 0, - "avg_kill_distance": 0, - "kills": 0 -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|Inline| - -

Response Schema

- -Status Code **200** - -*Weapon* - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|» max_kill_distance|integer|false|none|none| -|» avg_kill_distance|number|false|none|none| -|» kills|integer|false|none|none| - - - -## get-client-players - - - -> Code samples - -```javascript - -const headers = { - 'Accept':'application/json' -}; - -fetch('https://tone.sleepycat.date/v1/client/players', -{ - method: 'GET', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -`GET /client/players` - -*Statistics for all players* - -A JSON Object with player IDs as key and player data as value - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|weapon|query|string|false|Fetch data for specific weapon| -|server|query|number|false|Fetch data for specific server| - -> Example responses - -> OK - -```json -{ - "2250125460": { - "name": "Legonzaur", - "deaths": 0, - "kills": 0, - "max_kill_distance": 0, - "avg_kill_distance": 0 - } -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|Inline| - -

Response Schema

- -Status Code **200** - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|» 2250125460|object|false|none|none| -|»» name|string|false|none|none| -|»» deaths|integer|false|none|none| -|»» kills|integer|false|none|none| -|»» max_kill_distance|integer|false|none|none| -|»» avg_kill_distance|number|false|none|none| - - - -## get-client-players-playerId - - - -> Code samples - -```javascript - -const headers = { - 'Accept':'application/json' -}; - -fetch('https://tone.sleepycat.date/v1/client/players/{playerId}', -{ - method: 'GET', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -`GET /client/players/{playerId}` - -*Statistics for a single player* - -Data for a specific player - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|server|query|number|false|Fetch data for specific server| -|weapon|query|string|false|Fetch data for specific weapon| -|playerId|path|string|true|ID of a player| - -> Example responses - -> 200 Response - -```json -{ - "name": "Legonzaur", - "deaths": 0, - "kills": 0, - "max_kill_distance": 0, - "avg_kill_distance": 0 -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|Inline| - -

Response Schema

- -Status Code **200** - -*Player* - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|» name|string|false|none|none| -|» deaths|integer|false|none|none| -|» kills|integer|false|none|none| -|» max_kill_distance|integer|false|none|none| -|» avg_kill_distance|number|false|none|none| - - - -## post-servers-serverId - - - -> Code samples - -```javascript - -fetch('https://tone.sleepycat.date/v1/servers/{serverId}', -{ - method: 'POST' - -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -`POST /servers/{serverId}` - -Used to test auth - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|serverId|path|string|true|ID of the server| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Forbidden|None| - - - -## post-kills - - - -> Code samples - -```javascript -const inputBody = '{ - "tone_version": "string", - "match_id": "string", - "game_mode": "string", - "map": "string", - "game_time": "14:15:22Z", - "player_count": 0, - "attacker_name": "string", - "attacker_id": 0, - "attacker_current_weapon": "string", - "attacker_current_weapon_mods": 0, - "attacker_weapon_1": "string", - "attacker_weapon_1_mods": 0, - "attacker_weapon_2": "string", - "attacker_weapon_2_mods": 0, - "attacker_weapon_3": "string", - "attacker_weapon_3_mods": 0, - "attacker_offhand_weapon_1": 0, - "attacker_offhand_weapon_2": 0, - "victim_name": "string", - "victim_id": 0, - "victim_current_weapon": "string", - "victim_current_weapon_mods": 0, - "victim_weapon_1": "string", - "victim_weapon_1_mods": 0, - "victim_weapon_2": "string", - "victim_weapon_2_mods": 0, - "victim_weapon_3": "string", - "victim_weapon_3_mods": 0, - "victim_offhand_weapon_1": 0, - "victim_offhand_weapon_2": 0, - "cause_of_death": "string", - "distance": 0 -}'; -const headers = { - 'Content-Type':'application/json' -}; - -fetch('https://tone.sleepycat.date/v1/servers/{serverId}/kills', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -`POST /servers/{serverId}/kills` - -*Post kills* - -Allows a Northstar server to record kills on the database - -> Body parameter - -```json -{ - "tone_version": "string", - "match_id": "string", - "game_mode": "string", - "map": "string", - "game_time": "14:15:22Z", - "player_count": 0, - "attacker_name": "string", - "attacker_id": 0, - "attacker_current_weapon": "string", - "attacker_current_weapon_mods": 0, - "attacker_weapon_1": "string", - "attacker_weapon_1_mods": 0, - "attacker_weapon_2": "string", - "attacker_weapon_2_mods": 0, - "attacker_weapon_3": "string", - "attacker_weapon_3_mods": 0, - "attacker_offhand_weapon_1": 0, - "attacker_offhand_weapon_2": 0, - "victim_name": "string", - "victim_id": 0, - "victim_current_weapon": "string", - "victim_current_weapon_mods": 0, - "victim_weapon_1": "string", - "victim_weapon_1_mods": 0, - "victim_weapon_2": "string", - "victim_weapon_2_mods": 0, - "victim_weapon_3": "string", - "victim_weapon_3_mods": 0, - "victim_offhand_weapon_1": 0, - "victim_offhand_weapon_2": 0, - "cause_of_death": "string", - "distance": 0 -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|object|false|none| -|» id|body|integer|false|none| -|» server|body|string|false|none| -|» tone_version|body|string|false|none| -|» match_id|body|string|false|none| -|» game_mode|body|string|false|none| -|» map|body|string|false|none| -|» game_time|body|string(time)|false|none| -|» player_count|body|integer|false|none| -|» attacker_name|body|string|false|none| -|» attacker_id|body|integer|false|none| -|» attacker_current_weapon|body|string|false|none| -|» attacker_current_weapon_mods|body|integer|false|none| -|» attacker_weapon_1|body|string|false|none| -|» attacker_weapon_1_mods|body|integer|false|none| -|» attacker_weapon_2|body|string|false|none| -|» attacker_weapon_2_mods|body|integer|false|none| -|» attacker_weapon_3|body|string|false|none| -|» attacker_weapon_3_mods|body|integer|false|none| -|» attacker_offhand_weapon_1|body|integer|false|none| -|» attacker_offhand_weapon_2|body|integer|false|none| -|» victim_name|body|string|false|none| -|» victim_id|body|integer|false|none| -|» victim_current_weapon|body|string|false|none| -|» victim_current_weapon_mods|body|integer|false|none| -|» victim_weapon_1|body|string|false|none| -|» victim_weapon_1_mods|body|integer|false|none| -|» victim_weapon_2|body|string|false|none| -|» victim_weapon_2_mods|body|integer|false|none| -|» victim_weapon_3|body|string|false|none| -|» victim_weapon_3_mods|body|integer|false|none| -|» victim_offhand_weapon_1|body|integer|false|none| -|» victim_offhand_weapon_2|body|integer|false|none| -|» cause_of_death|body|string|true|none| -|» distance|body|number|false|none| -|serverId|path|string|true|ID of the server| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|Created|None| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request|None| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized|None| - - - -# Schemas - -

Player

- - - - - - -```json -{ - "name": "Legonzaur", - "deaths": 0, - "kills": 0, - "max_kill_distance": 0, - "avg_kill_distance": 0 -} - -``` - -Player - -### Properties - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|name|string|false|none|none| -|deaths|integer|false|none|none| -|kills|integer|false|none|none| -|max_kill_distance|integer|false|none|none| -|avg_kill_distance|number|false|none|none| - -

Weapon

- - - - - - -```json -{ - "max_kill_distance": 0, - "avg_kill_distance": 0, - "kills": 0 -} - -``` - -Weapon - -### Properties - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|max_kill_distance|integer|false|none|none| -|avg_kill_distance|number|false|none|none| -|kills|integer|false|none|none| - -

Server

- - - - - - -```json -{ - "id": 1, - "name": "fvnknoots 7v7" -} - -``` - -Server - -### Properties - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|id|integer|false|none|none| -|name|string|false|none|none| - -

Kill

- - - - - - -```json -{ - "id": 0, - "server": "string", - "tone_version": "string", - "match_id": "string", - "game_mode": "string", - "map": "string", - "game_time": "14:15:22Z", - "player_count": 0, - "attacker_name": "string", - "attacker_id": 0, - "attacker_current_weapon": "string", - "attacker_current_weapon_mods": 0, - "attacker_weapon_1": "string", - "attacker_weapon_1_mods": 0, - "attacker_weapon_2": "string", - "attacker_weapon_2_mods": 0, - "attacker_weapon_3": "string", - "attacker_weapon_3_mods": 0, - "attacker_offhand_weapon_1": 0, - "attacker_offhand_weapon_2": 0, - "victim_name": "string", - "victim_id": 0, - "victim_current_weapon": "string", - "victim_current_weapon_mods": 0, - "victim_weapon_1": "string", - "victim_weapon_1_mods": 0, - "victim_weapon_2": "string", - "victim_weapon_2_mods": 0, - "victim_weapon_3": "string", - "victim_weapon_3_mods": 0, - "victim_offhand_weapon_1": 0, - "victim_offhand_weapon_2": 0, - "cause_of_death": "string", - "distance": 0 -} - -``` - -Kill - -### Properties - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|id|integer|false|read-only|none| -|server|string|false|read-only|none| -|tone_version|string|false|none|none| -|match_id|string|false|none|none| -|game_mode|string|false|none|none| -|map|string|false|none|none| -|game_time|string(time)|false|none|none| -|player_count|integer|false|none|none| -|attacker_name|string|false|none|none| -|attacker_id|integer|false|none|none| -|attacker_current_weapon|string|false|none|none| -|attacker_current_weapon_mods|integer|false|none|none| -|attacker_weapon_1|string|false|none|none| -|attacker_weapon_1_mods|integer|false|none|none| -|attacker_weapon_2|string|false|none|none| -|attacker_weapon_2_mods|integer|false|none|none| -|attacker_weapon_3|string|false|none|none| -|attacker_weapon_3_mods|integer|false|none|none| -|attacker_offhand_weapon_1|integer|false|none|none| -|attacker_offhand_weapon_2|integer|false|none|none| -|victim_name|string|false|none|none| -|victim_id|integer|false|none|none| -|victim_current_weapon|string|false|none|none| -|victim_current_weapon_mods|integer|false|none|none| -|victim_weapon_1|string|false|none|none| -|victim_weapon_1_mods|integer|false|none|none| -|victim_weapon_2|string|false|none|none| -|victim_weapon_2_mods|integer|false|none|none| -|victim_weapon_3|string|false|none|none| -|victim_weapon_3_mods|integer|false|none|none| -|victim_offhand_weapon_1|integer|false|none|none| -|victim_offhand_weapon_2|integer|false|none|none| -|cause_of_death|string|true|none|none| -|distance|number|false|none|none| - From 2dc63a3b29d5f4e047bd306504e3b918672038d0 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Tue, 4 Apr 2023 18:41:38 +0200 Subject: [PATCH 2/5] fix swagger ui bundle cdn --- docs/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index 3948e3b..bcf1d0d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,9 +3,9 @@ - + OpenAPI Petstore -
+
+
+ + + +ToneAPI v1 +
- - \ No newline at end of file + + ToneAPI + + + + + + + + + +

ToneAPI (1.0)

Download OpenAPI specification:Download

Stats tracking API for Titanfall 2 Northstar

+

List of servers

An array containing the list of servers as objects

+

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Statistics for all weapons

A JSON Object with weapon IDs as key and weapon data as value

+
query Parameters
server
number
Example: server=2

Fetch data for specific server

+
player
number
Example: player=1005930844007

Fetch data for specific player

+

Responses

Response samples

Content type
application/json
{
  • "hemlock": {
    },
  • "lstar": {
    }
}

Statistics for a single weapon

Data for a specific weapon

+
path Parameters
weaponId
required
string
Example: epg

ID of a weapon

+
query Parameters
server
number
Example: server=2

Fetch data for specific server

+
player
number
Example: player=1005930844007

Fetch data for specific player

+

Responses

Response samples

Content type
application/json
{
  • "max_kill_distance": 0,
  • "avg_kill_distance": 0,
  • "kills": 0
}

Statistics for all players

A JSON Object with player IDs as key and player data as value

+
query Parameters
weapon
string
Example: weapon=epg

Fetch data for specific weapon

+
server
number
Example: server=2

Fetch data for specific server

+

Responses

Response samples

Content type
application/json
{
  • "2250125460": {
    }
}

Statistics for a single player

Data for a specific player

+
path Parameters
playerId
required
string

ID of a player

+
query Parameters
server
number
Example: server=2

Fetch data for specific server

+
weapon
string
Example: weapon=epg

Fetch data for specific weapon

+

Responses

Response samples

Content type
application/json
{
  • "name": "Legonzaur",
  • "deaths": 0,
  • "kills": 0,
  • "max_kill_distance": 0,
  • "avg_kill_distance": 0
}

post-servers-serverId

Used to test auth

+
Authorizations:
Auth_Token
path Parameters
serverId
required
string
Example: 2

ID of the server

+

Responses

Post kills

Allows a Northstar server to record kills on the database

+
Authorizations:
Auth_Token
path Parameters
serverId
required
string
Example: 2

ID of the server

+
Request Body schema: application/json
tone_version
string
match_id
string
game_mode
string
map
string
game_time
string <time>
player_count
integer
attacker_name
string
attacker_id
integer
attacker_current_weapon
string
attacker_current_weapon_mods
integer
attacker_weapon_1
string
attacker_weapon_1_mods
integer
attacker_weapon_2
string
attacker_weapon_2_mods
integer
attacker_weapon_3
string
attacker_weapon_3_mods
integer
attacker_offhand_weapon_1
integer
attacker_offhand_weapon_2
integer
victim_name
string
victim_id
integer
victim_current_weapon
string
victim_current_weapon_mods
integer
victim_weapon_1
string
victim_weapon_1_mods
integer
victim_weapon_2
string
victim_weapon_2_mods
integer
victim_weapon_3
string
victim_weapon_3_mods
integer
victim_offhand_weapon_1
integer
victim_offhand_weapon_2
integer
cause_of_death
required
string
distance
number

Responses

Request samples

Content type
application/json
{
  • "tone_version": "string",
  • "match_id": "string",
  • "game_mode": "string",
  • "map": "string",
  • "game_time": "14:15:22Z",
  • "player_count": 0,
  • "attacker_name": "string",
  • "attacker_id": 0,
  • "attacker_current_weapon": "string",
  • "attacker_current_weapon_mods": 0,
  • "attacker_weapon_1": "string",
  • "attacker_weapon_1_mods": 0,
  • "attacker_weapon_2": "string",
  • "attacker_weapon_2_mods": 0,
  • "attacker_weapon_3": "string",
  • "attacker_weapon_3_mods": 0,
  • "attacker_offhand_weapon_1": 0,
  • "attacker_offhand_weapon_2": 0,
  • "victim_name": "string",
  • "victim_id": 0,
  • "victim_current_weapon": "string",
  • "victim_current_weapon_mods": 0,
  • "victim_weapon_1": "string",
  • "victim_weapon_1_mods": 0,
  • "victim_weapon_2": "string",
  • "victim_weapon_2_mods": 0,
  • "victim_weapon_3": "string",
  • "victim_weapon_3_mods": 0,
  • "victim_offhand_weapon_1": 0,
  • "victim_offhand_weapon_2": 0,
  • "cause_of_death": "string",
  • "distance": 0
}
+ + + + diff --git a/docs/OpenAPI.yml b/docs/v1.yml similarity index 100% rename from docs/OpenAPI.yml rename to docs/v1.yml diff --git a/package.json b/package.json index faddf34..8295458 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "startServer": "node out/serverMain.js", "startClient": "node out/clientMain.js", "startProcess": "node out/processMain.js", - "documentation": "widdershins reference/OpenAPI.yml -o docs/openapi.md --language_tabs javascript:JavaScript:request.", + "documentation": "redocly build-docs .\\docs\\v1.yml --output=docs\\index.html", "test": "jest" } } \ No newline at end of file