pub struct EventClient { /* 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::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 EventClient
impl EventClient
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) -> &EventContent
pub fn content(&self) -> &EventContent
Read the data of the event
Sourcepub fn content_mut(&mut self) -> &mut EventContent
pub fn content_mut(&mut self) -> &mut EventContent
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) -> ReportContent
pub fn new_report(&self, client_name: String) -> ReportContent
Create a new report object
Sourcepub async fn create_report(
&self,
report_data: ReportContent,
) -> Result<ReportClient, Error>
pub async fn create_report( &self, report_data: ReportContent, ) -> Result<ReportClient, 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>, Error>
pub async fn get_report_list( &self, client_name: Option<&str>, ) -> Result<Vec<ReportClient>, Error>
Get all reports from the VTN, possibly filtered by client_name, trying to paginate whenever possible
Trait Implementations§
Source§impl Clone for EventClient
impl Clone for EventClient
Source§fn clone(&self) -> EventClient
fn clone(&self) -> EventClient
Returns a duplicate of the value. Read more
1.0.0 · 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 Freeze for EventClient
impl !RefUnwindSafe for EventClient
impl Send for EventClient
impl Sync for EventClient
impl Unpin for EventClient
impl !UnwindSafe for EventClient
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