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>
}
}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too