[update] PixabayStorage
This commit is contained in:
@@ -11,6 +11,28 @@ typedef PixabayResponse = {
|
|||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum PixabayCategory {
|
||||||
|
FASHION;
|
||||||
|
NATURE;
|
||||||
|
BACKGROUNDS;
|
||||||
|
SCIENCE;
|
||||||
|
EDUCATION;
|
||||||
|
PEOPLE;
|
||||||
|
FEELINGS;
|
||||||
|
RELIGION;
|
||||||
|
HEALTH;
|
||||||
|
PLACES;
|
||||||
|
ANIMALS;
|
||||||
|
INDUSTRY;
|
||||||
|
FOOD;
|
||||||
|
COMPUTER;
|
||||||
|
SPORTS;
|
||||||
|
TRANSPORTATION;
|
||||||
|
TRAVEL; BUILDINGS;
|
||||||
|
BUSINESS;
|
||||||
|
MUSIC;
|
||||||
|
}
|
||||||
|
|
||||||
@:provide class PixabayStorage extends SharedObjectStorage implements ISourceStorage {
|
@:provide class PixabayStorage extends SharedObjectStorage implements ISourceStorage {
|
||||||
|
|
||||||
private var key:String;
|
private var key:String;
|
||||||
@@ -26,7 +48,7 @@ typedef PixabayResponse = {
|
|||||||
return enabled && exists(type) ?
|
return enabled && exists(type) ?
|
||||||
Promise.promise(read(type)) :
|
Promise.promise(read(type)) :
|
||||||
new JsonLoader<PixabayResponse>()
|
new JsonLoader<PixabayResponse>()
|
||||||
.GET('https://pixabay.com/api/?key=${key}&category=${type}')
|
.GET('https://pixabay.com/api/?key=${key}&q=${type}')
|
||||||
.then(function(result:PixabayResponse) {
|
.then(function(result:PixabayResponse) {
|
||||||
var result = [for (item in result.hits) URL(item.largeImageURL)];
|
var result = [for (item in result.hits) URL(item.largeImageURL)];
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
|||||||
Reference in New Issue
Block a user