pub struct ApiClient {
pub url: String,
/* private fields */
}Expand description
A client for a single, existing Blyss bucket.
Fields§
§url: StringThe URL for the bucket.
Implementations§
Source§impl ApiClient
impl ApiClient
Sourcepub async fn new(url: &str, api_key: &str) -> Result<Self, Error>
pub async fn new(url: &str, api_key: &str) -> Result<Self, Error>
Create a new API client for the given URL and API key.
The URL should be the URL of the bucket, e.g. https://beta.api.blyss.dev/global.abc123.
Sourcepub async fn setup(&mut self) -> Result<(), Error>
pub async fn setup(&mut self) -> Result<(), Error>
Prepare the client for private reads. This must be called before calling private_read().
Sourcepub async fn private_read(&self, keys: &[String]) -> Result<Vec<Vec<u8>>, Error>
pub async fn private_read(&self, keys: &[String]) -> Result<Vec<Vec<u8>>, Error>
Privately read the given keys from the bucket. Must call setup() before calling this.
§Arguments
keys- The keys to read.
§Returns
A vector of the values corresponding to the given keys. If a key does not exist, the corresponding value will be an empty vector.
§Errors
Error::NeedSetup- If setup() has not been called.
Auto Trait Implementations§
impl Freeze for ApiClient
impl RefUnwindSafe for ApiClient
impl Send for ApiClient
impl Sync for ApiClient
impl Unpin for ApiClient
impl UnwindSafe for ApiClient
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