implement phone_validate

This commit is contained in:
Carson McManus 2022-12-05 10:28:10 -05:00
parent 85c4662a61
commit d3099d7686

View file

@ -442,14 +442,26 @@ impl SteamApiClient {
/// Provides lots of juicy information, like if the number is a VOIP number.
/// Host: store.steampowered.com
/// Endpoint: POST /phone/validate
/// Body format: form data
/// Example:
/// ```
/// sessionID=FOO&phoneNumber=%2B1+1234567890
/// ```
/// Found on page: https://store.steampowered.com/phone/add
pub fn phone_validate(&self, phone_number: String) -> anyhow::Result<bool> {
pub fn phone_validate(&self, phone_number: &String) -> anyhow::Result<PhoneValidateResponse> {
let params = hashmap! {
"sessionID" => "",
"phoneNumber" => "",
"sessionID" => self.session.as_ref().unwrap().expose_secret().session_id.as_str(),
"phoneNumber" => phone_number.as_str(),
};
todo!();
let resp = self
.client
.post("https://store.steampowered.com/phone/validate")
.form(&params)
.send()?
.json::<PhoneValidateResponse>()?;
return Ok(resp);
}
/// Starts the authenticator linking process.
@ -678,6 +690,16 @@ pub struct FinalizeAddAuthenticatorResponse {
pub success: bool,
}
#[derive(Debug, Clone, Deserialize)]
#[allow(dead_code)]
pub struct PhoneValidateResponse {
success: bool,
number: String,
is_valid: bool,
is_voip: bool,
is_fixed: bool,
}
#[derive(Debug, Clone, Deserialize)]
pub struct RemoveAuthenticatorResponse {
pub success: bool,