From 372dece74cbf618cd1cfa0aa6a9a185aadff5fcc Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 8 Jul 2017 12:02:48 +0100 Subject: [PATCH] Added typings --- types/google-images/index.d.ts | 41 +++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/types/google-images/index.d.ts b/types/google-images/index.d.ts index eceb0ca445..935cbda432 100644 --- a/types/google-images/index.d.ts +++ b/types/google-images/index.d.ts @@ -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 // 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; +}