Struct lexoffice::request::RequestWithState [−][src]
Represents a request to the lexoffice API. Please note that in order to
create a working Request
the Type variable T
must allow requests to be
made. The type variable S
is an optional argument that allows to share
state of the time, for example to make sure that certain functions have
been called.
Implementations
impl RequestWithState<T, ()>
[src]
Examples
use lexoffice::{ApiKey, Client}; use lexoffice::model::Country; let client = Client::new(ApiKey::try_default().await?); let countries = client.request::<Country>().get().await?; println!("{:#?}", countries); Ok(())
impl RequestWithState<T, ()>
[src]
pub fn by_id_url<I>(&self, uuid: I) -> Result<Url> where
I: Into<Uuid> + Send + Sync,
[src]
I: Into<Uuid> + Send + Sync,
This method creates an Url
that is used to address the object
identified by uuid
.
pub async fn by_id_str(self, uuid: &str) -> Result<Response>
[src]
This method requests an object identified by uuid
.
pub async fn by_id<I>(self, uuid: I) -> Result<Response> where
I: Into<Uuid> + Send + Sync,
[src]
I: Into<Uuid> + Send + Sync,
This method requests an object identified by uuid
.
pub async fn upload<P>(self, file_part: P) -> Result<Uuid> where
P: Into<Part> + Send + Sync,
[src]
P: Into<Part> + Send + Sync,
Uploads a file to lexoffice
pub async fn upload_bytes<B>(
self,
mime: &'static Mime,
bytes: B
) -> Result<Uuid> where
B: Into<Cow<'static, [u8]>>,
[src]
self,
mime: &'static Mime,
bytes: B
) -> Result<Uuid> where
B: Into<Cow<'static, [u8]>>,
Uploads arbitrary data as file to lexoffice
pub async fn upload_path<P>(self, path: P) -> Result<Uuid> where
P: AsRef<Path> + Send + Sync,
[src]
P: AsRef<Path> + Send + Sync,
Uploads a file from a path to lexoffice
impl RequestWithState<T, ()>
[src]
Examples
use lexoffice::{ApiKey, Client}; use lexoffice::model::PostingCategory; let client = Client::new(ApiKey::try_default().await?); let posting_categories = client.request::<PostingCategory>().get().await?; println!("{:#?}", posting_categories); Ok(())
pub async fn get(self) -> Result<Vec<PostingCategory>>
[src]
executes the request
impl RequestWithState<T, ()>
[src]
Examples
use lexoffice::{ApiKey, Client}; use lexoffice::model::Profile; let client = Client::new(ApiKey::try_default().await?); let profile = client.request::<Profile>().get().await?; println!("{:#?}", profile); Ok(())
impl RequestWithState<Voucherlist, VoucherlistStateUnstarted>
[src]
pub fn type_(
self,
voucher_type: &VoucherType
) -> RequestWithState<Voucherlist, VoucherlistState<VoucherType, ()>>
[src]
self,
voucher_type: &VoucherType
) -> RequestWithState<Voucherlist, VoucherlistState<VoucherType, ()>>
Sets the voucher status for this request. Calling this function is mandatory
pub fn status(
self,
voucher_status: &VoucherStatus
) -> RequestWithState<Voucherlist, VoucherlistState<(), VoucherStatus>>
[src]
self,
voucher_status: &VoucherStatus
) -> RequestWithState<Voucherlist, VoucherlistState<(), VoucherStatus>>
Sets the voucher status for this request. Calling this function is mandatory
impl<S: Clone> RequestWithState<Voucherlist, VoucherlistState<(), S>>
[src]
pub fn type_(
self,
voucher_type: &VoucherType
) -> RequestWithState<Voucherlist, VoucherlistState<VoucherType, S>>
[src]
self,
voucher_type: &VoucherType
) -> RequestWithState<Voucherlist, VoucherlistState<VoucherType, S>>
Sets the voucher status for this request. Calling this function is mandatory
impl<T: Clone> RequestWithState<Voucherlist, VoucherlistState<T, ()>>
[src]
pub fn status(
self,
voucher_status: &VoucherStatus
) -> RequestWithState<Voucherlist, VoucherlistState<T, VoucherStatus>>
[src]
self,
voucher_status: &VoucherStatus
) -> RequestWithState<Voucherlist, VoucherlistState<T, VoucherStatus>>
Sets the voucher status for this request. Calling this function is mandatory
impl<T, S> RequestWithState<T, S> where
Self: Endpoint + ById,
T: DeserializeOwned + Clone,
S: Clone,
[src]
Self: Endpoint + ById,
T: DeserializeOwned + Clone,
S: Clone,
pub fn by_id_url<I>(&self, uuid: I) -> Result<Url> where
I: Into<Uuid>,
[src]
I: Into<Uuid>,
This method creates an Url
that is used to address the object
identified by uuid
.
Request<T>
must implement the ById
trait in order to make
this function available.
pub async fn by_id_str(self, uuid: &str) -> Result<T>
[src]
This method requests an object identified by uuid
.
Request<T>
must implement the ById
trait in order to make
this function available.
pub async fn by_id<I>(self, uuid: I) -> Result<T> where
I: Into<Uuid> + Send,
[src]
I: Into<Uuid> + Send,
This method requests an object identified by uuid
.
Request<T>
must implement the ById
trait in order to make
this function available.
impl<T, S> RequestWithState<T, S> where
Self: Endpoint + Deletable + ById,
T: Serialize + DeserializeOwned + HasId + Clone,
S: Clone,
[src]
Self: Endpoint + Deletable + ById,
T: Serialize + DeserializeOwned + HasId + Clone,
S: Clone,
pub async fn delete_str(self, uuid: &str) -> Result<()>
[src]
This method requests an object identified by uuid
.
Request<T>
must implement the ById
trait in order to make
this function available.
pub async fn delete<I>(self, uuid: I) -> Result<()> where
I: Into<Uuid> + Send,
[src]
I: Into<Uuid> + Send,
This method requests an object identified by uuid
.
Request<T>
must implement the ById
trait in order to make
this function available.
impl<T, S> RequestWithState<T, S> where
Self: Endpoint + Paginated + Sync + Send + Clone,
T: DeserializeOwned + Sync + Send + Clone + 'static,
S: Sync + Send + Clone,
[src]
Self: Endpoint + Paginated + Sync + Send + Clone,
T: DeserializeOwned + Sync + Send + Clone + 'static,
S: Sync + Send + Clone,
pub async fn page_size(self, page: usize, size: usize) -> Result<Page<T>>
[src]
This method gets a page that contains items of type T
from the API.
It also allows to define a number of items to request per page.
RequestWithState<T, S>
must implement the Paginated
trait in order to make
this function available.
pub async fn page(self, page: usize) -> Result<Page<T>>
[src]
This method gets a page that contains items of type T
from the API
RequestWithState<T, S>
must implement the Paginated
trait in order to make
this function available.
pub fn stream(self) -> PageStream<T, S>
[src]
Creates a PageStream
from this request.
impl<T, S> RequestWithState<T, S> where
Self: Endpoint + Storable,
T: DeserializeOwned + Serialize + Clone,
S: Clone,
[src]
Self: Endpoint + Storable,
T: DeserializeOwned + Serialize + Clone,
S: Clone,
pub async fn save<I>(self, object: I) -> Result<ResultInfo<T>> where
I: Into<T> + Send,
[src]
I: Into<T> + Send,
This method allows to save a new model object. Please note, that
Request<T>
must implement the Storable
trait in order to make
this function available.
impl<T, S> RequestWithState<T, S> where
Self: Endpoint + Updatable,
T: Serialize + DeserializeOwned + Clone,
S: Clone,
[src]
Self: Endpoint + Updatable,
T: Serialize + DeserializeOwned + Clone,
S: Clone,
pub async fn update<I>(self, object: I) -> Result<ResultInfo<T>> where
I: Into<T> + Send + HasId,
[src]
I: Into<T> + Send + HasId,
This method allows to update an existing model object. Please note, that
Request<T>
must implement the Updatable
trait in order to make
this function available.
pub async fn update_with_id<I, U>(
self,
uuid: U,
object: I
) -> Result<ResultInfo<T>> where
I: Into<T> + Send + HasId,
U: Into<Uuid>,
[src]
self,
uuid: U,
object: I
) -> Result<ResultInfo<T>> where
I: Into<T> + Send + HasId,
U: Into<Uuid>,
This method allows to update an existing model object. Please note, that
Request<T>
must implement the Updatable
trait in order to make
this function available.
impl<T: Clone, S: Clone> RequestWithState<T, S>
[src]
Trait Implementations
impl<T: Clone, S: Clone> Clone for RequestWithState<T, S>
[src]
fn clone(&self) -> RequestWithState<T, S>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug + Clone, S: Debug + Clone> Debug for RequestWithState<T, S>
[src]
impl<S: Clone> Endpoint for RequestWithState<Voucherlist, S>
[src]
impl<T, S> From<RequestWithState<T, S>> for PageStream<T, S> where
RequestWithState<T, S>: Paginated + Clone + Endpoint,
T: DeserializeOwned + Sync + Send + Clone + 'static,
S: Sync + Send + Clone + 'static,
[src]
RequestWithState<T, S>: Paginated + Clone + Endpoint,
T: DeserializeOwned + Sync + Send + Clone + 'static,
S: Sync + Send + Clone + 'static,
fn from(request: RequestWithState<T, S>) -> Self
[src]
impl Paginated for RequestWithState<Voucherlist, VoucherlistStateFinished>
[src]
Examples
use lexoffice::{ApiKey, Client}; use lexoffice::model::Voucherlist; use lexoffice::model::voucherlist::{VoucherStatus, VoucherType}; let client = Client::new(ApiKey::try_default().await?); let voucherlist = client .request::<Voucherlist>() .type_(&VoucherType::Invoice) .status(&VoucherStatus::Open) .page(0).await?; println!("{:#?}", voucherlist);
Auto Trait Implementations
impl<T, S> !RefUnwindSafe for RequestWithState<T, S>
impl<T, S> Send for RequestWithState<T, S> where
S: Send,
T: Send,
S: Send,
T: Send,
impl<T, S> Sync for RequestWithState<T, S> where
S: Sync,
T: Sync,
S: Sync,
T: Sync,
impl<T, S> Unpin for RequestWithState<T, S> where
S: Unpin,
T: Unpin,
S: Unpin,
T: Unpin,
impl<T, S> !UnwindSafe for RequestWithState<T, S>
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> 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, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,