#analytics #next-cloud #api

nextcloud_analytics_rs

Small Rust wrapper to use the Nextcloud Analytics API

1 unstable release

0.1.0 Aug 15, 2020

#12 in #next-cloud

GPL-3.0-or-later

15KB
104 lines

nextcloud_analytics_rs

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

See examples of usage on docs.rs or src/lib.rs.


lib.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"));

Dependencies

~3.5–8MB
~170K SLoC