nil_payload/request/
world.rs1use nil_core::world::WorldOptions;
5use nil_core::world::config::WorldId;
6use nil_crypto::password::Password;
7use nil_server_types::round::RoundDuration;
8use serde::{Deserialize, Serialize};
9use std::path::PathBuf;
10
11#[cfg(feature = "typescript")]
12use ts_rs::TS;
13
14#[derive(Clone, Debug, Deserialize, Serialize)]
15#[serde(rename_all = "camelCase")]
16#[cfg_attr(feature = "typescript", derive(TS))]
17#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
18pub struct CreateRemoteWorldRequest {
19 pub options: WorldOptions,
20 #[serde(default)]
21 pub description: Option<String>,
22 #[serde(default)]
23 pub password: Option<Password>,
24 #[serde(default)]
25 pub round_duration: Option<RoundDuration>,
26}
27
28#[derive(Clone, Debug, Deserialize, Serialize)]
29#[serde(rename_all = "camelCase")]
30#[cfg_attr(feature = "typescript", derive(TS))]
31#[cfg_attr(feature = "typescript", ts(export))]
32pub struct DeleteRemoteWorldRequest {
33 pub world: WorldId,
34}
35
36#[derive(Clone, Debug, Deserialize, Serialize)]
37#[serde(rename_all = "camelCase")]
38#[cfg_attr(feature = "typescript", derive(TS))]
39#[cfg_attr(feature = "typescript", ts(export))]
40pub struct GetRemoteWorldRequest {
41 pub world: WorldId,
42}
43
44#[derive(Clone, Debug, Deserialize, Serialize)]
45#[serde(rename_all = "camelCase")]
46#[cfg_attr(feature = "typescript", derive(TS))]
47#[cfg_attr(feature = "typescript", ts(export))]
48pub struct GetWorldBotsRequest {
49 pub world: WorldId,
50}
51
52#[derive(Clone, Debug, Deserialize, Serialize)]
53#[serde(rename_all = "camelCase")]
54#[cfg_attr(feature = "typescript", derive(TS))]
55#[cfg_attr(feature = "typescript", ts(export))]
56pub struct GetWorldConfigRequest {
57 pub world: WorldId,
58}
59
60#[derive(Clone, Debug, Deserialize, Serialize)]
61#[serde(rename_all = "camelCase")]
62#[cfg_attr(feature = "typescript", derive(TS))]
63#[cfg_attr(feature = "typescript", ts(export))]
64pub struct GetWorldPersonnelRequest {
65 pub world: WorldId,
66}
67
68#[derive(Clone, Debug, Deserialize, Serialize)]
69#[serde(rename_all = "camelCase")]
70#[cfg_attr(feature = "typescript", derive(TS))]
71#[cfg_attr(feature = "typescript", ts(export))]
72pub struct GetWorldPlayersRequest {
73 pub world: WorldId,
74}
75
76#[derive(Clone, Debug, Deserialize, Serialize)]
77#[serde(rename_all = "camelCase")]
78#[cfg_attr(feature = "typescript", derive(TS))]
79#[cfg_attr(feature = "typescript", ts(export))]
80pub struct GetWorldPrecursorsRequest {
81 pub world: WorldId,
82}
83
84#[derive(Clone, Debug, Deserialize, Serialize)]
85#[serde(rename_all = "camelCase")]
86#[cfg_attr(feature = "typescript", derive(TS))]
87#[cfg_attr(feature = "typescript", ts(export))]
88pub struct GetWorldStatsRequest {
89 pub world: WorldId,
90}
91
92#[derive(Clone, Debug, Deserialize, Serialize)]
93#[serde(rename_all = "camelCase")]
94#[cfg_attr(feature = "typescript", derive(TS))]
95#[cfg_attr(feature = "typescript", ts(export))]
96pub struct LeaveRequest {
97 pub world: WorldId,
98}
99
100#[derive(Clone, Debug, Deserialize, Serialize)]
101#[serde(rename_all = "camelCase")]
102#[cfg_attr(feature = "typescript", derive(TS))]
103#[cfg_attr(feature = "typescript", ts(export))]
104pub struct SaveLocalWorldRequest {
105 pub world: WorldId,
106 pub path: PathBuf,
107}