Skip to content

Commit

Permalink
change some string params to UserIdResolvable
Browse files Browse the repository at this point in the history
  • Loading branch information
d-fischer committed Oct 26, 2020
1 parent ba9827c commit 9b7a79a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
14 changes: 8 additions & 6 deletions packages/twitch/src/API/Helix/Clip/HelixClipApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { TwitchApiCallType } from 'twitch-api-call';
import type { UserIdResolvable } from '../../../Toolkit/UserTools';
import { extractUserId } from '../../../Toolkit/UserTools';
import { BaseApi } from '../../BaseApi';
import { HelixPaginatedRequest } from '../HelixPaginatedRequest';
import { createPaginatedResult } from '../HelixPaginatedResult';
Expand Down Expand Up @@ -69,38 +71,38 @@ export class HelixClipApi extends BaseApi {
/**
* Retrieves the latest clips for the specified broadcaster.
*
* @param userId The broadcaster's user ID.
* @param user The broadcaster to fetch clips for.
* @param filter
*
* @expandParams
*/
async getClipsForBroadcaster(
userId: string,
user: UserIdResolvable,
filter: HelixClipFilter = {}
): Promise<HelixPaginatedResponse<HelixClip>> {
return this._getClips({
...filter,
filterType: 'broadcaster_id',
ids: userId
ids: extractUserId(user)
});
}

/**
* Creates a paginator for the latest clips for the specified broadcaster.
*
* @param userId The broadcaster's user ID.
* @param user The broadcaster to fetch clips for.
* @param filter
*
* @expandParams
*/
getClipsForBroadcasterPaginated(
userId: string,
user: UserIdResolvable,
filter: HelixClipFilter = {}
): HelixPaginatedRequest<HelixClipData, HelixClip> {
return this._getClipsPaginated({
...filter,
filterType: 'broadcaster_id',
ids: userId
ids: extractUserId(user)
});
}

Expand Down
7 changes: 5 additions & 2 deletions packages/twitch/src/API/Helix/Stream/HelixStreamApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,19 @@ export class HelixStreamApi extends BaseApi {
* Creates a new stream marker.
*
* Only works while the specified user's stream is live.
*
* @param broadcaster The broadcaster to create a stream marker for.
* @param description The description of the marker.
*/
async createStreamMarker(userId: string, description?: string): Promise<HelixStreamMarker> {
async createStreamMarker(broadcaster: UserIdResolvable, description?: string): Promise<HelixStreamMarker> {
try {
const result = await this._client.callApi<HelixResponse<HelixStreamMarkerData>>({
url: 'streams/markers',
method: 'POST',
type: TwitchApiCallType.Helix,
scope: 'user:edit:broadcast',
query: {
user_id: userId,
user_id: extractUserId(broadcaster),
description
}
});
Expand Down

0 comments on commit 9b7a79a

Please sign in to comment.