Crates.io | ulule-client |
lib.rs | ulule-client |
version | 1.0.0 |
source | src |
created_at | 2019-10-09 14:35:03.617291 |
updated_at | 2019-11-15 16:28:33.798941 |
description | Client for the Ulule v1 HTTP API |
homepage | |
repository | https://github.com/ulule/ulule-rs.git |
max_upload_size | |
id | 171229 |
size | 76,738 |
Rust API bindings for the Ulule v1 HTTP API. This library rely on rust Futures to allow asynchronous usage.
Put this in Cargo.toml
:
[dependencies]
ulule = "1.0.0"
ulule_client = "0.0.3"
and this in the crate root:
extern crate ulule;
extern crate ulule_client;
cargo test
Run file from examples with:
cargo run --example <example> -- <example flags> <example args>
To get started, create a client:
let client = ulule_client::Client::new();
Search for the last three project created matching the term beer
with their owner:
use ulule::search;
use ulule_client::{search_projects, Client};
#[tokio::main]
async fn main() {
let client = Client::new();
let p = search::Params::new()
.limit(2)
.with_term("beer")
.with_extra_fields(vec![
"owner".to_string(),
"main_tag".to_string(),
"main_image".to_string(),
]);
let first_page = search_projects(&client, Some(p)).await.unwrap();
println!("first page: {:?}", first_page);
if !first_page.meta.has_next() {
return;
}
let second_page = search_projects(&client, first_page.meta.next).await.unwrap();
println!("second page: {:?}", second_page)
}