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
:
toml
[dependencies]
pexels_client = "0.1.0"
Create a Pexels Client:
```rust use pexels_client::PexelsClient;
fn main() { let client = PexelsClient::new("authkey".tostring()).unwrap(); } ```
Search for Photos:
```rust use pexels_client::{PexelsClient, photos::PhotoSearchQuery};
async fn test() { let client = PexelsClient::new("authkey".tostring()).unwrap(); let response = client .photosearch(PhotoSearchQuery::new("tigers".tostring())) .await .unwrap(); } ```
Search for photos with filters:
```rust use pexels_client::{*, photos::PhotoSearchQuery};
async fn test() { let client = PexelsClient::new("authkey".tostring()).unwrap(); let query = PhotoSearchQuery::new("tigers".tostring()) .orientation(Orientation::Portrait) .size(Size::Large) .color(Color::Blue) .perpage(5); let response = client.photo_search(query).await.unwrap(); } ```
Licensed under