[][src]Crate nextcloud_analytics_rs

nextcloud_analytics_rs

A small Rust wrapper to call the Nextcloud Analytics API, for databases of type "internal database".

Example of usage:

  let base_url = "https://example.com/nextcloud";
  let collection = 42;
  let user = "myself";
  let passwd = "hunter2";

  let client = nextcloud_analytics_rs::SyncClient::new(base_url, collection, user, passwd);
  client.send_timeline_now_data("speed_kmh", 180).unwrap_or_else(|_| println!("api or network error"));
  client.send_timeline_now_data("power_level", 9001).unwrap_or_else(|_| println!("api or network error"));

  let other_collection = 3;
  let client = nextcloud_analytics_rs::SyncClient::new(base_url, other_collection, user, passwd);
  client.send_data("age", "alice", 25).unwrap_or_else(|_| println!("api or network error"));
  client.send_data("age", "bob", 20).unwrap_or_else(|_| println!("api or network error"));

Structs

ApiError

A simple error wrapper for API errors.

SyncClient

A synchronous client to call the Nextcloud Analytics API.