diff --git a/src/index.ts b/src/index.ts index cc075e3..ac1cee4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,7 +11,7 @@ import { BaseOptions, GetAllStreamTagsOptions, GetBitsLeaderboardOptions, - GetFollowsOptions, + GetFollowersOptions, GetStreamsOptions, GetVideosOptions, GetSubsOptions, @@ -456,16 +456,15 @@ export class TwitchApi extends EventEmitter{ return this._get(endpoint); } - /** Get follows to or from a channel. Must provide either from_id or to_id. - * @deprecated Twitch has remove this endpoint. - */ - async getFollows(options?: GetFollowsOptions): Promise{ + /** Get followers of a channel */ + async getFollowers(options?: GetFollowersOptions): Promise{ let query = "?"; - if(options) - query += parseOptions(options); + if(options){ + query += parseOptions(options); + } - const endpoint = `/users/follows${query}`; + const endpoint = `/channels/followers${query}`; return this._get(endpoint); } diff --git a/src/types/options.ts b/src/types/options.ts index eeb2cad..f68944f 100644 --- a/src/types/options.ts +++ b/src/types/options.ts @@ -27,18 +27,18 @@ export interface TwitchApiConfig{ } /** The options to customize the request. */ -export interface GetFollowsOptions{ +export interface GetFollowersOptions{ /** Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query. */ after?: string; /** Maximum number of objects to return. Maximum: 100. Default: 20. */ first?: number; - /** User ID. Return list of channels that the supplied user is following. */ - from_id?: string | number; + /** The broadcaster’s ID. Returns the list of users that follow this broadcaster. */ + broadcaster_id?: string | number; - /** User ID. Return list of users who are following the supplied channel. */ - to_id?: string | number; + /** Use this parameter to see whether the user follows this broadcaster. If specified, the response contains this user if they follow the broadcaster. If not specified, the response contains all users that follow the broadcaster. */ + user_id?: string | number; } /** An options object used to create the request. */