push new dir
This commit is contained in:
@@ -6,21 +6,27 @@ pub struct CreateFolder {
|
||||
}
|
||||
|
||||
impl CreateFolder {
|
||||
pub fn new<U: IntoUrl>(url: U) -> Self {
|
||||
ListFolders {
|
||||
api_builder: ApiBuilder::new()
|
||||
.set_request(Method::from_bytes(b"MKCOL").unwrap(), url),
|
||||
pub fn new() -> Self {
|
||||
CreateFolder {
|
||||
api_builder: ApiBuilder::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_url(&mut self, url: &str) -> &mut CreateFolder {
|
||||
self.api_builder.build_request(Method::from_bytes(b"MKCOL").unwrap(), url);
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn send(&mut self) -> Result<Response, Error> {
|
||||
self.api_builder.send().await
|
||||
}
|
||||
|
||||
pub async fn send_with_err(mut self) -> Result<(), ApiError> {
|
||||
let res = self.send().await.map_err(ApiError::RequestError)?;
|
||||
pub fn send_with_err(&mut self) -> Result<(), ApiError> {
|
||||
let res = tokio::runtime::Runtime::new().unwrap().block_on(async {
|
||||
self.send().await
|
||||
}).map_err(ApiError::RequestError)?;
|
||||
if res.status().is_success() {
|
||||
Ok()
|
||||
Ok(())
|
||||
} else {
|
||||
Err(ApiError::IncorrectRequest(res))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user