Something went wrong. Try again.
OpenAPI 3.0 compliant spec for TLE Community.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482import { operation, buildingBase, buildingCommonMethods, buildingView, requestBodySchema, response200, response500, security, statusSchema, tags,} from '../../chunks.ts';
const base = buildingBase('Transporter');
const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' } },});
// A tradeable/pushable item — resources (name/quantity), glyphs, plans, prisoners, or ships.const tradeableItemSchema = { type: 'object', properties: { type: { type: 'string', enum: ['glyph', 'plan', 'prisoner', 'ship'] }, // Resources are passed as { type: <resource name>, quantity }. name: { type: 'string' }, quantity: { type: 'integer' }, glyph_id: { type: 'integer' }, plan_id: { type: 'integer' }, prisoner_id: { type: 'integer' }, ship_id: { type: 'integer' }, },};
const marketEntrySchema = { type: 'object', required: ['id', 'date_offered', 'ask', 'offer'], properties: { id: { type: 'integer' }, date_offered: { type: 'string' }, ask: { type: 'number', description: 'Essentia amount requested.' }, offer: { type: 'array', items: { type: 'string' }, description: 'Human-readable descriptions of the offered items.', }, empire: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' } } }, },};
export const transporter = { ...buildingCommonMethods(base), ...buildingView(base, { transport: { type: 'object', properties: { max: { type: 'integer' }, pushable: { type: 'array', description: 'Planets with currently-online Transporters, alphabetical by name.', items: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, zone: { type: 'string' }, }, }, }, }, }, }),
[`${base}/add_to_market`]: { post: { ...tags(base), ...security(), ...operation( 'Add to market.', 'Queues a trade for other players to see. Costs 1 essentia in addition to whatever is offered.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'offer', 'ask'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, offer: { type: 'array', items: tradeableItemSchema, description: 'Resources, glyphs, plans, prisoners, or ships to offer.', }, ask: { type: 'number', minimum: 0.1, maximum: 100, description: 'Essentia amount requested.', }, }, }), responses: { ...response200( 'Queues a trade for other players to see. Costs 1 essentia in addition to whatever is offered.', { type: 'object', required: ['trade_id', 'status'], properties: { trade_id: { type: 'integer' }, status: statusSchema() }, } ), ...response500(), }, }, },
[`${base}/get_ships`]: { post: { ...tags(base), ...security(), ...operation('Get ships.', 'Lists ships that may be traded. Used with add_to_market.'), ...buildingIdRequestBody, responses: { ...response200('Lists ships that may be traded. Used with add_to_market.', { type: 'object', required: ['ships', 'cargo_space_used_each', 'status'], properties: { ships: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, type: { type: 'string' }, hold_size: { type: 'integer' }, speed: { type: 'integer' }, }, }, }, cargo_space_used_each: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, },
[`${base}/get_prisoners`]: { post: { ...tags(base), ...security(), ...operation( 'Get prisoners.', 'Lists prisoners that may be traded. Used with add_to_market.' ), ...buildingIdRequestBody, responses: { ...response200('Lists prisoners that may be traded. Used with add_to_market.', { type: 'object', required: ['prisoners', 'cargo_space_used_each', 'status'], properties: { prisoners: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, level: { type: 'integer' }, sentence_expires: { type: 'string' }, }, }, }, cargo_space_used_each: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, },
[`${base}/get_plan_summary`]: { post: { ...tags(base), ...security(), ...operation( 'Get plan summary.', 'Lists plans that may be traded, in summary form. Used with add_to_market.' ), ...buildingIdRequestBody, responses: { ...response200( 'Lists plans that may be traded, in summary form. Used with add_to_market.', { type: 'object', required: ['plans', 'cargo_space_used_each', 'status'], properties: { plans: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, level: { type: 'integer' }, extra_build_level: { type: 'integer' }, quantity: { type: 'integer' }, }, }, }, cargo_space_used_each: { type: 'integer' }, status: statusSchema(), }, } ), ...response500(), }, }, },
[`${base}/get_glyph_summary`]: { post: { ...tags(base), ...security(), ...operation( 'Get glyph summary.', 'Summarizes glyphs that may be traded. Used with add_to_market.' ), ...buildingIdRequestBody, responses: { ...response200('Summarizes glyphs that may be traded. Used with add_to_market.', { type: 'object', required: ['glyphs', 'cargo_space_used_each', 'status'], properties: { glyphs: { type: 'array', items: { type: 'object', properties: { type: { type: 'string' }, quantity: { type: 'integer' } }, }, }, cargo_space_used_each: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, },
[`${base}/withdraw_from_market`]: { post: { ...tags(base), ...security(), ...operation( 'Withdraw from market.', 'Removes a trade this empire posted and retrieves the offered items.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, trade_id: { type: 'integer', description: 'The unique id of the trade.' }, }, }), responses: { ...response200('Removes a trade this empire posted and retrieves the offered items.', { type: 'object', required: ['status'], properties: { status: statusSchema() }, }), ...response500(), }, }, },
[`${base}/accept_from_market`]: { post: { ...tags(base), ...security(), ...operation( 'Accept from market.', 'Accepts a trade offer from view_market. Costs the asking price plus 1 essentia. Throws 1016.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, trade_id: { type: 'integer', description: 'The unique id of the trade.' }, }, }), responses: { ...response200( 'Accepts a trade offer from view_market. Costs the asking price plus 1 essentia. Throws 1016.', { type: 'object', required: ['status'], properties: { status: statusSchema() } } ), ...response500(), }, }, },
[`${base}/view_market`]: { post: { ...tags(base), ...security(), ...operation('View market.', 'Lists trades currently available to accept.'), ...requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 items per page.' }, filter: { type: 'string', enum: ['food', 'ore', 'water', 'waste', 'energy', 'glyph', 'prisoner', 'ship', 'plan'], description: 'Optional. Narrows the list to trades offering one kind of object.', }, }, }), responses: { ...response200('Lists trades currently available to accept.', { type: 'object', required: ['trades', 'trade_count', 'page_number', 'status'], properties: { trades: { type: 'array', items: marketEntrySchema }, trade_count: { type: 'integer' }, page_number: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, },
[`${base}/view_my_market`]: { post: { ...tags(base), ...security(), ...operation('View my market.', 'Lists trades this empire has posted.'), ...requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 items per page.' }, }, }), responses: { ...response200('Lists trades this empire has posted.', { type: 'object', required: ['trades', 'trade_count', 'page_number', 'status'], properties: { trades: { type: 'array', items: marketEntrySchema }, trade_count: { type: 'integer' }, page_number: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, },
[`${base}/get_stored_resources`]: { post: { ...tags(base), ...security(), ...operation( 'Get stored resources.', 'Lists resources in storage, to make it easier to decide what to trade.' ), ...buildingIdRequestBody, responses: { ...response200('Lists resources in storage, to make it easier to decide what to trade.', { type: 'object', required: ['resources', 'cargo_space_used_each', 'status'], properties: { resources: { type: 'object', additionalProperties: { type: 'integer' } }, cargo_space_used_each: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, },
[`${base}/push_items`]: { post: { ...tags(base), ...security(), ...operation( 'Push items.', 'Instantly sends resources/items to another planet this empire owns.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'target_id', 'items'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, target_id: { type: 'integer', description: 'A planet controlled by this empire.' }, items: { type: 'array', items: tradeableItemSchema, description: 'Resources, glyphs, plans, prisoners, or ships to send.', }, }, }), responses: { ...response200('Instantly sends resources/items to another planet this empire owns.', { type: 'object', required: ['status'], properties: { status: statusSchema() }, }), ...response500(), }, }, },
[`${base}/trade_one_for_one`]: { post: { ...tags(base), ...security(), ...operation( 'Trade one for one.', 'Trades any resource for another one-for-one, in exchange for 3 essentia.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'have', 'want', 'quantity'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, have: { type: 'string', description: 'The resource type this empire has. See get_stored_resources.', }, want: { type: 'string', description: 'The resource type this empire wants.' }, quantity: { type: 'integer', description: 'How many to process. Defaults to 1.' }, }, }), responses: { ...response200('Trades any resource for another one-for-one, in exchange for 3 essentia.', { type: 'object', required: ['status'], properties: { status: statusSchema() }, }), ...response500(), }, }, },
[`${base}/report_abuse`]: { post: { ...tags(base), ...security(), ...operation('Report abuse.', 'Reports a trade suspected of abusing the trade system.'), ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, trade_id: { type: 'integer', description: 'The unique id of the trade.' }, }, }), responses: { ...response200('Reports a trade suspected of abusing the trade system.', { type: 'object', required: ['status'], properties: { status: statusSchema() }, }), ...response500(), }, }, },};