added subcommands `feed`, `get-post`, `like`, `unlike`
This commit is contained in:
parent
90586019df
commit
6fa77b8812
|
@ -94,6 +94,19 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"num-integer",
|
||||
"num-traits 0.2.14",
|
||||
"time",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
|
@ -643,6 +656,16 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-traits 0.2.14",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.1.43"
|
||||
|
@ -1192,6 +1215,7 @@ dependencies = [
|
|||
name = "socialvoid_types"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
|
|
|
@ -223,6 +223,26 @@ async fn main() {
|
|||
Err(err) => println!("{}", MyFriendlyError::from(err)),
|
||||
}
|
||||
}
|
||||
SocialVoidCommand::Feed { page } => match sv.timeline.retrieve_feed(page).await {
|
||||
Ok(feed) => {
|
||||
for post in feed.iter() {
|
||||
println!("================\n{}", post);
|
||||
}
|
||||
}
|
||||
Err(err) => println!("{}", MyFriendlyError::from(err)),
|
||||
},
|
||||
SocialVoidCommand::Like { post_id } => match sv.timeline.like(post_id).await {
|
||||
Ok(_) => println!("Done"),
|
||||
Err(err) => println!("{}", MyFriendlyError::from(err)),
|
||||
},
|
||||
SocialVoidCommand::Unlike { post_id } => match sv.timeline.unlike(post_id).await {
|
||||
Ok(_) => println!("Done"),
|
||||
Err(err) => println!("{}", MyFriendlyError::from(err)),
|
||||
},
|
||||
SocialVoidCommand::GetPost { post_id } => match sv.timeline.get_post(post_id).await {
|
||||
Ok(post) => println!("{}", post),
|
||||
Err(err) => println!("{}", MyFriendlyError::from(err)),
|
||||
},
|
||||
SocialVoidCommand::Sync {} => {}
|
||||
}
|
||||
}
|
||||
|
@ -273,6 +293,18 @@ enum SocialVoidCommand {
|
|||
Profile {
|
||||
peer: Option<String>,
|
||||
},
|
||||
Feed {
|
||||
page: Option<u32>,
|
||||
},
|
||||
GetPost {
|
||||
post_id: String,
|
||||
},
|
||||
Like {
|
||||
post_id: String,
|
||||
},
|
||||
Unlike {
|
||||
post_id: String,
|
||||
},
|
||||
Sync {},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue