https://github.com/sajanv88/pexels_deno
A simple Deno library for accessing Pexels api. You may use this library to integrate with your existing product.
https://github.com/sajanv88/pexels_deno
deno javascript library pexels pexels-api typescript
Last synced: 2 months ago
JSON representation
A simple Deno library for accessing Pexels api. You may use this library to integrate with your existing product.
- Host: GitHub
- URL: https://github.com/sajanv88/pexels_deno
- Owner: sajanv88
- Created: 2022-02-05T19:42:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-06T10:43:32.000Z (over 4 years ago)
- Last Synced: 2025-02-18T00:30:12.932Z (over 1 year ago)
- Topics: deno, javascript, library, pexels, pexels-api, typescript
- Language: TypeScript
- Homepage: https://deno.land/x/pexels_deno@v1.0.1
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pexels_deno
A simple Deno library for accessing pexels api service. [Pexels API](https://www.pexels.com/api/). Please refer to the API docs to understand the inputs and expected results.
### Supported API methods are.
* Photos
* Videos
* Collections
[Create authorization key from pexels](https://www.pexels.com/api/documentation/#authorization)
### Usage
```js
import { Pexels } from "https://deno.land/x/pexels_deno/mod.ts";
// Create Client instance by passing in API key
const pexelsClient = new PexelsApi("");
// Search Photos API
try {
return await pexelsClient.searchPhotos({query: 'food'});
}catch(err) {
console.log(err);
}
// Search Videos API
try {
return await pexelsClient.searchVideos({query:"people"});
}catch(err) {
console.log(err);
}
// Trending Photos
try {
return await pexelsClient.getTrendingPhotos();
}catch(err) {
console.log(err);
}
// Random Photos
try {
return await pexelsClient.getRandomPhotos();
}catch(err) {
console.log(err);
}
// Photo by ID
try {
return await pexelsClient.getPhotoById(1710795);
}catch(err) {
console.log(err);
}
// Popular Videos
try {
return await pexelsClient.getPopularVideos();
}catch(err) {
console.log(err);
}
// My collections
try {
return await pexelsClient.getMyCollection();
}catch(err) {
console.log(err);
}
// Collections Media
try {
return await pexelsClient.getCollectionsMedia('9mp14cx', 'all');
}catch(err) {
console.log(err);
}
// Featured collections
try {
return await pexelsClient.getFeaturedCollections();
}catch(err) {
console.log(err);
}
```
#### API Version
Get Pexels API version
```js
PexelsAPIInstance.getPexelsApiVerison();
```
### Development
git clone [pexels_deno](git@github.com:sajanv88/pexels_deno.git)
* `deno run --allow-net src/mod.ts`
### Acknowledgements
Thanks, [Pexels](http://pexels.com) for creating a great platform for great images.
I'd like to thank all the folks who have been using this library!