Something went wrong. Try again.
OpenAPI 3.0 compliant spec for TLE Community.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576import { operation, requestBodySchema, response200, response500, security, statusSchema, tags,} from '../chunks.ts';
export const body = { '/v2/body/get_status': { post: { ...tags('body'), ...security(), ...operation( 'Get detailed status for a body.', 'Returns detailed statistics about a body owned or sat for by the current empire. You should probably never call this directly — the same data comes back in the status block of every relevant request.' ),
...requestBodySchema({ type: 'object', required: ['body_id'], properties: { body_id: { type: 'integer', description: 'The id of the body you wish to retrieve.' }, }, }),
responses: { ...response200( 'Returns information about the current state of this body. Must be owned or a sitter of the current empire.', { type: 'object', required: ['empire', 'body'], properties: { server: { $ref: '#/components/schemas/server_status' }, empire: { $ref: '#/components/schemas/empire_status' }, body: { $ref: '#/components/schemas/body_status' }, }, } ), ...response500(), }, }, },
'/v2/body/get_body_status': { post: { ...tags('body'), ...security(), ...operation( 'Get the public star-map status for a body.', 'Returns the public star-map view of any body. This endpoint is not part of the original API documentation.' ),
...requestBodySchema({ type: 'object', required: ['body_id'], properties: { body_id: { type: 'integer', description: 'The id of the body you wish to retrieve.' }, }, }),
responses: { ...response200('Usd in the Star Map. Returns public information about the given body.', { type: 'object', required: ['body'], properties: { body: { $ref: '#/components/schemas/body_status' }, status: statusSchema(), }, }), ...response500(), }, }, },
'/v2/body/get_buildings': { post: { ...tags('body'), ...security(), ...operation( 'List the buildings on a body.', 'Retrieves the buildings on a body. The surface is an 11x11 tile grid running from -5 to 5 on both axes, with the Planetary Command Center always at 0,0; fill the remaining tiles with blank ground. Throws 1002 and 1010.' ),
...requestBodySchema({ type: 'object', required: ['body_id'], properties: { body_id: { type: 'integer', description: 'The id of the body you wish to retrieve the buildings on.', }, }, }),
responses: { ...response200( "Retrieves the buildings on a planet's 11x11 (-5 to 5) surface grid. The planetary command building is always at 0,0.", { type: 'object', required: ['buildings', 'body', 'status'], properties: { buildings: { $ref: '#/components/schemas/buildings_list' }, body: { type: 'object', required: ['surface_image'], properties: { surface_image: { type: 'string' } }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
'/v2/body/get_buildings_resources': { post: { ...tags('body'), ...security(), ...operation( "List buildings on a body with each one's resource contribution.", "Like get_buildings, but every building entry additionally carries a `resources` object describing that building's hourly production/consumption and storage capacity for each resource, plus per-food-type and per-ore-type breakdowns. Throws 1002 and 1010." ),
...requestBodySchema({ type: 'object', required: ['body_id'], properties: { body_id: { type: 'integer', description: 'The id of the body you wish to retrieve the buildings on.', }, }, }),
responses: { ...response200( 'Like get_buildings, but every building entry additionally carries a `resources` object: hourly production/consumption and storage capacity for food/ore/water/waste/energy plus happiness_hour, and per-food-type / per-ore-type production breakdowns (each omitted when the building produces none of that resource).', { type: 'object', required: ['buildings', 'body', 'status'], properties: { buildings: { $ref: '#/components/schemas/buildings_resources_list' }, body: { type: 'object', required: ['surface_image'], properties: { surface_image: { type: 'string' } }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
'/v2/body/repair_list': { post: { ...tags('body'), ...security(),
...operation( 'Repair a list of buildings.', 'Repairs the given buildings, in the order their ids are supplied. Returns the same shape as get_buildings, but only for the repaired buildings.' ),
...requestBodySchema({ type: 'object', required: ['body_id', 'building_ids'], properties: { body_id: { type: 'integer', description: 'The id of the body the buildings are on.' }, building_ids: { type: 'array', items: { type: 'integer' }, description: 'The building ids to repair, in the order they should be repaired.', }, }, }),
responses: { ...response200( 'Repairs the given buildings, in the order provided. Returns the same shape as get_buildings, but only for the repaired buildings.', { type: 'object', required: ['buildings', 'body', 'status'], properties: { buildings: { $ref: '#/components/schemas/buildings_list' }, body: { type: 'object', required: ['surface_image'], properties: { surface_image: { type: 'string' } }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
'/v2/body/rearrange_buildings': { post: { ...tags('body'), ...security(),
...operation( 'Move buildings to new coordinates.', 'Rearranges buildings to the coordinates supplied in the arrangement array. Throws 1002 and 1010.' ),
...requestBodySchema({ type: 'object', required: ['body_id', 'arrangement'], properties: { body_id: { type: 'integer', description: 'The id of the body you wish to arrange buildings on.', }, arrangement: { type: 'array', description: 'Every building being moved must be included. The Planetary Command/Station Command must end up at 0,0.', items: { type: 'object', required: ['id', 'x', 'y'], properties: { id: { type: 'integer', description: 'The id of the building to move.' }, x: { type: 'integer', minimum: -5, maximum: 5, description: 'The new x coordinate for the building.', }, y: { type: 'integer', minimum: -5, maximum: 5, description: 'The new y coordinate for the building.', }, }, }, }, }, }),
responses: { ...response200('Rearranges buildings to the supplied coordinates.', { type: 'object', required: ['moved', 'body', 'status'], properties: { moved: { type: 'array', items: { type: 'object', required: ['id', 'name', 'x', 'y'], properties: { id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, }, }, }, body: { type: 'object', required: ['surface_image'], properties: { surface_image: { type: 'string' } }, }, status: statusSchema(), }, }), ...response500(), }, }, },
'/v2/body/get_buildable': { post: { ...tags('body'), ...security(),
...operation( 'List building types buildable on a tile.', 'Lists every building type that can be built on the given tile and matches the given tag. If several plans apply, returns the one with the highest extra_build_level. Throws 1002, 1010, 1011, 1012, and 1013.' ),
...requestBodySchema({ type: 'object', required: ['body_id', 'x', 'y', 'tag'], properties: { body_id: { type: 'integer', description: 'The id of the body you wish to build on.' }, x: { type: 'integer', minimum: -5, maximum: 5, description: 'The x axis of the tile on the planet surface. Valid values are between -5 and 5 inclusive.', }, y: { type: 'integer', minimum: -5, maximum: 5, description: 'The y axis of the tile on the planet surface. Valid values are between -5 and 5 inclusive.', }, tag: { type: 'string', description: 'A tag that limits which building types are returned. Required. Cannot be Now, Soon, or Later; all other tags are allowed.', }, }, }),
responses: { ...response200( 'Lists the building types buildable at a given spot for a given tag. If multiple plans apply, returns the one with the highest extra_build_level.', { type: 'object', required: ['max_items_in_build_queue', 'build_queue', 'buildable', 'status'], properties: { max_items_in_build_queue: { type: 'integer' }, build_queue: { type: 'object', required: ['max', 'current'], properties: { max: { type: 'integer' }, current: { type: 'integer' } }, }, buildable: { type: 'object', description: 'Keyed by building type name.', additionalProperties: { type: 'object', required: ['url', 'build', 'image', 'production'], properties: { url: { type: 'string' }, image: { type: 'string' }, build: { type: 'object', required: ['can', 'no_plot_use', 'cost', 'tags', 'reason'], properties: { can: { type: 'integer', enum: [1, 0] }, no_plot_use: { type: 'integer', enum: [1, 0] }, cost: { $ref: '#/components/schemas/building_cost' }, // Only present for some plan types — skips level 1 and builds straight // to this level. extra_level: { type: 'integer' }, tags: { type: 'array', items: { type: 'string' } }, reason: { type: 'array', items: {}, description: '[code, message, data], same shape as an rpc_error.', }, }, }, production: { type: 'object', properties: { food_hour: { type: 'integer' }, energy_hour: { type: 'integer' }, ore_hour: { type: 'integer' }, water_hour: { type: 'integer' }, waste_hour: { type: 'integer' }, happiness_hour: { type: 'integer' }, }, }, }, }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
'/v2/body/get_buildable_locations': { post: { ...tags('body'), ...security(),
...operation( 'List unoccupied buildable locations.', 'Tells you where buildings can be placed on the body. The order of the returned list is not guaranteed.' ),
...requestBodySchema({ type: 'object', required: ['body_id'], properties: { body_id: { type: 'integer', description: 'The id of the body you wish to get the free locations of.', }, size: { type: 'integer', description: 'Optional building footprint size. 9 = center tile (LCOT), 4 = northwest tile (SSLA); omitted/other values return locations for single-tile buildings.', }, }, }),
responses: { ...response200( 'Lists unoccupied buildable locations on the planet. Order is not guaranteed.', { type: 'object', required: ['unoccupied', 'status'], properties: { unoccupied: { type: 'array', items: { type: 'array', items: { type: 'integer' }, minItems: 2, maxItems: 2 }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
'/v2/body/rename': { post: { ...tags('body'), ...security(),
...operation( 'Rename a body.', 'Renames a body owned by the empire attached to this session. Throws 1000, 1002, and 1010.' ),
...requestBodySchema({ type: 'object', required: ['body_id', 'name'], properties: { body_id: { type: 'integer', description: 'The id of the body you wish to rename.' }, name: { type: 'string', description: 'The new name for the body.' }, }, }),
responses: { ...response200('Renames a body owned by the empire attached to this session.', { type: 'integer', enum: [1], }), ...response500(), }, }, },
'/v2/body/abandon': { post: { ...tags('body'), ...security(), ...operation( 'Abandon a colony.', 'Abandons a colony, destroying everything on the planet. You cannot abandon your home planet.' ),
...requestBodySchema({ type: 'object', required: ['body_id'], properties: { body_id: { type: 'integer', description: 'The unique id of the colony you wish to abandon. You cannot abandon your home planet.', }, }, }),
responses: { ...response200( 'Abandons a colony, destroying everything on the planet. The home planet cannot be abandoned.', { type: 'object', required: ['status'], properties: { status: statusSchema() } } ), ...response500(), }, }, },
'/v2/body/view_laws': { post: { ...tags('body'), ...security(),
...operation( 'View the laws of a space station.', 'Returns the laws enacted by this space station. Pass the id of the station itself, not its Parliament building, since anyone may view the laws in a jurisdiction.' ),
...requestBodySchema({ type: 'object', required: ['body_id'], properties: { body_id: { type: 'integer', description: 'The id of the space station itself, not its Parliament building.', }, }, }),
responses: { ...response200('Returns the laws enacted by this space station.', { 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(), }, }, },
'/v2/body/set_colony_notes': { post: { ...tags('body'), ...security(),
...operation( 'Set the notes for a colony.', 'Sets the per-colony notes for an owned body (colony or station).' ),
...requestBodySchema({ type: 'object', required: ['body_id', 'options'], properties: { body_id: { type: 'integer', description: 'The unique id of the body whose notes you want to update.', }, options: { type: 'object', description: 'A hash of options. Currently the only valid key is `notes`.', required: ['notes'], properties: { notes: { type: 'string', description: 'The notes to assign to the body.' }, }, }, }, }),
responses: { ...response200('Sets the per-colony notes for an owned body (colony or station).', { type: 'object', required: ['status'], properties: { status: statusSchema() }, }), ...response500(), }, }, },};