1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
#![deny(warnings)] #![deny(missing_docs)] #![deny(missing_debug_implementations)] //! # hyperdav //! The `hyperdav` crate provides an API for interacting with the WebDAV protocol. //! //! It's easy to use and handles all the abstractions over HTTP for the user. //! //! ## GET request //! //! ```rust //! # extern crate failure; //! # extern crate hyperdav; //! # use hyperdav::{Client}; //! # use failure::Error; //! # //! # fn run() -> Result<(), Error> { //! let client = Client::new() //! .credentials("foo", "bar") //! .build("https://demo.owncloud.org/remote.php/webdav/") //! .unwrap(); //! //! let mut res = client.get(&["file.txt"])?; //! let mut buf = vec![]; //! res.copy_to(&mut buf)?; //! # Ok(()) //! # } //! ``` //! //! The GET request will return a [`Response`][response] from the [`reqwest`][reqwest] crate on //! success. //! //! ## PUT request //! //! ```rust //! # extern crate failure; //! # extern crate hyperdav; //! # use hyperdav::{Client}; //! # use failure::Error; //! # //! # fn run() -> Result<(), Error> { //! let client = Client::new() //! .credentials("foo", "bar") //! .build("https://demo.owncloud.org/remote.php/webdav/") //! .unwrap(); //! let r = std::io::empty(); //! client.put(r, &["file.txt"])?; //! # Ok(()) //! # } //! //! ``` //! //! The PUT request will return `()` on success just to indicate it succeeded //! //! [response]: ./struct.Response.html //! [reqwest]: https://crates.io/crates/reqwest #[macro_use] extern crate failure; #[macro_use] extern crate hyper; extern crate reqwest; extern crate url; extern crate xml; use std::string::ToString; pub use reqwest::Response; pub use self::client::{Client, ClientBuilder}; pub use self::error::Error; pub use self::response::PropfindResponse; mod client; mod error; mod header; mod response; #[derive(Debug)] /// Define the depth to which we should search. pub enum Depth { /// Any depth you want Number(u32), /// As deep as we can go Infinity, } impl ToString for Depth { fn to_string(&self) -> String { match *self { Depth::Number(depth) => depth.to_string(), Depth::Infinity => "Infinity".to_string(), } } }