|
| 1 | +import type { ApiRequest, ApiSuccessResponse } from "./common.js"; |
| 2 | +import { buildApiRequest } from "./common.js"; |
| 3 | + |
| 4 | +export interface SaveHeader { |
| 5 | + /** |
| 6 | + * Version of the Save Game format this file was saved with. |
| 7 | + */ |
| 8 | + saveVersion: number; |
| 9 | + /** |
| 10 | + * Changelist of the game or dedicated server this file was saved by. |
| 11 | + */ |
| 12 | + buildVersion: number; |
| 13 | + /** |
| 14 | + * Name of the save game file in the filesystem. |
| 15 | + */ |
| 16 | + saveName: string; |
| 17 | + saveLocationInfo: string; |
| 18 | + /** |
| 19 | + * Path to the map package this save game file is based on. |
| 20 | + */ |
| 21 | + mapName: string; |
| 22 | + /** |
| 23 | + * Additional Map URL options this save game was saved with. |
| 24 | + */ |
| 25 | + mapOptions: string; |
| 26 | + /** |
| 27 | + * Name of the session this save game file belongs to. |
| 28 | + */ |
| 29 | + sessionName: string; |
| 30 | + /** |
| 31 | + * Amount of seconds the game has been running for in total since the session was created. |
| 32 | + */ |
| 33 | + playDurationSeconds: number; |
| 34 | + /** |
| 35 | + * Date and time on which the save game file was saved. |
| 36 | + */ |
| 37 | + saveDateTime: string; |
| 38 | + /** |
| 39 | + * True if this save game file was saved with mods. |
| 40 | + */ |
| 41 | + isModdedSave: boolean; |
| 42 | + /** |
| 43 | + * True if this save game file has been edited by third party tools. |
| 44 | + */ |
| 45 | + isEditedSave: boolean; |
| 46 | + /** |
| 47 | + * True if Advanced Game Settings are enabled for this save game. |
| 48 | + */ |
| 49 | + isCreativeModeEnabled: boolean; |
| 50 | +} |
| 51 | + |
| 52 | +export interface SessionSaveStruct { |
| 53 | + /** |
| 54 | + * Name of the save session. |
| 55 | + */ |
| 56 | + sessionName: string; |
| 57 | + /** |
| 58 | + * All save game files belonging to this session. |
| 59 | + */ |
| 60 | + saveHeaders: SaveHeader[]; |
| 61 | +} |
| 62 | + |
| 63 | +export type EnumerateSessionsRequest = ApiRequest<"EnumerateSessions">; |
| 64 | + |
| 65 | +export type EnumerateSessionsResponseData = { |
| 66 | + /** |
| 67 | + * List of sessions available on the Dedicated Server. |
| 68 | + */ |
| 69 | + sessions: SessionSaveStruct[]; |
| 70 | + /** |
| 71 | + * Index of the currently selected session in the list. |
| 72 | + */ |
| 73 | + currentSessionIndex: number; |
| 74 | +}; |
| 75 | + |
| 76 | +export type EnumerateSessionsResponse = |
| 77 | + ApiSuccessResponse<EnumerateSessionsResponseData>; |
| 78 | + |
| 79 | +export const buildEnumerateSessions = buildApiRequest< |
| 80 | + EnumerateSessionsRequest, |
| 81 | + EnumerateSessionsResponse |
| 82 | +>("v1", { |
| 83 | + function: "EnumerateSessions", |
| 84 | +}); |
0 commit comments