pub struct Client { /* private fields */ }Expand description
Appwrite client for making API requests
Implementations§
Source§impl Client
impl Client
Sourcepub fn set_endpoint<S: Into<String>>(&self, endpoint: S) -> Self
pub fn set_endpoint<S: Into<String>>(&self, endpoint: S) -> Self
Set the API endpoint
Sourcepub fn set_project<S: Into<String>>(&self, project: S) -> Self
pub fn set_project<S: Into<String>>(&self, project: S) -> Self
Set the project ID
Sourcepub fn set_locale<S: Into<String>>(&self, locale: S) -> Self
pub fn set_locale<S: Into<String>>(&self, locale: S) -> Self
Set the locale
Sourcepub fn set_session<S: Into<String>>(&self, session: S) -> Self
pub fn set_session<S: Into<String>>(&self, session: S) -> Self
Set the session
Sourcepub fn set_self_signed(&self, self_signed: bool) -> Self
pub fn set_self_signed(&self, self_signed: bool) -> Self
Enable or disable self-signed certificates
Sourcepub fn set_chunk_size(&self, chunk_size: usize) -> Self
pub fn set_chunk_size(&self, chunk_size: usize) -> Self
Set chunk size for file uploads (minimum 1 byte)
Sourcepub fn set_timeout(&self, timeout_secs: u64) -> Self
pub fn set_timeout(&self, timeout_secs: u64) -> Self
Set request timeout in seconds
Sourcepub fn add_header<K: AsRef<str>, V: AsRef<str>>(&self, key: K, value: V) -> Self
pub fn add_header<K: AsRef<str>, V: AsRef<str>>(&self, key: K, value: V) -> Self
Add a custom header
Sourcepub fn get_headers(&self) -> HashMap<String, String>
pub fn get_headers(&self) -> HashMap<String, String>
Get a copy of the current request headers
pub async fn call<T: DeserializeOwned>( &self, method: Method, path: &str, headers: Option<HashMap<String, String>>, params: Option<HashMap<String, Value>>, ) -> Result<T>
Sourcepub async fn call_location(
&self,
method: Method,
path: &str,
headers: Option<HashMap<String, String>>,
params: Option<HashMap<String, Value>>,
) -> Result<String>
pub async fn call_location( &self, method: Method, path: &str, headers: Option<HashMap<String, String>>, params: Option<HashMap<String, Value>>, ) -> Result<String>
Make an API call that returns a location/redirect URL (for webAuth endpoints)
Sourcepub async fn call_bytes(
&self,
method: Method,
path: &str,
headers: Option<HashMap<String, String>>,
params: Option<HashMap<String, Value>>,
) -> Result<Vec<u8>>
pub async fn call_bytes( &self, method: Method, path: &str, headers: Option<HashMap<String, String>>, params: Option<HashMap<String, Value>>, ) -> Result<Vec<u8>>
Make an API call that returns raw bytes (for downloads/location endpoints)
Sourcepub async fn file_upload<T: DeserializeOwned>(
&self,
path: &str,
headers: Option<HashMap<String, String>>,
params: HashMap<String, Value>,
param_name: &str,
input_file: InputFile,
upload_id: Option<String>,
) -> Result<T>
pub async fn file_upload<T: DeserializeOwned>( &self, path: &str, headers: Option<HashMap<String, String>>, params: HashMap<String, Value>, param_name: &str, input_file: InputFile, upload_id: Option<String>, ) -> Result<T>
Upload a file
Sourcepub async fn file_upload_with_progress<T: DeserializeOwned, F>(
&self,
path: &str,
headers: Option<HashMap<String, String>>,
params: HashMap<String, Value>,
param_name: &str,
input_file: InputFile,
options: UploadOptions<F>,
) -> Result<T>where
F: Fn(UploadProgress),
pub async fn file_upload_with_progress<T: DeserializeOwned, F>(
&self,
path: &str,
headers: Option<HashMap<String, String>>,
params: HashMap<String, Value>,
param_name: &str,
input_file: InputFile,
options: UploadOptions<F>,
) -> Result<T>where
F: Fn(UploadProgress),
Upload a file with progress callback
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more