trade: fix ApiKeyCreation
confirmation getting iterpreted as Unknown
(#363)
This commit is contained in:
parent
8394baa157
commit
c5d51b5174
3 changed files with 37 additions and 17 deletions
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -1726,6 +1726,27 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num_enum"
|
||||||
|
version = "0.7.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845"
|
||||||
|
dependencies = [
|
||||||
|
"num_enum_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num_enum_derive"
|
||||||
|
version = "0.7.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro-crate",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.23",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "numtoa"
|
name = "numtoa"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -3027,6 +3048,7 @@ dependencies = [
|
||||||
"lazy_static 1.4.0",
|
"lazy_static 1.4.0",
|
||||||
"log",
|
"log",
|
||||||
"maplit",
|
"maplit",
|
||||||
|
"num_enum",
|
||||||
"phonenumber",
|
"phonenumber",
|
||||||
"protobuf",
|
"protobuf",
|
||||||
"protobuf-codegen",
|
"protobuf-codegen",
|
||||||
|
|
|
@ -14,7 +14,14 @@ license = "MIT OR Apache-2.0"
|
||||||
anyhow = "^1.0"
|
anyhow = "^1.0"
|
||||||
sha1 = "^0.10"
|
sha1 = "^0.10"
|
||||||
base64 = "^0.21"
|
base64 = "^0.21"
|
||||||
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "cookies", "gzip", "rustls-tls", "multipart"] }
|
reqwest = { version = "0.11", default-features = false, features = [
|
||||||
|
"blocking",
|
||||||
|
"json",
|
||||||
|
"cookies",
|
||||||
|
"gzip",
|
||||||
|
"rustls-tls",
|
||||||
|
"multipart",
|
||||||
|
] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
rsa = "0.9.2"
|
rsa = "0.9.2"
|
||||||
|
@ -36,6 +43,7 @@ phonenumber = "0.3"
|
||||||
serde_path_to_error = "0.1.11"
|
serde_path_to_error = "0.1.11"
|
||||||
hmac = "^0.12"
|
hmac = "^0.12"
|
||||||
sha2 = "^0.10"
|
sha2 = "^0.10"
|
||||||
|
num_enum = "0.7.2"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
anyhow = "^1.0"
|
anyhow = "^1.0"
|
||||||
|
|
|
@ -367,37 +367,27 @@ impl Confirmation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, num_enum::FromPrimitive)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
#[serde(from = "u32")]
|
#[serde(from = "u32")]
|
||||||
/// Source: <https://github.com/SteamDatabase/SteamTracking/blob/6e7797e69b714c59f4b5784780b24753c17732ba/Structs/enums.steamd#L1607-L1616>
|
/// Source: https://github.com/SteamDatabase/SteamTracking/blob/6e7797e69b714c59f4b5784780b24753c17732ba/Structs/enums.steamd#L1607-L1616
|
||||||
/// There are also some additional undocumented types.
|
/// There are also some additional undocumented types.
|
||||||
pub enum ConfirmationType {
|
pub enum ConfirmationType {
|
||||||
Test = 1,
|
Test = 1,
|
||||||
|
/// Occurs when sending a trade offer or accepting a received trade offer, only when there is items on the user's side
|
||||||
Trade = 2,
|
Trade = 2,
|
||||||
|
/// Occurs when selling an item on the Steam community market
|
||||||
MarketSell = 3,
|
MarketSell = 3,
|
||||||
FeatureOptOut = 4,
|
FeatureOptOut = 4,
|
||||||
|
/// Occurs when changing the phone number associated with the account
|
||||||
PhoneNumberChange = 5,
|
PhoneNumberChange = 5,
|
||||||
AccountRecovery = 6,
|
AccountRecovery = 6,
|
||||||
/// Occurs when a new web API key is created via https://steamcommunity.com/dev/apikey
|
/// Occurs when a new web API key is created via https://steamcommunity.com/dev/apikey
|
||||||
ApiKeyCreation = 9,
|
ApiKeyCreation = 9,
|
||||||
|
#[num_enum(catch_all)]
|
||||||
Unknown(u32),
|
Unknown(u32),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<u32> for ConfirmationType {
|
|
||||||
fn from(text: u32) -> Self {
|
|
||||||
match text {
|
|
||||||
1 => ConfirmationType::Test,
|
|
||||||
2 => ConfirmationType::Trade,
|
|
||||||
3 => ConfirmationType::MarketSell,
|
|
||||||
4 => ConfirmationType::FeatureOptOut,
|
|
||||||
5 => ConfirmationType::PhoneNumberChange,
|
|
||||||
6 => ConfirmationType::AccountRecovery,
|
|
||||||
v => ConfirmationType::Unknown(v),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct ConfirmationListResponse {
|
pub struct ConfirmationListResponse {
|
||||||
pub success: bool,
|
pub success: bool,
|
||||||
|
|
Loading…
Reference in a new issue