pub struct SystemApi<'a> { /* private fields */ }Expand description
Sub-API for system endpoints.
Implementations§
Source§impl<'a> SystemApi<'a>
impl<'a> SystemApi<'a>
Sourcepub async fn get_system_status(&self) -> Result<Value, RsError>
pub async fn get_system_status(&self) -> Result<Value, RsError>
Sourcepub async fn get_daily_stat_summary(
&self,
request: GetDailyStatSummaryRequest,
) -> Result<Value, RsError>
pub async fn get_daily_stat_summary( &self, request: GetDailyStatSummaryRequest, ) -> Result<Value, RsError>
Return a summary of daily statistics by activity type.
Note max 365 days as only the current and previous year’s data is accessed.
§Arguments
request- Parameters built viaGetDailyStatSummaryRequest
§Returns
Returns an array of daily statistics.
§TODO: Errors
§Examples
// Default — last 30 days
let stats = client.system()
.get_daily_stat_summary(GetDailyStatSummaryRequest::new())
.await?;
// Last 7 days
let stats = client.system()
.get_daily_stat_summary(GetDailyStatSummaryRequest::new().days(7))
.await?;Examples found in repository?
examples/basic.rs (line 37)
8async fn main() {
9 dotenvy::from_path("examples/.env").ok();
10
11 let base_url = std::env::var("RS_BASE_URL").expect("RS_BASE_URL not set");
12 let user = std::env::var("RS_USER").expect("RS_USER not set");
13 let _password = std::env::var("RS_PASS").expect("RS_PASS not set");
14 let key = std::env::var("RS_KEY").expect("RS_KEY not set");
15
16 let client = Client::builder()
17 .base_url(&base_url)
18 .expect("Error when setting base_url")
19 .user_key(&user, &key)
20 // .session_key(&user, &password)
21 .build()
22 .await
23 .expect("Error when building client");
24
25 let search_result = client
26 .search()
27 .do_search(DoSearchRequest::new("909").sort(SortOrder::Asc))
28 .await;
29
30 match search_result {
31 Ok(response) => println!("{:#?}", response),
32 Err(e) => println!("Error: {}", e),
33 }
34
35 let system_result = client
36 .system()
37 .get_daily_stat_summary(GetDailyStatSummaryRequest::new().days(31))
38 .await;
39
40 match system_result {
41 Ok(response) => println!("{:#?}", response),
42 Err(e) => println!("Error: {}", e),
43 }
44
45 let message_result = client
46 .message()
47 .get_user_message(GetUserMessageRequest::new(12))
48 .await;
49
50 match message_result {
51 Ok(response) => println!("{:#?}", response),
52 Err(e) => println!("Error: {}", e),
53 }
54}pub async fn get_reports(&self) -> Result<Value, RsError>
pub async fn do_report(&self) -> Result<Value, RsError>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SystemApi<'a>
impl<'a> !RefUnwindSafe for SystemApi<'a>
impl<'a> Send for SystemApi<'a>
impl<'a> Sync for SystemApi<'a>
impl<'a> Unpin for SystemApi<'a>
impl<'a> UnsafeUnpin for SystemApi<'a>
impl<'a> !UnwindSafe for SystemApi<'a>
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