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