Something went wrong. Try again.
OpenAPI 3.0 compliant spec for TLE Community.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424import { operation, requestBodySchema, response200, response500, security, statusSchema, tags,} from '../chunks.ts';
const empireSnippetSchema = { type: 'object', required: ['id', 'name', 'alignment', 'is_isolationist'], properties: { id: { type: 'integer' }, name: { type: 'string' }, alignment: { type: 'string', enum: ['ally', 'self', 'hostile'] }, is_isolationist: { type: 'integer', enum: [1, 0] }, },};
const stationSnippetSchema = { type: 'object', required: ['id', 'x', 'y', 'name'], properties: { id: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, name: { type: 'string' }, },};
const bodySnippetSchema = { type: 'object', required: ['name', 'id', 'orbit', 'x', 'y', 'type', 'image', 'size'], properties: { name: { type: 'string' }, id: { type: 'integer' }, orbit: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, type: { type: 'string' }, image: { type: 'string' }, size: { type: 'number' }, empire: { ...empireSnippetSchema, description: 'Only present if the body is occupied by an empire.', }, body_has_fissure: { type: 'integer', enum: [1, 0], description: 'Only present on asteroids or bodies that have a fissure.', }, },};
const starDetailSchema = { type: 'object', required: ['name', 'color', 'x', 'y', 'zone', 'id'], properties: { name: { type: 'string' }, color: { type: 'string' }, x: { type: 'number' }, y: { type: 'number' }, zone: { type: 'string' }, influence: { type: 'number' }, id: { type: 'integer' }, station: { ...stationSnippetSchema, description: 'Only present if this star is under the influence of a space station.', }, bodies: { type: 'array', items: { $ref: '#/components/schemas/body_status' }, description: 'Only present if a probe is present in the system.', }, },};
const starDetailResponses = (description: string) => ({ ...response200(description, { type: 'object', required: ['star', 'status'], properties: { star: starDetailSchema, status: statusSchema() }, }), ...response500(),});
export const map = { '/v2/map/get_star_map': { post: { ...tags('map'), ...security(), ...operation( 'Draw the star map (lite).', 'The preferred, lite way to get star data for drawing the star map — it returns just enough to render it, omitting most owned-planet detail such as ore and water and the station-influence block. The maximum area that can be returned is 1001 units (e.g. 50x20 or 1001x1).' ),
...requestBodySchema({ type: 'object', required: ['left', 'top', 'right', 'bottom'], properties: { left: { type: 'number', description: 'The left edge of the bounding rectangle.' }, top: { type: 'number', description: 'The top edge of the bounding rectangle.' }, right: { type: 'number', description: 'The right edge of the bounding rectangle.' }, bottom: { type: 'number', description: 'The bottom edge of the bounding rectangle.' }, }, }),
responses: { ...response200( "The preferred, 'lite' way to draw the starmap — returns just enough data to render it, and does not include most owned-planet detail (ore, water, etc). Maximum requestable area is 1001 units (e.g. 50x20 or 1001x1).", { type: 'object', required: ['stars'], properties: { stars: { type: 'array', items: { type: 'object', required: ['name', 'color', 'x', 'y', 'id', 'zone', 'influence', 'bodies'], properties: { name: { type: 'string' }, color: { type: 'string' }, x: { type: 'number' }, y: { type: 'number' }, id: { type: 'integer' }, zone: { type: 'string' }, influence: { type: 'number', description: 'May be null when the star is outside any station jurisdiction.', }, station: { type: 'object', description: 'Only present if this star is under the influence of a space station.', required: ['id', 'x', 'y', 'name', 'alliance'], properties: { id: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, name: { type: 'string' }, alliance: { type: 'object', required: ['name', 'id', 'image'], properties: { name: { type: 'string' }, id: { type: 'integer' }, image: { type: 'string' }, }, }, }, }, bodies: { type: 'array', items: bodySnippetSchema }, }, }, }, }, } ), ...response500(), }, }, },
'/v2/map/get_stars': { post: { ...tags('map'), ...security(), ...operation( 'Get a chunk of the star map.', 'Retrieves a chunk of the map as an array of stars. Coordinates without a star are omitted. The requested area can be no larger than 900 spaces (30x30). Throws 1003 when the area is too large.' ),
...requestBodySchema({ type: 'object', required: ['x1', 'y1', 'x2', 'y2'], properties: { x1: { type: 'number', description: 'The top left x coordinate.' }, y1: { type: 'number', description: 'The top left y coordinate.' }, x2: { type: 'number', description: 'The bottom right x coordinate.' }, y2: { type: 'number', description: 'The bottom right y coordinate.' }, }, }),
responses: { ...response200( 'Retrieves a chunk of the map. Coordinates without a star are omitted from the results. Maximum requestable area is 900 spaces (e.g. 30x30). Throws 1003 if the area is too large.', { type: 'object', required: ['stars', 'status'], properties: { stars: { type: 'array', items: starDetailSchema }, status: statusSchema(), }, } ), ...response500(), }, }, },
'/v2/map/check_star_for_incoming_probe': { post: { ...tags('map'), ...security(), ...operation( 'Check for an inbound probe to a star.', 'If a star has a status of "unprobed", call this to find out whether a probe from this empire is on its way.' ),
...requestBodySchema({ type: 'object', required: ['star_id'], properties: { star_id: { type: 'integer', description: 'The unique id of the star.' } }, }),
responses: { ...response200( 'If the star has a status of "unprobed", call this to check whether a probe from this empire is inbound.', { type: 'object', required: ['status'], properties: { status: statusSchema(), incoming_probe: { type: 'string', description: 'The arrival date of the inbound probe. Only present if one is inbound.', }, }, } ), ...response500(), }, }, },
'/v2/map/get_star': { post: { ...tags('map'), ...security(), ...operation('Get one star by id.', 'Retrieves info on a single star.'), ...requestBodySchema({ type: 'object', required: ['star_id'], properties: { star_id: { type: 'integer', description: 'The unique id of the star.' } }, }), responses: starDetailResponses('Retrieves info on a single star.'), }, },
'/v2/map/get_star_by_name': { post: { ...tags('map'), ...security(), ...operation( 'Get one star by name.', 'Retrieves info on a single star by its exact, case insensitive name.' ), ...requestBodySchema({ type: 'object', required: ['name'], properties: { name: { type: 'string', description: 'The exact name of the star. Case insensitive.' }, }, }), responses: starDetailResponses( 'Retrieves info on a single star by its exact (case insensitive) name.' ), }, },
'/v2/map/get_star_by_xy': { post: { ...tags('map'), ...security(), ...operation( 'Get one star by coordinates.', 'Retrieves info on a single star by its coordinates.' ), ...requestBodySchema({ type: 'object', required: ['x', 'y'], properties: { x: { type: 'number', description: 'The x coordinate of the star.' }, y: { type: 'number', description: 'The y coordinate of the star.' }, }, }), responses: starDetailResponses('Retrieves info on a single star by coordinates.'), }, },
'/v2/map/search_stars': { post: { ...tags('map'), ...security(), ...operation( 'Search stars by partial name.', 'Searches for stars by partial, case insensitive name. Returns up to 25 results, with no body data.' ),
...requestBodySchema({ type: 'object', required: ['name'], properties: { name: { type: 'string', description: 'A partial name of a star. Case insensitive. Must be at least 3 characters.', }, }, }),
responses: { ...response200( 'Searches for stars by partial, case insensitive name (minimum 3 characters). No body data is returned. Returns up to 25 results.', { type: 'object', required: ['stars', 'status'], properties: { stars: { type: 'array', items: { type: 'object', required: ['name', 'color', 'x', 'y'], properties: { name: { type: 'string' }, color: { type: 'string' }, x: { type: 'number' }, y: { type: 'number' }, }, }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
'/v2/map/probe_summary_fissures': { post: { ...tags('map'), ...security(), ...operation( 'Summarize known fissures in a zone.', "Returns a summary of every body with a fissure known to your own or your alliance's probes in the given zone. Returns an empty object when no fissures are known." ),
...requestBodySchema({ type: 'object', properties: { zone: { type: 'string', description: 'A zone string, e.g. "-1|0", "5|-5", or "0|0". If omitted, all zones are searched.', }, }, }),
responses: { ...response200( "A summary of every body with a fissure known to your (or your alliance's) probes in the given zone. Returns an empty object if no fissures are known.", { type: 'object', properties: { fissures: { type: 'object', description: 'Keyed by body id.', additionalProperties: bodySnippetSchema, }, }, } ), ...response500(), }, }, },
'/v2/map/view_laws': { post: { ...tags('map'), ...security(), ...operation( 'View the laws controlling a star.', 'Pass the id of a star and the laws enacted by the controlling space station are returned.' ),
...requestBodySchema({ type: 'object', required: ['star_id'], properties: { star_id: { type: 'integer', description: 'The unique id of the star.' } }, }),
responses: { ...response200('Returns the laws enacted by the space station controlling this star.', { type: 'object', required: ['status', 'laws'], properties: { status: statusSchema(), laws: { type: 'array', items: { type: 'object', required: ['id', 'name', 'description', 'date_enacted'], properties: { id: { type: 'integer' }, name: { type: 'string' }, description: { type: 'string' }, date_enacted: { type: 'string' }, }, }, }, }, }), ...response500(), }, }, },};