Added typings

This commit is contained in:
Dolan
2017-07-08 12:02:48 +01:00
parent 382bd6f56e
commit 372dece74c
+36 -5
View File
@@ -1,12 +1,43 @@
// Type definitions for google-images 1.2
// Project: https://github.com/beatgammit/base64-js
// Type definitions for google-images 2.1
// Project: https://github.com/vadimdemedes/google-images
// Definitions by: Dolan Miu <https://github.com/dolanmiu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace GoogleImages {
interface GoogleImages {
export as namespace GoogleImages;
export = GoogleImages;
declare namespace GoogleImages {
type SearchImageSize = "icon" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "huge";
type SearchImageType = "clipart" | "face" | "lineart" | "news" | "photo";
type SearchDominantColor = "black" | "blue" | "brown" | "gray" | "green" | "pink" | "purple" | "teal" | "white" | "yellow";
type SearchColorType = "color" | "gray" | "mono";
type SearchSafe = "high" | "medium" | "off";
interface SearchOptions {
page?: number;
size?: SearchImageSize;
type?: SearchImageType;
dominantColor?: SearchDominantColor;
colorType?: SearchColorType;
safe?: SearchSafe;
}
interface Image {
url: string;
type: string;
width: number;
height: number;
size: number;
thumbnail: {
url: string,
width: number,
height: number
};
}
}
export = GoogleImages;
declare class GoogleImages {
constructor(engineId: string, apiKey: string);
search(searchTerm: string, options?: GoogleImages.SearchOptions): Promise<GoogleImages.Image[]>;
}