jellyfin_sdk_rust/api/endpoints/
system.rs

1use crate::{
2    api::URLBuilder,
3    models::system::{
4        AvailableLogFiles, PublicSystemInformations, SystemEndpointStatus, SystemInformations,
5        WakeOnLanInformations,
6    },
7    JellyfinAPI, JellyfinResponse, JellyfinSDKResult,
8};
9
10impl JellyfinAPI {
11    #[cfg(feature = "sync")]
12    pub fn get_endpoint_informations() {}
13
14    /// Gets information about the request endpoint.
15    pub async fn async_get_endpoint_informations(
16        &self,
17    ) -> JellyfinSDKResult<JellyfinResponse<SystemEndpointStatus>> {
18        let url = URLBuilder::from(self.base_addr(), "/System/Endpoint")?;
19
20        let res = self.async_client().get(url.build()).send().await?;
21
22        JellyfinResponse::async_from(res).await
23    }
24
25    #[cfg(feature = "sync")]
26    pub fn get_system_informations() {}
27
28    /// Gets information about the server.
29    pub async fn async_get_system_informations(
30        &self,
31    ) -> JellyfinSDKResult<JellyfinResponse<SystemInformations>> {
32        let url = URLBuilder::from(self.base_addr(), "/System/Info")?;
33
34        let res = self.async_client().get(url.build()).send().await?;
35
36        JellyfinResponse::async_from(res).await
37    }
38
39    #[cfg(feature = "sync")]
40    pub fn get_public_system_informations() {}
41
42    /// Gets public information about the server.
43    pub async fn async_get_public_system_informations(
44        &self,
45    ) -> JellyfinSDKResult<JellyfinResponse<PublicSystemInformations>> {
46        let url = URLBuilder::from(self.base_addr(), "/System/Info/Public")?;
47
48        let res = self.async_client().get(url.build()).send().await?;
49
50        JellyfinResponse::async_from(res).await
51    }
52
53    #[cfg(feature = "sync")]
54    pub fn get_available_log_files() {}
55
56    /// Gets a list of available server log files.
57    pub async fn async_get_available_log_files(
58        &self,
59    ) -> JellyfinSDKResult<JellyfinResponse<AvailableLogFiles>> {
60        let url = URLBuilder::from(self.base_addr(), "/System/Logs")?;
61
62        let res = self.async_client().get(url.build()).send().await?;
63
64        JellyfinResponse::async_from(res).await
65    }
66
67    #[cfg(feature = "sync")]
68    pub fn get_log_file() {}
69
70    /// Gets a log file.
71    pub async fn async_get_log_file(
72        &self,
73        name: &str,
74    ) -> JellyfinSDKResult<JellyfinResponse<String>> {
75        let mut url = URLBuilder::from(self.base_addr(), "/System/Logs/Log")?;
76        url.add_param("name", name);
77
78        let res = self.async_client().get(url.build()).send().await?;
79
80        JellyfinResponse::async_from(res).await
81    }
82
83    #[cfg(feature = "sync")]
84    pub fn ping_server_http_get() {}
85
86    pub async fn async_ping_server_http_get(&self) -> JellyfinSDKResult<JellyfinResponse<String>> {
87        let url = URLBuilder::from(self.base_addr(), "/System/Ping")?;
88
89        let res = self.async_client().get(url.build()).send().await?;
90
91        JellyfinResponse::async_from(res).await
92    }
93
94    #[cfg(feature = "sync")]
95    pub fn ping_server_http_post() {}
96
97    pub async fn async_ping_server_http_post(&self) -> JellyfinSDKResult<JellyfinResponse<String>> {
98        let url = URLBuilder::from(self.base_addr(), "/System/Ping")?;
99
100        let res = self.async_client().post(url.build()).send().await?;
101
102        JellyfinResponse::async_from(res).await
103    }
104
105    #[cfg(feature = "sync")]
106    pub fn restart_server() {}
107
108    pub async fn async_restart_server(&self) -> JellyfinSDKResult<JellyfinResponse<()>> {
109        let url = URLBuilder::from(self.base_addr(), "/System/Restart")?;
110
111        let res = self.async_client().post(url.build()).send().await?;
112
113        JellyfinResponse::async_from(res).await
114    }
115
116    #[cfg(feature = "sync")]
117    pub fn shutdown_server() {}
118
119    pub async fn async_shutdown_server(&self) -> JellyfinSDKResult<JellyfinResponse<()>> {
120        let url = URLBuilder::from(self.base_addr(), "/System/Shutdown")?;
121
122        let res = self.async_client().post(url.build()).send().await?;
123
124        JellyfinResponse::async_from(res).await
125    }
126
127    #[cfg(feature = "sync")]
128    pub fn get_wake_on_lan_informations() {}
129
130    pub async fn async_get_wake_on_lan_informations(
131        &self,
132    ) -> JellyfinSDKResult<JellyfinResponse<WakeOnLanInformations>> {
133        let url = URLBuilder::from(self.base_addr(), "/System/WakeOnLanInfo")?;
134
135        let res = self.async_client().get(url.build()).send().await?;
136
137        JellyfinResponse::async_from(res).await
138    }
139}