[−][src]Struct bindle::client::Client
A client type for interacting with a Bindle server
Implementations
impl Client
[src]
pub fn new(base_url: &str) -> Result<Self>
[src]
Returns a new Client with the given URL. This URL should be the FQDN plus any namespacing
(like v1
). So if you were running a bindle server mounted at the v1 endpoint, your URL
would look something like http://my.bindle.com/v1/
. Will return an error if the URL is not
valid
pub async fn create_invoice<'_>(
&'_ self,
inv: Invoice
) -> Result<InvoiceCreateResponse>
[src]
&'_ self,
inv: Invoice
) -> Result<InvoiceCreateResponse>
Creates the given invoice, returns a response containing the created invoice and a list of missing parcels (that have not yet been uploaded)
pub async fn create_invoice_from_file<P: AsRef<Path>, '_>(
&'_ self,
file_path: P
) -> Result<InvoiceCreateResponse>
[src]
&'_ self,
file_path: P
) -> Result<InvoiceCreateResponse>
Same as create_invoice
, but takes a path to an invoice file
instead. This will load the invoice file directly into the request, skipping serialization
pub async fn get_invoice<I, '_>(&'_ self, id: I) -> Result<Invoice> where
I: TryInto<Id>,
I::Error: Into<ClientError>,
[src]
I: TryInto<Id>,
I::Error: Into<ClientError>,
Returns the requested invoice from the bindle server if it exists. This can take any form
that can convert into the Id
type, but generally speaking, this is the canonical name of
the bindle (e.g. example.com/foo/1.0.0
)
pub async fn query_invoices<'_>(
&'_ self,
query_opts: QueryOptions
) -> Result<Matches>
[src]
&'_ self,
query_opts: QueryOptions
) -> Result<Matches>
Queries the bindle server for matching invoices as specified by the given query options
pub async fn yank_invoice<I, '_>(&'_ self, id: I) -> Result<()> where
I: TryInto<Id>,
I::Error: Into<ClientError>,
[src]
I: TryInto<Id>,
I::Error: Into<ClientError>,
Yanks the invoice from availability on the bindle server. This can take any form that can
convert into the Id
type, but generally speaking, this is the canonical name of the bindle
(e.g. example.com/foo/1.0.0
)
pub async fn create_parcel<'_>(
&'_ self,
label: Label,
data: Vec<u8>
) -> Result<Label>
[src]
&'_ self,
label: Label,
data: Vec<u8>
) -> Result<Label>
Creates the given parcel using the label and the raw parcel data to upload to the server. Returns the label of the created parcel
pub async fn create_parcel_from_file<D: AsRef<Path>, '_>(
&'_ self,
label: Label,
data_path: D
) -> Result<Label>
[src]
&'_ self,
label: Label,
data_path: D
) -> Result<Label>
Same as create_parcel
, but takes a path to the parcel
file. This will be more efficient for large files as it will stream the data into the body
rather than taking the intermediate step of loading the bytes into a Vec
.
pub async fn get_parcel<'_, '_>(&'_ self, sha: &'_ str) -> Result<Vec<u8>>
[src]
Returns the requested parcel (identified by its SHA) as a vector of bytes
pub async fn get_parcel_stream<'_, '_>(
&'_ self,
sha: &'_ str
) -> Result<impl Stream<Item = Result<Bytes>>>
[src]
&'_ self,
sha: &'_ str
) -> Result<impl Stream<Item = Result<Bytes>>>
Returns the requested parcel (identified by its SHA) as a stream of bytes. This is useful for when you don't want to read it into memory but are instead writing to a file or other location
pub async fn get_missing_parcels<I, '_>(&'_ self, id: I) -> Result<Vec<Label>> where
I: TryInto<Id>,
I::Error: Into<ClientError>,
[src]
I: TryInto<Id>,
I::Error: Into<ClientError>,
Gets the labels of missing parcels, if any, of the specified bindle. If the bindle is yanked, this will fail
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
[src]
impl Send for Client
[src]
impl Sync for Client
[src]
impl Unpin for Client
[src]
impl !UnwindSafe for Client
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
T: Clone + Any,
pub fn clone_any(&self) -> Box<dyn CloneAny + 'static, Global>
pub fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send, Global> where
T: Send,
T: Send,
pub fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync, Global> where
T: Sync,
T: Sync,
pub fn clone_any_send_sync(
&self
) -> Box<dyn CloneAny + 'static + Send + Sync, Global> where
T: Send + Sync,
&self
) -> Box<dyn CloneAny + 'static + Send + Sync, Global> where
T: Send + Sync,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,