Something went wrong. Try again.
OpenAPI 3.0 compliant spec for TLE Community.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622import { operation, buildingBase, requestBodySchema, response200, response500, security, statusSchema, tags,} from '../../chunks.ts';
const base = buildingBase('Parliament');
const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' } },});
// Shared shape returned by view_propositions, cast_vote, and every propose_* method.const propositionSchema = { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, description: { type: 'string' }, votes_needed: { type: 'integer' }, votes_yes: { type: 'integer' }, votes_no: { type: 'integer' }, status: { type: 'string' }, date_ends: { type: 'string' }, proposed_by: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' } }, }, my_vote: { type: 'integer', enum: [1, 0], description: 'Only present if this empire has voted.', }, },};
const propositionResponses = (description: string) => ({ ...response200(description, { type: 'object', required: ['status', 'proposition'], properties: { status: statusSchema(), proposition: propositionSchema }, }), ...response500(),});
// Turns e.g. "propose_broadcast_on_network19" into "Propose broadcast on Network 19."const proposeSummary = (name: string) => { const words = name.replace(/_/g, ' '); return ( words.charAt(0).toUpperCase() + words .slice(1) .replace(/\bbhg\b/gi, 'BHG') .replace(/\bbfg\b/gi, 'BFG') .replace(/\bnetwork19\b/gi, 'Network 19') + '.' );};
// Builds one `propose_*` (or the `allow_bhg_by_alliance`) endpoint. Every proposition method// takes `building_id` plus its own params, and returns the same {status, proposition} shape.const proposeMethod = ( name: string, description: string, extraRequired: string[] = [], extraProperties: object = {}) => ({ [`${base}/${name}`]: { post: { ...tags(base), ...security(), ...operation(proposeSummary(name), description), ...requestBodySchema({ type: 'object', required: ['building_id', ...extraRequired], properties: { building_id: { type: 'integer', description: 'The unique id of the Parliament building.', }, ...extraProperties, }, }), responses: propositionResponses(description), }, },});
// Parliament is the module through which all module build/upgrade/downgrade/demolish/repair// acts, plus a range of station-governance actions, are proposed to and voted on by alliance// members (see Modules.pod). Most of the endpoints below are one proposition type each; casting// a vote and viewing propositions are separate, non-proposition methods.export const parliament = { [`${base}/view`]: { post: { ...tags(base), ...security(), ...operation( "Retrieve this module's properties.", 'Retrieves the properties of this module.' ), ...buildingIdRequestBody, responses: { ...response200('Retrieves the properties of this module.', { type: 'object', required: ['building', 'status'], properties: { building: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, x: { type: 'integer' }, y: { type: 'integer' }, efficiency: { type: 'integer' }, }, required: ['id', 'name', 'image', 'level', 'x', 'y', 'efficiency'], }, status: statusSchema(), }, }), ...response500(), }, }, },
[`${base}/view_laws`]: { post: { ...tags(base), ...security(), ...operation( 'View laws.', "Lists the laws currently in effect for this station's jurisdiction. Still usable, but superseded by the equivalent call on Body." ), ...requestBodySchema({ type: 'object', required: ['body_id'], properties: { body_id: { type: 'integer', description: 'The unique id of the space station.' }, }, }), responses: { ...response200( "Lists the laws currently in effect for this station's jurisdiction. Still usable, but superseded by the equivalent call on Body.", { type: 'object', required: ['laws', 'status'], properties: { laws: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, description: { type: 'string' }, date_enacted: { type: 'string' }, }, }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
[`${base}/view_propositions`]: { post: { ...tags(base), ...security(), ...operation('View propositions.', 'Returns a list of the pending propositions.'), ...buildingIdRequestBody, responses: { ...response200('Returns a list of the pending propositions.', { type: 'object', required: ['propositions', 'status'], properties: { propositions: { type: 'array', items: propositionSchema }, status: statusSchema(), }, }), ...response500(), }, }, },
[`${base}/view_taxes_collected`]: { post: { ...tags(base), ...security(), ...operation( 'View taxes collected.', 'Returns, for each empire that has paid taxes, their payments for today and the previous six days plus the seven-day total.' ), ...buildingIdRequestBody, responses: { ...response200( 'Returns, for each empire that has paid taxes, their payments for today and the previous six days plus the seven-day total.', { type: 'object', required: ['taxes_collected', 'status'], properties: { taxes_collected: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, paid: { type: 'array', items: { type: 'integer' }, description: 'Element 0 is today, followed by the previous six days.', }, total: { type: 'integer' }, }, }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
[`${base}/get_stars_in_jurisdiction`]: { post: { ...tags(base), ...security(), ...operation( 'Get stars in jurisdiction.', 'Returns a list of the stars in the jurisdiction of this space station.' ), ...buildingIdRequestBody, responses: { ...response200('Returns a list of the stars in the jurisdiction of this space station.', { type: 'object', required: ['stars', 'status'], properties: { stars: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, color: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, station: { type: 'object', description: 'Only present if this star is under the influence of a space station.', properties: { id: { type: 'integer' }, x: { type: 'integer' }, y: { type: 'integer' }, name: { type: 'string' }, }, }, }, }, }, status: statusSchema(), }, }), ...response500(), }, }, },
[`${base}/get_bodies_for_star_in_jurisdiction`]: { post: { ...tags(base), ...security(), ...operation( 'Get bodies for star in jurisdiction.', 'Returns a list of the bodies for a star in the jurisdiction of the space station.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'star_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, star_id: { type: 'integer', description: 'The unique id of a star in jurisdiction. See get_stars_in_jurisdiction.', }, }, }), responses: { ...response200( 'Returns a list of the bodies for a star in the jurisdiction of the space station.', { type: 'object', required: ['bodies', 'status'], properties: { bodies: { type: 'array', items: { $ref: '#/components/schemas/body_status' } }, status: statusSchema(), }, } ), ...response500(), }, }, },
[`${base}/get_mining_platforms_for_asteroid_in_jurisdiction`]: { post: { ...tags(base), ...security(), ...operation( 'Get mining platforms for asteroid in jurisdiction.', 'Returns a list of the mining platforms for an asteroid in the jurisdiction of the space station.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'asteroid_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, asteroid_id: { type: 'integer', description: 'The unique id of an asteroid in jurisdiction. See get_bodies_for_star_in_jurisdiction.', }, }, }), responses: { ...response200( 'Returns a list of the mining platforms for an asteroid in the jurisdiction of the space station.', { type: 'object', required: ['platforms', 'status'], properties: { platforms: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, empire: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' } }, }, }, }, }, status: statusSchema(), }, } ), ...response500(), }, }, },
[`${base}/cast_vote`]: { post: { ...tags(base), ...security(), ...operation( 'Cast vote.', 'Casts a vote for or against a proposition. Cannot be voted on using a sitter password.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'proposition_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, proposition_id: { type: 'integer', description: 'The id of the proposition being voted on. See view_propositions.', }, vote: { type: 'integer', enum: [1, 0], description: '1 for yes, 0 for no. Defaults to 0.', }, }, }), responses: propositionResponses( 'Casts a vote for or against a proposition. Cannot be voted on using a sitter password.' ), }, },
// --- Proposition methods ------------------------------------------------------------------- // Each proposes a law or action for Parliament to vote on; the vote itself is cast separately // via cast_vote. Many require a minimum Parliament level, noted per-method below.
...proposeMethod( 'propose_writ', 'Proposes an unenforceable law (writ). Requires Parliament level 4+.', ['title', 'description'], { title: { type: 'string', description: 'The name of the law.' }, description: { type: 'string', description: 'A detailed description of what the law intends to promote or prohibit. Same rules as an Inbox message body.', }, } ),
...proposeMethod( 'propose_repeal_law', 'Proposes repealing an existing law. Requires Parliament level 5+.', ['law_id'], { law_id: { type: 'integer', description: 'The id of the law to repeal.' } } ),
...proposeMethod( 'propose_transfer_station_ownership', 'Proposes transferring ownership of the station to another alliance member. Requires Parliament level 6+.', ['to_empire_id'], { to_empire_id: { type: 'integer', description: 'The id of the alliance member to receive the station.', }, } ),
...proposeMethod( 'propose_rename_star', 'Proposes renaming a star. Requires Parliament level 8+.', ['star_id', 'name'], { star_id: { type: 'integer', description: 'The id of the star to rename.' }, name: { type: 'string', description: 'The new name of the star.' }, } ),
...proposeMethod( 'propose_broadcast_on_network19', 'Proposes broadcasting a message on Network 19. Requires Parliament level 9+.', ['message'], { message: { type: 'string', maxLength: 140, description: 'Cannot contain special characters or profanity.', }, } ),
...proposeMethod( 'propose_induct_member', 'Proposes inducting a new member into the alliance; if passed, an invitation is sent. Requires Parliament level 10+.', ['empire_id'], { empire_id: { type: 'integer', description: 'The id of the empire proposed for membership.' }, message: { type: 'string', description: 'Optional personalized welcome message included in the invitation.', }, } ),
...proposeMethod( 'propose_expel_member', 'Proposes expelling a member from the alliance. Requires Parliament level 10+.', ['empire_id'], { empire_id: { type: 'integer', description: 'The id of the empire proposed for removal.' }, message: { type: 'string', description: 'Optional reason. Cannot contain restricted characters or profanity.', }, } ),
...proposeMethod( 'propose_elect_new_leader', 'Proposes electing a new alliance leader (who must already be a member). Requires Parliament level 11+.', ['to_empire_id'], { to_empire_id: { type: 'integer', description: 'The id of the alliance member to elect as leader.', }, } ),
...proposeMethod( 'propose_rename_asteroid', 'Proposes renaming an asteroid in the jurisdiction. Requires Parliament level 12+.', ['asteroid_id', 'name'], { asteroid_id: { type: 'integer', description: 'The id of the asteroid in the jurisdiction to rename.', }, name: { type: 'string', maxLength: 30, description: 'The new name (max 30 characters, no profanity or special characters).', }, } ),
...proposeMethod( 'propose_members_only_mining_rights', 'Proposes restricting new mining platforms in the jurisdiction to alliance members only. Requires Parliament level 13+.' ),
...proposeMethod( 'propose_evict_mining_platform', 'Proposes destroying a mining platform on an asteroid. Requires Parliament level 14+.', ['platform_id'], { platform_id: { type: 'integer', description: 'See get_mining_platforms_for_asteroid_in_jurisdiction.', }, } ),
...proposeMethod( 'propose_taxation', 'Proposes an unenforceable daily tax on all empires in the jurisdiction. Requires Parliament level 15+.', ['taxes'], { taxes: { type: 'integer', description: 'The amount of resources to tax per day.' } } ),
...proposeMethod( 'propose_foreign_aid', 'Proposes sending a foreign aid supply pod to a planet in the jurisdiction. Costs double the resources sent (half covers the pod, half is the aid). Limited to one per day, like normal supply pods. Requires Parliament level 16+.', ['planet_id', 'resources'], { planet_id: { type: 'integer', description: 'The id of the planet to receive the foreign aid.', }, resources: { type: 'integer', description: 'The amount of resources to send to the receiving planet.', }, } ),
...proposeMethod( 'propose_rename_uninhabited', 'Proposes renaming an uninhabited planet in the jurisdiction. Requires Parliament level 17+.', ['planet_id', 'name'], { planet_id: { type: 'integer', description: 'The id of the uninhabited planet in the jurisdiction to rename.', }, name: { type: 'string', maxLength: 30, description: 'The new name (max 30 characters, no profanity or special characters).', }, } ),
...proposeMethod( 'propose_members_only_colonization', 'Proposes restricting new colonies in the jurisdiction to alliance members only. Requires Parliament level 18+.' ),
...proposeMethod( 'propose_members_only_excavation', 'Proposes restricting new excavations in the jurisdiction to alliance members only. Requires Parliament level 18+.' ),
...proposeMethod( 'propose_members_only_stations', 'Proposes restricting new space stations in the jurisdiction to alliance members only. Requires Parliament level 18+.' ),
...proposeMethod( 'propose_neutralize_bhg', 'Proposes preventing non-alliance members from using Black Hole Generators on or from systems in the jurisdiction. Requires Parliament level 23+.' ),
...proposeMethod( 'propose_fire_bfg', 'Proposes firing the BFG equipped on all space stations at a planet within the jurisdiction. Requires Parliament level 25+.', ['body_id', 'reason'], { body_id: { type: 'integer', description: 'The planet to fire at. See get_bodies_for_star_in_jurisdiction.', }, reason: { type: 'string', description: 'An explicit reason why the BFG should be fired. Same rules as an Inbox message body.', }, } ),
...proposeMethod( 'allow_bhg_by_alliance', 'Proposes allowing another alliance to use Black Hole Generators in this jurisdiction, ignoring members-only colonization/stations restrictions. Requires Parliament level 28+.', ['alliance_id'], { alliance_id: { type: 'integer', description: 'The id of the alliance to be allowed to use their BHGs here.', }, } ),};