// Type definitions for podcast-index-api 2.0.0 // Project: https://github.com/comster/podcast-index-api // // The factory returns an object of API methods. Endpoints resolve to the raw // JSON returned by the Podcast Index API; see the official docs for response // shapes: https://podcastindex-org.github.io/docs-api/ declare function podcastIndexApi( key: string, secret: string, userAgent: string, ): podcastIndexApi.PodcastIndexApi declare namespace podcastIndexApi { /** Raw JSON body returned by an endpoint. See the Podcast Index API docs. */ type PodcastIndexResponse = any /** Error thrown for a failed API request. */ class PodcastIndexError extends Error { name: 'PodcastIndexError' /** HTTP status code of the failed response. */ code?: number /** Parsed JSON error payload from the API, when available. */ body?: any constructor(message: string, code?: number, body?: any) } interface PodcastIndexApi { /** * Low-level signed request. Unlike the named methods it does NOT throw * on API errors — it resolves with the raw status code and parsed body. */ api(path: string): Promise<{ statusCode: number; body: any }> /** Call an arbitrary endpoint path with a query object. */ custom( path: string, queries?: Record, ): Promise // Search searchByTerm( q: string, val?: string, clean?: boolean, fullText?: boolean, ): Promise searchByTitle( q: string, val?: string, clean?: boolean, fullText?: boolean, ): Promise searchEpisodesByPerson( q: string, fullText?: boolean, ): Promise // Podcasts podcastsByFeedUrl(feedUrl: string): Promise podcastsByFeedId(feedId: number): Promise podcastsByFeedItunesId(itunesId: number): Promise podcastsByGUID(guid: string): Promise podcastsByTag(): Promise podcastsTrending( max?: number, since?: number | null, lang?: string | null, cat?: string | null, notcat?: string | null, ): Promise podcastsDead(): Promise // Add addByFeedUrl( feedUrl: string, chash?: string | null, itunesId?: number | null, ): Promise addByItunesId(itunesId: number): Promise // Episodes episodesByFeedId( feedId: number, since?: number | null, max?: number, fullText?: boolean, ): Promise episodesByFeedUrl( feedUrl: string, since?: number | null, max?: number, fullText?: boolean, ): Promise episodesByItunesId( itunesId: number, since?: number | null, max?: number, fullText?: boolean, ): Promise episodesById( id: number, fullText?: boolean, ): Promise episodesRandom( max?: number, lang?: string | null, cat?: string | null, notcat?: string | null, fullText?: boolean, ): Promise // Recent recentFeeds( max?: number, since?: number | null, cat?: string | null, lang?: string | null, notcat?: string | null, ): Promise recentEpisodes( max?: number, excludeString?: string | null, before?: number | null, fullText?: boolean, ): Promise recentNewFeeds( max?: number, since?: number | null, ): Promise recentSoundbites(max?: number): Promise // Value valueByFeedId(feedId: number): Promise valueByFeedUrl(feedUrl: string): Promise // Categories categoriesList(): Promise // Notify Hub hubPubNotifyById(feedId: number): Promise hubPubNotifyByUrl(feedUrl: string): Promise } } export = podcastIndexApi