Crates.io | pexels_client |
lib.rs | pexels_client |
version | 0.1.1 |
source | src |
created_at | 2023-04-24 17:18:42.495754 |
updated_at | 2023-04-24 17:39:29.820917 |
description | Rust wrapper for Pexels API |
homepage | |
repository | https://github.com/sattva9/pexels_client |
max_upload_size | |
id | 847661 |
size | 36,294 |
The pexels_client crate is a wrapper around Pexels API.
More information about this crate can be found in the crate documentation.
To use pexels_client
, first add this to your Cargo.toml
:
[dependencies]
pexels_client = "0.1.0"
Create a Pexels Client:
use pexels_client::PexelsClient;
fn main() {
let client = PexelsClient::new("auth_key".to_string()).unwrap();
}
Search for Photos:
use pexels_client::{PexelsClient, photos::PhotoSearchQuery};
async fn test() {
let client = PexelsClient::new("auth_key".to_string()).unwrap();
let response = client
.photo_search(PhotoSearchQuery::new("tigers".to_string()))
.await
.unwrap();
}
Search for photos with filters:
use pexels_client::{*, photos::PhotoSearchQuery};
async fn test() {
let client = PexelsClient::new("auth_key".to_string()).unwrap();
let query = PhotoSearchQuery::new("tigers".to_string())
.orientation(Orientation::Portrait)
.size(Size::Large)
.color(Color::Blue)
.per_page(5);
let response = client.photo_search(query).await.unwrap();
}
Licensed under