Struct imagevault::Client
source · [−]pub struct Client<T: Authentication + Sync> {
pub client_identity: String,
pub client_secret: String,
pub authentication: Option<Arc<Mutex<T>>>,
pub reqwest_client: ReqwestClient,
pub base_url: Url,
}
Expand description
Fields
client_identity: String
client_secret: String
authentication: Option<Arc<Mutex<T>>>
reqwest_client: ReqwestClient
base_url: Url
Implementations
sourceimpl<T: Authentication + Sync> Client<T>
impl<T: Authentication + Sync> Client<T>
sourcepub fn new(
client_identity: &str,
client_secret: &str,
base_url: &str
) -> Result<Self, ImageVaultError>
pub fn new(
client_identity: &str,
client_secret: &str,
base_url: &str
) -> Result<Self, ImageVaultError>
Creates a new Client
Arguments
client_identity
- The client identityclient_secret
- The client secretbase_url
- The base URL to ImageVault, e.g.https://myimagevault.se
sourcepub fn with_authentication(self, authentication: T) -> Self
pub fn with_authentication(self, authentication: T) -> Self
Adds authentication to the Client
Arguments
authentication
- TheAuthentication
to use
Remarks
Pretty much everything in the ImageVault API requires authentication, so this should be included most of the time.
Examples
use imagevault::{
Client,
authentication::ClientCredentialsAuthentication,
};
let authentication = ClientCredentialsAuthentication::default();
let client = Client::new(
"identity",
"secret",
"https://myimagevault.local"
)?
.with_authentication(authentication);
Auto Trait Implementations
impl<T> !RefUnwindSafe for Client<T>
impl<T> Send for Client<T> where
T: Send,
impl<T> Sync for Client<T> where
T: Send,
impl<T> Unpin for Client<T>
impl<T> !UnwindSafe for Client<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more