use crate::prelude::reqwest::{self, Response};
pub struct DefaultResponse(Response);
impl DefaultResponse {
pub fn to_id(&self) -> Option<&'_ str> {
self.0
.headers()
.get(reqwest::header::LOCATION)
.and_then(|v| v.to_str().ok())
.and_then(|v| v.split('/').next_back())
}
pub fn into_response(self) -> Response {
self.0
}
}
impl From<Response> for DefaultResponse {
fn from(value: Response) -> Self {
Self(value)
}
}
impl AsRef<Response> for DefaultResponse {
fn as_ref(&self) -> &Response {
&self.0
}
}
impl AsMut<Response> for DefaultResponse {
fn as_mut(&mut self) -> &mut Response {
&mut self.0
}
}