Skip to content

Commit

Permalink
🏷️ Add types for packages
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Sep 22, 2020
1 parent 9249643 commit 58c6459
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/types/goodreads.d.ts
Original file line number Diff line number Diff line change
@@ -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<string>;
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" };
}[];
};
}>;
};
}
70 changes: 70 additions & 0 deletions src/types/pocket-casts.d.ts
Original file line number Diff line number Diff line change
@@ -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<T>(path: string, json: any): Promise<T>;
private get<T>(path: string): Promise<T>;

login(): Promise<void>;

getList(): Promise<{ podcasts: MyPodcast[] }>;
getNewReleases(): Promise<EpisodeList>;
getInProgress(): Promise<EpisodeList>;
getStarred(): Promise<EpisodeList>;
getHistory(): Promise<EpisodeList>;
getStats(): Promise<any>;
getSearchResults({
term,
}: {
term: string;
}): Promise<{ podcasts: Podcast[] }>;
getRecommendedEpisodes(): Promise<EpisodeList>;
getCategories(): Promise<any>; // 404
getContent(): Promise<any>; // 404
getFeatured(): Promise<any>; // 404
getNetworkList(): Promise<any>; // 404
getPopular(): Promise<any>; // 404
getTrending(): Promise<any>; // 404
}
}
33 changes: 33 additions & 0 deletions src/types/wakatime.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}>;
}
}

0 comments on commit 58c6459

Please sign in to comment.