From 58c645972b17e9b1081365ac0bdbfe44dd1f919c Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Tue, 22 Sep 2020 13:53:29 +0530 Subject: [PATCH] :label: Add types for packages --- src/types/goodreads.d.ts | 37 ++++++++++++++++++++ src/types/pocket-casts.d.ts | 70 +++++++++++++++++++++++++++++++++++++ src/types/wakatime.d.ts | 33 +++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 src/types/goodreads.d.ts create mode 100644 src/types/pocket-casts.d.ts create mode 100644 src/types/wakatime.d.ts diff --git a/src/types/goodreads.d.ts b/src/types/goodreads.d.ts new file mode 100644 index 0000000..0707ae9 --- /dev/null +++ b/src/types/goodreads.d.ts @@ -0,0 +1,37 @@ +declare module "goodreads-api-node" { + export default function goodreads( + params: { + key: string; + secret: string; + }, + url: string + ): { + initOAuth(url: string): void; + getRequestToken(): Promise; + getBooksOnUserShelf( + userId: string, + shiefName: string + ): Promise<{ + // + }>; + getUserInfo( + id: string + ): Promise<{ + user_shelves: { + type: "array"; + user_shelf: { + id: { _: string; type: "integer" }; + name: string; + book_count: { _: string; type: "integer" }; + exclusive_flag: { _: string; type: "boolean" }; + sort: { nil: "true" }; + order: "a"; + per_page: { type: "integer"; nil: "true" }; + featured: { _: string; type: "boolean" }; + recommend_for: { _: string; type: "boolean" }; + sticky: { type: "boolean"; nil: "true" }; + }[]; + }; + }>; + }; +} diff --git a/src/types/pocket-casts.d.ts b/src/types/pocket-casts.d.ts new file mode 100644 index 0000000..40cf9e0 --- /dev/null +++ b/src/types/pocket-casts.d.ts @@ -0,0 +1,70 @@ +interface Podcast { + uuid: string; + title: string; + author: string; + description: string; + url: string; +} + +interface MyPodcast extends Podcast { + episodesSortOrder: number; + autoStartFrom: number; + lastEpisodePublished: string; + unplayed: boolean; + lastEpisodeUuid: string; + lastEpisodePlayingStatus: number; + lastEpisodeArchived: boolean; +} + +interface Episode { + uuid: string; + url: string; + published: string; + duration: number; + fileType: string; + title: string; + size: string; + playingStatus: number; + playedUpTo: number; + starred: boolean; + podcastUuid: string; + podcastTitle: string; + episodeType: string; + episodeSeason: string; + episodeNumber: string; + isDeleted: boolean; +} + +interface EpisodeList { + total: number; + episodes: Episode[]; +} + +declare module "pocketcasts" { + export default class PocketCasts { + constructor(email: string, password: string); + private post(path: string, json: any): Promise; + private get(path: string): Promise; + + login(): Promise; + + getList(): Promise<{ podcasts: MyPodcast[] }>; + getNewReleases(): Promise; + getInProgress(): Promise; + getStarred(): Promise; + getHistory(): Promise; + getStats(): Promise; + getSearchResults({ + term, + }: { + term: string; + }): Promise<{ podcasts: Podcast[] }>; + getRecommendedEpisodes(): Promise; + getCategories(): Promise; // 404 + getContent(): Promise; // 404 + getFeatured(): Promise; // 404 + getNetworkList(): Promise; // 404 + getPopular(): Promise; // 404 + getTrending(): Promise; // 404 + } +} diff --git a/src/types/wakatime.d.ts b/src/types/wakatime.d.ts new file mode 100644 index 0000000..0ababc6 --- /dev/null +++ b/src/types/wakatime.d.ts @@ -0,0 +1,33 @@ +declare module "wakatime-client" { + export const RANGE: { + LAST_7_DAYS: "LAST_7_DAYS"; + LAST_30_DAYS: "LAST_30_DAYS"; + LAST_6_MONTHS: "LAST_6_MONTHS"; + LAST_YEAR: "LAST_YEAR"; + }; + export class WakaTimeClient { + constructor(apiKey: string); + getMySummary(params: { + dateRange: { startDate: string; endDate: string }; + }): Promise<{ + start: string; + end: string; + data: { + categories: any[]; + dependencies: []; + editors: any[]; + grand_total: any; + languages: any[]; + machines: any[]; + operating_systems: any[]; + projects: any[]; + range: any; + }[]; + }>; + getMyStats(params: { + range: string; + }): Promise<{ + data: any; + }>; + } +}