Skip to content

sattva9/pexels_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pexels Client

The pexels_client crate is a wrapper around Pexels API.

Crates.io Documentation

More information about this crate can be found in the crate documentation.

Usage

To use pexels_client, first add this to your Cargo.toml:

[dependencies]
pexels_client = "0.1.0"

Examples

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();
}

License

Licensed under

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages