diff --git a/SPEC-CHANGES-1.4.0.md b/SPEC-CHANGES-1.4.0.md new file mode 100644 index 0000000..a2f7360 --- /dev/null +++ b/SPEC-CHANGES-1.4.0.md @@ -0,0 +1,190 @@ +# api-spec changes for `@tlecommunity/client` regeneration — v1.3.4 → v1.4.0 + +**Audience:** whoever regenerates `@tlecommunity/client` from `@tlecommunity/api-spec` and then +deletes the now-redundant local types/casts in the `app` repo. + +**What happened:** a pass over `api-spec` to (1) normalize every ID field to a numeric type and +(2) close the still-open correctness gaps listed in `app/api-implementation-status.md` §2/§3 +(and two §1.6 residuals). The `§x.y` references below point at that document. + +**Source of truth:** `api-spec/src/spec/` (hand-authored). `src/spec.ts` `info.version` is now +`1.4.0`. Everything assembles (`node --experimental-strip-types` import of `src/spec.ts` succeeds, +all `$ref`s resolve, `npm start` renders). + +**Not committed** — the working tree holds the changes; commit/tag as normal. + +--- + +## 1. ID fields are now `integer` everywhere (the big one) + +Previously IDs were a mix: ~329 `{ type: 'string' }`, ~17 `{ type: 'number' }`, ~12 +`{ type: 'integer' }`. Every game `*_id` resolves an auto-increment integer PK in the server DB +(`Lacuna::DB::Result`). **All ID fields — request parameters and response fields alike — are now +`{ type: 'integer' }`.** + +This applies to: + +- Every property named `id` or ending in `_id` (`building_id`, `body_id`, `star_id`, + `empire_id`, `leader_id`, `from_id`, `to_id`, `trade_id`, `spy_id`, `prisoner_id`, + `mission_id`, `plan_id`, `law_id`, `proposition_id`, `platform_id`, `site_id`, + `scheduled_id`, `waste_chain_id`, `supply_chain_id`, …). +- Every ID array: `building_ids`, `message_ids`, `ship_ids`, `spy_ids`, and response arrays of + ids (`recipients`, inbox `success` / `failure` / `deleted`, spaceport `spies_sent` / + `spies_not_sent`). +- `in_reply_to` / `forward` (inbox — they carry a message id). +- `oneOf: [{string}, {array of string}]` id shapes → `oneOf: [{integer}, {array of integer}]` + (`development.cancel_build` `scheduled_id`, `shipyard` `building_id`). +- The `stats` nullable alliance id: `{ type: ['string','null'] }` → `{ type: ['integer','null'] }`. +- `components.ts` shared schemas: `body_status.{id,star_id,empire.id,station.id}` + (`number`→`integer`), `building.id` (`string`→`integer`). `empire_status` ids were already + `integer`. +- The reuse helpers in `src/spec/chunks.ts` (`buildingCommonMethods`, `buildingView`) — this is + why ~90 building path files changed with no per-file edit. + +### Effect on generated types + +`openapi-typescript` output for these fields flips from `string` to `number`. In the app that +means: + +- **Request params** — the app already sends `number` for most of these (README #1). Casts like + `message_id: messageId as number`, `util.int(star.id)` before `abandon_probe`, etc. become + unnecessary. +- **Response fields** — fields the app currently receives as `string` and coerces (`int(body.x)` + etc. on status ingest, `alliance.leader_id === String(...)` comparisons, `Prisoner.id`, + `GetProbedStarsResponse.stars[].id`, `GetAllianceStatusResponse` ids, `Observatory` star ids) + are now typed `number`. The app should stop stringifying / coercing and compare as numbers. + +### Exceptions — still `string` (intentionally) + +| Field | Why | +|---|---| +| `session_id` (login / found / reset_password) | UUID v4 auth token, not a DB key | +| `guid` / `captcha_guid` (captcha, empire/create) | 36-char UUID | +| `empire/authorize_sitters` + `deauthorize_sitters` `empires: string[]` | documented as "ids **and/or** names" | +| Object **keys** in id-keyed maps (`empire_status.colonies` / `planets` / `stations`, `buildings_list`, `buildings_resources_list`, medals, `map` `fissures`) | JSON object keys are always strings; described as "stringified integer" | + +### ⚠️ Wire-format caveat — verify before trusting the generator + +The legacy Perl JSON-RPC server frequently serialises integer ids **as JSON strings** (dualvar +scalars). The spec now describes **intent/DB semantics** (`integer`), which is also the direction +`util.fixNumbers` normalises toward. Before deleting the app's coercion helpers wholesale: + +1. Hit a live `/v2` response (e.g. `body/get_status`, `spaceport/view_all_ships`, + `embassy/get_alliance_status`) and check whether ids come back `123` or `"123"`. +2. If still stringified: keep the client's response pipeline running affected fields through + `util.fixNumbers` / `int()`, and treat the spec as the target the server should converge to. +3. Record the finding in `app/api-implementation-status.md` (it currently has no note on the + response side of README #1). + +--- + +## 2. Shared component schema changes (`src/spec/components.ts`) — these ripple widely + +| Schema | Change | Feedback | +|---|---|---| +| `server_status` | added `announcement: { integer, enum [1,0] }` (optional) | §2.2 — app can drop `ServerBlockWithAnnouncement` | +| `body_status` | added `zone: { string }` (optional) | §2.10 — unblocks `@ts-expect-error` on `body?.zone` in `bodyDetailsHeader` | +| **`planet_status`** | **new schema** — the full "own body" shape (a `body_status` + population / happiness / per-resource `*_stored` / `*_hour` / `*_capacity` + `zone`, `notes`, `neutral_entry`, `empire`, `num_incoming_own/ally/enemy`). Lifted from the old inline `stationcommand` `planetSchema`. | §1.6 — see §5 below | +| `building.work` | added `searching: { string }` (optional) — archaeology digs report it | §2.1 residual — `ArchaeologyViewResponse.building.work.searching` | +| `building.downgrade.reason` | `{ string }` → `{ type: 'array', items: {} }`, so it matches `building.upgrade.reason`. Both are now "a `[code, message]` pair; `[0, ""]` when no reason". | §3.6 / README #4 — app can type `reason` as `[number, string]` and drop the `any[]` absorbers | +| `empire_status` | `colonies` / `planets` → `{ type: 'object', additionalProperties: { string } }` (the baked-in `'467647'` sample key + its `required` are gone); `stations` → same shape instead of bare `{ type: 'object' }` | §3.15 — `schema.d.ts` `empire_status` stops being sample-value garbage | +| `buildings_list` entry | added `id: { integer }` (required) and the `repair_costs` block (`food/water/energy/ore`, optional) | §2.8 — `PlanetMapBuilding` no longer needs `id` / `repair_costs` spliced in | +| `buildings_resources_list` entry | added `id: { integer }` (required) | §2.8 — app can reuse `BuildingResourcesSummary` (+ `id`) | + +> Note on `id` in the two `buildings_*` list entries: the **old** captured server payload did NOT +> include `id` inside each row (it existed only as the map key). The spec now asserts the row +> carries `id` too. If the live server still omits it, the client wrapper should splice it from +> the key (as the app does today) rather than treat it as missing. + +--- + +## 3. Response fields added (were missing; forced `as unknown as` casts) + +| Endpoint(s) | Added | Feedback / unblocks | +|---|---|---| +| `security/view_prisoners` **and** `policestation/view_prisoners` | `captured_count: { integer }` (required) | §2.4 — `ViewPrisonersResponse` cast | +| `security/view_foreign_spies` **and** `policestation/view_foreign_spies` | `spy_count: { integer }` (required) | §2.5 — `ViewForeignSpiesResponse` cast | +| `trade/view_market` **and** `trade/view_my_market` | `trade_count: { integer }` (required) | §2.12 — `MarketResponse` cast | +| `map/get_star_map` star items | `zone: { string }`, `influence: { number }` (both required; `influence` may be null) | §2.6 — `StarMapStar` extension, `map.ts` `as unknown as` cast | +| `map` `starDetailSchema` (`get_stars` / `get_star*`) | `influence: { number }` (keeps it consistent with `get_star_map`; already had `zone`) | §2.6 | +| `parliament/get_stars_in_jurisdiction` star rows | `id: { integer }` | §2.7 — `JurisdictionStar` double cast | +| `spaceport` shared `shipSchema` | `combat: { integer }`, `max_occupants: { integer }`, `estimated_travel_time: { integer }`, `details: { payload: string[] }` | §2.9 — the 6+ `@ts-expect-error` in `shipItem.tsx` / `shipDetails.tsx`. **Verify against live `/v2`:** old captured traffic had a top-level `payload` array (not `details.payload`) — if the server still sends it top-level, the app should keep reading `ship.details?.payload ?? ship.payload`. | +| `embassy/view_stash` | `stored: { object, additionalProperties: integer }` (required) | §2.3 — `StashResponse` cast; `stash` was already tightened to `integer` values | +| `archaeology/view_excavators` `excavators[].body` | was bare `{ type: 'object' }`, now `{ id: integer, name, x, y, image }` | §2.11 residual | + +--- + +## 4. Type corrections (field existed, type was wrong) + +| Location | Was | Now | Feedback | +|---|---|---|---| +| `wasterecycling` + `wasteexchanger` `recycle.seconds_per_resource` | `string` | `integer` (block is shared by `view` / `recycle` / `subsidize_recycling`) | §3.2 — `RecycleStatus`, `util.int()` at every call site | +| `empire/create` response | `{ type: 'string' }` | `{ type: 'integer' }` ("The new empire id") | §3.1 — `EmpireCreateResponse` | +| `trade` market row (`view_market` / `view_my_market`) | `{ date, offer: tradeableItemSchema[] }` | `{ date_offered, offer: string[] }` — matches `transporter` / `mercenariesguild`. (`add_to_market` **request** still takes typed `tradeableItemSchema[]` — only the response row changed.) | §3.14 — `MarketTrade` | +| `planetarycommand/view_incoming_supply_chains` `supply_chains[].from_body` | `{ type: 'string' }` | object `{ id, name, x, y, image }` — now identical to `stationcommand`'s version | §3.8 — `IncomingSupplyChain` + `RawSupplyChain` + `toSupplyChain` reshape | +| `planetarycommand` + `stationcommand` `supply_chains[].percent_transferred` | `number` / `integer` (disagreed) | `number` in both | §3.8 | +| `intelligence` spy `assignment` and `possible_assignments[].task` | free `{ string }` | `{ string, enum: ASSIGNMENTS }` (the 26-value list already used by `assign_spy` params) | §3.13 — the hard-coded `ASSIGNMENT_TASKS` fallback in `app/queries/intelligence.ts` | +| `map/view_laws` law item | key misspelled `descripition` | `description` | typo fix | + +--- + +## 5. New / restructured schemas to consume + +- **`components.schemas.planet_status`** — used as `{ $ref }` by: + - `planetarycommand/view` `planet` (was a bare `{ type: 'object' }` — §1.6 residual; + unblocks `PlanetaryCommandViewResponse.planet`) + - `stationcommand/view` `planet` (previously an inline schema local to that file) + Both now point at the one shape. The app's `PlanetaryCommandViewResponse` / + `StationCommand` planet types collapse into it. +- **`components.schemas.server_overview`** — §1.7. The in-game "General"/Server stats tab is fed + by a static `server_overview.json` on the server, **not** a JSON-RPC method, so there is *no + path* for it — just this schema, so the client can export a `ServerOverview` type and the app + can delete its hand-written `ServerOverview*` model in `app/interfaces/stats.ts`. Shape mirrors + that interface (`bodies` / `buildings` / `empires` / `orbits` / `ships` / `spies` / `stars` / + `glyphs`, with the `types` / `orbits` / `glyphs.types` sub-maps as `additionalProperties`). +- **`embassy` `alliance_status`** — the `view` extra was a bare `{ type: 'object' }`; it now has + real properties (`id`, `name`, `members[].{empire_id,name}`, `leader_id`, `forum_uri`, + `description`, `announcements`, `date_created`), shared with the `get_alliance_status` response + via a local `allianceStatusProperties` const. §1.6 residual — unblocks `EmbassyViewResponse` / + `AllianceStatus` / `AllianceMember`. + +--- + +## 6. Deliberately NOT changed (so you don't wait for it) + +- The spec was already well ahead of `api-implementation-status.md` (which was written against + 1.2.0). Already present before this pass, nothing to do: the whole `blackHoleGenerator` + module (§1.1), `body/get_buildable` (§1.2), `body/abandon` · `rename` · `set_colony_notes` + (§1.3–1.5), per-building typed `view`s (§1.6 core), `building.work` block (§2.1), + `building_cost` optionality (§3.5), inbox `tags` as array (§3.11), `network19.restrict_coverage` + as `IntBool` (§3.3), observatory/embassy id primitive choice (§3.4/§3.7 — now unified to + `integer` by §1 here). +- Purely generated-client / app-codegen concerns with nothing to change in the hand-authored + spec: §3.9 (status-block numeric strings — see the wire-format caveat in §1), + §3.10 (`incoming_*_ships: any[]`), §3.11 (`MessageTag` needs a **named** export from the + client — inline enum in the OpenAPI output is unchanged), §3.16 (`SpyTrainingBuilding` + nesting — spec already matches the app's nested model; the divergence is in the convenience + type), `LacunaError` (§6 of the doc). +- The 5 module `view` files (`artmuseum`, `culinaryinstitute`, `ibs`, `operahouse`, + `warehouse`) and `stationcommand` still inline a partial `building` shape instead of + `$ref`-ing `components.schemas.building`. Only their `id` was fixed to `integer`. Converging + them is a later tidy-up. + +--- + +## 7. Suggested order of work on the client / app + +1. Regenerate `dist/lib/types/schema.d.ts` (`npm run generate:types`) from `api-spec` @ 1.4.0. +2. Do the live-payload id spot-check (§1 caveat). Decide whether `util.fixNumbers` stays in the + response pipeline for id/number-string fields. +3. Add the hand-written wrappers that are now backed by real shapes: typed `planet` on the two + command `view`s, `alliance_status`, `stored` on `viewStash`, `captured_count` / `spy_count` / + `trade_count` on the paginated views, `zone` / `influence` on star-map tiles, ship + `combat` / `max_occupants` / `details` / `estimated_travel_time`, `ServerOverview`. +4. Export a **named** `MessageTag` from the client (still a client-only task — the OpenAPI output + inlines the enum). +5. Delete the local types / casts in `app` that these unblock — the `§4` and `§5` tables in + `app/api-implementation-status.md` are the checklist; the "Feedback" column above maps each + spec change to its row(s). +6. Update `app/api-implementation-status.md` to mark the landed items and record the id + wire-format finding. diff --git a/src/spec.ts b/src/spec.ts index 31a075f..6697cec 100644 --- a/src/spec.ts +++ b/src/spec.ts @@ -6,7 +6,7 @@ export const spec = { info: { title: 'TLE', - version: '1.0.0', + version: '1.4.0', description: ` Open API specification for The Lacuna Expanse. Note that this spec applies not to the original API but a new layout of the api which is available on the \`/v2\` subpath of whatever server you are calling. diff --git a/src/spec/chunks.ts b/src/spec/chunks.ts index 0049d4f..e7f3228 100644 --- a/src/spec/chunks.ts +++ b/src/spec/chunks.ts @@ -62,7 +62,7 @@ export const buildingCommonMethods = (base: string) => { const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const pendingBuildSchema = { @@ -83,7 +83,7 @@ export const buildingCommonMethods = (base: string) => { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, level: { type: 'integer' }, pending_build: pendingBuildSchema, }, @@ -117,7 +117,7 @@ export const buildingCommonMethods = (base: string) => { type: 'object', required: ['body_id', 'x', 'y'], properties: { - body_id: { type: 'string' }, + body_id: { type: 'integer' }, x: { type: 'integer', minimum: -5, maximum: 5 }, y: { type: 'integer', minimum: -5, maximum: 5 }, }, @@ -179,7 +179,7 @@ export const buildingCommonMethods = (base: string) => { type: 'object', required: ['building_id', 'level'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, level: { type: 'integer', minimum: 1, maximum: 100 }, }, }), @@ -193,7 +193,7 @@ export const buildingCommonMethods = (base: string) => { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, @@ -246,7 +246,7 @@ export const buildingView = ( ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: { ...response200('Retrieves the properties of the building.', { diff --git a/src/spec/components.ts b/src/spec/components.ts index b0f2f06..ece3179 100644 --- a/src/spec/components.ts +++ b/src/spec/components.ts @@ -12,11 +12,12 @@ export const components = { body_status: { type: 'object', properties: { - id: { type: 'number' }, + id: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, - star_id: { type: 'number' }, + star_id: { type: 'integer' }, star_name: { type: 'string' }, + zone: { type: 'string' }, orbit: { type: 'number' }, type: { type: 'string' }, // TODO: this can probably be an enum name: { type: 'string' }, @@ -73,7 +74,7 @@ export const components = { empire: { type: 'object', properties: { - id: { type: 'number' }, + id: { type: 'integer' }, name: { type: 'string' }, alignment: { type: 'string', enum: ['ally', 'self', 'hostile'] }, is_isolationist: { type: 'integer', enum: [1, 0] }, @@ -83,7 +84,7 @@ export const components = { station: { type: 'object', properties: { - id: { type: 'number' }, + id: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, name: { type: 'string' }, @@ -106,23 +107,72 @@ export const components = { ], }, - empire_status: { + // The comprehensive "own body" shape returned as the `planet` block on the + // Planetary Command / Station Command `view` — a body_status plus population, happiness, + // and per-resource stored/hour/capacity figures. + planet_status: { type: 'object', properties: { - essentia: { type: 'integer' }, - colonies: { + id: { type: 'integer' }, + x: { type: 'integer' }, + y: { type: 'integer' }, + star_id: { type: 'integer' }, + star_name: { type: 'string' }, + zone: { type: 'string' }, + orbit: { type: 'integer' }, + type: { type: 'string' }, + name: { type: 'string' }, + image: { type: 'string' }, + size: { type: 'integer' }, + water: { type: 'integer' }, + ore: { type: 'object', additionalProperties: { type: 'integer' } }, + notes: { type: 'string' }, + neutral_entry: { type: 'string' }, + empire: { type: 'object', - properties: { '467647': { type: 'string' } }, - required: ['467647'], + properties: { + id: { type: 'integer' }, + name: { type: 'string' }, + alignment: { type: 'string', enum: ['ally', 'self', 'hostile'] }, + is_isolationist: { type: 'integer', enum: [1, 0] }, + }, }, + building_count: { type: 'integer' }, + population: { type: 'integer' }, + happiness: { type: 'integer' }, + happiness_hour: { type: 'integer' }, + food_stored: { type: 'integer' }, + food_capacity: { type: 'integer' }, + food_hour: { type: 'integer' }, + energy_stored: { type: 'integer' }, + energy_capacity: { type: 'integer' }, + energy_hour: { type: 'integer' }, + ore_hour: { type: 'integer' }, + ore_capacity: { type: 'integer' }, + ore_stored: { type: 'integer' }, + waste_hour: { type: 'integer' }, + waste_stored: { type: 'integer' }, + waste_capacity: { type: 'integer' }, + water_stored: { type: 'integer' }, + water_hour: { type: 'integer' }, + water_capacity: { type: 'integer' }, + num_incoming_own: { type: 'integer' }, + num_incoming_ally: { type: 'integer' }, + num_incoming_enemy: { type: 'integer' }, + }, + }, + + empire_status: { + type: 'object', + properties: { + essentia: { type: 'integer' }, + // Keyed by body id (a stringified integer), value is the colony name. + colonies: { type: 'object', additionalProperties: { type: 'string' } }, rpc_count: { type: 'integer' }, is_isolationist: { type: 'integer' }, id: { type: 'integer' }, - planets: { - type: 'object', - properties: { '467647': { type: 'string' } }, - required: ['467647'], - }, + // Keyed by body id (a stringified integer), value is the planet name. + planets: { type: 'object', additionalProperties: { type: 'string' } }, has_new_messages: { type: 'integer' }, name: { type: 'string' }, home_planet_id: { type: 'integer' }, @@ -130,7 +180,8 @@ export const components = { status_message: { type: 'string' }, self_destruct_active: { type: 'integer' }, next_colony_srcs: { type: 'integer' }, - stations: { type: 'object' }, + // Keyed by space station id (a stringified integer), value is the station name. + stations: { type: 'object', additionalProperties: { type: 'string' } }, self_destruct_date: { type: 'string' }, next_colony_cost: { type: 'integer' }, latest_message_id: { type: 'integer' }, @@ -219,11 +270,13 @@ export const components = { properties: { buildings: { type: 'object', - description: 'Keyed by building id.', + description: 'Keyed by building id (a stringified integer).', additionalProperties: { type: 'object', - required: ['name', 'x', 'y', 'url', 'level', 'image', 'efficiency'], + required: ['id', 'name', 'x', 'y', 'url', 'level', 'image', 'efficiency'], properties: { + // Same value as the map key, repeated for convenience. + id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer', minimum: -5, maximum: 5 }, y: { type: 'integer', minimum: -5, maximum: 5 }, @@ -251,6 +304,17 @@ export const components = { }, required: ['seconds_remaining', 'start', 'end'], }, + // Only included when the building is damaged (efficiency < 100). + repair_costs: { + type: 'object', + properties: { + food: { type: 'integer' }, + water: { type: 'integer' }, + energy: { type: 'integer' }, + ore: { type: 'integer' }, + }, + required: ['food', 'water', 'energy', 'ore'], + }, }, }, }, @@ -340,11 +404,13 @@ export const components = { // building id, one level deep (no extra `buildings` wrapper). buildings_resources_list: { type: 'object', - description: 'Keyed by building id.', + description: 'Keyed by building id (a stringified integer).', additionalProperties: { type: 'object', - required: ['name', 'x', 'y', 'url', 'level', 'image', 'efficiency', 'resources'], + required: ['id', 'name', 'x', 'y', 'url', 'level', 'image', 'efficiency', 'resources'], properties: { + // Same value as the map key, repeated for convenience. + id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer', minimum: -5, maximum: 5 }, y: { type: 'integer', minimum: -5, maximum: 5 }, @@ -393,7 +459,7 @@ export const components = { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, url: { type: 'string' }, @@ -439,6 +505,8 @@ export const components = { seconds_remaining: { type: 'integer' }, start: { type: 'string' }, end: { type: 'string' }, + // Present for an Archaeology Ministry that is searching for a glyph. + searching: { type: 'string' }, }, required: ['seconds_remaining', 'start', 'end'], }, @@ -446,7 +514,8 @@ export const components = { type: 'object', properties: { can: { type: 'integer', enum: [1, 0] }, - reason: { type: 'string' }, + // A [code, message] pair; [0, ""] when there is no reason. + reason: { type: 'array', items: {} }, image: { type: 'string' }, }, required: ['can', 'reason', 'image'], @@ -455,6 +524,7 @@ export const components = { type: 'object', properties: { can: { type: 'integer', enum: [1, 0] }, + // A [code, message] pair; [0, ""] when there is no reason. reason: { type: 'array', items: {} }, cost: { $ref: '#/components/schemas/building_cost' }, production: { $ref: '#/components/schemas/building_production' }, @@ -546,8 +616,127 @@ export const components = { required: ['y', 'x'], }, rpc_limit: { type: 'integer' }, + // 1 when a server announcement is active. Clients pop the announcement window on the + // 0 -> 1 transition. + announcement: { type: 'integer', enum: [1, 0] }, }, required: ['version', 'time', 'star_map_size', 'rpc_limit'], }, + + // The "General" tab of the in-game stats window is fed by a static `server_overview.json` + // snapshot on the server (not a JSON-RPC method), so it has no path in this spec. This + // schema documents that snapshot's shape. + server_overview: { + type: 'object', + properties: { + bodies: { + type: 'object', + properties: { + count: { type: 'integer' }, + colony_count: { type: 'integer' }, + types: { + type: 'object', + description: 'Keyed by body class: asteroids, gas_giants, habitables, stations.', + additionalProperties: { + type: 'object', + properties: { + count: { type: 'integer' }, + average_orbit: { type: 'number' }, + average_size: { type: 'number' }, + largest_size: { type: 'number' }, + smallest_size: { type: 'number' }, + }, + }, + }, + }, + }, + buildings: { + type: 'object', + properties: { + count: { type: 'integer' }, + types: { + type: 'object', + description: 'Keyed by building name.', + additionalProperties: { + type: 'object', + properties: { + count: { type: 'integer' }, + average_level: { type: 'number' }, + highest_level: { type: 'integer' }, + }, + }, + }, + }, + }, + empires: { + type: 'object', + properties: { + count: { type: 'integer' }, + active_this_week_count: { type: 'integer' }, + active_today_count: { type: 'integer' }, + currently_active_count: { type: 'integer' }, + average_university_level: { type: 'number' }, + highest_university_level: { type: 'integer' }, + essentia_using_count: { type: 'integer' }, + isolationist_count: { type: 'integer' }, + }, + }, + orbits: { + type: 'object', + description: "Keyed '1' through '8'.", + additionalProperties: { + type: 'object', + properties: { bodies: { type: 'integer' }, inhabited: { type: 'integer' } }, + }, + }, + ships: { + type: 'object', + properties: { + count: { type: 'integer' }, + types: { + type: 'object', + description: 'Keyed by ship type.', + additionalProperties: { + type: 'object', + properties: { + count: { type: 'integer' }, + smallest_hold_size: { type: 'integer' }, + average_hold_size: { type: 'number' }, + largest_hold_size: { type: 'integer' }, + slowest_speed: { type: 'integer' }, + average_speed: { type: 'number' }, + fastest_speed: { type: 'integer' }, + }, + }, + }, + }, + }, + spies: { + type: 'object', + description: + 'A `count` plus a set of `average_*` / `highest_*` skill figures and `*_count` assignment tallies.', + additionalProperties: { type: 'number' }, + }, + stars: { + type: 'object', + properties: { + count: { type: 'integer' }, + seized_count: { type: 'integer' }, + probed_count: { type: 'integer' }, + probes_count: { type: 'integer' }, + }, + }, + glyphs: { + type: 'object', + properties: { + types: { + type: 'object', + description: 'Glyph name to count.', + additionalProperties: { type: 'integer' }, + }, + }, + }, + }, + }, }, }; diff --git a/src/spec/paths/alliance.ts b/src/spec/paths/alliance.ts index d3740ec..896a7d8 100644 --- a/src/spec/paths/alliance.ts +++ b/src/spec/paths/alliance.ts @@ -11,7 +11,7 @@ export const alliance = { ...requestBodySchema({ type: 'object', required: ['alliance_id'], - properties: { alliance_id: { type: 'string' } }, + properties: { alliance_id: { type: 'integer' } }, }), responses: { @@ -32,17 +32,17 @@ export const alliance = { 'influence', ], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, description: { type: 'string' }, - leader_id: { type: 'string' }, + leader_id: { type: 'integer' }, date_created: { type: 'string' }, members: { type: 'array', items: { type: 'object', required: ['id', 'name'], - properties: { id: { type: 'string' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, }, }, space_stations: { @@ -51,7 +51,7 @@ export const alliance = { type: 'object', required: ['id', 'name', 'x', 'y'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'number' }, y: { type: 'number' }, @@ -91,7 +91,7 @@ export const alliance = { items: { type: 'object', required: ['id', 'name'], - properties: { id: { type: 'string' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, }, }, status: statusSchema(), diff --git a/src/spec/paths/body.ts b/src/spec/paths/body.ts index 59e761f..d447b2b 100644 --- a/src/spec/paths/body.ts +++ b/src/spec/paths/body.ts @@ -8,7 +8,7 @@ export const body = { ...requestBodySchema({ type: 'object', required: ['body_id'], - properties: { body_id: { type: 'string' } }, + properties: { body_id: { type: 'integer' } }, }), responses: { @@ -36,7 +36,7 @@ export const body = { ...requestBodySchema({ type: 'object', required: ['body_id'], - properties: { body_id: { type: 'string' } }, + properties: { body_id: { type: 'integer' } }, }), responses: { @@ -60,7 +60,7 @@ export const body = { ...requestBodySchema({ type: 'object', required: ['body_id'], - properties: { body_id: { type: 'string' } }, + properties: { body_id: { type: 'integer' } }, }), responses: { @@ -92,7 +92,7 @@ export const body = { ...requestBodySchema({ type: 'object', required: ['body_id'], - properties: { body_id: { type: 'string' } }, + properties: { body_id: { type: 'integer' } }, }), responses: { @@ -125,8 +125,8 @@ export const body = { type: 'object', required: ['body_id', 'building_ids'], properties: { - body_id: { type: 'string' }, - building_ids: { type: 'array', items: { type: 'string' } }, + body_id: { type: 'integer' }, + building_ids: { type: 'array', items: { type: 'integer' } }, }, }), @@ -160,7 +160,7 @@ export const body = { type: 'object', required: ['body_id', 'arrangement'], properties: { - body_id: { type: 'string' }, + body_id: { type: 'integer' }, arrangement: { type: 'array', description: @@ -169,7 +169,7 @@ export const body = { type: 'object', required: ['id', 'x', 'y'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, x: { type: 'integer', minimum: -5, maximum: 5 }, y: { type: 'integer', minimum: -5, maximum: 5 }, }, @@ -189,7 +189,7 @@ export const body = { type: 'object', required: ['id', 'name', 'x', 'y'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, @@ -217,7 +217,7 @@ export const body = { type: 'object', required: ['body_id', 'x', 'y', 'tag'], properties: { - body_id: { type: 'string' }, + body_id: { type: 'integer' }, x: { type: 'integer', minimum: -5, maximum: 5 }, y: { type: 'integer', minimum: -5, maximum: 5 }, tag: { @@ -298,7 +298,7 @@ export const body = { type: 'object', required: ['body_id'], properties: { - body_id: { type: 'string' }, + body_id: { type: 'integer' }, size: { type: 'integer', description: @@ -334,7 +334,7 @@ export const body = { ...requestBodySchema({ type: 'object', required: ['body_id', 'name'], - properties: { body_id: { type: 'string' }, name: { type: 'string' } }, + properties: { body_id: { type: 'integer' }, name: { type: 'string' } }, }), responses: { @@ -354,7 +354,7 @@ export const body = { ...requestBodySchema({ type: 'object', required: ['body_id'], - properties: { body_id: { type: 'string' } }, + properties: { body_id: { type: 'integer' } }, }), responses: { @@ -376,7 +376,7 @@ export const body = { required: ['body_id'], properties: { body_id: { - type: 'string', + type: 'integer', description: 'The id of the space station itself, not its Parliament building.', }, }, @@ -394,7 +394,7 @@ export const body = { type: 'object', required: ['id', 'name', 'description', 'date_enacted'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, description: { type: 'string' }, date_enacted: { type: 'string' }, @@ -416,7 +416,7 @@ export const body = { type: 'object', required: ['body_id', 'options'], properties: { - body_id: { type: 'string' }, + body_id: { type: 'integer' }, options: { type: 'object', required: ['notes'], diff --git a/src/spec/paths/buildings/archaeology.ts b/src/spec/paths/buildings/archaeology.ts index 7c444d9..afb3abc 100644 --- a/src/spec/paths/buildings/archaeology.ts +++ b/src/spec/paths/buildings/archaeology.ts @@ -37,7 +37,7 @@ const ORE_TYPES = [ const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); export const archaeology = { @@ -51,7 +51,7 @@ export const archaeology = { type: 'object', required: ['building_id', 'ore_type'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, ore_type: { type: 'string', enum: ORE_TYPES, @@ -109,7 +109,7 @@ export const archaeology = { type: 'object', required: ['id', 'name', 'type', 'quantity'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, type: { type: 'string' }, quantity: { type: 'integer' }, @@ -131,7 +131,7 @@ export const archaeology = { type: 'object', required: ['building_id', 'glyphs'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, glyphs: { type: 'array', items: { type: 'string' }, @@ -195,9 +195,19 @@ export const archaeology = { type: 'object', required: ['id', 'date_landed'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, date_landed: { type: 'string' }, - body: { type: 'object', description: 'The body the excavator is sited on.' }, + body: { + type: 'object', + description: 'The body the excavator is sited on.', + properties: { + id: { type: 'integer' }, + name: { type: 'string' }, + x: { type: 'integer' }, + y: { type: 'integer' }, + image: { type: 'string' }, + }, + }, artifact_chance: { type: 'number' }, glyph_chance: { type: 'number' }, plan_chance: { type: 'number' }, @@ -219,7 +229,7 @@ export const archaeology = { ...requestBodySchema({ type: 'object', required: ['building_id', 'site_id'], - properties: { building_id: { type: 'string' }, site_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, site_id: { type: 'integer' } }, }), responses: { ...response200('Closes a single excavator site.', { diff --git a/src/spec/paths/buildings/blackholegenerator.ts b/src/spec/paths/buildings/blackholegenerator.ts index a5bb9d2..5739c2c 100644 --- a/src/spec/paths/buildings/blackholegenerator.ts +++ b/src/spec/paths/buildings/blackholegenerator.ts @@ -32,14 +32,14 @@ const targetSchema = { type: 'string', description: "Case insensitive; throws if it doesn't match a body.", }, - body_id: { type: 'string' }, + body_id: { type: 'integer' }, x: { type: 'integer' }, y: { type: 'integer' }, star_name: { type: 'string', description: "Case insensitive; throws if it doesn't match a star.", }, - star_id: { type: 'string' }, + star_id: { type: 'integer' }, orbit: { type: 'integer', description: @@ -55,7 +55,7 @@ const targetSchema = { const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); export const blackHoleGenerator = { @@ -103,7 +103,7 @@ export const blackHoleGenerator = { type: 'object', required: ['building_id', 'target', 'task_name'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, target: targetSchema, task_name: { type: 'string', enum: TASK_NAMES }, params: { @@ -136,7 +136,7 @@ export const blackHoleGenerator = { description: 'Present when the task succeeded (or produced a side effect).', properties: { class: { type: 'string' }, - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, old_class: { type: 'string' }, old_size: { type: 'integer' }, @@ -164,7 +164,7 @@ export const blackHoleGenerator = { ...requestBodySchema({ type: 'object', required: ['building_id', 'target'], - properties: { building_id: { type: 'string' }, target: targetSchema }, + properties: { building_id: { type: 'integer' }, target: targetSchema }, }), responses: { ...response200( @@ -183,7 +183,7 @@ export const blackHoleGenerator = { properties: { name: { type: 'string', enum: TASK_NAMES }, base_fail: { type: 'integer' }, - body_id: { type: 'string' }, + body_id: { type: 'integer' }, dist: { type: 'number' }, min_level: { type: 'integer' }, occupied: { type: 'integer', enum: [0, 1] }, diff --git a/src/spec/paths/buildings/capitol.ts b/src/spec/paths/buildings/capitol.ts index 97939ca..581b919 100644 --- a/src/spec/paths/buildings/capitol.ts +++ b/src/spec/paths/buildings/capitol.ts @@ -21,7 +21,7 @@ export const capitol = { ...requestBodySchema({ type: 'object', required: ['building_id', 'name'], - properties: { building_id: { type: 'string' }, name: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, name: { type: 'string' } }, }), responses: { ...response200( diff --git a/src/spec/paths/buildings/development.ts b/src/spec/paths/buildings/development.ts index 4663db2..e6f25ea 100644 --- a/src/spec/paths/buildings/development.ts +++ b/src/spec/paths/buildings/development.ts @@ -14,7 +14,7 @@ const base = buildingBase('Development'); const buildQueueItemSchema = { type: 'object', properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, name: { type: 'string' }, to_level: { type: 'integer' }, seconds_remaining: { type: 'integer' }, @@ -49,7 +49,7 @@ const developmentViewResultSchema = (description: string) => ({ const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); export const development = { @@ -88,9 +88,9 @@ export const development = { type: 'object', required: ['building_id', 'scheduled_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, scheduled_id: { - type: 'string', + type: 'integer', description: 'The ID of the building scheduled to be built/upgraded that you wish to subsidize.', }, @@ -117,9 +117,9 @@ export const development = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, scheduled_id: { - oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }], + 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.', }, diff --git a/src/spec/paths/buildings/distributioncenter.ts b/src/spec/paths/buildings/distributioncenter.ts index 49a67b4..6d104ae 100644 --- a/src/spec/paths/buildings/distributioncenter.ts +++ b/src/spec/paths/buildings/distributioncenter.ts @@ -43,7 +43,7 @@ const reserveSchema = { const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); export const distributionCenter = { @@ -57,7 +57,7 @@ export const distributionCenter = { type: 'object', required: ['building_id', 'resources'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, resources: { type: 'array', description: "Resources to reserve so they don't get automatically spent.", diff --git a/src/spec/paths/buildings/embassy.ts b/src/spec/paths/buildings/embassy.ts index 42a53f0..7c8ecc8 100644 --- a/src/spec/paths/buildings/embassy.ts +++ b/src/spec/paths/buildings/embassy.ts @@ -14,7 +14,7 @@ const base = buildingBase('Embassy'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const optionalMessageRequestBody = (extraRequired: string[] = [], extraProperties: object = {}) => @@ -22,12 +22,31 @@ const optionalMessageRequestBody = (extraRequired: string[] = [], extraPropertie type: 'object', required: ['building_id', ...extraRequired], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, message: { type: 'string' }, ...extraProperties, }, }); +// This empire's alliance, as returned nested under `alliance_status` on `view` and (flattened +// alongside `status`) by get_alliance_status. +const allianceStatusProperties = { + id: { type: 'integer' }, + name: { type: 'string' }, + members: { + type: 'array', + items: { + type: 'object', + properties: { empire_id: { type: 'integer' }, name: { type: 'string' } }, + }, + }, + leader_id: { type: 'integer' }, + forum_uri: { type: 'string' }, + description: { type: 'string' }, + announcements: { type: 'string' }, + date_created: { type: 'string' }, +}; + // This is the module where alliance *management* (create/dissolve/invite/leave/stash/ // propositions) lives, per the docs — the Alliance module itself only exposes read-only lookups. export const embassy = { @@ -36,6 +55,7 @@ export const embassy = { alliance_status: { type: 'object', description: 'Present only when this empire is in an alliance.', + properties: allianceStatusProperties, }, }), @@ -46,7 +66,7 @@ export const embassy = { type: 'object', required: ['building_id', 'name'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, name: { type: 'string', minLength: 3, maxLength: 30 }, }, }), @@ -69,23 +89,7 @@ export const embassy = { ...response200("Returns this empire's alliance data.", { type: 'object', required: ['status'], - properties: { - id: { type: 'string' }, - name: { type: 'string' }, - members: { - type: 'array', - items: { - type: 'object', - properties: { empire_id: { type: 'string' }, name: { type: 'string' } }, - }, - }, - leader_id: { type: 'string' }, - forum_uri: { type: 'string' }, - description: { type: 'string' }, - announcements: { type: 'string' }, - date_created: { type: 'string' }, - status: statusSchema(), - }, + properties: { ...allianceStatusProperties, status: statusSchema() }, }), ...response500(), }, @@ -113,7 +117,7 @@ export const embassy = { type: 'object', required: ['building_id', 'params'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, params: { type: 'object', properties: { @@ -138,7 +142,7 @@ export const embassy = { [`${base}/send_invite`]: { post: { ...security(), - ...optionalMessageRequestBody(['invitee_id'], { invitee_id: { type: 'string' } }), + ...optionalMessageRequestBody(['invitee_id'], { invitee_id: { type: 'integer' } }), responses: { ...response200('Leader-only. Invites an empire to join the alliance.', { type: 'object', @@ -153,7 +157,7 @@ export const embassy = { [`${base}/withdraw_invite`]: { post: { ...security(), - ...optionalMessageRequestBody(['invite_id'], { invite_id: { type: 'string' } }), + ...optionalMessageRequestBody(['invite_id'], { invite_id: { type: 'integer' } }), responses: { ...response200('Leader-only. Withdraws a pending invite.', { type: 'object', @@ -179,9 +183,9 @@ export const embassy = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, - empire_id: { type: 'string' }, + empire_id: { type: 'integer' }, }, }, }, @@ -196,7 +200,7 @@ export const embassy = { [`${base}/accept_invite`]: { post: { ...security(), - ...optionalMessageRequestBody(['invite_id'], { invite_id: { type: 'string' } }), + ...optionalMessageRequestBody(['invite_id'], { invite_id: { type: 'integer' } }), responses: { ...response200('Accepts an invite to join an alliance.', { type: 'object', @@ -211,7 +215,7 @@ export const embassy = { [`${base}/reject_invite`]: { post: { ...security(), - ...optionalMessageRequestBody(['invite_id'], { invite_id: { type: 'string' } }), + ...optionalMessageRequestBody(['invite_id'], { invite_id: { type: 'integer' } }), responses: { ...response200('Declines an invite to join an alliance.', { type: 'object', @@ -237,9 +241,9 @@ export const embassy = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, - alliance_id: { type: 'string' }, + alliance_id: { type: 'integer' }, }, }, }, @@ -269,7 +273,7 @@ export const embassy = { [`${base}/expel_member`]: { post: { ...security(), - ...optionalMessageRequestBody(['empire_id'], { empire_id: { type: 'string' } }), + ...optionalMessageRequestBody(['empire_id'], { empire_id: { type: 'integer' } }), responses: { ...response200('Leader-only. Removes a member from the alliance.', { type: 'object', @@ -287,7 +291,7 @@ export const embassy = { ...requestBodySchema({ type: 'object', required: ['building_id', 'new_leader_id'], - properties: { building_id: { type: 'string' }, new_leader_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, new_leader_id: { type: 'integer' } }, }), responses: { ...response200('Leader-only. Transfers alliance leadership to another current member.', { @@ -307,9 +311,18 @@ export const embassy = { responses: { ...response200("Returns the alliance stash's contents.", { type: 'object', - required: ['stash', 'max_exchange_size', 'exchanges_remaining_today', 'status'], + required: ['stash', 'stored', 'max_exchange_size', 'exchanges_remaining_today', 'status'], properties: { - stash: { type: 'object', additionalProperties: { type: 'integer' } }, + stash: { + type: 'object', + description: "The alliance stash's contents, keyed by resource name.", + additionalProperties: { type: 'integer' }, + }, + stored: { + type: 'object', + description: "The calling planet's own storable resources, keyed by resource name.", + additionalProperties: { type: 'integer' }, + }, max_exchange_size: { type: 'integer' }, exchanges_remaining_today: { type: 'integer' }, status: statusSchema(), @@ -327,7 +340,7 @@ export const embassy = { type: 'object', required: ['building_id', 'donation'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, donation: { type: 'object', description: @@ -354,7 +367,7 @@ export const embassy = { type: 'object', required: ['building_id', 'donation', 'request'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, donation: { type: 'object', description: 'Must equal request in total value. Waste is not allowed.', @@ -388,7 +401,7 @@ export const embassy = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, description: { type: 'string' }, votes_needed: { type: 'integer' }, @@ -398,7 +411,7 @@ export const embassy = { date_ends: { type: 'string' }, proposed_by: { type: 'object', - properties: { id: { type: 'string' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, }, my_vote: { type: 'integer', @@ -423,8 +436,8 @@ export const embassy = { type: 'object', required: ['building_id', 'proposition_id', 'vote'], properties: { - building_id: { type: 'string' }, - proposition_id: { type: 'string' }, + building_id: { type: 'integer' }, + proposition_id: { type: 'integer' }, vote: { type: 'integer', enum: [1, 0] }, }, }), diff --git a/src/spec/paths/buildings/energyreserve.ts b/src/spec/paths/buildings/energyreserve.ts index 32395ec..41ad886 100644 --- a/src/spec/paths/buildings/energyreserve.ts +++ b/src/spec/paths/buildings/energyreserve.ts @@ -22,7 +22,7 @@ export const energyReserve = { type: 'object', required: ['building_id', 'amount'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, amount: { type: 'integer', description: 'The amount of energy to dump.' }, }, }), diff --git a/src/spec/paths/buildings/entertainment.ts b/src/spec/paths/buildings/entertainment.ts index 0c3b9a5..53005e4 100644 --- a/src/spec/paths/buildings/entertainment.ts +++ b/src/spec/paths/buildings/entertainment.ts @@ -14,7 +14,7 @@ const base = buildingBase('Entertainment'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); export const entertainment = { diff --git a/src/spec/paths/buildings/essentiavein.ts b/src/spec/paths/buildings/essentiavein.ts index 6b838cc..cf660ce 100644 --- a/src/spec/paths/buildings/essentiavein.ts +++ b/src/spec/paths/buildings/essentiavein.ts @@ -27,7 +27,7 @@ export const essentiaVein = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, times: { type: 'integer', minimum: 1, diff --git a/src/spec/paths/buildings/foodreserve.ts b/src/spec/paths/buildings/foodreserve.ts index b681117..f247431 100644 --- a/src/spec/paths/buildings/foodreserve.ts +++ b/src/spec/paths/buildings/foodreserve.ts @@ -28,7 +28,7 @@ export const foodReserve = { type: 'object', required: ['building_id', 'type', 'amount'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, type: { type: 'string', description: 'Food type to convert into waste, e.g. apple, corn, burger.', diff --git a/src/spec/paths/buildings/geneticslab.ts b/src/spec/paths/buildings/geneticslab.ts index 03dd37e..cfe2c8c 100644 --- a/src/spec/paths/buildings/geneticslab.ts +++ b/src/spec/paths/buildings/geneticslab.ts @@ -15,7 +15,7 @@ const base = buildingBase('GeneticsLab'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const experimentResultSchema = ( @@ -44,7 +44,7 @@ const experimentResultSchema = ( spy: { type: 'object', description: 'The prisoner spy available to be experimented on.', - properties: { id: { type: 'string' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, required: ['id', 'name'], }, species: speciesSchema(), @@ -92,8 +92,8 @@ export const geneticsLab = { type: 'object', required: ['building_id', 'spy_id', 'affinity'], properties: { - building_id: { type: 'string' }, - spy_id: { type: 'string' }, + building_id: { type: 'integer' }, + spy_id: { type: 'integer' }, affinity: { type: 'string', description: @@ -130,7 +130,7 @@ export const geneticsLab = { type: 'object', required: ['building_id', 'params'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, params: { type: 'object', required: ['name'], diff --git a/src/spec/paths/buildings/intelligence.ts b/src/spec/paths/buildings/intelligence.ts index cbb0ff8..5a7d792 100644 --- a/src/spec/paths/buildings/intelligence.ts +++ b/src/spec/paths/buildings/intelligence.ts @@ -14,7 +14,7 @@ const base = buildingBase('Intelligence'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const ASSIGNMENTS = [ @@ -60,15 +60,15 @@ const spySchema = { 'is_available', ], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, - assignment: { type: 'string' }, + assignment: { type: 'string', enum: ASSIGNMENTS }, possible_assignments: { type: 'array', items: { type: 'object', properties: { - task: { type: 'string' }, + task: { type: 'string', enum: ASSIGNMENTS }, recovery: { type: 'integer' }, skill: { type: 'string' }, }, @@ -84,7 +84,7 @@ const spySchema = { assigned_to: { type: 'object', properties: { - body_id: { type: 'string' }, + body_id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, @@ -93,7 +93,7 @@ const spySchema = { based_from: { type: 'object', properties: { - body_id: { type: 'string' }, + body_id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, @@ -131,7 +131,7 @@ export const intelligence = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, quantity: { type: 'integer', minimum: 1, maximum: 5, description: 'Defaults to 1.' }, }, }), @@ -161,7 +161,7 @@ export const intelligence = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. 30 per page.' }, }, }), @@ -226,7 +226,7 @@ export const intelligence = { ...requestBodySchema({ type: 'object', required: ['building_id', 'spy_id'], - properties: { building_id: { type: 'string' }, spy_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, spy_id: { type: 'integer' } }, }), responses: { ...response200('Eliminates a spy from payroll. Throws 1002, 1010.', { @@ -246,8 +246,8 @@ export const intelligence = { type: 'object', required: ['building_id', 'spy_id', 'name'], properties: { - building_id: { type: 'string' }, - spy_id: { type: 'string' }, + building_id: { type: 'integer' }, + spy_id: { type: 'integer' }, name: { type: 'string', description: 'Cannot contain @, <, #, &, ; or profanity.' }, }, }), @@ -269,7 +269,7 @@ export const intelligence = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, prefix: { type: 'string' }, suffix: { type: 'string' }, rename_null_only: { @@ -301,8 +301,8 @@ export const intelligence = { type: 'object', required: ['building_id', 'spy_id', 'assignment'], properties: { - building_id: { type: 'string' }, - spy_id: { type: 'string' }, + building_id: { type: 'integer' }, + spy_id: { type: 'integer' }, assignment: { oneOf: [ { type: 'string', enum: ASSIGNMENTS }, @@ -331,7 +331,7 @@ export const intelligence = { type: 'object', properties: { result: { type: 'string', enum: ['Accepted', 'Success', 'Bounce', 'Failure'] }, - message_id: { type: 'string' }, + message_id: { type: 'integer' }, reason: { type: 'string' }, }, }, diff --git a/src/spec/paths/buildings/libraryofjith.ts b/src/spec/paths/buildings/libraryofjith.ts index 62f0071..d143742 100644 --- a/src/spec/paths/buildings/libraryofjith.ts +++ b/src/spec/paths/buildings/libraryofjith.ts @@ -23,9 +23,9 @@ export const libraryOfJith = { type: 'object', required: ['building_id', 'empire_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, empire_id: { - type: 'string', + type: 'integer', description: "The unique id of an empire you'd like to know more about.", }, }, diff --git a/src/spec/paths/buildings/mercenariesguild.ts b/src/spec/paths/buildings/mercenariesguild.ts index 00fe4b2..0dfc3a3 100644 --- a/src/spec/paths/buildings/mercenariesguild.ts +++ b/src/spec/paths/buildings/mercenariesguild.ts @@ -14,27 +14,27 @@ const base = buildingBase('MercenariesGuild'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const tradeEntrySchema = { type: 'object', properties: { date_offered: { type: 'string' }, - id: { type: 'string' }, + id: { type: 'integer' }, ask: { type: 'integer', description: 'Amount of essentia being asked for.' }, offer: { type: 'array', items: { type: 'string' } }, body: { type: 'object', description: 'Only present on view_market. Use with get_trade_ships to determine travel time.', - properties: { id: { type: 'string' } }, + properties: { id: { type: 'integer' } }, required: ['id'], }, empire: { type: 'object', description: 'Only present on view_market.', - properties: { id: { type: 'string' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, required: ['id', 'name'], }, }, @@ -52,22 +52,22 @@ export const mercenariesGuild = { type: 'object', required: ['building_id', 'spy_id', 'ask'], properties: { - building_id: { type: 'string' }, - spy_id: { type: 'string', description: 'See get_spies for a list of your spies.' }, + building_id: { type: 'integer' }, + spy_id: { type: 'integer', description: 'See get_spies for a list of your spies.' }, ask: { type: 'integer', minimum: 1, maximum: 99, description: 'Amount of essentia being asked for.', }, - ship_id: { type: 'string', description: 'Optional. See get_trade_ships for details.' }, + ship_id: { type: 'integer', description: 'Optional. See get_trade_ships for details.' }, }, }), responses: { ...response200('Queues a trade of a spy for others to see.', { type: 'object', required: ['trade_id', 'status'], - properties: { trade_id: { type: 'string' }, status: statusSchema() }, + properties: { trade_id: { type: 'integer' }, status: statusSchema() }, }), ...response500(), }, @@ -88,7 +88,7 @@ export const mercenariesGuild = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, level: { type: 'integer' }, }, @@ -109,7 +109,7 @@ export const mercenariesGuild = { ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], - properties: { building_id: { type: 'string' }, trade_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, trade_id: { type: 'integer' } }, }), responses: { ...response200( @@ -127,7 +127,7 @@ export const mercenariesGuild = { ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], - properties: { building_id: { type: 'string' }, trade_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, trade_id: { type: 'integer' } }, }), responses: { ...response200( @@ -146,7 +146,7 @@ export const mercenariesGuild = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Optional. Defaults to 1. 25 trades per page.', @@ -176,7 +176,7 @@ export const mercenariesGuild = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Optional. Defaults to 1. 25 trades per page.', @@ -206,9 +206,9 @@ export const mercenariesGuild = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, target_body_id: { - type: 'string', + type: 'integer', description: 'Optional. If included, the estimated travel time to this body is calculated.', }, @@ -224,7 +224,7 @@ export const mercenariesGuild = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, type: { type: 'string' }, name: { type: 'string' }, estimated_travel_time: { @@ -250,7 +250,7 @@ export const mercenariesGuild = { ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], - properties: { building_id: { type: 'string' }, trade_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, trade_id: { type: 'integer' } }, }), responses: { ...response200('Reports a trade that is suspected of abusing the trade system.', { diff --git a/src/spec/paths/buildings/miningministry.ts b/src/spec/paths/buildings/miningministry.ts index 99373cf..4521043 100644 --- a/src/spec/paths/buildings/miningministry.ts +++ b/src/spec/paths/buildings/miningministry.ts @@ -41,7 +41,7 @@ const oreHourProperties = Object.fromEntries( const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); export const miningMinistry = { @@ -65,11 +65,11 @@ export const miningMinistry = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, asteroid: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, @@ -113,7 +113,7 @@ export const miningMinistry = { type: 'object', properties: { name: { type: 'string' }, - id: { type: 'string' }, + id: { type: 'integer' }, task: { type: 'string' }, speed: { type: 'integer' }, hold_size: { type: 'integer' }, @@ -136,7 +136,7 @@ export const miningMinistry = { ...requestBodySchema({ type: 'object', required: ['building_id', 'ship_id'], - properties: { building_id: { type: 'string' }, ship_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, ship_id: { type: 'integer' } }, }), responses: { ...response200('Takes a cargo ship from the space port and adds it to the mining fleet.', { @@ -155,7 +155,7 @@ export const miningMinistry = { ...requestBodySchema({ type: 'object', required: ['building_id', 'ship_id'], - properties: { building_id: { type: 'string' }, ship_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, ship_id: { type: 'integer' } }, }), responses: { ...response200( @@ -173,7 +173,7 @@ export const miningMinistry = { ...requestBodySchema({ type: 'object', required: ['building_id', 'platform_id'], - properties: { building_id: { type: 'string' }, platform_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, platform_id: { type: 'integer' } }, }), responses: { ...response200('Closes down an existing mining platform.', { diff --git a/src/spec/paths/buildings/missioncommand.ts b/src/spec/paths/buildings/missioncommand.ts index 366bda0..68c2456 100644 --- a/src/spec/paths/buildings/missioncommand.ts +++ b/src/spec/paths/buildings/missioncommand.ts @@ -16,8 +16,8 @@ const missionIdRequestBody = (extraDescription: string) => type: 'object', required: ['building_id', 'mission_id'], properties: { - building_id: { type: 'string' }, - mission_id: { type: 'string', description: extraDescription }, + building_id: { type: 'integer' }, + mission_id: { type: 'integer', description: extraDescription }, }, }); @@ -31,7 +31,7 @@ export const missionCommand = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: { ...response200( @@ -45,7 +45,7 @@ export const missionCommand = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, max_university_level: { type: 'integer' }, date_posted: { type: 'string' }, name: { type: 'string' }, diff --git a/src/spec/paths/buildings/network19.ts b/src/spec/paths/buildings/network19.ts index 0dd232d..40d1ff9 100644 --- a/src/spec/paths/buildings/network19.ts +++ b/src/spec/paths/buildings/network19.ts @@ -29,7 +29,7 @@ export const network19 = { type: 'object', required: ['building_id', 'onoff'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, onoff: { type: 'integer', enum: [1, 0], @@ -54,7 +54,7 @@ export const network19 = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: { ...response200( diff --git a/src/spec/paths/buildings/observatory.ts b/src/spec/paths/buildings/observatory.ts index 6b89c98..b3a56f1 100644 --- a/src/spec/paths/buildings/observatory.ts +++ b/src/spec/paths/buildings/observatory.ts @@ -14,13 +14,13 @@ const base = buildingBase('Observatory'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const starSchema = { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, color: { type: 'string' }, name: { type: 'string' }, x: { type: 'integer' }, @@ -30,10 +30,10 @@ const starSchema = { items: { type: 'object', properties: { - id: { type: 'number' }, + id: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, - star_id: { type: 'number' }, + star_id: { type: 'integer' }, star_name: { type: 'string' }, orbit: { type: 'number' }, type: { type: 'string' }, @@ -45,7 +45,7 @@ const starSchema = { station: { type: 'object', properties: { - id: { type: 'number' }, + id: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, name: { type: 'string' }, @@ -84,7 +84,7 @@ export const observatory = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: @@ -116,9 +116,9 @@ export const observatory = { type: 'object', required: ['building_id', 'star_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, star_id: { - type: 'string', + type: 'integer', description: 'The unique id of the star the probe is attached to.', }, }, diff --git a/src/spec/paths/buildings/oracleofanid.ts b/src/spec/paths/buildings/oracleofanid.ts index 5713755..12c17cc 100644 --- a/src/spec/paths/buildings/oracleofanid.ts +++ b/src/spec/paths/buildings/oracleofanid.ts @@ -14,7 +14,7 @@ const base = buildingBase('OracleOfAnid'); const starSchema = { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, color: { type: 'string' }, name: { type: 'string' }, x: { type: 'integer' }, @@ -34,7 +34,7 @@ export const oracleOfAnid = { ...requestBodySchema({ type: 'object', required: ['building_id', 'star_id'], - properties: { building_id: { type: 'string' }, star_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, star_id: { type: 'integer' } }, }), responses: { ...response200( @@ -57,7 +57,7 @@ export const oracleOfAnid = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Optional. Defaults to 1. Each page contains page_size records.', diff --git a/src/spec/paths/buildings/orestorage.ts b/src/spec/paths/buildings/orestorage.ts index 350278f..77dac65 100644 --- a/src/spec/paths/buildings/orestorage.ts +++ b/src/spec/paths/buildings/orestorage.ts @@ -28,7 +28,7 @@ export const oreStorage = { type: 'object', required: ['building_id', 'type', 'amount'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, type: { type: 'string', description: 'Ore type to convert into waste, e.g. gold, bauxite, galena.', diff --git a/src/spec/paths/buildings/park.ts b/src/spec/paths/buildings/park.ts index 588a70c..40a53e8 100644 --- a/src/spec/paths/buildings/park.ts +++ b/src/spec/paths/buildings/park.ts @@ -14,7 +14,7 @@ const base = buildingBase('Park'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const viewResultSchema = (description: string) => ({ diff --git a/src/spec/paths/buildings/planetarycommand.ts b/src/spec/paths/buildings/planetarycommand.ts index 2de0600..24659f1 100644 --- a/src/spec/paths/buildings/planetarycommand.ts +++ b/src/spec/paths/buildings/planetarycommand.ts @@ -14,7 +14,7 @@ const base = buildingBase('PlanetaryCommand'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); export const planetaryCommand = { @@ -35,10 +35,7 @@ export const planetaryCommand = { additionalProperties: { type: 'integer' }, }, pod_delay: { type: 'integer', description: 'Seconds between supply pods being sent.' }, - planet: { - type: 'object', - description: 'Comprehensive planet data — coordinates, type, population, happiness, storage.', - }, + planet: { $ref: '#/components/schemas/planet_status' }, }), [`${base}/view_plans`]: { @@ -84,8 +81,17 @@ export const planetaryCommand = { items: { type: 'object', properties: { - id: { type: 'string' }, - from_body: { type: 'string' }, + id: { type: 'integer' }, + from_body: { + type: 'object', + properties: { + id: { type: 'integer' }, + name: { type: 'string' }, + x: { type: 'integer' }, + y: { type: 'integer' }, + image: { type: 'string' }, + }, + }, resource_hour: { type: 'integer' }, resource_type: { type: 'string' }, percent_transferred: { type: 'number' }, diff --git a/src/spec/paths/buildings/security.ts b/src/spec/paths/buildings/security.ts index 1e620cc..2f29ff5 100644 --- a/src/spec/paths/buildings/security.ts +++ b/src/spec/paths/buildings/security.ts @@ -14,13 +14,13 @@ const base = buildingBase('Security'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const prisonerIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id', 'prisoner_id'], - properties: { building_id: { type: 'string' }, prisoner_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, prisoner_id: { type: 'integer' } }, }); export const security_ = { @@ -34,7 +34,7 @@ export const security_ = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. Each page contains 25 spies.', @@ -44,16 +44,20 @@ export const security_ = { responses: { ...response200('Displays a list of the spies that have been captured.', { type: 'object', - required: ['status', 'prisoners'], + required: ['status', 'prisoners', 'captured_count'], properties: { status: statusSchema(), + captured_count: { + type: 'integer', + description: 'Total captured spies across all pages (the pager is sized from this).', + }, prisoners: { type: 'array', items: { type: 'object', required: ['id', 'name', 'level', 'task', 'sentence_expires'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, level: { type: 'integer' }, task: { type: 'string', enum: ['Captured', 'Prisoner Transport'] }, @@ -104,7 +108,7 @@ export const security_ = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. Each page contains 25 spies.', @@ -116,9 +120,13 @@ export const security_ = { 'Displays a list of the spies that are on your planet and have a level lower than your security ministry.', { type: 'object', - required: ['status', 'spies'], + required: ['status', 'spies', 'spy_count'], properties: { status: statusSchema(), + spy_count: { + type: 'integer', + description: 'Total foreign spies across all pages (the pager is sized from this).', + }, spies: { type: 'array', items: { diff --git a/src/spec/paths/buildings/shipyard.ts b/src/spec/paths/buildings/shipyard.ts index 557bac4..69877e1 100644 --- a/src/spec/paths/buildings/shipyard.ts +++ b/src/spec/paths/buildings/shipyard.ts @@ -24,7 +24,7 @@ const shipsBuildingSchema = { type: 'object', required: ['id', 'type', 'type_human', 'date_completed'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, type: { type: 'string' }, type_human: { type: 'string' }, date_completed: { type: 'string' }, @@ -37,7 +37,7 @@ const shipsBuildingSchema = { const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); export const shipyard = { @@ -51,7 +51,7 @@ export const shipyard = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 items per page.' }, }, }), @@ -85,7 +85,7 @@ export const shipyard = { ...requestBodySchema({ type: 'object', required: ['building_id', 'ship_id'], - properties: { building_id: { type: 'string' }, ship_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, ship_id: { type: 'integer' } }, }), responses: { ...response200( @@ -104,7 +104,7 @@ export const shipyard = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, tag: { type: 'string', enum: ['Trade', 'Colonization', 'Intelligence', 'Exploration', 'War', 'Mining'], @@ -173,7 +173,7 @@ export const shipyard = { type: 'object', required: ['building_id', 'type'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, type: { type: 'string' }, quantity: { type: 'integer', minimum: 1, maximum: 600, description: 'Defaults to 1.' }, }, @@ -203,10 +203,10 @@ export const shipyard = { maximum: 600, description: 'Defaults to 1.', }, - body_id: { type: 'string', description: 'Alternative to building_id.' }, + body_id: { type: 'integer', description: 'Alternative to building_id.' }, building_id: { description: 'A single shipyard id, or an array of shipyard ids.', - oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }], + oneOf: [{ type: 'integer' }, { type: 'array', items: { type: 'integer' } }], }, autoselect: { type: 'string', enum: ['all', 'higher', 'only'] }, }, diff --git a/src/spec/paths/buildings/spaceport.ts b/src/spec/paths/buildings/spaceport.ts index c38b5ea..c2adab1 100644 --- a/src/spec/paths/buildings/spaceport.ts +++ b/src/spec/paths/buildings/spaceport.ts @@ -14,7 +14,7 @@ const base = buildingBase('SpacePort'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); // A star/body locator, as accepted by every method that needs to identify a target — exactly one @@ -23,9 +23,9 @@ const targetSchema = { type: 'object', properties: { body_name: { type: 'string' }, - body_id: { type: 'string' }, + body_id: { type: 'integer' }, star_name: { type: 'string' }, - star_id: { type: 'string' }, + star_id: { type: 'integer' }, x: { type: 'integer' }, y: { type: 'integer' }, }, @@ -36,12 +36,12 @@ const targetSchema = { const locationRefSchema = { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, type: { type: 'string', enum: ['body', 'star'] }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, - empire: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' } } }, + empire: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' } } }, }, }; @@ -51,7 +51,7 @@ const locationRefSchema = { const shipSchema = { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, type: { type: 'string' }, type_human: { type: 'string' }, @@ -59,16 +59,26 @@ const shipSchema = { speed: { type: 'integer' }, fleet_speed: { type: 'integer' }, stealth: { type: 'integer' }, + combat: { type: 'integer' }, hold_size: { type: 'integer' }, + max_occupants: { type: 'integer' }, berth_level: { type: 'integer' }, date_started: { type: 'string' }, date_available: { type: 'string' }, date_arrives: { type: 'string' }, + // Seconds to reach the target; present on ship rows returned for a specific destination + // (e.g. get_fleet_for). + estimated_travel_time: { type: 'integer' }, can_recall: { type: 'integer', enum: [1, 0] }, can_scuttle: { type: 'integer', enum: [1, 0] }, from: locationRefSchema, to: locationRefSchema, orbiting: locationRefSchema, + // Present on detailed ship views; `payload` lists the carried items. + details: { + type: 'object', + properties: { payload: { type: 'array', items: { type: 'string' } } }, + }, }, }; @@ -91,7 +101,7 @@ export const spacePort = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, paging: { type: 'object', properties: { @@ -148,7 +158,7 @@ export const spacePort = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 per page.' }, }, }), @@ -176,7 +186,7 @@ export const spacePort = { ...requestBodySchema({ type: 'object', required: ['from_body_id', 'target'], - properties: { from_body_id: { type: 'string' }, target: targetSchema }, + properties: { from_body_id: { type: 'integer' }, target: targetSchema }, }), responses: { ...response200( @@ -217,7 +227,7 @@ export const spacePort = { ...requestBodySchema({ type: 'object', required: ['from_body_id', 'target'], - properties: { from_body_id: { type: 'string' }, target: targetSchema }, + properties: { from_body_id: { type: 'integer' }, target: targetSchema }, }), responses: { ...response200( @@ -254,7 +264,7 @@ export const spacePort = { description: 'Only present if the target is an asteroid with platforms on it.', items: { type: 'object', - properties: { empire_id: { type: 'string' }, empire_name: { type: 'string' } }, + properties: { empire_id: { type: 'integer' }, empire_name: { type: 'string' } }, }, }, fleet_send_limit: { type: 'integer' }, @@ -273,7 +283,7 @@ export const spacePort = { ...requestBodySchema({ type: 'object', required: ['ship_id', 'target'], - properties: { ship_id: { type: 'string' }, target: targetSchema }, + properties: { ship_id: { type: 'integer' }, target: targetSchema }, }), responses: { ...response200('Sends a single ship to a body or star. Use with get_ships_for.', { @@ -293,7 +303,7 @@ export const spacePort = { type: 'object', required: ['from_body_id', 'target', 'types', 'arrival'], properties: { - from_body_id: { type: 'string' }, + from_body_id: { type: 'integer' }, target: targetSchema, types: { type: 'array', @@ -368,7 +378,7 @@ export const spacePort = { type: 'object', required: ['ship_ids', 'target'], properties: { - ship_ids: { type: 'array', items: { type: 'string' } }, + ship_ids: { type: 'array', items: { type: 'integer' } }, target: targetSchema, set_speed: { type: 'integer', @@ -397,7 +407,7 @@ export const spacePort = { ...requestBodySchema({ type: 'object', required: ['building_id', 'ship_id'], - properties: { building_id: { type: 'string' }, ship_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, ship_id: { type: 'integer' } }, }), responses: { ...response200( @@ -438,8 +448,8 @@ export const spacePort = { type: 'object', required: ['building_id', 'ship_id', 'name'], properties: { - building_id: { type: 'string' }, - ship_id: { type: 'string' }, + building_id: { type: 'integer' }, + ship_id: { type: 'integer' }, name: { type: 'string', minLength: 1, maxLength: 30 }, }, }), @@ -460,7 +470,7 @@ export const spacePort = { ...requestBodySchema({ type: 'object', required: ['building_id', 'ship_id'], - properties: { building_id: { type: 'string' }, ship_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, ship_id: { type: 'integer' } }, }), responses: { ...response200('Destroys a docked ship.', { @@ -480,8 +490,8 @@ export const spacePort = { type: 'object', required: ['building_id', 'ship_ids'], properties: { - building_id: { type: 'string' }, - ship_ids: { type: 'array', items: { type: 'string' } }, + building_id: { type: 'integer' }, + ship_ids: { type: 'array', items: { type: 'integer' } }, }, }), responses: { @@ -502,7 +512,7 @@ export const spacePort = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 per page.' }, }, }), @@ -531,7 +541,7 @@ export const spacePort = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 per page.' }, }, }), @@ -559,7 +569,7 @@ export const spacePort = { ...requestBodySchema({ type: 'object', required: ['on_body_id', 'to_body_id'], - properties: { on_body_id: { type: 'string' }, to_body_id: { type: 'string' } }, + properties: { on_body_id: { type: 'integer' }, to_body_id: { type: 'integer' } }, }), responses: { ...response200('Gathers the ships and spies needed to call send_spies.', { @@ -577,12 +587,12 @@ export const spacePort = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, level: { type: 'integer' }, name: { type: 'string' }, assigned_to: { type: 'object', - properties: { body_id: { type: 'string' }, name: { type: 'string' } }, + properties: { body_id: { type: 'integer' }, name: { type: 'string' } }, }, }, }, @@ -602,10 +612,10 @@ export const spacePort = { type: 'object', required: ['on_body_id', 'to_body_id', 'ship_id', 'spy_ids'], properties: { - on_body_id: { type: 'string' }, - to_body_id: { type: 'string' }, - ship_id: { type: 'string' }, - spy_ids: { type: 'array', items: { type: 'string' } }, + on_body_id: { type: 'integer' }, + to_body_id: { type: 'integer' }, + ship_id: { type: 'integer' }, + spy_ids: { type: 'array', items: { type: 'integer' } }, }, }), responses: { @@ -616,10 +626,10 @@ export const spacePort = { required: ['ship', 'spies_sent', 'spies_not_sent', 'status'], properties: { ship: shipSchema, - spies_sent: { type: 'array', items: { type: 'string' } }, + spies_sent: { type: 'array', items: { type: 'integer' } }, spies_not_sent: { type: 'array', - items: { type: 'string' }, + items: { type: 'integer' }, description: 'Should only be non-empty in edge cases (e.g. a spy died between calls).', }, @@ -639,9 +649,9 @@ export const spacePort = { type: 'object', required: ['on_body_id', 'to_body_id'], properties: { - on_body_id: { type: 'string', description: 'The planet the spies are currently on.' }, + on_body_id: { type: 'integer', description: 'The planet the spies are currently on.' }, to_body_id: { - type: 'string', + type: 'integer', description: 'The planet the spies should be brought to, and the ship will be dispatched from.', }, @@ -658,12 +668,12 @@ export const spacePort = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, level: { type: 'integer' }, name: { type: 'string' }, assigned_to: { type: 'object', - properties: { body_id: { type: 'string' }, name: { type: 'string' } }, + properties: { body_id: { type: 'integer' }, name: { type: 'string' } }, }, }, }, @@ -683,14 +693,14 @@ export const spacePort = { type: 'object', required: ['on_body_id', 'to_body_id', 'ship_id', 'spy_ids'], properties: { - on_body_id: { type: 'string', description: 'The planet the spies are currently on.' }, + on_body_id: { type: 'integer', description: 'The planet the spies are currently on.' }, to_body_id: { - type: 'string', + type: 'integer', description: 'The planet the spies should be brought to, and the ship will be dispatched from.', }, - ship_id: { type: 'string' }, - spy_ids: { type: 'array', items: { type: 'string' } }, + ship_id: { type: 'integer' }, + spy_ids: { type: 'array', items: { type: 'integer' } }, }, }), responses: { @@ -714,7 +724,7 @@ export const spacePort = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 per page.' }, }, }), diff --git a/src/spec/paths/buildings/spacestationlab.ts b/src/spec/paths/buildings/spacestationlab.ts index f90affa..1ecc654 100644 --- a/src/spec/paths/buildings/spacestationlab.ts +++ b/src/spec/paths/buildings/spacestationlab.ts @@ -16,7 +16,7 @@ const base = buildingBase('SpaceStationLab'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const makePlanSchema = { @@ -65,7 +65,7 @@ export const spaceStationLab = { type: 'object', required: ['building_id', 'type', 'level'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, type: { type: 'string', description: "Key from view's make_plan > types, e.g. 'ibs'." }, level: { type: 'integer', minimum: 1, maximum: 30 }, }, diff --git a/src/spec/paths/buildings/subspacesupplydepot.ts b/src/spec/paths/buildings/subspacesupplydepot.ts index 0e2c5f0..d735696 100644 --- a/src/spec/paths/buildings/subspacesupplydepot.ts +++ b/src/spec/paths/buildings/subspacesupplydepot.ts @@ -14,7 +14,7 @@ const base = buildingBase('SubspaceSupplyDepot'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); // Shared response shape for the transmit_* methods and complete_build_queue — all convert seconds diff --git a/src/spec/paths/buildings/templeofthedrajilites.ts b/src/spec/paths/buildings/templeofthedrajilites.ts index fbea15d..9d18af1 100644 --- a/src/spec/paths/buildings/templeofthedrajilites.ts +++ b/src/spec/paths/buildings/templeofthedrajilites.ts @@ -22,8 +22,8 @@ export const templeOfTheDrajilites = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, - star_id: { type: 'string', description: 'Defaults to the star the Temple is built on.' }, + building_id: { type: 'integer' }, + star_id: { type: 'integer', description: 'Defaults to the star the Temple is built on.' }, }, }), responses: { @@ -36,7 +36,7 @@ export const templeOfTheDrajilites = { items: { type: 'object', required: ['id', 'name'], - properties: { id: { type: 'string' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, }, }, status: statusSchema(), @@ -54,9 +54,9 @@ export const templeOfTheDrajilites = { type: 'object', required: ['building_id', 'planet_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, planet_id: { - type: 'string', + type: 'integer', description: 'Must be a planet id, not a body id (e.g. asteroids are not valid). Must be within range — 10 star map units per level of the Temple.', }, diff --git a/src/spec/paths/buildings/thedillonforge.ts b/src/spec/paths/buildings/thedillonforge.ts index 5460448..291196c 100644 --- a/src/spec/paths/buildings/thedillonforge.ts +++ b/src/spec/paths/buildings/thedillonforge.ts @@ -14,7 +14,7 @@ const base = buildingBase('TheDillonForge'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const tasksSchema = { @@ -65,7 +65,7 @@ export const theDillonForge = { type: 'object', required: ['building_id', 'plan_class', 'level'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, plan_class: { type: 'string', description: "The plan's class, as returned by view's tasks > make_plan.", @@ -98,7 +98,7 @@ export const theDillonForge = { type: 'object', required: ['building_id', 'plan_class', 'level', 'quantity'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, plan_class: { type: 'string', description: "The plan's class, as returned by view's tasks > split_plan.", diff --git a/src/spec/paths/buildings/themepark.ts b/src/spec/paths/buildings/themepark.ts index 124483d..1cc6ec3 100644 --- a/src/spec/paths/buildings/themepark.ts +++ b/src/spec/paths/buildings/themepark.ts @@ -30,7 +30,7 @@ export const themePark = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: { ...response200( diff --git a/src/spec/paths/buildings/trade.ts b/src/spec/paths/buildings/trade.ts index 04a355e..22deaad 100644 --- a/src/spec/paths/buildings/trade.ts +++ b/src/spec/paths/buildings/trade.ts @@ -14,7 +14,7 @@ const base = buildingBase('Trade'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); // A tradeable item, per the Trade docs — resources (quantity-based), glyphs, plans, prisoners, or ships. @@ -28,21 +28,28 @@ const tradeableItemSchema = { plan_type: { type: 'string' }, level: { type: 'integer' }, extra_build_level: { type: 'integer' }, - prisoner_id: { type: 'string' }, - ship_id: { type: 'string' }, + prisoner_id: { type: 'integer' }, + ship_id: { type: 'integer' }, }, }; +// A posted-trade row as returned by view_market / view_my_market. Matches the transporter / +// mercenaries guild market row shape: `date_offered` and a pre-rendered `offer` string list +// (e.g. "10,000 apple"), not the typed tradeableItemSchema used when *posting* a trade. const marketEntrySchema = { type: 'object', - required: ['id', 'date', 'ask', 'offer'], + required: ['id', 'date_offered', 'ask', 'offer'], properties: { - id: { type: 'string' }, - date: { type: 'string' }, + id: { type: 'integer' }, + date_offered: { type: 'string' }, ask: { type: 'number' }, - offer: { type: 'array', items: tradeableItemSchema }, - empire: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' } } }, - body: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' } } }, + offer: { + type: 'array', + items: { type: 'string' }, + description: 'Human-readable item descriptions, e.g. "10,000 apple".', + }, + empire: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' } } }, + body: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' } } }, transmitter_delivery_time: { type: 'integer' }, }, }; @@ -58,7 +65,7 @@ export const trade = { type: 'object', required: ['building_id', 'offer', 'ask'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, offer: { type: 'array', items: tradeableItemSchema }, ask: { type: 'number', @@ -66,14 +73,14 @@ export const trade = { maximum: 100, description: 'Essentia amount requested.', }, - options: { type: 'object', properties: { ship_id: { type: 'string' } } }, + options: { type: 'object', properties: { ship_id: { type: 'integer' } } }, }, }), responses: { ...response200('Posts a trade offer for other players to accept.', { type: 'object', required: ['trade_id', 'status'], - properties: { trade_id: { type: 'string' }, status: statusSchema() }, + properties: { trade_id: { type: 'integer' }, status: statusSchema() }, }), ...response500(), }, @@ -87,7 +94,7 @@ export const trade = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 items per page.' }, filter: { type: 'string', @@ -98,9 +105,13 @@ export const trade = { responses: { ...response200("Lists other players' posted trades.", { type: 'object', - required: ['trades', 'status'], + required: ['trades', 'trade_count', 'status'], properties: { trades: { type: 'array', items: marketEntrySchema }, + trade_count: { + type: 'integer', + description: 'Total matching trades across all pages (the pager is sized from this).', + }, status: statusSchema(), }, }), @@ -116,16 +127,20 @@ export const trade = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1.' }, }, }), responses: { ...response200('Lists trades posted by this empire.', { type: 'object', - required: ['trades', 'status'], + required: ['trades', 'trade_count', 'status'], properties: { trades: { type: 'array', items: marketEntrySchema }, + trade_count: { + type: 'integer', + description: 'Total trades posted by this empire across all pages.', + }, status: statusSchema(), }, }), @@ -140,7 +155,7 @@ export const trade = { ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], - properties: { building_id: { type: 'string' }, trade_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, trade_id: { type: 'integer' } }, }), responses: { ...response200( @@ -158,7 +173,7 @@ export const trade = { ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], - properties: { building_id: { type: 'string' }, trade_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, trade_id: { type: 'integer' } }, }), responses: { ...response200('Cancels a trade this empire posted and retrieves the offered items.', { @@ -178,16 +193,16 @@ export const trade = { type: 'object', required: ['building_id', 'target_id', 'items'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, target_id: { - type: 'string', + type: 'integer', description: 'The destination planet, which must be owned by this empire.', }, items: { type: 'array', items: tradeableItemSchema }, options: { type: 'object', properties: { - ship_id: { type: 'string' }, + ship_id: { type: 'integer' }, stay: { type: 'integer', enum: [1, 0], @@ -242,7 +257,7 @@ export const trade = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' }, target_body_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, target_body_id: { type: 'integer' } }, }), responses: { ...response200('Lists cargo vessels available for trading, with estimated travel time.', { @@ -254,7 +269,7 @@ export const trade = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, type: { type: 'string' }, hold_size: { type: 'integer' }, @@ -285,7 +300,7 @@ export const trade = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, type: { type: 'string' }, hold_size: { type: 'integer' }, @@ -315,7 +330,7 @@ export const trade = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, task: { type: 'string' }, speed: { type: 'integer' }, @@ -345,7 +360,7 @@ export const trade = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, task: { type: 'string' }, speed: { type: 'integer' }, @@ -375,7 +390,7 @@ export const trade = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, resource_type: { type: 'string' }, resource_hour: { type: 'integer' }, percent_transferred: { type: 'number' }, @@ -399,8 +414,8 @@ export const trade = { type: 'object', required: ['building_id', 'target_id', 'resource_type', 'resource_hour'], properties: { - building_id: { type: 'string' }, - target_id: { type: 'string' }, + building_id: { type: 'integer' }, + target_id: { type: 'integer' }, resource_type: { type: 'string' }, resource_hour: { type: 'integer' }, }, @@ -423,8 +438,8 @@ export const trade = { type: 'object', required: ['building_id', 'supply_chain_id', 'resource_type', 'resource_hour'], properties: { - building_id: { type: 'string' }, - supply_chain_id: { type: 'string' }, + building_id: { type: 'integer' }, + supply_chain_id: { type: 'integer' }, resource_type: { type: 'string' }, resource_hour: { type: 'integer', description: 'Set to 0 to suspend the chain.' }, }, @@ -446,7 +461,7 @@ export const trade = { ...requestBodySchema({ type: 'object', required: ['building_id', 'supply_chain_id'], - properties: { building_id: { type: 'string' }, supply_chain_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, supply_chain_id: { type: 'integer' } }, }), responses: { ...response200('Removes a supply chain.', { @@ -465,7 +480,7 @@ export const trade = { ...requestBodySchema({ type: 'object', required: ['building_id', 'ship_id'], - properties: { building_id: { type: 'string' }, ship_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, ship_id: { type: 'integer' } }, }), responses: { ...response200('Assigns a hulk to supply chain service. Throws 1009 on failure.', { @@ -484,7 +499,7 @@ export const trade = { ...requestBodySchema({ type: 'object', required: ['building_id', 'ship_id'], - properties: { building_id: { type: 'string' }, ship_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, ship_id: { type: 'integer' } }, }), responses: { ...response200('Returns a hulk to the spaceport from supply chain duty.', { @@ -511,7 +526,7 @@ export const trade = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, waste_hour: { type: 'integer' }, percent_transferred: { type: 'number' }, }, @@ -532,8 +547,8 @@ export const trade = { type: 'object', required: ['building_id', 'waste_chain_id', 'waste_hour'], properties: { - building_id: { type: 'string' }, - waste_chain_id: { type: 'string' }, + building_id: { type: 'integer' }, + waste_chain_id: { type: 'integer' }, waste_hour: { type: 'integer' }, }, }), @@ -554,7 +569,7 @@ export const trade = { ...requestBodySchema({ type: 'object', required: ['building_id', 'ship_id'], - properties: { building_id: { type: 'string' }, ship_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, ship_id: { type: 'integer' } }, }), responses: { ...response200('Assigns a scow to waste transport duty. Throws 1009 on failure.', { @@ -573,7 +588,7 @@ export const trade = { ...requestBodySchema({ type: 'object', required: ['building_id', 'ship_id'], - properties: { building_id: { type: 'string' }, ship_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, ship_id: { type: 'integer' } }, }), responses: { ...response200('Returns a scow to the spaceport from waste transport duty.', { @@ -600,7 +615,7 @@ export const trade = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, level: { type: 'integer' }, sentence_expires: { type: 'string' }, @@ -674,7 +689,7 @@ export const trade = { ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], - properties: { building_id: { type: 'string' }, trade_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, trade_id: { type: 'integer' } }, }), responses: { ...response200('Flags a suspicious trade for moderation review.', { diff --git a/src/spec/paths/buildings/transporter.ts b/src/spec/paths/buildings/transporter.ts index 0e5b646..9049ccc 100644 --- a/src/spec/paths/buildings/transporter.ts +++ b/src/spec/paths/buildings/transporter.ts @@ -14,7 +14,7 @@ const base = buildingBase('Transporter'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); // A tradeable/pushable item — resources (name/quantity), glyphs, plans, prisoners, or ships. @@ -25,10 +25,10 @@ const tradeableItemSchema = { // Resources are passed as { type: , quantity }. name: { type: 'string' }, quantity: { type: 'integer' }, - glyph_id: { type: 'string' }, - plan_id: { type: 'string' }, - prisoner_id: { type: 'string' }, - ship_id: { type: 'string' }, + glyph_id: { type: 'integer' }, + plan_id: { type: 'integer' }, + prisoner_id: { type: 'integer' }, + ship_id: { type: 'integer' }, }, }; @@ -36,7 +36,7 @@ const marketEntrySchema = { type: 'object', required: ['id', 'date_offered', 'ask', 'offer'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, date_offered: { type: 'string' }, ask: { type: 'number', description: 'Essentia amount requested.' }, offer: { @@ -44,7 +44,7 @@ const marketEntrySchema = { items: { type: 'string' }, description: 'Human-readable descriptions of the offered items.', }, - empire: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' } } }, + empire: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' } } }, }, }; @@ -61,7 +61,7 @@ export const transporter = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, @@ -80,7 +80,7 @@ export const transporter = { type: 'object', required: ['building_id', 'offer', 'ask'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, offer: { type: 'array', items: tradeableItemSchema, @@ -100,7 +100,7 @@ export const transporter = { { type: 'object', required: ['trade_id', 'status'], - properties: { trade_id: { type: 'string' }, status: statusSchema() }, + properties: { trade_id: { type: 'integer' }, status: statusSchema() }, } ), ...response500(), @@ -122,7 +122,7 @@ export const transporter = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, type: { type: 'string' }, hold_size: { type: 'integer' }, @@ -153,7 +153,7 @@ export const transporter = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, level: { type: 'integer' }, sentence_expires: { type: 'string' }, @@ -233,7 +233,7 @@ export const transporter = { ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], - properties: { building_id: { type: 'string' }, trade_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, trade_id: { type: 'integer' } }, }), responses: { ...response200('Removes a trade this empire posted and retrieves the offered items.', { @@ -252,7 +252,7 @@ export const transporter = { ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], - properties: { building_id: { type: 'string' }, trade_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, trade_id: { type: 'integer' } }, }), responses: { ...response200( @@ -271,7 +271,7 @@ export const transporter = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 items per page.' }, filter: { type: 'string', @@ -302,7 +302,7 @@ export const transporter = { type: 'object', required: ['building_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. 25 items per page.' }, }, }), @@ -348,8 +348,8 @@ export const transporter = { type: 'object', required: ['building_id', 'target_id', 'items'], properties: { - building_id: { type: 'string' }, - target_id: { type: 'string', description: 'A planet controlled by this empire.' }, + building_id: { type: 'integer' }, + target_id: { type: 'integer', description: 'A planet controlled by this empire.' }, items: { type: 'array', items: tradeableItemSchema, @@ -375,7 +375,7 @@ export const transporter = { type: 'object', required: ['building_id', 'have', 'want', 'quantity'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, have: { type: 'string', description: 'The resource type this empire has. See get_stored_resources.', @@ -401,7 +401,7 @@ export const transporter = { ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], - properties: { building_id: { type: 'string' }, trade_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, trade_id: { type: 'integer' } }, }), responses: { ...response200('Reports a trade suspected of abusing the trade system.', { diff --git a/src/spec/paths/buildings/wasteexchanger.ts b/src/spec/paths/buildings/wasteexchanger.ts index bbc8ab3..416b87b 100644 --- a/src/spec/paths/buildings/wasteexchanger.ts +++ b/src/spec/paths/buildings/wasteexchanger.ts @@ -17,7 +17,7 @@ const recycleSchema = { seconds_remaining: { type: 'integer' }, can: { type: 'integer', enum: [1, 0] }, seconds_per_resource: { - type: 'string', + type: 'integer', description: 'Seconds required to recycle one unit of a resource, precalculated for convenience.', }, @@ -64,7 +64,7 @@ export const wasteExchanger = { type: 'object', required: ['building_id', 'water', 'ore', 'energy'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, water: { type: 'integer', description: 'Amount of water to produce from waste.' }, ore: { type: 'integer', description: 'Amount of ore to produce from waste.' }, energy: { type: 'integer', description: 'Amount of energy to produce from waste.' }, @@ -88,7 +88,7 @@ export const wasteExchanger = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: recycleResultSchema( "Spends 2 essentia to complete the current recycling job immediately. Returns the building's view." diff --git a/src/spec/paths/buildings/wasterecycling.ts b/src/spec/paths/buildings/wasterecycling.ts index 2f9ee17..9aa03bd 100644 --- a/src/spec/paths/buildings/wasterecycling.ts +++ b/src/spec/paths/buildings/wasterecycling.ts @@ -17,7 +17,7 @@ const recycleSchema = { seconds_remaining: { type: 'integer' }, can: { type: 'integer', enum: [1, 0] }, seconds_per_resource: { - type: 'string', + type: 'integer', description: 'Seconds required to recycle one unit of a resource, precalculated for convenience.', }, @@ -64,7 +64,7 @@ export const wasteRecycling = { type: 'object', required: ['building_id', 'water', 'ore', 'energy'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, water: { type: 'integer', description: 'Amount of water to produce from waste.' }, ore: { type: 'integer', description: 'Amount of ore to produce from waste.' }, energy: { type: 'integer', description: 'Amount of energy to produce from waste.' }, @@ -88,7 +88,7 @@ export const wasteRecycling = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: recycleResultSchema( "Spends 2 essentia to complete the current recycling job immediately. Returns the building's view." diff --git a/src/spec/paths/buildings/waterstorage.ts b/src/spec/paths/buildings/waterstorage.ts index 05c1cde..ccbbf0b 100644 --- a/src/spec/paths/buildings/waterstorage.ts +++ b/src/spec/paths/buildings/waterstorage.ts @@ -22,7 +22,7 @@ export const waterStorage = { type: 'object', required: ['building_id', 'amount'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, amount: { type: 'integer', description: 'Amount of water to convert into waste.' }, }, }), diff --git a/src/spec/paths/empire.ts b/src/spec/paths/empire.ts index 0bcc533..ec0e464 100644 --- a/src/spec/paths/empire.ts +++ b/src/spec/paths/empire.ts @@ -132,7 +132,7 @@ export const empire = { responses: { ...response200( 'Creates a new empire and returns its empire_id. The empire is not playable yet — either call update_species and then found, or skip the species step and call found directly. Throws 1000, 1001, 1002, and 1014. On a 1014 the error data carries fresh captcha information that must be used for the next attempt, since a captcha cannot be used more than once.', - { type: 'string' } + { type: 'integer', description: 'The new empire id.' } ), ...response500(), }, @@ -195,7 +195,7 @@ export const empire = { required: ['session_id', 'welcome_message_id', 'status'], properties: { session_id: { type: 'string' }, - welcome_message_id: { type: 'string' }, + welcome_message_id: { type: 'integer' }, status: statusSchema(), }, } @@ -207,7 +207,7 @@ export const empire = { type: 'object', required: ['empire_id', 'api_key'], properties: { - empire_id: { type: 'string', description: 'The empire to found.' }, + empire_id: { type: 'integer', description: 'The empire to found.' }, api_key: { type: 'string', description: @@ -747,7 +747,7 @@ export const empire = { required: ['empire_id'], properties: { empire_id: { - type: 'number', + type: 'integer', description: "The id of the empire for which you'd like to retrieve the public profile.", }, @@ -775,7 +775,7 @@ export const empire = { required: [], properties: { empire_id: { - type: 'number', + type: 'integer', description: 'The unique id of the empire to recover. Choose one of empire_id, empire_name, or email.', }, @@ -881,7 +881,7 @@ export const empire = { type: 'array', items: { type: 'object', - properties: { id: { type: 'number' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, required: ['id', 'name'], }, }, @@ -1274,7 +1274,7 @@ export const empire = { required: ['empire_id', 'params'], properties: { empire_id: { - type: 'string', + type: 'integer', description: 'The id of the empire you wish to update a species for.', }, params: { @@ -1420,7 +1420,7 @@ export const empire = { items: { type: 'object', required: ['id', 'reason'], - properties: { id: { type: 'string' }, reason: { type: 'string' } }, + properties: { id: { type: 'integer' }, reason: { type: 'string' } }, }, }, status: statusSchema(), @@ -1444,7 +1444,7 @@ export const empire = { description: 'The name of another alliance, all of whom are automatically selected.', }, alliance_id: { - type: 'string', + type: 'integer', description: 'The id of another alliance, all of whom are automatically selected.', }, empires: { diff --git a/src/spec/paths/inbox.ts b/src/spec/paths/inbox.ts index 6023096..48a66f2 100644 --- a/src/spec/paths/inbox.ts +++ b/src/spec/paths/inbox.ts @@ -33,13 +33,13 @@ const messageSummarySchema = { 'tags', ], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, subject: { type: 'string' }, date: { type: 'string' }, from: { type: 'string' }, - from_id: { type: 'string' }, + from_id: { type: 'integer' }, to: { type: 'string' }, - to_id: { type: 'string' }, + to_id: { type: 'integer' }, has_read: { type: 'integer', enum: [1, 0] }, has_replied: { type: 'integer', enum: [1, 0] }, body_preview: { type: 'string' }, @@ -124,7 +124,7 @@ export const inbox = { ...requestBodySchema({ type: 'object', required: ['message_id'], - properties: { message_id: { type: 'string' } }, + properties: { message_id: { type: 'integer' } }, }), responses: { @@ -152,11 +152,11 @@ export const inbox = { 'tags', ], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, from: { type: 'string' }, - from_id: { type: 'string' }, + from_id: { type: 'integer' }, to: { type: 'string' }, - to_id: { type: 'string' }, + to_id: { type: 'integer' }, subject: { type: 'string' }, body: { type: 'string' }, date: { type: 'string' }, @@ -164,10 +164,10 @@ export const inbox = { has_replied: { type: 'integer', enum: [1, 0] }, has_archived: { type: 'integer', enum: [1, 0] }, has_trashed: { type: 'integer', enum: [1, 0] }, - in_reply_to: { type: 'string' }, + in_reply_to: { type: 'integer' }, // The complete list of empires who received the message. `to`/`to_id` above is // just the empire that owns this particular copy of the message. - recipients: { type: 'array', items: { type: 'string' } }, + recipients: { type: 'array', items: { type: 'integer' } }, tags: { type: 'array', items: { type: 'string', enum: MESSAGE_TAGS } }, // No more than one of each attachment type per message. attachments: { @@ -226,7 +226,7 @@ export const inbox = { ...requestBodySchema({ type: 'object', required: ['message_ids'], - properties: { message_ids: { type: 'array', items: { type: 'string' } } }, + properties: { message_ids: { type: 'array', items: { type: 'integer' } } }, }), responses: { @@ -236,8 +236,8 @@ export const inbox = { type: 'object', required: ['success', 'failure', 'status'], properties: { - success: { type: 'array', items: { type: 'string' } }, - failure: { type: 'array', items: { type: 'string' } }, + success: { type: 'array', items: { type: 'integer' } }, + failure: { type: 'array', items: { type: 'integer' } }, status: statusSchema(), }, } @@ -254,7 +254,7 @@ export const inbox = { ...requestBodySchema({ type: 'object', required: ['message_ids'], - properties: { message_ids: { type: 'array', items: { type: 'string' } } }, + properties: { message_ids: { type: 'array', items: { type: 'integer' } } }, }), responses: { @@ -264,7 +264,7 @@ export const inbox = { type: 'object', required: ['success', 'status'], properties: { - success: { type: 'array', items: { type: 'string' } }, + success: { type: 'array', items: { type: 'integer' } }, status: statusSchema(), }, } @@ -309,7 +309,7 @@ export const inbox = { properties: { deleted: { type: 'array', - items: { type: 'string' }, + items: { type: 'integer' }, description: 'Only present when return_ids is true.', }, deleted_count: { type: 'integer' }, @@ -340,9 +340,9 @@ export const inbox = { options: { type: 'object', properties: { - in_reply_to: { type: 'string' }, + in_reply_to: { type: 'integer' }, forward: { - type: 'string', + type: 'integer', description: 'A message id whose attachments should be sent along with this message.', }, diff --git a/src/spec/paths/map.ts b/src/spec/paths/map.ts index 0d37edf..26c5e28 100644 --- a/src/spec/paths/map.ts +++ b/src/spec/paths/map.ts @@ -4,7 +4,7 @@ const empireSnippetSchema = { type: 'object', required: ['id', 'name', 'alignment', 'is_isolationist'], properties: { - id: { type: 'number' }, + id: { type: 'integer' }, name: { type: 'string' }, alignment: { type: 'string', enum: ['ally', 'self', 'hostile'] }, is_isolationist: { type: 'integer', enum: [1, 0] }, @@ -15,7 +15,7 @@ const stationSnippetSchema = { type: 'object', required: ['id', 'x', 'y', 'name'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, name: { type: 'string' }, @@ -27,7 +27,7 @@ const bodySnippetSchema = { required: ['name', 'id', 'orbit', 'x', 'y', 'type', 'image', 'size'], properties: { name: { type: 'string' }, - id: { type: 'number' }, + id: { type: 'integer' }, orbit: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, @@ -50,7 +50,8 @@ const starDetailSchema = { x: { type: 'number' }, y: { type: 'number' }, zone: { type: 'string' }, - id: { type: 'string' }, + influence: { type: 'number' }, + id: { type: 'integer' }, // Only present if this star is under the influence of a space station. station: stationSnippetSchema, // Only present if a probe is present in the system. @@ -94,19 +95,24 @@ export const map = { type: 'array', items: { type: 'object', - required: ['name', 'color', 'x', 'y', 'id', 'bodies'], + required: ['name', 'color', 'x', 'y', 'id', 'zone', 'influence', 'bodies'], properties: { name: { type: 'string' }, color: { type: 'string' }, x: { type: 'number' }, y: { type: 'number' }, - id: { type: 'number' }, + id: { type: 'integer' }, + zone: { type: 'string' }, + influence: { + type: 'number', + description: 'May be null when the star is outside any station jurisdiction.', + }, // Only present if this star is under the influence of a space station. station: { type: 'object', required: ['id', 'x', 'y', 'name', 'alliance'], properties: { - id: { type: 'number' }, + id: { type: 'integer' }, x: { type: 'number' }, y: { type: 'number' }, name: { type: 'string' }, @@ -115,7 +121,7 @@ export const map = { required: ['name', 'id', 'image'], properties: { name: { type: 'string' }, - id: { type: 'number' }, + id: { type: 'integer' }, image: { type: 'string' }, }, }, @@ -172,7 +178,7 @@ export const map = { ...requestBodySchema({ type: 'object', required: ['star_id'], - properties: { star_id: { type: 'string' } }, + properties: { star_id: { type: 'integer' } }, }), responses: { @@ -199,7 +205,7 @@ export const map = { ...requestBodySchema({ type: 'object', required: ['star_id'], - properties: { star_id: { type: 'string' } }, + properties: { star_id: { type: 'integer' } }, }), responses: starDetailResponses('Retrieves info on a single star.'), }, @@ -311,7 +317,7 @@ export const map = { ...requestBodySchema({ type: 'object', required: ['star_id'], - properties: { star_id: { type: 'string' } }, + properties: { star_id: { type: 'integer' } }, }), responses: { @@ -324,11 +330,11 @@ export const map = { type: 'array', items: { type: 'object', - required: ['id', 'name', 'descripition', 'date_enacted'], + required: ['id', 'name', 'description', 'date_enacted'], properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, - descripition: { type: 'string' }, + description: { type: 'string' }, date_enacted: { type: 'string' }, }, }, diff --git a/src/spec/paths/modules/artmuseum.ts b/src/spec/paths/modules/artmuseum.ts index 4ebcf88..c059750 100644 --- a/src/spec/paths/modules/artmuseum.ts +++ b/src/spec/paths/modules/artmuseum.ts @@ -18,7 +18,7 @@ export const artMuseum = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: { ...response200('Retrieves the properties of this module.', { @@ -28,7 +28,7 @@ export const artMuseum = { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, diff --git a/src/spec/paths/modules/culinaryinstitute.ts b/src/spec/paths/modules/culinaryinstitute.ts index 20fd350..770c308 100644 --- a/src/spec/paths/modules/culinaryinstitute.ts +++ b/src/spec/paths/modules/culinaryinstitute.ts @@ -18,7 +18,7 @@ export const culinaryInstitute = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: { ...response200('Retrieves the properties of this module.', { @@ -28,7 +28,7 @@ export const culinaryInstitute = { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, diff --git a/src/spec/paths/modules/ibs.ts b/src/spec/paths/modules/ibs.ts index a159afd..3648473 100644 --- a/src/spec/paths/modules/ibs.ts +++ b/src/spec/paths/modules/ibs.ts @@ -18,7 +18,7 @@ export const ibs = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: { ...response200('Retrieves the properties of this module.', { @@ -28,7 +28,7 @@ export const ibs = { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, diff --git a/src/spec/paths/modules/operahouse.ts b/src/spec/paths/modules/operahouse.ts index 8044b46..7d0e054 100644 --- a/src/spec/paths/modules/operahouse.ts +++ b/src/spec/paths/modules/operahouse.ts @@ -18,7 +18,7 @@ export const operaHouse = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: { ...response200('Retrieves the properties of this module.', { @@ -28,7 +28,7 @@ export const operaHouse = { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, diff --git a/src/spec/paths/modules/parliament.ts b/src/spec/paths/modules/parliament.ts index 0437933..6d36694 100644 --- a/src/spec/paths/modules/parliament.ts +++ b/src/spec/paths/modules/parliament.ts @@ -12,14 +12,14 @@ const base = buildingBase('Parliament'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); // Shared shape returned by view_propositions, cast_vote, and every propose_* method. const propositionSchema = { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, description: { type: 'string' }, votes_needed: { type: 'integer' }, @@ -29,7 +29,7 @@ const propositionSchema = { date_ends: { type: 'string' }, proposed_by: { type: 'object', - properties: { id: { type: 'string' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, }, my_vote: { type: 'integer', @@ -62,7 +62,7 @@ const proposeMethod = ( ...requestBodySchema({ type: 'object', required: ['building_id', ...extraRequired], - properties: { building_id: { type: 'string' }, ...extraProperties }, + properties: { building_id: { type: 'integer' }, ...extraProperties }, }), responses: propositionResponses(description), }, @@ -86,7 +86,7 @@ export const parliament = { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, @@ -111,7 +111,7 @@ export const parliament = { type: 'object', required: ['body_id'], properties: { - body_id: { type: 'string', description: 'The unique id of the space station.' }, + body_id: { type: 'integer', description: 'The unique id of the space station.' }, }, }), responses: { @@ -126,7 +126,7 @@ export const parliament = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, description: { type: 'string' }, date_enacted: { type: 'string' }, @@ -176,7 +176,7 @@ export const parliament = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, paid: { type: 'array', @@ -210,6 +210,7 @@ export const parliament = { items: { type: 'object', properties: { + id: { type: 'integer' }, name: { type: 'string' }, color: { type: 'string' }, x: { type: 'integer' }, @@ -219,7 +220,7 @@ export const parliament = { description: 'Only present if this star is under the influence of a space station.', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, x: { type: 'integer' }, y: { type: 'integer' }, name: { type: 'string' }, @@ -243,9 +244,9 @@ export const parliament = { type: 'object', required: ['building_id', 'star_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, star_id: { - type: 'string', + type: 'integer', description: 'The unique id of a star in jurisdiction. See get_stars_in_jurisdiction.', }, }, @@ -274,9 +275,9 @@ export const parliament = { type: 'object', required: ['building_id', 'asteroid_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, asteroid_id: { - type: 'string', + type: 'integer', description: 'The unique id of an asteroid in jurisdiction. See get_bodies_for_star_in_jurisdiction.', }, @@ -294,10 +295,10 @@ export const parliament = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, empire: { type: 'object', - properties: { id: { type: 'string' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, }, }, }, @@ -318,9 +319,9 @@ export const parliament = { type: 'object', required: ['building_id', 'proposition_id'], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, proposition_id: { - type: 'string', + type: 'integer', description: 'The id of the proposition being voted on. See view_propositions.', }, vote: { @@ -351,21 +352,21 @@ export const parliament = { 'propose_repeal_law', 'Proposes repealing an existing law. Requires Parliament level 5+.', ['law_id'], - { law_id: { type: 'string' } } + { law_id: { type: 'integer' } } ), ...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: 'string' } } + { to_empire_id: { type: 'integer' } } ), ...proposeMethod( 'propose_rename_star', 'Proposes renaming a star. Requires Parliament level 8+.', ['star_id', 'name'], - { star_id: { type: 'string' }, name: { type: 'string' } } + { star_id: { type: 'integer' }, name: { type: 'string' } } ), ...proposeMethod( @@ -386,7 +387,7 @@ export const parliament = { 'Proposes inducting a new member into the alliance; if passed, an invitation is sent. Requires Parliament level 10+.', ['empire_id'], { - empire_id: { type: 'string' }, + empire_id: { type: 'integer' }, message: { type: 'string', description: 'Optional personalized welcome message included in the invitation.', @@ -399,7 +400,7 @@ export const parliament = { 'Proposes expelling a member from the alliance. Requires Parliament level 10+.', ['empire_id'], { - empire_id: { type: 'string' }, + empire_id: { type: 'integer' }, message: { type: 'string', description: 'Optional reason. Cannot contain restricted characters or profanity.', @@ -411,14 +412,14 @@ export const parliament = { '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: 'string' } } + { to_empire_id: { type: 'integer' } } ), ...proposeMethod( 'propose_rename_asteroid', 'Proposes renaming an asteroid in the jurisdiction. Requires Parliament level 12+.', ['asteroid_id', 'name'], - { asteroid_id: { type: 'string' }, name: { type: 'string', maxLength: 30 } } + { asteroid_id: { type: 'integer' }, name: { type: 'string', maxLength: 30 } } ), ...proposeMethod( @@ -432,7 +433,7 @@ export const parliament = { ['platform_id'], { platform_id: { - type: 'string', + type: 'integer', description: 'See get_mining_platforms_for_asteroid_in_jurisdiction.', }, } @@ -450,7 +451,7 @@ export const parliament = { '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: 'string' }, + planet_id: { type: 'integer' }, resources: { type: 'integer', description: 'The amount of resources to send to the receiving planet.', @@ -462,7 +463,7 @@ export const parliament = { 'propose_rename_uninhabited', 'Proposes renaming an uninhabited planet in the jurisdiction. Requires Parliament level 17+.', ['planet_id', 'name'], - { planet_id: { type: 'string' }, name: { type: 'string', maxLength: 30 } } + { planet_id: { type: 'integer' }, name: { type: 'string', maxLength: 30 } } ), ...proposeMethod( @@ -490,7 +491,7 @@ export const parliament = { '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: 'string', description: 'See get_bodies_for_star_in_jurisdiction.' }, + body_id: { type: 'integer', description: 'See get_bodies_for_star_in_jurisdiction.' }, reason: { type: 'string' }, } ), @@ -499,6 +500,6 @@ export const parliament = { '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: 'string' } } + { alliance_id: { type: 'integer' } } ), }; diff --git a/src/spec/paths/modules/policestation.ts b/src/spec/paths/modules/policestation.ts index 36c8b63..2762a7c 100644 --- a/src/spec/paths/modules/policestation.ts +++ b/src/spec/paths/modules/policestation.ts @@ -12,7 +12,7 @@ const base = buildingBase('PoliceStation'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); const pagedRequestBody = (extraRequired: string[] = [], extraProperties: object = {}) => @@ -20,7 +20,7 @@ const pagedRequestBody = (extraRequired: string[] = [], extraProperties: object type: 'object', required: ['building_id', ...extraRequired], properties: { - building_id: { type: 'string' }, + building_id: { type: 'integer' }, page_number: { type: 'integer', description: 'Defaults to 1. Each page contains 25 results.', @@ -32,7 +32,7 @@ const pagedRequestBody = (extraRequired: string[] = [], extraProperties: object const shipSchema = { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, type: { type: 'string' }, type_human: { type: 'string' }, @@ -43,11 +43,11 @@ const shipSchema = { description: "Only included if the ship's stealth is low enough relative to the Police Station's level.", properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, empire: { type: 'object', - properties: { id: { type: 'string' }, name: { type: 'string' } }, + properties: { id: { type: 'integer' }, name: { type: 'string' } }, }, }, }, @@ -70,7 +70,7 @@ export const policeStation = { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, @@ -95,14 +95,18 @@ export const policeStation = { responses: { ...response200('Displays a list of the spies that have been captured.', { type: 'object', - required: ['prisoners', 'status'], + required: ['prisoners', 'status', 'captured_count'], properties: { + captured_count: { + type: 'integer', + description: 'Total captured spies across all pages (the pager is sized from this).', + }, prisoners: { type: 'array', items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, level: { type: 'integer' }, task: { type: 'string', enum: ['Captured', 'Prisoner Transport'] }, @@ -124,7 +128,7 @@ export const policeStation = { ...requestBodySchema({ type: 'object', required: ['building_id', 'prisoner_id'], - properties: { building_id: { type: 'string' }, prisoner_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, prisoner_id: { type: 'integer' } }, }), responses: { ...response200( @@ -142,7 +146,7 @@ export const policeStation = { ...requestBodySchema({ type: 'object', required: ['building_id', 'prisoner_id'], - properties: { building_id: { type: 'string' }, prisoner_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' }, prisoner_id: { type: 'integer' } }, }), responses: { ...response200('Releases a captured prisoner.', { @@ -164,8 +168,12 @@ export const policeStation = { 'Displays a list of the spies on your planet with a level lower than your Police Station.', { type: 'object', - required: ['spies', 'status'], + required: ['spies', 'status', 'spy_count'], properties: { + spy_count: { + type: 'integer', + description: 'Total foreign spies across all pages (the pager is sized from this).', + }, spies: { type: 'array', items: { @@ -225,14 +233,14 @@ export const policeStation = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, type: { type: 'string' }, type_human: { type: 'string' }, date_arrives: { type: 'string' }, from: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, type: { type: 'string' }, name: { type: 'string' }, }, @@ -240,7 +248,7 @@ export const policeStation = { to: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, type: { type: 'string' }, name: { type: 'string' }, }, diff --git a/src/spec/paths/modules/stationcommand.ts b/src/spec/paths/modules/stationcommand.ts index 092e77d..e4e9b69 100644 --- a/src/spec/paths/modules/stationcommand.ts +++ b/src/spec/paths/modules/stationcommand.ts @@ -12,46 +12,12 @@ const base = buildingBase('StationCommand'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }); // StationCommand.pod's `planet` block on `view` documents the space station's own body/resource -// status, reusing the same shape as body_status plus counts/stores similar to statusSchema's body. -const planetSchema = { - type: 'object', - properties: { - id: { type: 'string' }, - x: { type: 'integer' }, - y: { type: 'integer' }, - star_id: { type: 'string' }, - orbit: { type: 'integer' }, - type: { type: 'string' }, - name: { type: 'string' }, - image: { type: 'string' }, - size: { type: 'integer' }, - water: { type: 'integer' }, - ore: { type: 'object', additionalProperties: { type: 'integer' } }, - building_count: { type: 'integer' }, - population: { type: 'integer' }, - happiness: { type: 'integer' }, - happiness_hour: { type: 'integer' }, - food_stored: { type: 'integer' }, - food_capacity: { type: 'integer' }, - food_hour: { type: 'integer' }, - energy_stored: { type: 'integer' }, - energy_capacity: { type: 'integer' }, - energy_hour: { type: 'integer' }, - ore_hour: { type: 'integer' }, - ore_capacity: { type: 'integer' }, - ore_stored: { type: 'integer' }, - waste_hour: { type: 'integer' }, - waste_stored: { type: 'integer' }, - waste_capacity: { type: 'integer' }, - water_stored: { type: 'integer' }, - water_hour: { type: 'integer' }, - water_capacity: { type: 'integer' }, - }, -}; +// status — the shared planet_status shape (see src/spec/components.ts). +const planetSchema = { $ref: '#/components/schemas/planet_status' }; // Station Command Center. StationCommand.pod: "Command extends the view method to include a // `planet` section" plus `next_colony_cost`. @@ -70,7 +36,7 @@ export const stationCommand = { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, @@ -141,11 +107,11 @@ export const stationCommand = { items: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, from_body: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, @@ -154,7 +120,7 @@ export const stationCommand = { }, resource_hour: { type: 'integer' }, resource_type: { type: 'string' }, - percent_transferred: { type: 'integer' }, + percent_transferred: { type: 'number' }, stalled: { type: 'integer', enum: [1, 0] }, }, }, diff --git a/src/spec/paths/modules/warehouse.ts b/src/spec/paths/modules/warehouse.ts index 0eb1936..176eac3 100644 --- a/src/spec/paths/modules/warehouse.ts +++ b/src/spec/paths/modules/warehouse.ts @@ -18,7 +18,7 @@ export const warehouse = { ...requestBodySchema({ type: 'object', required: ['building_id'], - properties: { building_id: { type: 'string' } }, + properties: { building_id: { type: 'integer' } }, }), responses: { ...response200('Retrieves the properties of this module.', { @@ -28,7 +28,7 @@ export const warehouse = { building: { type: 'object', properties: { - id: { type: 'string' }, + id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, diff --git a/src/spec/paths/stats.ts b/src/spec/paths/stats.ts index 540b0e1..9bf2e21 100644 --- a/src/spec/paths/stats.ts +++ b/src/spec/paths/stats.ts @@ -42,7 +42,7 @@ const allianceRankEntrySchema = { 'dirtiest', ], properties: { - alliance_id: { type: 'string' }, + alliance_id: { type: 'integer' }, alliance_name: { type: 'string' }, member_count: { type: 'integer' }, space_station_count: { type: 'integer' }, @@ -75,10 +75,10 @@ const empireRankEntrySchema = { 'dirtiest', ], properties: { - empire_id: { type: 'string' }, + empire_id: { type: 'integer' }, empire_name: { type: 'string' }, // Always present, but null when the empire is not in an alliance. - alliance_id: { type: ['string', 'null'] }, + alliance_id: { type: ['integer', 'null'] }, alliance_name: { type: ['string', 'null'] }, colony_count: { type: 'integer' }, population: { type: 'integer' }, @@ -104,9 +104,9 @@ const colonyRankEntrySchema = { 'highest_building_level', ], properties: { - empire_id: { type: 'string' }, + empire_id: { type: 'integer' }, empire_name: { type: 'string' }, - planet_id: { type: 'string' }, + planet_id: { type: 'integer' }, planet_name: { type: 'string' }, population: { type: 'integer' }, building_count: { type: 'integer' }, @@ -128,9 +128,9 @@ const spyRankEntrySchema = { 'dirtiest', ], properties: { - empire_id: { type: 'string' }, + empire_id: { type: 'integer' }, empire_name: { type: 'string' }, - spy_id: { type: 'string' }, + spy_id: { type: 'integer' }, spy_name: { type: 'string' }, age: { type: 'integer' }, level: { type: 'integer' }, @@ -143,7 +143,7 @@ const medalWinnerSchema = { type: 'object', required: ['empire_id', 'empire_name', 'medal_name', 'medal_image', 'times_earned'], properties: { - empire_id: { type: 'string' }, + empire_id: { type: 'integer' }, empire_name: { type: 'string' }, medal_name: { type: 'string' }, medal_image: { type: 'string' }, @@ -238,7 +238,7 @@ export const stats = { type: 'object', required: ['alliance_id', 'alliance_name', 'page_number'], properties: { - alliance_id: { type: 'string' }, + alliance_id: { type: 'integer' }, alliance_name: { type: 'string' }, page_number: { type: 'integer' }, }, @@ -318,7 +318,7 @@ export const stats = { type: 'object', required: ['empire_id', 'empire_name', 'page_number'], properties: { - empire_id: { type: 'string' }, + empire_id: { type: 'integer' }, empire_name: { type: 'string' }, page_number: { type: 'integer' }, },