Files
csgowtf-api/api.csgowtf.yaml

603 lines
15 KiB
YAML

openapi: 3.0.0
servers:
- description: csgoWTF API Endpoint
url: https://api.csgow.tf
info:
version: "1.0.0"
title: csgoWTF API
contact:
email: api@csgow.tf
license:
name: GPLv3
url: 'https://www.gnu.org/licenses/gpl-3.0.html'
tags:
- name: matches
description: All calls related to matches
- name: players
description: All calls related to players
- name: meta
description: All calls not related to players or matches
paths:
/match/{id}:
get:
tags:
- matches
summary: gets match by MatchID
operationId: getMatch
description: |
Get match by matchID
parameters:
- in: path
name: id
description: match id
required: true
schema:
type: string
responses:
'200':
description: match with id
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Match'
- type: object
properties:
stats:
type: array
maxItems: 10
items:
$ref: '#/components/schemas/Stats'
'400':
description: bad input parameter
'404':
description: match not found
'500':
description: internal server errror
/match/{id}/chat:
get:
tags:
- matches
summary: gets match-chat by MatchID
operationId: getMatchChat
description: |
Get match-chat by MatchID
parameters:
- in: path
name: id
description: match id
required: true
schema:
type: string
- in: query
name: translated
schema:
type: number
enum: [0, 1]
required: false
responses:
'200':
description: match with id
content:
application/json:
schema:
$ref: '#/components/schemas/MatchChat'
'400':
description: bad input parameter
'404':
description: match not found
'500':
description: internal server error
/match/{id}/rounds:
get:
tags:
- matches
summary: gets match-rounds by MatchID
operationId: getMatchRounds
description: |
Get match-rounds by MatchID
parameters:
- in: path
name: id
description: match id
required: true
schema:
type: string
responses:
'200':
description: match with id
content:
application/json:
schema:
$ref: '#/components/schemas/MatchRounds'
'400':
description: bad input parameter
'404':
description: match not found
'500':
description: internal server error
/match/{id}/weapons:
get:
tags:
- matches
summary: gets match-weapons by MatchID
operationId: getMatchWeapons
description: |
Get match-weapons by MatchID
parameters:
- in: path
name: id
description: match id
required: true
schema:
type: string
responses:
'200':
description: match with id
content:
application/json:
schema:
$ref: '#/components/schemas/MatchWeapons'
'400':
description: bad input parameter
'404':
description: match not found
'500':
description: internal server error
/matches:
get:
tags:
- matches
summary: gets matches
operationId: getMatches
description: |
Get last 10 matches
parameters:
- in: query
name: after
schema:
type: integer
format: int64
required: false
description: Unix time after which games are loaded
responses:
'200':
description: match with id
content:
application/json:
schema:
$ref: '#/components/schemas/Match'
'400':
description: bad input parameter
'500':
description: internal server error
/player/{id}:
get:
tags:
- players
summary: gets player by steamID64
operationId: getPlayer
description: |
Get player by steamid64
parameters:
- in: path
name: id
description: player steamid64
required: true
schema:
type: string
- in: query
name: after
schema:
type: integer
format: int64
required: false
description: Unix time after which games are loaded
responses:
'200':
description: player with matches and stats
content:
application/json:
schema:
$ref: '#/components/schemas/Player'
'400':
description: bad input parameter
'404':
description: player not found
'500':
description: unable to get player
/player/{id}/meta:
get:
tags:
- players
summary: gets player-meta by steamID64
operationId: getPlayerMeta
description: |
Get player-meta by steamid64
parameters:
- in: path
name: id
description: player steamid64
required: true
schema:
type: string
- in: query
name: limit
schema:
type: integer
minimum: 1
maximum: 10
required: true
description: Number of returned meta-stats
responses:
'200':
description: player meta stats
content:
application/json:
schema:
$ref: '#/components/schemas/PlayerMeta'
'400':
description: bad input parameter
'404':
description: player not found
'500':
description: unable to get player meta-stats
/player/{id}/track:
post:
tags:
- players
summary: tracks player with steamid64 by authCode
operationId: postPlayerTrack
description: |
Post player steamid64, authcode (and sharecode) to track games
parameters:
- in: path
name: id
description: player steamid64
required: true
schema:
type: string
- in: query
name: authcode
description: player authcode
required: true
schema:
type: string
pattern: '^[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{5}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}$'
- in: query
name: sharecode
description: player sharecode
required: false
schema:
type: string
pattern: '^CSGO(?:-?[ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789]{5}){5}$'
responses:
'202':
description: Tracking successful
'400':
description: Invalid arguments
'401':
description: Authcode is invalid
'404':
description: Player not found
'412':
description: Sharecode is invalid or missing
'500':
description: Internal server error
'503':
description: Steam API not available
delete:
tags:
- players
summary: deletes tracked player with steamid64 by authCode
operationId: deletePlayerTrack
description: |
Delete player steamid64 and authcode to delete tracked status
parameters:
- in: path
name: id
description: player steamid64
required: true
schema:
type: string
- in: query
name: authcode
description: player authcode
required: true
schema:
type: string
pattern: '^[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{5}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}$'
responses:
'200':
description: Delete successful
'400':
description: Invalid arguments
'401':
description: Authcode is invalid
'404':
description: Player not found
'500':
description: Internal server error
'503':
description: Steam API not available
components:
schemas:
Match:
type: object
properties:
match_id:
type: string
share_code:
type: string
map:
type: string
date:
type: integer
score:
type: array
items:
type: integer
maxItems: 2
minItems: 2
duration:
type: integer
match_result:
type: integer
enum: [0, 1, 2]
max_rounds:
type: integer
parsed:
type: boolean
replay_url:
type: string
vac:
type: boolean
game_ban:
type: boolean
avg_rank:
type: number
tick_rate:
type: number
required:
- match_id
- map
- date
- score
- duration
- match_result
- parsed
- vac
- game_ban
MatchChat:
type: object
properties:
message:
type: string
all_chat:
type: boolean
tick:
type: integer
translated_from:
type: string
translated_to:
type: string
required:
- message
- all_chat
- tick
MatchRounds:
type: object
additionalProperties:
type: object
additionalProperties:
type: array
items:
type: integer
minItems: 3
maxItems: 3
MatchWeapons:
type: object
properties:
equipment_map:
type: object
additionalProperties:
type: string
stats:
type: array
items:
type: object
additionalProperties:
type: object
additionalProperties:
type: array
items:
type: array
items:
type: integer
minItems: 3
maxItems: 3
spray:
type: array
items:
type: object
additionalProperties:
type: object
additionalProperties:
type: array
items:
type: array
items:
type: number
minItems: 3
maxItems: 3
Player:
type: object
properties:
steamid64:
type: string
name:
type: string
avatar:
type: string
vac:
type: boolean
vac_date:
type: integer
format: int64
game_ban:
type: boolean
game_ban_date:
type: integer
format: int64
tracked:
type: boolean
vanity_url:
type: string
match_stats:
type: object
properties:
win:
type: integer
loss:
type: integer
tie:
type: integer
matches:
type: array
items:
$ref: '#/components/schemas/Match'
required:
- steamid64
- vac
- game_ban
- tracked
PlayerMeta:
type: object
properties:
player:
$ref: '#/components/schemas/Player'
best_mates:
type: array
items:
$ref: '#/components/schemas/PlayerMate'
most_mates:
type: array
items:
$ref: '#/components/schemas/PlayerMate'
eq_map:
type: object
additionalProperties:
type: string
weapon_dmg:
type: array
items:
type: object
properties:
eq:
type: integer
dmg:
type: integer
win_maps:
type: object
additionalProperties:
type: number
tie_maps:
type: object
additionalProperties:
type: number
total_maps:
type: object
additionalProperties:
type: integer
required:
- player
PlayerMate:
type: object
properties:
player:
$ref: '#/components/schemas/Player'
win_rate:
type: number
tie_rate:
type: number
total:
type: integer
required:
- player
Stats:
type: object
properties:
team_id:
type: integer
kills:
type: integer
deaths:
type: integer
assists:
type: integer
headshots:
type: integer
mvp:
type: integer
score:
type: integer
crosshair:
type: string
color:
type: string
player:
$ref: '#/components/schemas/Player'
rank:
type: object
properties:
old:
type: integer
new:
type: integer
multi_kills:
type: object
properties:
duo:
type: integer
triple:
type: integer
quad:
type: integer
pent:
type: integer
dmg:
type: object
properties:
ememy:
type: integer
team:
type: integer
flash:
type: object
properties:
duration:
type: object
properties:
self:
type: number
team:
type: number
enemy:
type: number
total:
type: object
properties:
self:
type: integer
team:
type: integer
enemy:
type: integer
required:
- team_id
- kills
- deaths
- assists
- headshot
- mvp
- score