Something went wrong. Try again.
OpenAPI 3.0 compliant spec for TLE Community.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465import { operation, requestBodySchema, response200, response500, security, statusSchema, tags,} from '../chunks.ts';
const ALLIANCE_SORT_BY = [ 'average_empire_size_rank', 'offense_success_rate_rank', 'defense_success_rate_rank', 'dirtiest_rank',];
const EMPIRE_SORT_BY = [ 'empire_size_rank', 'offense_success_rate_rank', 'defense_success_rate_rank', 'dirtiest_rank',];
const COLONY_SORT_BY = ['population_rank'];
const SPY_SORT_BY = ['level_rank', 'success_rate_rank', 'dirtiest_rank'];
const pageNumberSchema = { type: 'integer', description: "Optional. 25 records per page. Defaults to the page containing the current user's own rank.",};
const allianceRankEntrySchema = { type: 'object', required: [ 'alliance_id', 'alliance_name', 'member_count', 'space_station_count', 'influence', 'colony_count', 'population', 'average_empire_size', 'building_count', 'average_building_level', 'offense_success_rate', 'defense_success_rate', 'dirtiest', ], properties: { alliance_id: { type: 'integer' }, alliance_name: { type: 'string' }, member_count: { type: 'integer' }, space_station_count: { type: 'integer' }, influence: { type: 'integer' }, colony_count: { type: 'integer' }, population: { type: 'integer' }, average_empire_size: { type: 'number' }, building_count: { type: 'integer' }, average_building_level: { type: 'number' }, offense_success_rate: { type: 'number' }, defense_success_rate: { type: 'number' }, dirtiest: { type: 'integer' }, },};
const empireRankEntrySchema = { type: 'object', required: [ 'empire_id', 'empire_name', 'alliance_id', 'alliance_name', 'colony_count', 'population', 'empire_size', 'building_count', 'average_building_level', 'offense_success_rate', 'defense_success_rate', 'dirtiest', ], properties: { empire_id: { type: 'integer' }, empire_name: { type: 'string' }, alliance_id: { type: ['integer', 'null'], description: 'Always present, but null when the empire is not in an alliance.', }, alliance_name: { type: ['string', 'null'], description: 'Always present, but null when the empire is not in an alliance.', }, colony_count: { type: 'integer' }, population: { type: 'integer' }, empire_size: { type: 'integer' }, building_count: { type: 'integer' }, average_building_level: { type: 'number' }, offense_success_rate: { type: 'number' }, defense_success_rate: { type: 'number' }, dirtiest: { type: 'integer' }, },};
const colonyRankEntrySchema = { type: 'object', required: [ 'empire_id', 'empire_name', 'planet_id', 'planet_name', 'population', 'building_count', 'average_building_level', 'highest_building_level', ], properties: { empire_id: { type: 'integer' }, empire_name: { type: 'string' }, planet_id: { type: 'integer' }, planet_name: { type: 'string' }, population: { type: 'integer' }, building_count: { type: 'integer' }, average_building_level: { type: 'number' }, highest_building_level: { type: 'integer' }, },};
const spyRankEntrySchema = { type: 'object', required: [ 'empire_id', 'empire_name', 'spy_id', 'spy_name', 'age', 'level', 'success_rate', 'dirtiest', ], properties: { empire_id: { type: 'integer' }, empire_name: { type: 'string' }, spy_id: { type: 'integer' }, spy_name: { type: 'string' }, age: { type: 'integer' }, level: { type: 'integer' }, success_rate: { type: 'number' }, dirtiest: { type: 'integer' }, },};
const medalWinnerSchema = { type: 'object', required: ['empire_id', 'empire_name', 'medal_name', 'medal_image', 'times_earned'], properties: { empire_id: { type: 'integer' }, empire_name: { type: 'string' }, medal_name: { type: 'string' }, medal_image: { type: 'string' }, times_earned: { type: 'integer' }, },};
export const stats = { '/v2/stats/credits': { post: { ...tags('stats'), ...security(), ...operation( 'Get the game credits.', 'Retrieves the list of game credits. Each entry names a single contribution category and the people who worked on it.' ),
responses: { ...response200( 'Retrieves the list of game credits. Each entry names a single contribution category and the people who worked on it.', { type: 'array', items: { type: 'object', description: 'Keyed by contribution category, e.g. "Game Server" or "Play Testers".', additionalProperties: { type: 'array', items: { type: 'string' } }, }, } ), ...response500(), }, }, },
'/v2/stats/alliance_rank': { post: { ...tags('stats'), ...security(), ...operation( 'Rank alliances by statistic.', 'Returns a sorted list of alliances ranked according to various stats.' ),
...requestBodySchema({ type: 'object', properties: { sort_by: { type: 'string', enum: ALLIANCE_SORT_BY, description: 'Optional. Defaults to average_empire_size_rank.', }, page_number: pageNumberSchema, }, }),
responses: { ...response200('Returns a sorted list of alliances ranked by various statistics.', { type: 'object', required: ['alliances', 'total_alliances', 'page_number', 'status'], properties: { alliances: { type: 'array', items: allianceRankEntrySchema }, total_alliances: { type: 'integer' }, page_number: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, },
'/v2/stats/find_alliance_rank': { post: { ...tags('stats'), ...security(), ...operation( 'Find an alliance in the rankings.', 'Searches for a particular alliance within the alliance rankings, returning the page of the alliance_rank listing each match appears on.' ),
...requestBodySchema({ type: 'object', required: ['sort_by', 'alliance_name'], properties: { sort_by: { type: 'string', enum: ALLIANCE_SORT_BY, description: 'Determines which ranking the returned page numbers refer to.', }, alliance_name: { type: 'string', description: 'Full or partial name. Must be at least 3 characters.', }, }, }),
responses: { ...response200( 'Searches for a particular alliance within the alliance rankings, returning the page of the alliance_rank listing each match appears on.', { type: 'object', required: ['alliances', 'status'], properties: { alliances: { type: 'array', items: { type: 'object', required: ['alliance_id', 'alliance_name', 'page_number'], properties: { alliance_id: { type: 'integer' }, alliance_name: { type: 'string' }, page_number: { type: 'integer' }, }, }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
'/v2/stats/empire_rank': { post: { ...tags('stats'), ...security(), ...operation( 'Rank empires by statistic.', 'Returns a sorted list of empires ranked according to various stats.' ),
...requestBodySchema({ type: 'object', properties: { sort_by: { type: 'string', enum: EMPIRE_SORT_BY, description: 'Optional. Defaults to empire_size_rank.', }, page_number: pageNumberSchema, }, }),
responses: { ...response200('Returns a sorted list of empires ranked by various statistics.', { type: 'object', required: ['empires', 'total_empires', 'page_number', 'status'], properties: { empires: { type: 'array', items: empireRankEntrySchema }, total_empires: { type: 'integer' }, page_number: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, },
'/v2/stats/find_empire_rank': { post: { ...tags('stats'), ...security(), ...operation( 'Find an empire in the rankings.', 'Searches for a particular empire within the empire rankings, returning the page of the empire_rank listing each match appears on.' ),
...requestBodySchema({ type: 'object', required: ['sort_by', 'empire_name'], properties: { sort_by: { type: 'string', enum: EMPIRE_SORT_BY, description: 'Determines which ranking the returned page numbers refer to.', }, empire_name: { type: 'string', description: 'Full or partial name. Must be at least 3 characters.', }, }, }),
responses: { ...response200( 'Searches for a particular empire within the empire rankings, returning the page of the empire_rank listing each match appears on.', { type: 'object', required: ['empires', 'status'], properties: { empires: { type: 'array', items: { type: 'object', required: ['empire_id', 'empire_name', 'page_number'], properties: { empire_id: { type: 'integer' }, empire_name: { type: 'string' }, page_number: { type: 'integer' }, }, }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
'/v2/stats/colony_rank': { post: { ...tags('stats'), ...security(), ...operation( 'Rank colonies by statistic.', 'Returns a sorted list of planets ranked according to various stats.' ),
...requestBodySchema({ type: 'object', properties: { sort_by: { type: 'string', enum: COLONY_SORT_BY, description: 'Optional. Defaults to population_rank.', }, }, }),
responses: { ...response200('Returns a sorted list of planets ranked by various statistics.', { type: 'object', required: ['colonies', 'status'], properties: { colonies: { type: 'array', items: colonyRankEntrySchema }, status: statusSchema(), }, }), ...response500(), }, }, },
'/v2/stats/spy_rank': { post: { ...tags('stats'), ...security(), ...operation( 'Rank the top spies by statistic.', 'Returns a sorted list of the top spies in the game ranked according to various stats.' ),
...requestBodySchema({ type: 'object', properties: { sort_by: { type: 'string', enum: SPY_SORT_BY, description: 'Optional. Defaults to level_rank.', }, }, }),
responses: { ...response200('Returns a sorted list of the top spies ranked by various statistics.', { type: 'object', required: ['spies', 'status'], properties: { spies: { type: 'array', items: spyRankEntrySchema }, status: statusSchema(), }, }), ...response500(), }, }, },
'/v2/stats/weekly_medal_winners': { post: { ...tags('stats'), ...security(), ...operation( "List this week's medal winners.", "Returns the list of empires who won this week's weekly medals." ),
responses: { ...response200("Returns the list of empires who won this week's weekly medals.", { type: 'object', required: ['winners', 'status'], properties: { winners: { type: 'array', items: medalWinnerSchema }, status: statusSchema(), }, }), ...response500(), }, }, },};