aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/zot
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2023-03-26 22:53:49 +0200
committerHarald Eilertsen <haraldei@anduin.net>2023-03-26 22:53:49 +0200
commit93ee81f05e1cb90c79949d5c57b1d7e3c272dd02 (patch)
tree67440c378b4ac0642e7c576ff8f1758f63e83be2 /src/bin/zot
parentb527b13422fc376bf056f6e3499eeb7a8ad94cf9 (diff)
downloadrust-zotapi-93ee81f05e1cb90c79949d5c57b1d7e3c272dd02.tar.gz
rust-zotapi-93ee81f05e1cb90c79949d5c57b1d7e3c272dd02.tar.bz2
rust-zotapi-93ee81f05e1cb90c79949d5c57b1d7e3c272dd02.zip
Implement "verify" API.HEADmaster
The verify API call returns a full channel object, including the corresponding xchan. I've added the xchan as a field in the Channel object, instead of having all the fields in one object like it is returned from the API.
Diffstat (limited to 'src/bin/zot')
-rw-r--r--src/bin/zot/main.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/bin/zot/main.rs b/src/bin/zot/main.rs
index a8451b2..70a7984 100644
--- a/src/bin/zot/main.rs
+++ b/src/bin/zot/main.rs
@@ -34,6 +34,10 @@ async fn main() {
(version: crate_version!())
(author: crate_authors!())
(about: "zotapi command line client")
+ (@subcommand verify =>
+ (about: "Verify")
+ (@arg raw: --raw "Display raw json payload")
+ )
(@subcommand channel =>
(about: "Fetch the channel stream")
(@arg raw: --raw "Display raw json payload")
@@ -72,12 +76,29 @@ async fn main() {
(@arg ATTACH: --attach [FILE] "Attach a file or image to the post")
(@arg GROUP: --group [groups] "Limit distribution to the specified group(s) separated by comma")
)
+ (@subcommand photos =>
+ (about: "Post or get photos or albums")
+ (@arg UPLOAD: --upload [FILE] requires[ALBUM] "Upload a photo")
+ (@arg ALBUM: --album +takes_value "The album to upload the photo to")
+ (@arg DESC: --description +takes_value "A description/title for the photo")
+ (@arg BODY: --body +takes_value "A longer description/body text")
+ (@arg POST: --post "Post the photo to the timeline")
+ (@arg GROUP: --group [groups] "Limit distribution to the specified group(s) separated by comma")
+ )
)
.get_matches();
let client = zotapi::client(&site, &user, &password);
match matches.subcommand() {
+ ("verify", Some(m)) => {
+ let r = zotapi::Channel::z();
+ if m.is_present("raw") {
+ println!("{}", r.fetch_raw(&client).await.unwrap());
+ } else {
+ println!("{:?}", r.fetch(&client).await);
+ }
+ }
("channel", Some(m)) => {
let raw = m.is_present("raw");
zot::channel_stream::fetch(&client, raw).await;