Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
BaseOptions,
GetAllStreamTagsOptions,
GetBitsLeaderboardOptions,
GetFollowsOptions,
GetFollowersOptions,
GetStreamsOptions,
GetVideosOptions,
GetSubsOptions,
Expand Down Expand Up @@ -456,16 +456,15 @@ export class TwitchApi extends EventEmitter{
return this._get<APIUserResponse>(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<APIFollowResponse>{
/** Get followers of a channel */
async getFollowers(options?: GetFollowersOptions): Promise<APIFollowResponse>{
let query = "?";

if(options)
query += parseOptions<GetFollowsOptions>(options);
if(options){
query += parseOptions<GetFollowersOptions>(options);
}

const endpoint = `/users/follows${query}`;
const endpoint = `/channels/followers${query}`;

return this._get<APIFollowResponse>(endpoint);
}
Expand Down
10 changes: 5 additions & 5 deletions src/types/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down