implement phone_validate
This commit is contained in:
parent
85c4662a61
commit
d3099d7686
1 changed files with 26 additions and 4 deletions
|
@ -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(¶ms)
|
||||
.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,
|
||||
|
|
Loading…
Reference in a new issue