Crates.io | connpass-rs |
lib.rs | connpass-rs |
version | 0.1.0 |
source | src |
created_at | 2021-10-26 17:27:14.577557 |
updated_at | 2021-10-26 17:27:14.577557 |
description | An api client for connpass.com |
homepage | |
repository | |
max_upload_size | |
id | 472009 |
size | 71,617 |
An API client for connpass.com. The specification is here.
The asynchronous example uses tokio and reqwest crate, so the Cargo.toml settings could look like the below:
[dependencies]
tokio = { version = "1.12.0", features = ["full"] }
connpass-rs = "0.1.0"
The code is like (the complete example in here):
use connpass_rs::{client::ConnpassClient, query::builder::QueryBuilder};
#[tokio::main]
async fn main() {
let query = QueryBuilder::begin().event_id(228732).build();
if let Ok(query) = query {
let client = ConnpassClient::new();
let res = client.send_request(query).await;
match res {
Ok(r) => println!("{:?}", r),
Err(err) => eprintln!("{:?}", err),
}
}
}
There's an optional "blocking" client that can be enabled:
[dependencies]
connpass-rs = { version = "0.1.0", features = ["blocking"] }
And then, the code looks like (the complete example is here):
use connpass_rs::{client::blocking::ConnpassClient, query::builder::QueryBuilder};
fn main() {
let query = QueryBuilder::begin().event_id(228732).build();
if let Ok(query) = query {
let client = ConnpassClient::new();
let res = client.send_request(query);
match res {
Ok(r) => println!("{:?}", r),
Err(err) => eprintln!("{:?}", err),
}
}
}
MIT