1use serde::{Deserialize, Serialize};
2
3use crate::Api;
4
5pub const INTERFACE: &str = "ISteamWebAPIUtil";
6
7#[derive(Clone, Debug)]
8pub struct GetServerInfo;
9
10impl GetServerInfo {
11 pub const METHOD: &str = "GetServerInfo";
12 pub const VERSION: &str = "v1";
13}
14
15impl Api for GetServerInfo {
16 fn interface() -> &'static str {
17 INTERFACE
18 }
19
20 fn method() -> &'static str {
21 Self::METHOD
22 }
23
24 fn version() -> &'static str {
25 Self::VERSION
26 }
27
28 type Response = GetServerInfoResponse;
29
30 fn parameters(&self) -> impl Iterator<Item = (&str, &str)> {
31 std::iter::empty()
32 }
33}
34
35#[derive(Clone, Debug, Deserialize, Serialize)]
36#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
37pub struct GetServerInfoResponse {
38 pub servertime: u64,
39 pub servertimestring: String,
40}
41
42#[derive(Clone, Debug)]
43pub struct GetSupportedApiList;
44
45impl GetSupportedApiList {
46 pub const METHOD: &str = "GetSupportedAPIList";
47 pub const VERSION: &str = "v1";
48}
49
50impl Api for GetSupportedApiList {
51 fn interface() -> &'static str {
52 INTERFACE
53 }
54
55 fn method() -> &'static str {
56 Self::METHOD
57 }
58
59 fn version() -> &'static str {
60 Self::VERSION
61 }
62
63 type Response = GetSupportedApiListResponse;
64
65 fn parameters(&self) -> impl Iterator<Item = (&str, &str)> {
66 std::iter::empty()
67 }
68}
69
70#[derive(Clone, Debug, Deserialize, Serialize)]
71#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
72#[serde(rename_all = "UPPERCASE")]
73pub enum HttpMethod {
74 Get,
75 Head,
76 Post,
77 Put,
78 Delete,
79 Connect,
80 Options,
81 Trace,
82 Patch,
83}
84
85#[derive(Clone, Debug, Deserialize, Serialize)]
86#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
87#[serde(rename_all = "lowercase")]
88pub enum ParameterType {
89 Bool,
90 Int8,
91 UInt8,
92 Int16,
93 UInt16,
94 Int32,
95 Uint32,
96 Int64,
97 Uint64,
98 String,
99 #[serde(rename = "{enum}")]
100 Enum,
101 #[serde(rename = "{message}")]
102 Message,
103}
104
105#[derive(Clone, Debug, Deserialize, Serialize)]
106#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
107pub struct Parameter {
108 pub name: String,
109 pub r#type: ParameterType,
110 pub optional: bool,
111 #[serde(default)]
112 pub description: String,
113}
114
115#[derive(Clone, Debug, Deserialize, Serialize)]
116#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
117pub struct Method {
118 pub name: String,
119 pub version: i32,
120 pub httpmethod: HttpMethod,
121 pub parameters: Vec<Parameter>,
122 #[serde(default)]
123 pub description: String,
124}
125
126#[derive(Clone, Debug, Deserialize, Serialize)]
127#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
128pub struct Interface {
129 pub name: String,
130 pub methods: Vec<Method>,
131}
132
133#[derive(Clone, Debug, Deserialize, Serialize)]
134#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
135pub struct ApiList {
136 pub interfaces: Vec<Interface>,
137}
138
139#[derive(Clone, Debug, Deserialize, Serialize)]
140#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
141pub struct GetSupportedApiListResponse {
142 pub apilist: ApiList,
143}