aboutsummaryrefslogtreecommitdiffstats
path: root/examples/zot
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2020-01-03 23:32:44 +0100
committerHarald Eilertsen <haraldei@anduin.net>2020-01-03 23:32:44 +0100
commit0c76f0c9727a512475e29b5d099b5b7188f72052 (patch)
treed1c2b59458c62116447fa2d885113afe6a5378da /examples/zot
parent5f96d9981a6d041f5c8a464cda10a0dc371060f8 (diff)
downloadrust-zotapi-0c76f0c9727a512475e29b5d099b5b7188f72052.tar.gz
rust-zotapi-0c76f0c9727a512475e29b5d099b5b7188f72052.tar.bz2
rust-zotapi-0c76f0c9727a512475e29b5d099b5b7188f72052.zip
Move Client out of the api objects.
Also make constructor functions in the zotapi namespace.
Diffstat (limited to 'examples/zot')
-rw-r--r--examples/zot/abconfig.rs2
-rw-r--r--examples/zot/abook.rs2
-rw-r--r--examples/zot/item.rs4
-rw-r--r--examples/zot/xchan.rs6
4 files changed, 7 insertions, 7 deletions
diff --git a/examples/zot/abconfig.rs b/examples/zot/abconfig.rs
index 54d555c..2362408 100644
--- a/examples/zot/abconfig.rs
+++ b/examples/zot/abconfig.rs
@@ -18,7 +18,7 @@
use zotapi;
pub fn fetch(client: &zotapi::Client) {
- match client.abconfig().fetch() {
+ match zotapi::abconfig().fetch(&client) {
Ok(payload) => {
println!("{}", payload);
}
diff --git a/examples/zot/abook.rs b/examples/zot/abook.rs
index a16f68c..b710fa7 100644
--- a/examples/zot/abook.rs
+++ b/examples/zot/abook.rs
@@ -16,7 +16,7 @@
*/
pub fn fetch(client: &zotapi::Client, raw: bool) {
- match client.abook().fetch() {
+ match zotapi::abook().fetch(&client) {
Ok(payload) => {
if raw {
println!("{}", &payload);
diff --git a/examples/zot/item.rs b/examples/zot/item.rs
index dec6c8d..2e07561 100644
--- a/examples/zot/item.rs
+++ b/examples/zot/item.rs
@@ -19,7 +19,7 @@ use clap::ArgMatches;
use zotapi;
pub fn post(client: &zotapi::Client, args: &ArgMatches) {
- let mut msg = client.item();
+ let mut msg = zotapi::item();
msg.body(args.value_of("BODY").unwrap());
if let Some(title) = dbg!(args.value_of("TITLE")) {
@@ -36,7 +36,7 @@ pub fn post(client: &zotapi::Client, args: &ArgMatches) {
}
}
- match msg.create() {
+ match msg.create(&client) {
Ok(payload) => {
println!("Raw payload: {}", payload);
}
diff --git a/examples/zot/xchan.rs b/examples/zot/xchan.rs
index d2d73d0..2995d0b 100644
--- a/examples/zot/xchan.rs
+++ b/examples/zot/xchan.rs
@@ -25,9 +25,9 @@ pub enum Type {
pub fn fetch(client: &zotapi::Client, _raw: bool, t: Type, id: &str) {
let res = match t {
- Type::Addr => client.xchan().by_address(&id).fetch(),
- Type::Hash => client.xchan().by_hash(&id).fetch(),
- Type::GUID => client.xchan().by_guid(&id).fetch(),
+ Type::Addr => zotapi::xchan().by_address(&id).fetch(&client),
+ Type::Hash => zotapi::xchan().by_hash(&id).fetch(&client),
+ Type::GUID => zotapi::xchan().by_guid(&id).fetch(&client),
};
match res {