@borealise/api 2.1.0-alpha.2 → 2.1.0-alpha.4
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/index.d.mts +71 -2
- package/dist/index.d.ts +71 -2
- package/dist/index.js +38 -3
- package/dist/index.mjs +38 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -431,7 +431,7 @@ interface BoothResponse {
|
|
|
431
431
|
interface VoteResponse {
|
|
432
432
|
success: boolean;
|
|
433
433
|
data: {
|
|
434
|
-
vote: 'woot' | 'meh';
|
|
434
|
+
vote: 'woot' | 'meh' | null;
|
|
435
435
|
votes: {
|
|
436
436
|
woots: number;
|
|
437
437
|
mehs: number;
|
|
@@ -446,6 +446,28 @@ interface GrabResponse {
|
|
|
446
446
|
message: string;
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
|
+
interface RoomCustomEmoji {
|
|
450
|
+
id: string;
|
|
451
|
+
name: string;
|
|
452
|
+
image_url: string;
|
|
453
|
+
animated: boolean;
|
|
454
|
+
created_by: number;
|
|
455
|
+
created_at: number;
|
|
456
|
+
}
|
|
457
|
+
interface RoomCustomSticker {
|
|
458
|
+
id: string;
|
|
459
|
+
name: string;
|
|
460
|
+
image_url: string;
|
|
461
|
+
created_by: number;
|
|
462
|
+
created_at: number;
|
|
463
|
+
}
|
|
464
|
+
interface RoomAssetsResponse {
|
|
465
|
+
success: boolean;
|
|
466
|
+
data: {
|
|
467
|
+
emojis: RoomCustomEmoji[];
|
|
468
|
+
stickers: RoomCustomSticker[];
|
|
469
|
+
};
|
|
470
|
+
}
|
|
449
471
|
interface PlayHistoryItem {
|
|
450
472
|
id: number;
|
|
451
473
|
userId: number;
|
|
@@ -613,6 +635,38 @@ interface RoomResource {
|
|
|
613
635
|
}>>;
|
|
614
636
|
vote(slug: string, type: 'woot' | 'meh'): Promise<ApiResponse<VoteResponse>>;
|
|
615
637
|
grabTrack(slug: string, playlistId?: number): Promise<ApiResponse<GrabResponse>>;
|
|
638
|
+
getAssets(slug: string): Promise<ApiResponse<RoomAssetsResponse>>;
|
|
639
|
+
createEmoji(slug: string, data: {
|
|
640
|
+
name?: string;
|
|
641
|
+
file: File | Blob;
|
|
642
|
+
animated?: boolean;
|
|
643
|
+
}): Promise<ApiResponse<{
|
|
644
|
+
success: boolean;
|
|
645
|
+
data: {
|
|
646
|
+
emojis: RoomCustomEmoji[];
|
|
647
|
+
};
|
|
648
|
+
}>>;
|
|
649
|
+
deleteEmoji(slug: string, emojiId: string): Promise<ApiResponse<{
|
|
650
|
+
success: boolean;
|
|
651
|
+
data: {
|
|
652
|
+
emojis: RoomCustomEmoji[];
|
|
653
|
+
};
|
|
654
|
+
}>>;
|
|
655
|
+
createSticker(slug: string, data: {
|
|
656
|
+
name?: string;
|
|
657
|
+
file: File | Blob;
|
|
658
|
+
}): Promise<ApiResponse<{
|
|
659
|
+
success: boolean;
|
|
660
|
+
data: {
|
|
661
|
+
stickers: RoomCustomSticker[];
|
|
662
|
+
};
|
|
663
|
+
}>>;
|
|
664
|
+
deleteSticker(slug: string, stickerId: string): Promise<ApiResponse<{
|
|
665
|
+
success: boolean;
|
|
666
|
+
data: {
|
|
667
|
+
stickers: RoomCustomSticker[];
|
|
668
|
+
};
|
|
669
|
+
}>>;
|
|
616
670
|
getHistory(slug: string, page?: number, limit?: number): Promise<ApiResponse<RoomHistoryResponse>>;
|
|
617
671
|
getAuditLog(slug: string, limit?: number, before?: string): Promise<ApiResponse<RoomAuditLogResponse>>;
|
|
618
672
|
activity(limit?: number): Promise<ApiResponse<DashboardActivityResponse>>;
|
|
@@ -654,6 +708,20 @@ interface ChatMessageResponse {
|
|
|
654
708
|
message: ChatMessage;
|
|
655
709
|
};
|
|
656
710
|
}
|
|
711
|
+
interface GifSearchItem {
|
|
712
|
+
id: string;
|
|
713
|
+
title: string;
|
|
714
|
+
url: string;
|
|
715
|
+
preview_url: string | null;
|
|
716
|
+
width: number | null;
|
|
717
|
+
height: number | null;
|
|
718
|
+
}
|
|
719
|
+
interface GifSearchResponse {
|
|
720
|
+
success: boolean;
|
|
721
|
+
data: {
|
|
722
|
+
gifs: GifSearchItem[];
|
|
723
|
+
};
|
|
724
|
+
}
|
|
657
725
|
interface ChatResource {
|
|
658
726
|
sendMessage(slug: string, data: SendMessageData): Promise<ApiResponse<ChatMessageResponse>>;
|
|
659
727
|
getMessages(slug: string, before?: string, limit?: number): Promise<ApiResponse<ChatMessagesResponse>>;
|
|
@@ -662,6 +730,7 @@ interface ChatResource {
|
|
|
662
730
|
success: boolean;
|
|
663
731
|
data: null;
|
|
664
732
|
}>>;
|
|
733
|
+
searchGifs(query: string, limit?: number): Promise<ApiResponse<GifSearchResponse>>;
|
|
665
734
|
}
|
|
666
735
|
declare const createChatResource: (api: Api) => ChatResource;
|
|
667
736
|
|
|
@@ -1074,4 +1143,4 @@ interface ApiClient {
|
|
|
1074
1143
|
}
|
|
1075
1144
|
declare const createApiClient: (config: ApiConfig) => ApiClient;
|
|
1076
1145
|
|
|
1077
|
-
export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, type Api, type ApiClient, type ApiConfig, ApiError, type ApiQueryParams, type ApiRequestConfig, type ApiResponse, type AuditAction, type AuthResource, type AuthUser, type AvatarCatalogItem, type AvatarCatalogResponse, type AvatarUnlockType, type BackendErrorResponse, type BanResponse, type BoothDJ, type BoothMedia, type BoothResponse, type BoothState, type ChatMessage, type ChatMessageResponse, type ChatMessagesResponse, type ChatResource, type CreateIntentResponse, type CreateRoomData, type DashboardActivityItem, type DashboardActivityResponse, type DashboardActivityType, type EquipAvatarData, type FeaturedRoomsResponse, type FriendActionResponse, type FriendEntry, type FriendList, type FriendListResponse, type FriendResource, type FriendStatusResponse, type FriendshipStatus, type GlobalRole, type GrabResponse, type ImportPlaylistData, type ImportPlaylistResponse, type ImportResult, type JoinMuteInfo, type JoinRoomResponse, Logger, type MediaItem, type MediaItemResponse, type MediaSearchResult, type MediaSource, type ModerateUserData, type MuteResponse, type MyViolation, type MyViolationsResponse, type PaginationMeta, type PlayHistoryItem, type Playlist, type PlaylistResource, type PlaylistResponse, type PlaylistsResponse, type PortalResponse, type PublicProfileFriend, type PublicUser, type Room, type RoomAuditLog, type RoomBan, type RoomBansResponse, type RoomHistoryResponse, type RoomMember, type RoomMute, type RoomMutesResponse, type RoomResource, type RoomResponse, type RoomRole, type RoomStaffResponse, type RoomUserState, type RoomsResponse, type SendMessageData, type ShopResource, type ShuffleResponse, type SoundCloudSearchResponse, type SoundCloudTrackResponse, type SourceResource, type SubscriptionPlan, type SubscriptionResource, type SubscriptionStatus, type UpdateProfileData, type UpdateRoomData, type User, type UserResource, type UserResponse, type UserViolationsResponse, type VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, createAdminResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
|
|
1146
|
+
export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, type Api, type ApiClient, type ApiConfig, ApiError, type ApiQueryParams, type ApiRequestConfig, type ApiResponse, type AuditAction, type AuthResource, type AuthUser, type AvatarCatalogItem, type AvatarCatalogResponse, type AvatarUnlockType, type BackendErrorResponse, type BanResponse, type BoothDJ, type BoothMedia, type BoothResponse, type BoothState, type ChatMessage, type ChatMessageResponse, type ChatMessagesResponse, type ChatResource, type CreateIntentResponse, type CreateRoomData, type DashboardActivityItem, type DashboardActivityResponse, type DashboardActivityType, type EquipAvatarData, type FeaturedRoomsResponse, type FriendActionResponse, type FriendEntry, type FriendList, type FriendListResponse, type FriendResource, type FriendStatusResponse, type FriendshipStatus, type GifSearchItem, type GifSearchResponse, type GlobalRole, type GrabResponse, type ImportPlaylistData, type ImportPlaylistResponse, type ImportResult, type JoinMuteInfo, type JoinRoomResponse, Logger, type MediaItem, type MediaItemResponse, type MediaSearchResult, type MediaSource, type ModerateUserData, type MuteResponse, type MyViolation, type MyViolationsResponse, type PaginationMeta, type PlayHistoryItem, type Playlist, type PlaylistResource, type PlaylistResponse, type PlaylistsResponse, type PortalResponse, type PublicProfileFriend, type PublicUser, type Room, type RoomAssetsResponse, type RoomAuditLog, type RoomBan, type RoomBansResponse, type RoomCustomEmoji, type RoomCustomSticker, type RoomHistoryResponse, type RoomMember, type RoomMute, type RoomMutesResponse, type RoomResource, type RoomResponse, type RoomRole, type RoomStaffResponse, type RoomUserState, type RoomsResponse, type SendMessageData, type ShopResource, type ShuffleResponse, type SoundCloudSearchResponse, type SoundCloudTrackResponse, type SourceResource, type SubscriptionPlan, type SubscriptionResource, type SubscriptionStatus, type UpdateProfileData, type UpdateRoomData, type User, type UserResource, type UserResponse, type UserViolationsResponse, type VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, createAdminResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
|
package/dist/index.d.ts
CHANGED
|
@@ -431,7 +431,7 @@ interface BoothResponse {
|
|
|
431
431
|
interface VoteResponse {
|
|
432
432
|
success: boolean;
|
|
433
433
|
data: {
|
|
434
|
-
vote: 'woot' | 'meh';
|
|
434
|
+
vote: 'woot' | 'meh' | null;
|
|
435
435
|
votes: {
|
|
436
436
|
woots: number;
|
|
437
437
|
mehs: number;
|
|
@@ -446,6 +446,28 @@ interface GrabResponse {
|
|
|
446
446
|
message: string;
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
|
+
interface RoomCustomEmoji {
|
|
450
|
+
id: string;
|
|
451
|
+
name: string;
|
|
452
|
+
image_url: string;
|
|
453
|
+
animated: boolean;
|
|
454
|
+
created_by: number;
|
|
455
|
+
created_at: number;
|
|
456
|
+
}
|
|
457
|
+
interface RoomCustomSticker {
|
|
458
|
+
id: string;
|
|
459
|
+
name: string;
|
|
460
|
+
image_url: string;
|
|
461
|
+
created_by: number;
|
|
462
|
+
created_at: number;
|
|
463
|
+
}
|
|
464
|
+
interface RoomAssetsResponse {
|
|
465
|
+
success: boolean;
|
|
466
|
+
data: {
|
|
467
|
+
emojis: RoomCustomEmoji[];
|
|
468
|
+
stickers: RoomCustomSticker[];
|
|
469
|
+
};
|
|
470
|
+
}
|
|
449
471
|
interface PlayHistoryItem {
|
|
450
472
|
id: number;
|
|
451
473
|
userId: number;
|
|
@@ -613,6 +635,38 @@ interface RoomResource {
|
|
|
613
635
|
}>>;
|
|
614
636
|
vote(slug: string, type: 'woot' | 'meh'): Promise<ApiResponse<VoteResponse>>;
|
|
615
637
|
grabTrack(slug: string, playlistId?: number): Promise<ApiResponse<GrabResponse>>;
|
|
638
|
+
getAssets(slug: string): Promise<ApiResponse<RoomAssetsResponse>>;
|
|
639
|
+
createEmoji(slug: string, data: {
|
|
640
|
+
name?: string;
|
|
641
|
+
file: File | Blob;
|
|
642
|
+
animated?: boolean;
|
|
643
|
+
}): Promise<ApiResponse<{
|
|
644
|
+
success: boolean;
|
|
645
|
+
data: {
|
|
646
|
+
emojis: RoomCustomEmoji[];
|
|
647
|
+
};
|
|
648
|
+
}>>;
|
|
649
|
+
deleteEmoji(slug: string, emojiId: string): Promise<ApiResponse<{
|
|
650
|
+
success: boolean;
|
|
651
|
+
data: {
|
|
652
|
+
emojis: RoomCustomEmoji[];
|
|
653
|
+
};
|
|
654
|
+
}>>;
|
|
655
|
+
createSticker(slug: string, data: {
|
|
656
|
+
name?: string;
|
|
657
|
+
file: File | Blob;
|
|
658
|
+
}): Promise<ApiResponse<{
|
|
659
|
+
success: boolean;
|
|
660
|
+
data: {
|
|
661
|
+
stickers: RoomCustomSticker[];
|
|
662
|
+
};
|
|
663
|
+
}>>;
|
|
664
|
+
deleteSticker(slug: string, stickerId: string): Promise<ApiResponse<{
|
|
665
|
+
success: boolean;
|
|
666
|
+
data: {
|
|
667
|
+
stickers: RoomCustomSticker[];
|
|
668
|
+
};
|
|
669
|
+
}>>;
|
|
616
670
|
getHistory(slug: string, page?: number, limit?: number): Promise<ApiResponse<RoomHistoryResponse>>;
|
|
617
671
|
getAuditLog(slug: string, limit?: number, before?: string): Promise<ApiResponse<RoomAuditLogResponse>>;
|
|
618
672
|
activity(limit?: number): Promise<ApiResponse<DashboardActivityResponse>>;
|
|
@@ -654,6 +708,20 @@ interface ChatMessageResponse {
|
|
|
654
708
|
message: ChatMessage;
|
|
655
709
|
};
|
|
656
710
|
}
|
|
711
|
+
interface GifSearchItem {
|
|
712
|
+
id: string;
|
|
713
|
+
title: string;
|
|
714
|
+
url: string;
|
|
715
|
+
preview_url: string | null;
|
|
716
|
+
width: number | null;
|
|
717
|
+
height: number | null;
|
|
718
|
+
}
|
|
719
|
+
interface GifSearchResponse {
|
|
720
|
+
success: boolean;
|
|
721
|
+
data: {
|
|
722
|
+
gifs: GifSearchItem[];
|
|
723
|
+
};
|
|
724
|
+
}
|
|
657
725
|
interface ChatResource {
|
|
658
726
|
sendMessage(slug: string, data: SendMessageData): Promise<ApiResponse<ChatMessageResponse>>;
|
|
659
727
|
getMessages(slug: string, before?: string, limit?: number): Promise<ApiResponse<ChatMessagesResponse>>;
|
|
@@ -662,6 +730,7 @@ interface ChatResource {
|
|
|
662
730
|
success: boolean;
|
|
663
731
|
data: null;
|
|
664
732
|
}>>;
|
|
733
|
+
searchGifs(query: string, limit?: number): Promise<ApiResponse<GifSearchResponse>>;
|
|
665
734
|
}
|
|
666
735
|
declare const createChatResource: (api: Api) => ChatResource;
|
|
667
736
|
|
|
@@ -1074,4 +1143,4 @@ interface ApiClient {
|
|
|
1074
1143
|
}
|
|
1075
1144
|
declare const createApiClient: (config: ApiConfig) => ApiClient;
|
|
1076
1145
|
|
|
1077
|
-
export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, type Api, type ApiClient, type ApiConfig, ApiError, type ApiQueryParams, type ApiRequestConfig, type ApiResponse, type AuditAction, type AuthResource, type AuthUser, type AvatarCatalogItem, type AvatarCatalogResponse, type AvatarUnlockType, type BackendErrorResponse, type BanResponse, type BoothDJ, type BoothMedia, type BoothResponse, type BoothState, type ChatMessage, type ChatMessageResponse, type ChatMessagesResponse, type ChatResource, type CreateIntentResponse, type CreateRoomData, type DashboardActivityItem, type DashboardActivityResponse, type DashboardActivityType, type EquipAvatarData, type FeaturedRoomsResponse, type FriendActionResponse, type FriendEntry, type FriendList, type FriendListResponse, type FriendResource, type FriendStatusResponse, type FriendshipStatus, type GlobalRole, type GrabResponse, type ImportPlaylistData, type ImportPlaylistResponse, type ImportResult, type JoinMuteInfo, type JoinRoomResponse, Logger, type MediaItem, type MediaItemResponse, type MediaSearchResult, type MediaSource, type ModerateUserData, type MuteResponse, type MyViolation, type MyViolationsResponse, type PaginationMeta, type PlayHistoryItem, type Playlist, type PlaylistResource, type PlaylistResponse, type PlaylistsResponse, type PortalResponse, type PublicProfileFriend, type PublicUser, type Room, type RoomAuditLog, type RoomBan, type RoomBansResponse, type RoomHistoryResponse, type RoomMember, type RoomMute, type RoomMutesResponse, type RoomResource, type RoomResponse, type RoomRole, type RoomStaffResponse, type RoomUserState, type RoomsResponse, type SendMessageData, type ShopResource, type ShuffleResponse, type SoundCloudSearchResponse, type SoundCloudTrackResponse, type SourceResource, type SubscriptionPlan, type SubscriptionResource, type SubscriptionStatus, type UpdateProfileData, type UpdateRoomData, type User, type UserResource, type UserResponse, type UserViolationsResponse, type VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, createAdminResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
|
|
1146
|
+
export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, type Api, type ApiClient, type ApiConfig, ApiError, type ApiQueryParams, type ApiRequestConfig, type ApiResponse, type AuditAction, type AuthResource, type AuthUser, type AvatarCatalogItem, type AvatarCatalogResponse, type AvatarUnlockType, type BackendErrorResponse, type BanResponse, type BoothDJ, type BoothMedia, type BoothResponse, type BoothState, type ChatMessage, type ChatMessageResponse, type ChatMessagesResponse, type ChatResource, type CreateIntentResponse, type CreateRoomData, type DashboardActivityItem, type DashboardActivityResponse, type DashboardActivityType, type EquipAvatarData, type FeaturedRoomsResponse, type FriendActionResponse, type FriendEntry, type FriendList, type FriendListResponse, type FriendResource, type FriendStatusResponse, type FriendshipStatus, type GifSearchItem, type GifSearchResponse, type GlobalRole, type GrabResponse, type ImportPlaylistData, type ImportPlaylistResponse, type ImportResult, type JoinMuteInfo, type JoinRoomResponse, Logger, type MediaItem, type MediaItemResponse, type MediaSearchResult, type MediaSource, type ModerateUserData, type MuteResponse, type MyViolation, type MyViolationsResponse, type PaginationMeta, type PlayHistoryItem, type Playlist, type PlaylistResource, type PlaylistResponse, type PlaylistsResponse, type PortalResponse, type PublicProfileFriend, type PublicUser, type Room, type RoomAssetsResponse, type RoomAuditLog, type RoomBan, type RoomBansResponse, type RoomCustomEmoji, type RoomCustomSticker, type RoomHistoryResponse, type RoomMember, type RoomMute, type RoomMutesResponse, type RoomResource, type RoomResponse, type RoomRole, type RoomStaffResponse, type RoomUserState, type RoomsResponse, type SendMessageData, type ShopResource, type ShuffleResponse, type SoundCloudSearchResponse, type SoundCloudTrackResponse, type SourceResource, type SubscriptionPlan, type SubscriptionResource, type SubscriptionStatus, type UpdateProfileData, type UpdateRoomData, type User, type UserResource, type UserResponse, type UserViolationsResponse, type VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, createAdminResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
|
package/dist/index.js
CHANGED
|
@@ -145,7 +145,15 @@ var Logger = class _Logger {
|
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
// src/api/client.ts
|
|
148
|
-
var
|
|
148
|
+
var ABSOLUTE_URL_PATTERN = /^[a-z][a-z\d+\-.]*:\/\//i;
|
|
149
|
+
var resolveUrl = (baseURL, url) => {
|
|
150
|
+
if (ABSOLUTE_URL_PATTERN.test(url)) {
|
|
151
|
+
return url;
|
|
152
|
+
}
|
|
153
|
+
const normalizedBase = baseURL.replace(/\/+$/, "");
|
|
154
|
+
const normalizedPath = url.replace(/^\/+/, "");
|
|
155
|
+
return `${normalizedBase}/${normalizedPath}`;
|
|
156
|
+
};
|
|
149
157
|
var parseQueryParams = (params) => {
|
|
150
158
|
if (!params) {
|
|
151
159
|
return void 0;
|
|
@@ -207,7 +215,13 @@ var createApi = (config) => {
|
|
|
207
215
|
try {
|
|
208
216
|
const options = buildOptions(defaultHeaders, requestConfig);
|
|
209
217
|
if (data !== void 0) {
|
|
210
|
-
|
|
218
|
+
if (data instanceof FormData) {
|
|
219
|
+
const headers = options.headers;
|
|
220
|
+
delete headers["Content-Type"];
|
|
221
|
+
options.body = data;
|
|
222
|
+
} else {
|
|
223
|
+
options.json = data;
|
|
224
|
+
}
|
|
211
225
|
}
|
|
212
226
|
const response = await client(resolveUrl(config.baseURL, url), {
|
|
213
227
|
...options,
|
|
@@ -311,6 +325,26 @@ var createRoomResource = (api) => ({
|
|
|
311
325
|
),
|
|
312
326
|
vote: (slug, type) => api.post(`${endpoint3}/${slug}/booth/vote`, { type }),
|
|
313
327
|
grabTrack: (slug, playlistId) => api.post(`${endpoint3}/${slug}/booth/grab`, playlistId ? { playlistId } : {}),
|
|
328
|
+
getAssets: (slug) => api.get(`${endpoint3}/${slug}/assets`),
|
|
329
|
+
createEmoji: (slug, data) => {
|
|
330
|
+
const FormDataCtor = globalThis.FormData;
|
|
331
|
+
if (!FormDataCtor) throw new Error("FormData is not available in this runtime");
|
|
332
|
+
const form = new FormDataCtor();
|
|
333
|
+
if (data.name) form.set("name", data.name);
|
|
334
|
+
form.set("file", data.file);
|
|
335
|
+
if (typeof data.animated === "boolean") form.set("animated", `${data.animated}`);
|
|
336
|
+
return api.post(`${endpoint3}/${slug}/assets/emojis`, form);
|
|
337
|
+
},
|
|
338
|
+
deleteEmoji: (slug, emojiId) => api.delete(`${endpoint3}/${slug}/assets/emojis/${emojiId}`),
|
|
339
|
+
createSticker: (slug, data) => {
|
|
340
|
+
const FormDataCtor = globalThis.FormData;
|
|
341
|
+
if (!FormDataCtor) throw new Error("FormData is not available in this runtime");
|
|
342
|
+
const form = new FormDataCtor();
|
|
343
|
+
if (data.name) form.set("name", data.name);
|
|
344
|
+
form.set("file", data.file);
|
|
345
|
+
return api.post(`${endpoint3}/${slug}/assets/stickers`, form);
|
|
346
|
+
},
|
|
347
|
+
deleteSticker: (slug, stickerId) => api.delete(`${endpoint3}/${slug}/assets/stickers/${stickerId}`),
|
|
314
348
|
getHistory: (slug, page = 1, limit = 20) => api.get(`${endpoint3}/${slug}/history`, { params: { page, limit } }),
|
|
315
349
|
getAuditLog: (slug, limit = 50, before) => api.get(`${endpoint3}/${slug}/audit`, { params: before ? { limit, before } : { limit } }),
|
|
316
350
|
activity: (limit = 12) => api.get(`${endpoint3}/activity`, { params: { limit } })
|
|
@@ -328,7 +362,8 @@ var createChatResource = (api) => ({
|
|
|
328
362
|
return api.get(`${endpoint4}/${slug}/chat`, { params });
|
|
329
363
|
},
|
|
330
364
|
editMessage: (slug, messageId, data) => api.patch(`${endpoint4}/${slug}/chat/${messageId}`, data),
|
|
331
|
-
deleteMessage: (slug, messageId) => api.delete(`${endpoint4}/${slug}/chat/${messageId}`)
|
|
365
|
+
deleteMessage: (slug, messageId) => api.delete(`${endpoint4}/${slug}/chat/${messageId}`),
|
|
366
|
+
searchGifs: (query, limit = 20) => api.post("/chat/gif/search", { query, limit })
|
|
332
367
|
});
|
|
333
368
|
|
|
334
369
|
// src/resources/playlist.ts
|
package/dist/index.mjs
CHANGED
|
@@ -96,7 +96,15 @@ var Logger = class _Logger {
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
// src/api/client.ts
|
|
99
|
-
var
|
|
99
|
+
var ABSOLUTE_URL_PATTERN = /^[a-z][a-z\d+\-.]*:\/\//i;
|
|
100
|
+
var resolveUrl = (baseURL, url) => {
|
|
101
|
+
if (ABSOLUTE_URL_PATTERN.test(url)) {
|
|
102
|
+
return url;
|
|
103
|
+
}
|
|
104
|
+
const normalizedBase = baseURL.replace(/\/+$/, "");
|
|
105
|
+
const normalizedPath = url.replace(/^\/+/, "");
|
|
106
|
+
return `${normalizedBase}/${normalizedPath}`;
|
|
107
|
+
};
|
|
100
108
|
var parseQueryParams = (params) => {
|
|
101
109
|
if (!params) {
|
|
102
110
|
return void 0;
|
|
@@ -158,7 +166,13 @@ var createApi = (config) => {
|
|
|
158
166
|
try {
|
|
159
167
|
const options = buildOptions(defaultHeaders, requestConfig);
|
|
160
168
|
if (data !== void 0) {
|
|
161
|
-
|
|
169
|
+
if (data instanceof FormData) {
|
|
170
|
+
const headers = options.headers;
|
|
171
|
+
delete headers["Content-Type"];
|
|
172
|
+
options.body = data;
|
|
173
|
+
} else {
|
|
174
|
+
options.json = data;
|
|
175
|
+
}
|
|
162
176
|
}
|
|
163
177
|
const response = await client(resolveUrl(config.baseURL, url), {
|
|
164
178
|
...options,
|
|
@@ -262,6 +276,26 @@ var createRoomResource = (api) => ({
|
|
|
262
276
|
),
|
|
263
277
|
vote: (slug, type) => api.post(`${endpoint3}/${slug}/booth/vote`, { type }),
|
|
264
278
|
grabTrack: (slug, playlistId) => api.post(`${endpoint3}/${slug}/booth/grab`, playlistId ? { playlistId } : {}),
|
|
279
|
+
getAssets: (slug) => api.get(`${endpoint3}/${slug}/assets`),
|
|
280
|
+
createEmoji: (slug, data) => {
|
|
281
|
+
const FormDataCtor = globalThis.FormData;
|
|
282
|
+
if (!FormDataCtor) throw new Error("FormData is not available in this runtime");
|
|
283
|
+
const form = new FormDataCtor();
|
|
284
|
+
if (data.name) form.set("name", data.name);
|
|
285
|
+
form.set("file", data.file);
|
|
286
|
+
if (typeof data.animated === "boolean") form.set("animated", `${data.animated}`);
|
|
287
|
+
return api.post(`${endpoint3}/${slug}/assets/emojis`, form);
|
|
288
|
+
},
|
|
289
|
+
deleteEmoji: (slug, emojiId) => api.delete(`${endpoint3}/${slug}/assets/emojis/${emojiId}`),
|
|
290
|
+
createSticker: (slug, data) => {
|
|
291
|
+
const FormDataCtor = globalThis.FormData;
|
|
292
|
+
if (!FormDataCtor) throw new Error("FormData is not available in this runtime");
|
|
293
|
+
const form = new FormDataCtor();
|
|
294
|
+
if (data.name) form.set("name", data.name);
|
|
295
|
+
form.set("file", data.file);
|
|
296
|
+
return api.post(`${endpoint3}/${slug}/assets/stickers`, form);
|
|
297
|
+
},
|
|
298
|
+
deleteSticker: (slug, stickerId) => api.delete(`${endpoint3}/${slug}/assets/stickers/${stickerId}`),
|
|
265
299
|
getHistory: (slug, page = 1, limit = 20) => api.get(`${endpoint3}/${slug}/history`, { params: { page, limit } }),
|
|
266
300
|
getAuditLog: (slug, limit = 50, before) => api.get(`${endpoint3}/${slug}/audit`, { params: before ? { limit, before } : { limit } }),
|
|
267
301
|
activity: (limit = 12) => api.get(`${endpoint3}/activity`, { params: { limit } })
|
|
@@ -279,7 +313,8 @@ var createChatResource = (api) => ({
|
|
|
279
313
|
return api.get(`${endpoint4}/${slug}/chat`, { params });
|
|
280
314
|
},
|
|
281
315
|
editMessage: (slug, messageId, data) => api.patch(`${endpoint4}/${slug}/chat/${messageId}`, data),
|
|
282
|
-
deleteMessage: (slug, messageId) => api.delete(`${endpoint4}/${slug}/chat/${messageId}`)
|
|
316
|
+
deleteMessage: (slug, messageId) => api.delete(`${endpoint4}/${slug}/chat/${messageId}`),
|
|
317
|
+
searchGifs: (query, limit = 20) => api.post("/chat/gif/search", { query, limit })
|
|
283
318
|
});
|
|
284
319
|
|
|
285
320
|
// src/resources/playlist.ts
|