pub struct EventClient<K> { /* private fields */ }Expand description
Client to manage the data of a specific event and the reports contained in that event
Can be created by a ProgramClient
let client = Client::<BusinessLogic>::with_url("https://your-vtn.com".try_into().unwrap(), None);
let program = client.get_program_by_id(&"program-1".parse().unwrap()).await.unwrap();
// retrieve all events in that specific program
let mut events = program.get_event_list(Filter::none()).await.unwrap();
let mut event = events.remove(0);
// Set event priority to maximum
event.content_mut().priority = Priority::MAX;
event.update().await.unwrap()Implementations§
Source§impl<K: ClientKind> EventClient<K>
impl<K: ClientKind> EventClient<K>
Sourcepub fn created_date_time(&self) -> DateTime<Utc>
pub fn created_date_time(&self) -> DateTime<Utc>
Get the time the event was created on the VTN
Sourcepub fn modification_date_time(&self) -> DateTime<Utc>
pub fn modification_date_time(&self) -> DateTime<Utc>
Get the time the event was last modified on the VTN
Sourcepub fn content(&self) -> &EventRequest
pub fn content(&self) -> &EventRequest
Read the data of the event
Sourcepub fn content_mut(&mut self) -> &mut EventRequest
pub fn content_mut(&mut self) -> &mut EventRequest
Modify the data of the event.
Make sure to call update
after your modifications to store them on the VTN
Sourcepub async fn update(&mut self) -> Result<(), Error>
pub async fn update(&mut self) -> Result<(), Error>
Stores any modifications made to the event content at the server and refreshes the locally stored data with the returned VTN data
Sourcepub fn new_report(&self, client_name: String) -> ReportRequest
pub fn new_report(&self, client_name: String) -> ReportRequest
Create a new report object
Sourcepub async fn create_report(
&self,
report_data: ReportRequest,
) -> Result<ReportClient<K>, Error>
pub async fn create_report( &self, report_data: ReportRequest, ) -> Result<ReportClient<K>, Error>
Create a new report on the VTN.
The content should be created with EventClient::new_report
to automatically insert the correct program ID and event ID
Sourcepub async fn get_report_list(
&self,
client_name: Option<&str>,
) -> Result<Vec<ReportClient<K>>, Error>
pub async fn get_report_list( &self, client_name: Option<&str>, ) -> Result<Vec<ReportClient<K>>, Error>
Get all reports from the VTN, possibly filtered by client_name, trying to paginate whenever possible
Trait Implementations§
Source§impl<K: Clone> Clone for EventClient<K>
impl<K: Clone> Clone for EventClient<K>
Source§fn clone(&self) -> EventClient<K>
fn clone(&self) -> EventClient<K>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<K> !RefUnwindSafe for EventClient<K>
impl<K> !UnwindSafe for EventClient<K>
impl<K> Freeze for EventClient<K>
impl<K> Send for EventClient<K>
impl<K> Sync for EventClient<K>
impl<K> Unpin for EventClient<K>
impl<K> UnsafeUnpin for EventClient<K>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more