Open WickedSik opened 5 years ago
Hi! I realise this is a fairly old project, but still. I decided to add a typescript definition file 🗡
declare module 'wallhaven-api' { type SearchCategory = 'general' | 'anime' | 'people' type SearchCategoryUC = 'General' | 'Anime' | 'People' type SearchSorting = 'relevance' | 'random' | 'date_added' | 'views' | 'favorites' type SearchOptions = { categories?: SearchCategory[] page?: number sorting?: SearchSorting nsfw?: boolean sketchy?: boolean } type Tag = { id: number text: string } type SearchResultItem = { id: number width: number height: number thumb: string } type SearchResult = { end: boolean totalPages: number images: SearchResultItem[] } type DetailResult = { fullImage: string tags: Tag[] category: SearchCategoryUC size: string views: number width: number height: number colors: string[] } export default class Wallhaven { search(keyword: string, options?: SearchOptions): Promise<SearchResult> details(id: number): Promise<DetailResult> } }
Also, the package name is wallhaven-api not wallhaven like it shows in the README.md
wallhaven-api
wallhaven
Hi! I realise this is a fairly old project, but still. I decided to add a typescript definition file 🗡