DefinitelyTyped/types/google-images/google-images-tests.ts
2017-07-08 01:11:05 +01:00

28 lines
686 B
TypeScript

import * as GoogleImages from "google-images";
const client = new GoogleImages('CSE ID', 'API KEY');
client.search('Steve Angello')
.then(images => {
/*
[{
"url": "http://steveangello.com/boss.jpg",
"type": "image/jpeg",
"width": 1024,
"height": 768,
"size": 102451,
"thumbnail": {
"url": "http://steveangello.com/thumbnail.jpg",
"width": 512,
"height": 512
}
}]
*/
});
// paginate results
client.search('Steve Angello', {page: 2});
// search for certain size
client.search('Steve Angello', {size: 'large'});