unsplash-js
Advanced tools
Comparing version 3.1.1 to 3.2.0
{ | ||
"name": "unsplash-js", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"description": "A Universal JavaScript wrapper for the Unsplash API", | ||
@@ -5,0 +5,0 @@ "main": "lib/unsplash.js", |
@@ -315,3 +315,3 @@ # Unsplash | ||
### photos.listPhotos(page, perPage) | ||
### photos.listPhotos(page, perPage, orderBy) | ||
Get a single page from the list of all photos. | ||
@@ -325,6 +325,7 @@ | ||
|__`perPage`__|_number_|Optional| | ||
|__`orderBy`__|_string_|Optional|`latest`, `popular` or `oldest`| | ||
__Example__ | ||
```js | ||
unsplash.photos.listPhotos(2, 15) | ||
unsplash.photos.listPhotos(2, 15, "latest") | ||
.then(toJson) | ||
@@ -337,2 +338,23 @@ .then(json => { | ||
### photos.listCuratedPhotos(page, perPage, orderBy) | ||
Get a single page from the list of the curated photos. | ||
__Arguments__ | ||
| Argument | Type | Opt/Required | | ||
|---|---|---| | ||
|__`page`__|_number_|Optional| | ||
|__`perPage`__|_number_|Optional| | ||
|__`orderBy`__|_string_|Optional|`latest`, `popular` or `oldest`| | ||
__Example__ | ||
```js | ||
unsplash.photos.listCuratedPhotos(2, 15, "latest") | ||
.then(toJson) | ||
.then(json => { | ||
// Your code | ||
}); | ||
``` | ||
--- | ||
### photos.searchPhotos(query, category, page, perPage) | ||
@@ -339,0 +361,0 @@ Get a single page from a photo search. Optionally limit your search to a set of categories by supplying the category ID’s. |
@@ -7,4 +7,18 @@ /* @flow */ | ||
const url = "/photos"; | ||
const query = { | ||
page, | ||
per_page: perPage, | ||
order_by: orderBy | ||
}; | ||
let query = { | ||
return this.request({ | ||
url, | ||
method: "GET", | ||
query | ||
}); | ||
}, | ||
listCuratedPhotos: (page = 1, perPage = 10, orderBy = "latest") => { | ||
const url = "/photos/curated"; | ||
const query = { | ||
page, | ||
@@ -24,4 +38,3 @@ per_page: perPage, | ||
const url = "/photos/search"; | ||
let query = { | ||
const query = { | ||
query: q, | ||
@@ -44,4 +57,3 @@ category: category.length > 1 | ||
const url = `/photos/${id}`; | ||
let query = { | ||
const query = { | ||
w: width, | ||
@@ -61,3 +73,2 @@ h: height, | ||
const url = "/photos/random"; | ||
const query = { | ||
@@ -67,3 +78,3 @@ category: options.category, | ||
username: options.username, | ||
q: options.query, | ||
query: options.query, | ||
w: options.width, | ||
@@ -70,0 +81,0 @@ h: options.height, |
107750
2445
844