Skip to content

Commit 3eaeecf

Browse files
committed
Fix class and method signatures in typings
1 parent 0d2347b commit 3eaeecf

1 file changed

Lines changed: 55 additions & 16 deletions

File tree

lib/types/index.d.ts

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
/* =================== USAGE ===================
66
7-
import anilist from 'anilist-node';
8-
const Anilist = new anilist();
7+
import AniList from 'anilist-node';
8+
const anilist = new AniList();
99
1010
=============================================== */
1111

1212
/**
1313
* The main class for AniList-Node
1414
* @since 1.0.0
1515
*/
16-
export class Anilist {
16+
export class AniList {
1717

1818
/**
1919
* Access AniList's user data.
@@ -25,7 +25,7 @@ export class Anilist {
2525
/**
2626
* Access a user's AniList list data.
2727
* @since 1.1.0
28-
* @memberof Anilist
28+
* @memberof AniList
2929
*/
3030
lists: Lists;
3131

@@ -296,7 +296,13 @@ declare class People {
296296
*/
297297
favouriteChar(id: number): Promise<Boolean>;
298298

299-
getBirthdayCharacter(page: number): Promise<PersonRelation[]>;
299+
/**
300+
* Get all characters who's birthday is today
301+
* @param { Number } page - What page in the search to target. Defaults at 1.
302+
* @returns { PersonRelation[] }
303+
* @since 1.14.0
304+
*/
305+
getBirthdayCharacters(page?: number): Promise<PersonRelation[]>;
300306

301307
/**
302308
* Fetch a staff entry by its AniList ID or their name.
@@ -314,7 +320,13 @@ declare class People {
314320
*/
315321
favouriteStaff(id: number): Promise<Boolean>;
316322

317-
getBirthdayStaff(page: number): Promise<PersonRelation[]>;
323+
/**
324+
* Get all staff entries who's birthday is today
325+
* @param { Number } page - What page in the search to target. Defaults at 1.
326+
* @returns { PersonRelation[] }
327+
* @since 1.14.0
328+
*/
329+
getBirthdayStaff(page?: number): Promise<PersonRelation[]>;
318330
}
319331

320332
declare class Activity {
@@ -340,10 +352,35 @@ declare class Activity {
340352
*/
341353
getUserActivity(user: number, page?: number, perPage?: number): Promise<Array<ListActivity | TextActivity | MessageActivity>>;
342354

343-
postText(text: string, id?:number): Promise<TextActivity>;
355+
/**
356+
* [Require Login] Post a new text activity or update the activity with its ID
357+
* @param {String} text - The content of the activity.
358+
* @param {Number?} id - The AniList activity ID. Null to create, number for update
359+
*
360+
* @returns {TextActivity}
361+
* @since 1.11.0
362+
*/
363+
postText(text: string, id: number | null): Promise<TextActivity>;
344364

345-
postMessage(text: string, recipientId: number, isPrivate?:boolean, id?: number): Promise<MessageActivity>;
365+
/**
366+
* [Require Login] Post a new message activity or update the activity with its ID
367+
* @param {String} text - The activity message text
368+
* @param {Number} recipientId - The target user to send the message to
369+
* @param {Boolean} isPrivate - Set to true if it is a private message
370+
* @param {Number?} id - AniList Activity ID. Null to create, number to update.
371+
*
372+
* @returns {MessageActivity}
373+
* @since 1.11.0
374+
*/
375+
postMessage(text: string, recipientId: number, isPrivate?:boolean, id: number | null): Promise<MessageActivity>;
346376

377+
/**
378+
* [Require Login] Delete the current authorized user's activity post
379+
* @param {Number} id - The AniList activity ID to delete
380+
*
381+
* @returns {Boolean} Returns true if successful
382+
* @since 1.11.0
383+
*/
347384
delete(id: number): Promise<boolean>;
348385
}
349386

@@ -428,18 +465,20 @@ declare class Recommendation {
428465
/**
429466
* Get AniList recommendations for a media.
430467
* @param { Number } mediaID The AniList media id
468+
* @param { Number } page Target a specific page number for recommended.
469+
* @param { Number } perPage Limits the page amount to a specific number. 25 is max as per AniList limits.
431470
* @returns { RecommendationList }
432471
* @since 1.8.0
433472
*/
434-
getList(mediaID: Number): Promise<RecommendationList>;
473+
getList(mediaID: number, page?: number, perPage?: number): Promise<RecommendationList>;
435474

436475
/**
437476
* Get an AniList recommendation via its ID
438477
* @param { Number } recommendID The AniList recommendation ID
439478
* @returns { SingleRecommendation }
440479
* @since 1.8.0
441480
*/
442-
get(recommendID: Number): Promise<SingleRecommendation>;
481+
get(recommendID: number): Promise<SingleRecommendation>;
443482
}
444483

445484
declare class Thread {
@@ -469,7 +508,7 @@ declare class Thread {
469508
* @returns {ThreadComments[]}
470509
* @since 1.12.0
471510
*/
472-
getComments(id: number, page: number, perPage: number): Promise<ThreadComment[]>;
511+
getComments(id: number, page?: number, perPage?: number): Promise<ThreadComment[]>;
473512
}
474513

475514
export declare type MediaType = 'ANIME' | 'MANGA';
@@ -785,7 +824,7 @@ export declare interface UserOptions {
785824
displayAdultContent: boolean,
786825
airingNotifications: boolean,
787826
profileColor: string,
788-
activityMergeTime: Number,
827+
activityMergeTime: number,
789828
staffNameLanguage: UserStaffNameLanguage,
790829
notificationOptions: NotificationOptions[]
791830
}
@@ -800,7 +839,7 @@ export declare interface UserOptionsInput {
800839
displayAdultContent: boolean,
801840
airingNotifications: boolean,
802841
profileColor: string,
803-
activityMergeTime: Number,
842+
activityMergeTime: number,
804843
staffNameLanguage: UserStaffNameLanguage,
805844
notificationOptions: NotificationOptions[],
806845
timezone: string,
@@ -1202,8 +1241,8 @@ export declare interface RecommendationList {
12021241
}
12031242

12041243
export declare interface RecommendationEntry {
1205-
id: Number,
1206-
rating: Number,
1244+
id: number,
1245+
rating: number,
12071246
userRating: RecommendationRating,
12081247
user: UserRelation,
12091248
mediaRecommendation: MediaRelation
@@ -1319,4 +1358,4 @@ export declare interface AniListStats {
13191358
reviews: DayStats[]
13201359
}
13211360

1322-
export default Anilist;
1361+
export default AniList;

0 commit comments

Comments
 (0)