Something went wrong. Try again.
OpenAPI 3.0 compliant spec for TLE Community.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155import { operation, buildingBase, buildingCommonMethods, buildingView, requestBodySchema, response200, response500, security, statusSchema, tags,} from '../../chunks.ts';
const base = buildingBase('Development');
const buildQueueItemSchema = { type: 'object', properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, name: { type: 'string' }, to_level: { type: 'integer' }, seconds_remaining: { type: 'integer' }, x: { type: 'integer', minimum: -5, maximum: 5 }, y: { type: 'integer', minimum: -5, maximum: 5 }, subsidy_cost: { type: 'integer', description: 'The essentia cost to subsidize just this building.', }, }, required: ['building_id', 'name', 'to_level', 'seconds_remaining', 'x', 'y', 'subsidy_cost'],};
// Same shape as buildingView()'s response, reused by cancel_build which returns the same as view.const developmentViewResultSchema = (description: string) => ({ ...response200(description, { type: 'object', required: ['building', 'status', 'build_queue', 'subsidy_cost'], properties: { building: { $ref: '#/components/schemas/building' }, status: statusSchema(), build_queue: { type: 'array', items: buildQueueItemSchema }, subsidy_cost: { type: 'integer', description: 'The essentia cost to subsidize the whole build queue.', }, }, }), ...response500(),});
const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' } },});
export const development = { ...buildingCommonMethods(base), ...buildingView( base, { build_queue: { type: 'array', items: buildQueueItemSchema }, subsidy_cost: { type: 'integer', description: 'The essentia cost to subsidize the whole build queue.', }, }, ['build_queue', 'subsidy_cost'] ),
[`${base}/subsidize_build_queue`]: { post: { ...tags(base), ...security(), ...operation( 'Subsidize build queue.', 'Instantly finishes all buildings in the build queue.' ), ...buildingIdRequestBody, responses: { ...response200('Instantly finishes all buildings in the build queue.', { type: 'object', required: ['status', 'essentia_spent'], properties: { status: statusSchema(), essentia_spent: { type: 'integer' } }, }), ...response500(), }, }, },
[`${base}/subsidize_one_build`]: { post: { ...tags(base), ...security(), ...operation( 'Subsidize one build.', 'Subsidizes the immediate build of one job on the build queue. Later jobs (if any) are brought forward by the (remaining) time of the subsidized build.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'scheduled_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, scheduled_id: { type: 'integer', description: 'The ID of the building scheduled to be built/upgraded that you wish to subsidize.', }, }, }), responses: { ...response200( 'Subsidizes the immediate build of one job on the build queue. Later jobs (if any) are brought forward by the (remaining) time of the subsidized build.', { type: 'object', required: ['status', 'essentia_spent'], properties: { status: statusSchema(), essentia_spent: { type: 'integer' } }, } ), ...response500(), }, }, },
[`${base}/cancel_build`]: { post: { ...tags(base), ...security(), ...operation( 'Cancel build.', 'Cancels a build. All following builds in the build queue are brought forward. Resources or plans used when the build/upgrade was requested are not returned. Returns the same as the view method.' ), ...requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, scheduled_id: { oneOf: [{ type: 'integer' }, { type: 'array', items: { type: 'integer' } }], description: 'The ID, or array of IDs, of the building(s) scheduled to be built/upgraded that you wish to cancel. One of scheduled_id or cancel_all is required.', }, cancel_all: { type: 'boolean', description: 'If true, cancels all builds currently scheduled.', }, }, }), responses: developmentViewResultSchema( 'Cancels a build. All following builds in the build queue are brought forward. Resources or plans used when the build/upgrade was requested are not returned. Returns the same as the view method.' ), }, },};