[][src]Struct bindle::client::Client

pub struct Client { /* fields omitted */ }

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]

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]

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]

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]

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]

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]

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]

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]

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]

Gets the labels of missing parcels, if any, of the specified bindle. If the bindle is yanked, this will fail

Trait Implementations

impl Clone for Client[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<T> UnsafeAny for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,