Crates.io | pexels-uri |
lib.rs | pexels-uri |
version | 0.1.0 |
source | src |
created_at | 2023-03-18 20:49:04.174816 |
updated_at | 2023-03-18 20:49:04.174816 |
description | Create URI's for Pexels API |
homepage | |
repository | https://github.com/emilsivervik/pexels-uri-rs |
max_upload_size | |
id | 813976 |
size | 45,257 |
Create URI's for Pexels API using the builderpattern.
This is not an official crate from Pexels, their documentation can be found here
use pexels_uri::{videos, Orientation};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let uri_builder = videos::Search::builder()
.query("Dogs running")
.orientation(Orientation::Landscape)
.per_page(25)
.build();
assert_eq!(
"https://api.pexels.com/videos/search?query=Dogs+running&per_page=25&orientation=landscape",
uri_builder.create_uri()?
);
Ok(())
}