@phxgg/kick.js 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseResponse.d.ts +0 -1
- package/dist/BaseResponse.js +0 -1
- package/dist/Errors.d.ts +0 -1
- package/dist/Errors.js +0 -1
- package/dist/EventManager.d.ts +0 -1
- package/dist/EventManager.js +0 -1
- package/dist/KickClient.d.ts +2 -1
- package/dist/KickClient.js +3 -1
- package/dist/OAuth.d.ts +0 -1
- package/dist/OAuth.js +0 -1
- package/dist/Scope.d.ts +0 -1
- package/dist/Scope.js +0 -1
- package/dist/Serializable.d.ts +0 -1
- package/dist/Serializable.js +0 -1
- package/dist/Version.d.ts +0 -1
- package/dist/Version.js +0 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/resources/Category.d.ts +0 -1
- package/dist/resources/Category.js +0 -1
- package/dist/resources/Channel.d.ts +0 -1
- package/dist/resources/Channel.js +0 -1
- package/dist/resources/ChannelReward.d.ts +0 -1
- package/dist/resources/ChannelReward.js +0 -1
- package/dist/resources/ChannelRewardRedemption.d.ts +0 -1
- package/dist/resources/ChannelRewardRedemption.js +0 -1
- package/dist/resources/EventSubscription.d.ts +0 -1
- package/dist/resources/EventSubscription.js +0 -1
- package/dist/resources/Leaderboard.d.ts +0 -1
- package/dist/resources/Leaderboard.js +0 -1
- package/dist/resources/Livestream.d.ts +0 -1
- package/dist/resources/Livestream.js +0 -1
- package/dist/resources/LivestreamV2.d.ts +48 -0
- package/dist/resources/LivestreamV2.js +43 -0
- package/dist/resources/Message.d.ts +0 -1
- package/dist/resources/Message.js +0 -1
- package/dist/resources/User.d.ts +0 -1
- package/dist/resources/User.js +0 -1
- package/dist/services/CategoriesService.d.ts +0 -1
- package/dist/services/CategoriesService.js +0 -1
- package/dist/services/CategoriesServiceV2.d.ts +0 -1
- package/dist/services/CategoriesServiceV2.js +0 -1
- package/dist/services/ChannelRewardsService.d.ts +0 -1
- package/dist/services/ChannelRewardsService.js +0 -1
- package/dist/services/ChannelsService.d.ts +0 -1
- package/dist/services/ChannelsService.js +0 -1
- package/dist/services/ChatService.d.ts +0 -1
- package/dist/services/ChatService.js +0 -1
- package/dist/services/EventsService.d.ts +0 -1
- package/dist/services/EventsService.js +0 -1
- package/dist/services/KICKsService.d.ts +0 -1
- package/dist/services/KICKsService.js +0 -1
- package/dist/services/LivestreamsService.d.ts +3 -1
- package/dist/services/LivestreamsService.js +3 -1
- package/dist/services/LivestreamsServiceV2.d.ts +32 -0
- package/dist/services/LivestreamsServiceV2.js +78 -0
- package/dist/services/ModerationService.d.ts +0 -1
- package/dist/services/ModerationService.js +0 -1
- package/dist/services/PublicKeyService.d.ts +0 -1
- package/dist/services/PublicKeyService.js +0 -1
- package/dist/services/UsersService.d.ts +0 -1
- package/dist/services/UsersService.js +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -1
- package/dist/webhooks/WebhookEvents.d.ts +0 -1
- package/dist/webhooks/WebhookEvents.js +0 -1
- package/dist/webhooks/dispatch.d.ts +0 -1
- package/dist/webhooks/dispatch.js +0 -1
- package/dist/webhooks/v1/Properties.d.ts +0 -1
- package/dist/webhooks/v1/Properties.js +0 -1
- package/dist/webhooks/v1/payloads/ChannelFollowed.d.ts +0 -1
- package/dist/webhooks/v1/payloads/ChannelFollowed.js +0 -1
- package/dist/webhooks/v1/payloads/ChannelRewardRedemptionUpdated.d.ts +0 -1
- package/dist/webhooks/v1/payloads/ChannelRewardRedemptionUpdated.js +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionGifts.d.ts +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionGifts.js +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionNew.d.ts +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionNew.js +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionRenewal.d.ts +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionRenewal.js +0 -1
- package/dist/webhooks/v1/payloads/ChatMessageSent.d.ts +0 -1
- package/dist/webhooks/v1/payloads/ChatMessageSent.js +0 -1
- package/dist/webhooks/v1/payloads/KicksGifted.d.ts +0 -1
- package/dist/webhooks/v1/payloads/KicksGifted.js +0 -1
- package/dist/webhooks/v1/payloads/LivestreamMetadataUpdated.d.ts +0 -1
- package/dist/webhooks/v1/payloads/LivestreamMetadataUpdated.js +0 -1
- package/dist/webhooks/v1/payloads/LivestreamStatusUpdated.d.ts +0 -1
- package/dist/webhooks/v1/payloads/LivestreamStatusUpdated.js +0 -1
- package/dist/webhooks/v1/payloads/ModerationBanned.d.ts +0 -1
- package/dist/webhooks/v1/payloads/ModerationBanned.js +0 -1
- package/dist/webhooks/v1/payloads/index.d.ts +0 -1
- package/dist/webhooks/v1/payloads/index.js +0 -1
- package/dist/webhooks/verify.d.ts +0 -1
- package/dist/webhooks/verify.js +0 -1
- package/package.json +1 -1
- package/dist/BaseResponse.d.ts.map +0 -1
- package/dist/BaseResponse.js.map +0 -1
- package/dist/Errors.d.ts.map +0 -1
- package/dist/Errors.js.map +0 -1
- package/dist/EventManager.d.ts.map +0 -1
- package/dist/EventManager.js.map +0 -1
- package/dist/KickClient.d.ts.map +0 -1
- package/dist/KickClient.js.map +0 -1
- package/dist/OAuth.d.ts.map +0 -1
- package/dist/OAuth.js.map +0 -1
- package/dist/Scope.d.ts.map +0 -1
- package/dist/Scope.js.map +0 -1
- package/dist/Serializable.d.ts.map +0 -1
- package/dist/Serializable.js.map +0 -1
- package/dist/Version.d.ts.map +0 -1
- package/dist/Version.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/resources/Category.d.ts.map +0 -1
- package/dist/resources/Category.js.map +0 -1
- package/dist/resources/Channel.d.ts.map +0 -1
- package/dist/resources/Channel.js.map +0 -1
- package/dist/resources/ChannelReward.d.ts.map +0 -1
- package/dist/resources/ChannelReward.js.map +0 -1
- package/dist/resources/ChannelRewardRedemption.d.ts.map +0 -1
- package/dist/resources/ChannelRewardRedemption.js.map +0 -1
- package/dist/resources/EventSubscription.d.ts.map +0 -1
- package/dist/resources/EventSubscription.js.map +0 -1
- package/dist/resources/Leaderboard.d.ts.map +0 -1
- package/dist/resources/Leaderboard.js.map +0 -1
- package/dist/resources/Livestream.d.ts.map +0 -1
- package/dist/resources/Livestream.js.map +0 -1
- package/dist/resources/Message.d.ts.map +0 -1
- package/dist/resources/Message.js.map +0 -1
- package/dist/resources/User.d.ts.map +0 -1
- package/dist/resources/User.js.map +0 -1
- package/dist/services/CategoriesService.d.ts.map +0 -1
- package/dist/services/CategoriesService.js.map +0 -1
- package/dist/services/CategoriesServiceV2.d.ts.map +0 -1
- package/dist/services/CategoriesServiceV2.js.map +0 -1
- package/dist/services/ChannelRewardsService.d.ts.map +0 -1
- package/dist/services/ChannelRewardsService.js.map +0 -1
- package/dist/services/ChannelsService.d.ts.map +0 -1
- package/dist/services/ChannelsService.js.map +0 -1
- package/dist/services/ChatService.d.ts.map +0 -1
- package/dist/services/ChatService.js.map +0 -1
- package/dist/services/EventsService.d.ts.map +0 -1
- package/dist/services/EventsService.js.map +0 -1
- package/dist/services/KICKsService.d.ts.map +0 -1
- package/dist/services/KICKsService.js.map +0 -1
- package/dist/services/LivestreamsService.d.ts.map +0 -1
- package/dist/services/LivestreamsService.js.map +0 -1
- package/dist/services/ModerationService.d.ts.map +0 -1
- package/dist/services/ModerationService.js.map +0 -1
- package/dist/services/PublicKeyService.d.ts.map +0 -1
- package/dist/services/PublicKeyService.js.map +0 -1
- package/dist/services/UsersService.d.ts.map +0 -1
- package/dist/services/UsersService.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
- package/dist/webhooks/WebhookEvents.d.ts.map +0 -1
- package/dist/webhooks/WebhookEvents.js.map +0 -1
- package/dist/webhooks/dispatch.d.ts.map +0 -1
- package/dist/webhooks/dispatch.js.map +0 -1
- package/dist/webhooks/v1/Properties.d.ts.map +0 -1
- package/dist/webhooks/v1/Properties.js.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelFollowed.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelFollowed.js.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelRewardRedemptionUpdated.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelRewardRedemptionUpdated.js.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionGifts.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionGifts.js.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionNew.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionNew.js.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionRenewal.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/ChannelSubscriptionRenewal.js.map +0 -1
- package/dist/webhooks/v1/payloads/ChatMessageSent.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/ChatMessageSent.js.map +0 -1
- package/dist/webhooks/v1/payloads/KicksGifted.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/KicksGifted.js.map +0 -1
- package/dist/webhooks/v1/payloads/LivestreamMetadataUpdated.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/LivestreamMetadataUpdated.js.map +0 -1
- package/dist/webhooks/v1/payloads/LivestreamStatusUpdated.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/LivestreamStatusUpdated.js.map +0 -1
- package/dist/webhooks/v1/payloads/ModerationBanned.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/ModerationBanned.js.map +0 -1
- package/dist/webhooks/v1/payloads/index.d.ts.map +0 -1
- package/dist/webhooks/v1/payloads/index.js.map +0 -1
- package/dist/webhooks/verify.d.ts.map +0 -1
- package/dist/webhooks/verify.js.map +0 -1
package/dist/BaseResponse.d.ts
CHANGED
package/dist/BaseResponse.js
CHANGED
package/dist/Errors.d.ts
CHANGED
package/dist/Errors.js
CHANGED
package/dist/EventManager.d.ts
CHANGED
package/dist/EventManager.js
CHANGED
package/dist/KickClient.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ChatService } from './services/ChatService.js';
|
|
|
8
8
|
import { EventsService } from './services/EventsService.js';
|
|
9
9
|
import { KICKsService } from './services/KICKsService.js';
|
|
10
10
|
import { LivestreamsService } from './services/LivestreamsService.js';
|
|
11
|
+
import { LivestreamsServiceV2 } from './services/LivestreamsServiceV2.js';
|
|
11
12
|
import { ModerationService } from './services/ModerationService.js';
|
|
12
13
|
import { UsersService } from './services/UsersService.js';
|
|
13
14
|
import { WebhookEventNames, WebhookEventPayloadMap } from './webhooks/WebhookEvents.js';
|
|
@@ -32,6 +33,7 @@ export declare class KickClient {
|
|
|
32
33
|
chat: ChatService;
|
|
33
34
|
moderation: ModerationService;
|
|
34
35
|
livestreams: LivestreamsService;
|
|
36
|
+
livestreamsV2: LivestreamsServiceV2;
|
|
35
37
|
events: EventsService;
|
|
36
38
|
kicks: KICKsService;
|
|
37
39
|
constructor(options: KickClientOptions);
|
|
@@ -43,4 +45,3 @@ export declare class KickClient {
|
|
|
43
45
|
removeAllListeners(): void;
|
|
44
46
|
requiresScope(scope: Scope): void;
|
|
45
47
|
}
|
|
46
|
-
//# sourceMappingURL=KickClient.d.ts.map
|
package/dist/KickClient.js
CHANGED
|
@@ -10,6 +10,7 @@ import { ChatService } from './services/ChatService.js';
|
|
|
10
10
|
import { EventsService } from './services/EventsService.js';
|
|
11
11
|
import { KICKsService } from './services/KICKsService.js';
|
|
12
12
|
import { LivestreamsService } from './services/LivestreamsService.js';
|
|
13
|
+
import { LivestreamsServiceV2 } from './services/LivestreamsServiceV2.js';
|
|
13
14
|
import { ModerationService } from './services/ModerationService.js';
|
|
14
15
|
import { UsersService } from './services/UsersService.js';
|
|
15
16
|
export const KICK_BASE_URL = 'https://api.kick.com/public';
|
|
@@ -28,6 +29,7 @@ export class KickClient {
|
|
|
28
29
|
chat;
|
|
29
30
|
moderation;
|
|
30
31
|
livestreams;
|
|
32
|
+
livestreamsV2;
|
|
31
33
|
events;
|
|
32
34
|
kicks;
|
|
33
35
|
constructor(options) {
|
|
@@ -40,6 +42,7 @@ export class KickClient {
|
|
|
40
42
|
this.chat = new ChatService(this);
|
|
41
43
|
this.moderation = new ModerationService(this);
|
|
42
44
|
this.livestreams = new LivestreamsService(this);
|
|
45
|
+
this.livestreamsV2 = new LivestreamsServiceV2(this);
|
|
43
46
|
this.events = new EventsService(this);
|
|
44
47
|
this.kicks = new KICKsService(this);
|
|
45
48
|
}
|
|
@@ -85,4 +88,3 @@ export class KickClient {
|
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
//# sourceMappingURL=KickClient.js.map
|
package/dist/OAuth.d.ts
CHANGED
package/dist/OAuth.js
CHANGED
package/dist/Scope.d.ts
CHANGED
package/dist/Scope.js
CHANGED
package/dist/Serializable.d.ts
CHANGED
package/dist/Serializable.js
CHANGED
package/dist/Version.d.ts
CHANGED
package/dist/Version.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { ChatService, ChatMessageType } from './services/ChatService.js';
|
|
|
18
18
|
export { EventsService, EventSubscriptionMethod } from './services/EventsService.js';
|
|
19
19
|
export { KICKsService } from './services/KICKsService.js';
|
|
20
20
|
export { LivestreamsService } from './services/LivestreamsService.js';
|
|
21
|
+
export { LivestreamsServiceV2 } from './services/LivestreamsServiceV2.js';
|
|
21
22
|
export { ModerationService } from './services/ModerationService.js';
|
|
22
23
|
export { PublicKeyService, getKickPublicKey } from './services/PublicKeyService.js';
|
|
23
24
|
export type { PublicKeyDto, PublicKeyResponse } from './services/PublicKeyService.js';
|
|
@@ -36,6 +37,8 @@ export { Leaderboard } from './resources/Leaderboard.js';
|
|
|
36
37
|
export type { LeaderboardDto } from './resources/Leaderboard.js';
|
|
37
38
|
export { Livestream } from './resources/Livestream.js';
|
|
38
39
|
export type { LivestreamDto, LivestreamStatsDto } from './resources/Livestream.js';
|
|
40
|
+
export { LivestreamV2 } from './resources/LivestreamV2.js';
|
|
41
|
+
export type { LivestreamV2Dto, LivestreamV2StatsDto } from './resources/LivestreamV2.js';
|
|
39
42
|
export { Message } from './resources/Message.js';
|
|
40
43
|
export type { MessageDto } from './resources/Message.js';
|
|
41
44
|
export { User } from './resources/User.js';
|
|
@@ -46,4 +49,3 @@ export { dispatchWebhookEvent } from './webhooks/dispatch.js';
|
|
|
46
49
|
export { WebhookEvents } from './webhooks/WebhookEvents.js';
|
|
47
50
|
export type { WebhookEventNames, WebhookEventPayloadMap } from './webhooks/WebhookEvents.js';
|
|
48
51
|
export type { ChannelFollowedEventPayload, ChannelRewardRedemptionUpdatedEventPayload, ChannelSubscriptionGiftsEventPayload, ChannelSubscriptionNewEventPayload, ChannelSubscriptionRenewalEventPayload, ChatMessageSentEventPayload, KicksGiftedEventPayload, LivestreamMetadataUpdatedEventPayload, LivestreamStatusUpdatedEventPayload, ModerationBannedEventPayload, } from './webhooks/v1/payloads/index.js';
|
|
49
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export { ChatService, ChatMessageType } from './services/ChatService.js';
|
|
|
22
22
|
export { EventsService, EventSubscriptionMethod } from './services/EventsService.js';
|
|
23
23
|
export { KICKsService } from './services/KICKsService.js';
|
|
24
24
|
export { LivestreamsService } from './services/LivestreamsService.js';
|
|
25
|
+
export { LivestreamsServiceV2 } from './services/LivestreamsServiceV2.js';
|
|
25
26
|
export { ModerationService } from './services/ModerationService.js';
|
|
26
27
|
export { PublicKeyService, getKickPublicKey } from './services/PublicKeyService.js';
|
|
27
28
|
export { UsersService } from './services/UsersService.js';
|
|
@@ -32,10 +33,10 @@ export { ChannelReward } from './resources/ChannelReward.js';
|
|
|
32
33
|
export { EventSubscription } from './resources/EventSubscription.js';
|
|
33
34
|
export { Leaderboard } from './resources/Leaderboard.js';
|
|
34
35
|
export { Livestream } from './resources/Livestream.js';
|
|
36
|
+
export { LivestreamV2 } from './resources/LivestreamV2.js';
|
|
35
37
|
export { Message } from './resources/Message.js';
|
|
36
38
|
export { User } from './resources/User.js';
|
|
37
39
|
// Webhooks: framework-agnostic primitives
|
|
38
40
|
export { verifyKickSignature } from './webhooks/verify.js';
|
|
39
41
|
export { dispatchWebhookEvent } from './webhooks/dispatch.js';
|
|
40
42
|
export { WebhookEvents } from './webhooks/WebhookEvents.js';
|
|
41
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { KickClient } from '../KickClient.js';
|
|
2
|
+
import { Serializable } from '../Serializable.js';
|
|
3
|
+
type LivestreamUserDto = {
|
|
4
|
+
id: number;
|
|
5
|
+
profile_picture: string;
|
|
6
|
+
username: string;
|
|
7
|
+
};
|
|
8
|
+
type LivestreamCategoryDto = {
|
|
9
|
+
id: number;
|
|
10
|
+
name: string;
|
|
11
|
+
thumbnail: string;
|
|
12
|
+
};
|
|
13
|
+
type LivestreamChannelDto = {
|
|
14
|
+
slug: string;
|
|
15
|
+
};
|
|
16
|
+
export type LivestreamV2Dto = {
|
|
17
|
+
broadcaster_user: LivestreamUserDto;
|
|
18
|
+
category: LivestreamCategoryDto;
|
|
19
|
+
channel: LivestreamChannelDto;
|
|
20
|
+
has_mature_content: boolean;
|
|
21
|
+
id: string;
|
|
22
|
+
language_code: string;
|
|
23
|
+
started_at: string;
|
|
24
|
+
tags: string[];
|
|
25
|
+
thumbnail: string;
|
|
26
|
+
title: string;
|
|
27
|
+
viewer_count: number;
|
|
28
|
+
};
|
|
29
|
+
export type LivestreamV2StatsDto = {
|
|
30
|
+
total_count: number;
|
|
31
|
+
};
|
|
32
|
+
export declare class LivestreamV2 extends Serializable {
|
|
33
|
+
private dto;
|
|
34
|
+
protected readonly client: KickClient;
|
|
35
|
+
constructor(client: KickClient, dto: LivestreamV2Dto);
|
|
36
|
+
get broadcasterUser(): LivestreamUserDto;
|
|
37
|
+
get category(): LivestreamCategoryDto;
|
|
38
|
+
get channel(): LivestreamChannelDto;
|
|
39
|
+
get hasMatureContent(): boolean;
|
|
40
|
+
get id(): string;
|
|
41
|
+
get languageCode(): string;
|
|
42
|
+
get startedAt(): Date;
|
|
43
|
+
get tags(): string[];
|
|
44
|
+
get thumbnail(): URL;
|
|
45
|
+
get title(): string;
|
|
46
|
+
get viewerCount(): number;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Serializable } from '../Serializable.js';
|
|
2
|
+
export class LivestreamV2 extends Serializable {
|
|
3
|
+
dto;
|
|
4
|
+
client;
|
|
5
|
+
constructor(client, dto) {
|
|
6
|
+
super();
|
|
7
|
+
this.dto = dto;
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
get broadcasterUser() {
|
|
11
|
+
return this.dto.broadcaster_user;
|
|
12
|
+
}
|
|
13
|
+
get category() {
|
|
14
|
+
return this.dto.category;
|
|
15
|
+
}
|
|
16
|
+
get channel() {
|
|
17
|
+
return this.dto.channel;
|
|
18
|
+
}
|
|
19
|
+
get hasMatureContent() {
|
|
20
|
+
return this.dto.has_mature_content;
|
|
21
|
+
}
|
|
22
|
+
get id() {
|
|
23
|
+
return this.dto.id;
|
|
24
|
+
}
|
|
25
|
+
get languageCode() {
|
|
26
|
+
return this.dto.language_code;
|
|
27
|
+
}
|
|
28
|
+
get startedAt() {
|
|
29
|
+
return new Date(this.dto.started_at);
|
|
30
|
+
}
|
|
31
|
+
get tags() {
|
|
32
|
+
return this.dto.tags;
|
|
33
|
+
}
|
|
34
|
+
get thumbnail() {
|
|
35
|
+
return new URL(this.dto.thumbnail);
|
|
36
|
+
}
|
|
37
|
+
get title() {
|
|
38
|
+
return this.dto.title;
|
|
39
|
+
}
|
|
40
|
+
get viewerCount() {
|
|
41
|
+
return this.dto.viewer_count;
|
|
42
|
+
}
|
|
43
|
+
}
|
package/dist/resources/User.d.ts
CHANGED
package/dist/resources/User.js
CHANGED
|
@@ -16,6 +16,9 @@ export declare const fetchLivestreamsSchema: z.ZodObject<{
|
|
|
16
16
|
export type FetchLivestreamsParams = z.infer<typeof fetchLivestreamsSchema>;
|
|
17
17
|
export type FetchLivestreamsResponse = BaseResponse<LivestreamDto[]>;
|
|
18
18
|
export type FetchLivestreamStatsResponse = BaseResponse<LivestreamStatsDto>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `LivestreamsServiceV2` instead.
|
|
21
|
+
*/
|
|
19
22
|
export declare class LivestreamsService {
|
|
20
23
|
private readonly LIVESTREAMS_URL;
|
|
21
24
|
protected readonly client: KickClient;
|
|
@@ -36,4 +39,3 @@ export declare class LivestreamsService {
|
|
|
36
39
|
total_count: number;
|
|
37
40
|
}>;
|
|
38
41
|
}
|
|
39
|
-
//# sourceMappingURL=LivestreamsService.d.ts.map
|
|
@@ -14,6 +14,9 @@ export const fetchLivestreamsSchema = z.object({
|
|
|
14
14
|
limit: z.number().int().min(1).max(100).optional(),
|
|
15
15
|
sort: z.enum(Sort).optional(),
|
|
16
16
|
});
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use `LivestreamsServiceV2` instead.
|
|
19
|
+
*/
|
|
17
20
|
export class LivestreamsService {
|
|
18
21
|
LIVESTREAMS_URL = constructEndpoint(Version.V1, 'livestreams');
|
|
19
22
|
client;
|
|
@@ -89,4 +92,3 @@ export class LivestreamsService {
|
|
|
89
92
|
return json.data;
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
|
-
//# sourceMappingURL=LivestreamsService.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { BaseResponse } from '../BaseResponse.js';
|
|
3
|
+
import type { KickClient } from '../KickClient.js';
|
|
4
|
+
import { LivestreamV2, type LivestreamV2Dto, type LivestreamV2StatsDto } from '../index.js';
|
|
5
|
+
export declare const fetchLivestreamsV2Schema: z.ZodObject<{
|
|
6
|
+
categoryId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
7
|
+
language_code: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.z.core.$strip>;
|
|
11
|
+
export type FetchLivestreamsV2Params = z.infer<typeof fetchLivestreamsV2Schema>;
|
|
12
|
+
export type FetchLivestreamsV2Response = BaseResponse<LivestreamV2Dto[]>;
|
|
13
|
+
export type FetchLivestreamStatsResponse = BaseResponse<LivestreamV2StatsDto>;
|
|
14
|
+
export declare class LivestreamsServiceV2 {
|
|
15
|
+
private readonly LIVESTREAMS_URL;
|
|
16
|
+
protected readonly client: KickClient;
|
|
17
|
+
constructor(client: KickClient);
|
|
18
|
+
/**
|
|
19
|
+
* Fetches livestreams from the Kick API.
|
|
20
|
+
*
|
|
21
|
+
* @param params Parameters for fetching livestreams.
|
|
22
|
+
* @param params.category_id (Optional) Category ID to filter by.
|
|
23
|
+
* @param params.language_code (Optional) Array of language codes to filter by.
|
|
24
|
+
* @param params.limit (Optional) Maximum number of results to return. Min: 1, Max: 1000.
|
|
25
|
+
* @param params.cursor (Optional) Cursor for pagination.
|
|
26
|
+
* @returns An array of `LivestreamV2` instances.
|
|
27
|
+
*/
|
|
28
|
+
fetch(params: FetchLivestreamsV2Params): Promise<LivestreamV2[]>;
|
|
29
|
+
fetchStats(): Promise<{
|
|
30
|
+
total_count: number;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { LivestreamV2 } from '../index.js';
|
|
3
|
+
import { constructEndpoint, handleError, parseJSON } from '../utils.js';
|
|
4
|
+
import { Version } from '../Version.js';
|
|
5
|
+
export const fetchLivestreamsV2Schema = z.object({
|
|
6
|
+
categoryId: z.array(z.number().int().positive()).optional(),
|
|
7
|
+
language_code: z.array(z.string()).optional(),
|
|
8
|
+
limit: z.number().int().min(1).max(1000).optional(),
|
|
9
|
+
cursor: z.string().optional(),
|
|
10
|
+
});
|
|
11
|
+
export class LivestreamsServiceV2 {
|
|
12
|
+
LIVESTREAMS_URL = constructEndpoint(Version.V2, 'livestreams');
|
|
13
|
+
client;
|
|
14
|
+
constructor(client) {
|
|
15
|
+
this.client = client;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Fetches livestreams from the Kick API.
|
|
19
|
+
*
|
|
20
|
+
* @param params Parameters for fetching livestreams.
|
|
21
|
+
* @param params.category_id (Optional) Category ID to filter by.
|
|
22
|
+
* @param params.language_code (Optional) Array of language codes to filter by.
|
|
23
|
+
* @param params.limit (Optional) Maximum number of results to return. Min: 1, Max: 1000.
|
|
24
|
+
* @param params.cursor (Optional) Cursor for pagination.
|
|
25
|
+
* @returns An array of `LivestreamV2` instances.
|
|
26
|
+
*/
|
|
27
|
+
async fetch(params) {
|
|
28
|
+
const schema = fetchLivestreamsV2Schema.safeParse(params);
|
|
29
|
+
if (!schema.success) {
|
|
30
|
+
const errorMessages = schema.error.issues.map((issue) => ({
|
|
31
|
+
key: issue.path.join('.'),
|
|
32
|
+
message: issue.message,
|
|
33
|
+
}));
|
|
34
|
+
throw new Error(`Invalid parameters: ${JSON.stringify(errorMessages)}`);
|
|
35
|
+
}
|
|
36
|
+
const { categoryId, language_code, limit, cursor } = schema.data;
|
|
37
|
+
if (limit && (limit < 1 || limit > 1000)) {
|
|
38
|
+
throw new Error('The limit must be between 1 and 1000.');
|
|
39
|
+
}
|
|
40
|
+
const endpoint = new URL(this.LIVESTREAMS_URL);
|
|
41
|
+
if (categoryId && categoryId.length > 0) {
|
|
42
|
+
categoryId.forEach((id) => endpoint.searchParams.append('category_id', String(id)));
|
|
43
|
+
}
|
|
44
|
+
if (language_code && language_code.length > 0) {
|
|
45
|
+
language_code.forEach((code) => endpoint.searchParams.append('language_code', code));
|
|
46
|
+
}
|
|
47
|
+
if (limit) {
|
|
48
|
+
endpoint.searchParams.append('limit', String(limit));
|
|
49
|
+
}
|
|
50
|
+
if (cursor) {
|
|
51
|
+
endpoint.searchParams.append('cursor', cursor);
|
|
52
|
+
}
|
|
53
|
+
const response = await fetch(endpoint, {
|
|
54
|
+
headers: {
|
|
55
|
+
Authorization: `Bearer ${this.client.token?.access_token}`,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
if (!response.ok) {
|
|
59
|
+
handleError(response);
|
|
60
|
+
}
|
|
61
|
+
const json = await parseJSON(response);
|
|
62
|
+
const livestreams = json.data.map((livestream) => new LivestreamV2(this.client, livestream));
|
|
63
|
+
return livestreams;
|
|
64
|
+
}
|
|
65
|
+
async fetchStats() {
|
|
66
|
+
const endpoint = new URL(this.LIVESTREAMS_URL.replace(`/${Version.V2}/`, `/${Version.V1}/`) + '/stats');
|
|
67
|
+
const response = await fetch(endpoint, {
|
|
68
|
+
headers: {
|
|
69
|
+
Authorization: `Bearer ${this.client.token?.access_token}`,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
handleError(response);
|
|
74
|
+
}
|
|
75
|
+
const json = await parseJSON(response);
|
|
76
|
+
return json.data;
|
|
77
|
+
}
|
|
78
|
+
}
|