Expand description
§pexels_client
The pexels_client
crate is a convenient wrapper around
Pexels API.
§Basic Usage
§Create a client
Creates pexels client taking authorization key as argument. You can get your authorization key here. You can make multiple requests using same client.
use pexels_client::PexelsClient;
fn main() {
let client = PexelsClient::new("auth_key".to_string()).unwrap();
}
§Search for photos
Returns photos of requested query.
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
Returns photos of requested query 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();
}
Modules§
- collection
- Contains
Structs
required for browsing Collections - photos
- Contains
Structs
required for browsing Photos - videos
- Contains
Structs
required for browsing Videos
Structs§
- Pexels
Client - Wrapper for Pexels API
- Pexels
Request Statistics - Struct for Pexels API stats
- User
- The
User
resource
Enums§
- Collection
Media Type - Media type Filter
- Color
- Color Filter
- Locale
- Locale Filter
- Media
Type - Media Data type
- Orientation
- Orientation Filter
- Pexels
Error - Error type for this crate
- Size
- Size Filter
Type Aliases§
- Pexels
Result - Result type for this crate