1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#![cfg(feature = "serialize")]

//! Data returned from `UniverseConfig.svc`

use serde::{Deserialize, Serialize};

/// Information on account registration
#[derive(Debug, Deserialize, Serialize)]
pub struct AccountInfo {
    /// Unknown
    #[serde(rename = "SendPasswordUrl")]
    pub send_password_url: String,
    /// URL to log into an account
    #[serde(rename = "SignInUrl")]
    pub sign_in_url: String,
    /// URL to sign up for an account
    #[serde(rename = "SignUpUrl")]
    pub sign_up_url: String,
}

/// Information on the game
#[derive(Debug, Deserialize, Serialize)]
pub struct GameInfo {
    /// URL for login to subscription management
    #[serde(rename = "AuthenticationUrl")]
    pub authentication_url: String,
    /// URL for registration as a user
    #[serde(rename = "ClientUrl")]
    pub client_url: String,
    /// URL to submit crash logs
    #[serde(rename = "CrashLogUrl")]
    pub crash_log_url: String,
    /// Old launcher URL?
    #[serde(rename = "LauncherUrl")]
    pub launcher_url: String,
    /// URL of the website shown in the patcher
    #[serde(rename = "LauncherUrl2")]
    pub launcher_url2: String,
}

/// Information on downloading the game
#[derive(Debug, Deserialize, Serialize)]
pub struct PatcherInfo {
    /// Manifest of files specific to running Windows programs on Mac
    #[serde(rename = "CiderUrl")]
    pub cider_url: String,
    /// Configuration for the patching process
    #[serde(rename = "ConfigUrl")]
    pub config_url: String,
    /// URL of the installer for major updates
    #[serde(rename = "InstallUrl")]
    pub install_url: String,
}

/// Information on the CDN client
#[derive(Debug, Deserialize, Serialize)]
pub struct CdnInfo {
    /// An ID for the Akamai CDN
    #[serde(rename = "CpCode")]
    pub cp_code: i32,
    /// The patcher subdirectory
    #[serde(rename = "PatcherDir")]
    pub patcher_dir: String,
    /// The patch server
    #[serde(rename = "PatcherUrl")]
    pub patcher_url: String,
    /// Whether to use https (?)
    #[serde(rename = "Secure")]
    pub secure: bool,
    /// Whether to use the Akamai download manager
    #[serde(rename = "UseDlm")]
    pub use_dlm: bool,
}

/// A single server (*Universe*) that can be selected
#[derive(Debug, Deserialize, Serialize)]
pub struct Server {
    /// URL of the auth server
    #[serde(rename = "AuthenticationIP")]
    pub authentication_ip: String,
    /// Information for the CDN client
    #[serde(rename = "CdnInfo")]
    pub cdn_info: CdnInfo,
    /// Info for moderation (?)
    #[serde(rename = "CrispInfo")]
    pub crisp_info: String,
    /// ID of the data center
    #[serde(rename = "DataCenterId")]
    pub data_center_id: u32,
    /// URL for the game API
    #[serde(rename = "GameApiUrl")]
    pub game_api_url: String,
    /// URL for game content
    #[serde(rename = "GameContentApiUrl")]
    pub game_content_api_url: String,
    /// Language Tag of the server
    #[serde(rename = "Language")]
    pub language: String,
    /// Log level
    #[serde(rename = "LogLevel")]
    pub log_level: i32,
    /// URL of the metrics server
    #[serde(rename = "MetricsDataServiceUrl")]
    pub metrics_data_service_url: String,
    /// Display name of the server
    #[serde(rename = "Name")]
    pub name: String,
    /// Whether this server is available
    #[serde(rename = "Online")]
    pub online: bool,
    /// Whether this server is selected by default
    #[serde(rename = "Suggested")]
    pub suggested: bool,
    /// URL for the UGC controller
    #[serde(rename = "UGCControllerServicesUrl")]
    pub ugc_controller_services_url: String,
    /// CDN info for user generated content
    #[serde(rename = "UgcCdnInfo")]
    pub ugc_cdn_info: CdnInfo,
    /// Whether to use online model conversion
    #[serde(rename = "Use3DServices")]
    pub use3d_services: bool,
    /// Current version of the game
    #[serde(rename = "Version")]
    pub version: String,
    /// Type of version dir (default 0)
    #[serde(rename = "VersionDirType")]
    pub version_dir_type: String,
    /// API url (?)
    #[serde(rename = "WebApiUrl")]
    pub web_api_url: String,
}

/// The list of servers
#[derive(Debug, Deserialize, Serialize)]
pub struct Servers {
    /// The list of servers
    #[serde(rename = "Server")]
    pub servers: Vec<Server>,
}

/// The root of the `EnvironmentInfo` endpoint
#[derive(Debug, Deserialize, Serialize)]
pub struct Environment {
    /// Information on accounts
    #[serde(rename = "AccountInfo")]
    pub account_info: AccountInfo,
    /// Information on the game
    #[serde(rename = "GameInfo")]
    pub game_info: GameInfo,
    /// Information on the general patcher process
    #[serde(rename = "PatcherInfo")]
    pub patcher_info: PatcherInfo,
    /// Information on individual servers/universes
    #[serde(rename = "Servers")]
    pub servers: Servers,
}