Update dependencies
This commit is contained in:
parent
42f9f81b01
commit
437b68819b
3 changed files with 652 additions and 208 deletions
|
|
@ -67,13 +67,13 @@ pub(crate) struct AddIpRequest<'a> {
|
|||
|
||||
pub(crate) fn check() -> anyhow::Result<CheckData> {
|
||||
let url = format!("{}/v3/check", BASE_URL);
|
||||
let response: CheckResponse = ureq::get(&url).call()?.into_json()?;
|
||||
let response: CheckResponse = ureq::get(&url).call()?.body_mut().read_json()?;
|
||||
debug!("response = {:?}", &response);
|
||||
Ok(response.data)
|
||||
}
|
||||
pub(crate) fn get_locations() -> anyhow::Result<Vec<Location>> {
|
||||
let url = format!("{}/v3/locations", BASE_URL);
|
||||
let response: LocationsResponse = ureq::get(&url).call()?.into_json()?;
|
||||
let response: LocationsResponse = ureq::get(&url).call()?.body_mut().read_json()?;
|
||||
debug!("response = {:?}", &response);
|
||||
Ok(response.locations)
|
||||
}
|
||||
|
|
@ -85,9 +85,10 @@ pub(crate) fn add_ip(token: &str, public_key: &Key) -> anyhow::Result<AddressDat
|
|||
key: &public_key.to_base64(),
|
||||
};
|
||||
let response: AddressResponse = ureq::post(&url)
|
||||
.set("Authorization", &authorization)
|
||||
.header("Authorization", &authorization)
|
||||
.send_json(&request)?
|
||||
.into_json()?;
|
||||
.body_mut()
|
||||
.read_json()?;
|
||||
debug!("response = {:?}", &response);
|
||||
Ok(response.data)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue