@borealise/api 1.1.10 → 2.0.0-alpha.1

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 CHANGED
@@ -23,14 +23,10 @@ declare class ApiError extends Error {
23
23
  constructor(message: string, status?: number, code?: string, response?: BackendErrorResponse);
24
24
  }
25
25
  declare class Api {
26
- private static instance;
27
26
  private readonly axios;
28
27
  private readonly logger;
29
28
  private readonly config;
30
- private constructor();
31
- static getInstance(config?: ApiConfig): Api;
32
- /** Reset the singleton (useful for testing or re-initializing with a new config) */
33
- static reset(): void;
29
+ constructor(config: ApiConfig);
34
30
  private setupInterceptors;
35
31
  private parseError;
36
32
  setAuthToken(token: string | null): void;
@@ -44,11 +40,12 @@ declare class Api {
44
40
  private wrapResponse;
45
41
  get axiosInstance(): AxiosInstance;
46
42
  }
43
+ declare const createApi: (config: ApiConfig) => Api;
47
44
 
48
45
  declare class Logger {
49
46
  private readonly name;
50
47
  private enabled;
51
- private constructor();
48
+ constructor(name: string, enabled?: boolean);
52
49
  static create(name: string): Logger;
53
50
  enable(): void;
54
51
  disable(): void;
@@ -59,39 +56,6 @@ declare class Logger {
59
56
  error(message: string, ...args: unknown[]): void;
60
57
  }
61
58
 
62
- interface PaginatedResponse<T> {
63
- data: T[];
64
- meta: {
65
- total: number;
66
- page: number;
67
- perPage: number;
68
- lastPage: number;
69
- };
70
- }
71
- interface ResourceOptions {
72
- params?: Record<string, unknown>;
73
- headers?: Record<string, string>;
74
- }
75
- declare abstract class ApiResource<T = unknown> {
76
- private _logger;
77
- protected abstract readonly endpoint: string;
78
- protected get api(): Api;
79
- protected get logger(): Logger;
80
- protected buildUrl(path?: string | number): string;
81
- protected buildConfig(options?: ResourceOptions): AxiosRequestConfig;
82
- index(options?: ResourceOptions): Promise<ApiResponse<T[]>>;
83
- paginate(page?: number, perPage?: number, options?: ResourceOptions): Promise<ApiResponse<PaginatedResponse<T>>>;
84
- show(id: string | number, options?: ResourceOptions): Promise<ApiResponse<T>>;
85
- store(data: Partial<T>, options?: ResourceOptions): Promise<ApiResponse<T>>;
86
- update(id: string | number, data: Partial<T>, options?: ResourceOptions): Promise<ApiResponse<T>>;
87
- patch(id: string | number, data: Partial<T>, options?: ResourceOptions): Promise<ApiResponse<T>>;
88
- destroy(id: string | number, options?: ResourceOptions): Promise<ApiResponse<void>>;
89
- protected get<R = T>(path: string, options?: ResourceOptions): Promise<ApiResponse<R>>;
90
- protected post<R = T>(path: string, data?: unknown, options?: ResourceOptions): Promise<ApiResponse<R>>;
91
- protected put<R = T>(path: string, data?: unknown, options?: ResourceOptions): Promise<ApiResponse<R>>;
92
- protected delete<R = void>(path: string, options?: ResourceOptions): Promise<ApiResponse<R>>;
93
- }
94
-
95
59
  interface AuthUser {
96
60
  id: number;
97
61
  email?: string;
@@ -144,8 +108,7 @@ interface MeResponse {
144
108
  user: AuthUser;
145
109
  };
146
110
  }
147
- declare class AuthResource extends ApiResource<AuthUser> {
148
- protected readonly endpoint = "/auth";
111
+ interface AuthResource {
149
112
  login(credentials: LoginCredentials): Promise<ApiResponse<AuthResponse>>;
150
113
  register(data: RegisterData): Promise<ApiResponse<AuthResponse>>;
151
114
  refresh(refreshToken: string): Promise<ApiResponse<RefreshResponse>>;
@@ -155,7 +118,7 @@ declare class AuthResource extends ApiResource<AuthUser> {
155
118
  }>>;
156
119
  me(): Promise<ApiResponse<MeResponse>>;
157
120
  }
158
- declare const authResource: AuthResource;
121
+ declare const createAuthResource: (api: Api) => AuthResource;
159
122
 
160
123
  interface User extends AuthUser {
161
124
  }
@@ -170,9 +133,8 @@ interface UserResponse {
170
133
  user: User;
171
134
  };
172
135
  }
173
- declare class UserResource extends ApiResource<User> {
174
- protected readonly endpoint = "/users";
175
- getById(id: number): Promise<ApiResponse<User>>;
136
+ interface UserResource {
137
+ getById(id: number): Promise<ApiResponse<UserResponse>>;
176
138
  getByUsername(username: string): Promise<ApiResponse<UserResponse>>;
177
139
  updateProfile(data: UpdateProfileData): Promise<ApiResponse<UserResponse>>;
178
140
  deleteAccount(): Promise<ApiResponse<{
@@ -185,7 +147,7 @@ declare class UserResource extends ApiResource<User> {
185
147
  data: null;
186
148
  }>>;
187
149
  }
188
- declare const userResource: UserResource;
150
+ declare const createUserResource: (api: Api) => UserResource;
189
151
 
190
152
  type RoomRole = 'user' | 'resident_dj' | 'bouncer' | 'manager' | 'cohost' | 'host';
191
153
  interface Room {
@@ -295,6 +257,23 @@ interface RoomBansResponse {
295
257
  bans: RoomBan[];
296
258
  };
297
259
  }
260
+ interface RoomMute {
261
+ id: number;
262
+ userId: number;
263
+ modById: number;
264
+ reason: string | null;
265
+ duration: number | null;
266
+ expiresAt: string | null;
267
+ createdAt: string;
268
+ username: string;
269
+ displayName: string | null;
270
+ }
271
+ interface RoomMutesResponse {
272
+ success: boolean;
273
+ data: {
274
+ mutes: RoomMute[];
275
+ };
276
+ }
298
277
  interface ModerateUserData {
299
278
  reason?: string;
300
279
  duration?: number;
@@ -351,11 +330,8 @@ interface BoothState {
351
330
  };
352
331
  }
353
332
  interface JoinMuteInfo {
354
- /** ISO timestamp when the mute expires, or null if permanent */
355
333
  expiresAt: string | null;
356
- /** Seconds remaining until unmute, or null if permanent */
357
334
  remainingSeconds: number | null;
358
- /** Optional reason given by the moderator */
359
335
  reason: string | null;
360
336
  }
361
337
  interface JoinRoomResponse {
@@ -371,7 +347,6 @@ interface JoinRoomResponse {
371
347
  role: RoomRole;
372
348
  users: RoomUserState[];
373
349
  booth: BoothState;
374
- /** Present when the joining user is currently muted in this room */
375
350
  mute: JoinMuteInfo | null;
376
351
  };
377
352
  }
@@ -441,8 +416,7 @@ interface RoomHistoryResponse {
441
416
  pagination: PaginationMeta;
442
417
  };
443
418
  }
444
- declare class RoomResource extends ApiResource<Room> {
445
- protected readonly endpoint = "/rooms";
419
+ interface RoomResource {
446
420
  list(): Promise<ApiResponse<RoomsResponse>>;
447
421
  featured(): Promise<ApiResponse<FeaturedRoomsResponse>>;
448
422
  getBySlug(slug: string): Promise<ApiResponse<RoomResponse>>;
@@ -453,6 +427,7 @@ declare class RoomResource extends ApiResource<Room> {
453
427
  }>>;
454
428
  getStaff(slug: string): Promise<ApiResponse<RoomStaffResponse>>;
455
429
  getBans(slug: string): Promise<ApiResponse<RoomBansResponse>>;
430
+ getMutes(slug: string): Promise<ApiResponse<RoomMutesResponse>>;
456
431
  updateUserRole(slug: string, userId: number, role: RoomRole): Promise<ApiResponse<{
457
432
  success: boolean;
458
433
  data: {
@@ -528,7 +503,7 @@ declare class RoomResource extends ApiResource<Room> {
528
503
  grabTrack(slug: string, playlistId?: number): Promise<ApiResponse<GrabResponse>>;
529
504
  getHistory(slug: string, page?: number, limit?: number): Promise<ApiResponse<RoomHistoryResponse>>;
530
505
  }
531
- declare const roomResource: RoomResource;
506
+ declare const createRoomResource: (api: Api) => RoomResource;
532
507
 
533
508
  interface ChatMessage {
534
509
  id: string;
@@ -560,8 +535,7 @@ interface ChatMessageResponse {
560
535
  message: ChatMessage;
561
536
  };
562
537
  }
563
- declare class ChatResource extends ApiResource<ChatMessage> {
564
- protected readonly endpoint = "/rooms";
538
+ interface ChatResource {
565
539
  sendMessage(slug: string, data: SendMessageData): Promise<ApiResponse<ChatMessageResponse>>;
566
540
  getMessages(slug: string, before?: string, limit?: number): Promise<ApiResponse<ChatMessagesResponse>>;
567
541
  deleteMessage(slug: string, messageId: string): Promise<ApiResponse<{
@@ -569,13 +543,13 @@ declare class ChatResource extends ApiResource<ChatMessage> {
569
543
  data: null;
570
544
  }>>;
571
545
  }
572
- declare const chatResource: ChatResource;
546
+ declare const createChatResource: (api: Api) => ChatResource;
573
547
 
574
- type MediaSource = 'youtube' | 'soundcloud';
548
+ type MediaSource$1 = 'youtube' | 'soundcloud';
575
549
  interface MediaItem {
576
550
  id: number;
577
551
  playlistId: number;
578
- source: MediaSource;
552
+ source: MediaSource$1;
579
553
  sourceId: string;
580
554
  title: string;
581
555
  artist: string | null;
@@ -614,7 +588,7 @@ interface MediaItemResponse {
614
588
  };
615
589
  }
616
590
  interface AddMediaData {
617
- source: MediaSource;
591
+ source: MediaSource$1;
618
592
  sourceId: string;
619
593
  }
620
594
  interface ShuffleResponse {
@@ -625,7 +599,7 @@ interface ShuffleResponse {
625
599
  };
626
600
  }
627
601
  interface ImportPlaylistData {
628
- source?: MediaSource;
602
+ source?: MediaSource$1;
629
603
  url: string;
630
604
  }
631
605
  interface ImportResult {
@@ -639,8 +613,7 @@ interface ImportPlaylistResponse {
639
613
  success: boolean;
640
614
  data: ImportResult;
641
615
  }
642
- declare class PlaylistResource extends ApiResource<Playlist> {
643
- protected readonly endpoint = "/playlists";
616
+ interface PlaylistResource {
644
617
  getAll(): Promise<ApiResponse<PlaylistsResponse>>;
645
618
  getById(playlistId: number): Promise<ApiResponse<PlaylistResponse>>;
646
619
  create(name: string): Promise<ApiResponse<PlaylistResponse>>;
@@ -657,8 +630,9 @@ declare class PlaylistResource extends ApiResource<Playlist> {
657
630
  moveItem(playlistId: number, itemId: number, position: number): Promise<ApiResponse<MediaItemResponse>>;
658
631
  importPlaylist(playlistId: number, data: ImportPlaylistData): Promise<ApiResponse<ImportPlaylistResponse>>;
659
632
  }
660
- declare const playlistResource: PlaylistResource;
633
+ declare const createPlaylistResource: (api: Api) => PlaylistResource;
661
634
 
635
+ type MediaSource = 'youtube' | 'soundcloud';
662
636
  interface MediaSearchResult {
663
637
  source: MediaSource;
664
638
  sourceId: string;
@@ -692,8 +666,7 @@ interface SoundCloudTrackResponse {
692
666
  track: MediaSearchResult;
693
667
  };
694
668
  }
695
- declare class SourceResource extends ApiResource<MediaSearchResult> {
696
- protected readonly endpoint = "/sources";
669
+ interface SourceResource {
697
670
  searchYouTube(query: string, limit?: number): Promise<ApiResponse<YouTubeSearchResponse>>;
698
671
  getYouTubeVideo(videoId: string): Promise<ApiResponse<YouTubeVideoResponse>>;
699
672
  searchSoundCloud(query: string, limit?: number): Promise<ApiResponse<SoundCloudSearchResponse>>;
@@ -701,16 +674,14 @@ declare class SourceResource extends ApiResource<MediaSearchResult> {
701
674
  resolveSoundCloudUrl(url: string): Promise<ApiResponse<SoundCloudTrackResponse>>;
702
675
  searchAll(query: string, limit?: number): Promise<MediaSearchResult[]>;
703
676
  }
704
- declare const sourceResource: SourceResource;
677
+ declare const createSourceResource: (api: Api) => SourceResource;
705
678
 
706
679
  type AvatarUnlockType = 'free' | 'level' | 'subscription';
707
680
  interface AvatarCatalogItem {
708
681
  id: string;
709
682
  unlockType: AvatarUnlockType;
710
683
  requiredLevel: number | null;
711
- /** Whether the user has unlocked (or has free access to) this avatar */
712
684
  unlocked: boolean;
713
- /** Whether the user currently meets the requirement to unlock it */
714
685
  eligible: boolean;
715
686
  }
716
687
  interface AvatarCatalogResponse {
@@ -721,11 +692,7 @@ interface AvatarCatalogResponse {
721
692
  xp: number;
722
693
  };
723
694
  }
724
- interface EquipAvatarData {
725
- avatarId: string;
726
- }
727
- declare class ShopResource extends ApiResource {
728
- protected readonly endpoint = "/shop";
695
+ interface ShopResource {
729
696
  getAvatarCatalog(): Promise<ApiResponse<AvatarCatalogResponse>>;
730
697
  unlockAvatar(avatarId: string): Promise<ApiResponse<{
731
698
  success: boolean;
@@ -741,7 +708,7 @@ declare class ShopResource extends ApiResource {
741
708
  };
742
709
  }>>;
743
710
  }
744
- declare const shopResource: ShopResource;
711
+ declare const createShopResource: (api: Api) => ShopResource;
745
712
 
746
713
  type SubscriptionPlan = 'monthly' | 'yearly';
747
714
  interface SubscriptionStatus {
@@ -764,8 +731,7 @@ interface PortalResponse {
764
731
  url: string;
765
732
  };
766
733
  }
767
- declare class SubscriptionResource extends ApiResource {
768
- protected readonly endpoint = "/subscriptions";
734
+ interface SubscriptionResource {
769
735
  getStatus(): Promise<ApiResponse<{
770
736
  success: boolean;
771
737
  data: SubscriptionStatus;
@@ -776,7 +742,7 @@ declare class SubscriptionResource extends ApiResource {
776
742
  }>>;
777
743
  createPortal(): Promise<ApiResponse<PortalResponse>>;
778
744
  }
779
- declare const subscriptionResource: SubscriptionResource;
745
+ declare const createSubscriptionResource: (api: Api) => SubscriptionResource;
780
746
 
781
747
  type FriendshipStatus = 'none' | 'pending_sent' | 'pending_received' | 'accepted' | 'blocked_by_me' | 'blocked_by_them';
782
748
  interface FriendEntry {
@@ -811,8 +777,7 @@ interface FriendActionResponse {
811
777
  status: FriendshipStatus;
812
778
  } | null;
813
779
  }
814
- declare class FriendResource extends ApiResource<FriendEntry> {
815
- protected readonly endpoint = "/friends";
780
+ interface FriendResource {
816
781
  list(): Promise<ApiResponse<FriendListResponse>>;
817
782
  getStatus(targetUserId: number): Promise<ApiResponse<FriendStatusResponse>>;
818
783
  sendRequest(targetUserId: number): Promise<ApiResponse<FriendActionResponse>>;
@@ -821,6 +786,20 @@ declare class FriendResource extends ApiResource<FriendEntry> {
821
786
  block(targetUserId: number): Promise<ApiResponse<FriendActionResponse>>;
822
787
  unblock(targetUserId: number): Promise<ApiResponse<FriendActionResponse>>;
823
788
  }
824
- declare const friendResource: FriendResource;
789
+ declare const createFriendResource: (api: Api) => FriendResource;
790
+
791
+ interface ApiClient {
792
+ api: Api;
793
+ auth: AuthResource;
794
+ user: UserResource;
795
+ room: RoomResource;
796
+ chat: ChatResource;
797
+ playlist: PlaylistResource;
798
+ source: SourceResource;
799
+ shop: ShopResource;
800
+ subscription: SubscriptionResource;
801
+ friend: FriendResource;
802
+ }
803
+ declare const createApiClient: (config: ApiConfig) => ApiClient;
825
804
 
826
- export { type AddMediaData, Api, type ApiConfig, ApiError, ApiResource, type ApiResponse, AuthResource, type AuthResponse, 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, ChatResource, type CreateIntentResponse, type CreateRoomData, type EquipAvatarData, type FeaturedRoomsResponse, type FriendActionResponse, type FriendEntry, type FriendList, type FriendListResponse, FriendResource, type FriendStatusResponse, type FriendshipStatus, type GlobalRole, type GrabResponse, type ImportPlaylistData, type ImportPlaylistResponse, type ImportResult, type JoinMuteInfo, type JoinRoomResponse, Logger, type LoginCredentials, type MeResponse, type MediaItem, type MediaItemResponse, type MediaSearchResult, type MediaSource, type ModerateUserData, type MuteResponse, type PaginatedResponse, type PaginationMeta, type PlayHistoryItem, type Playlist, PlaylistResource, type PlaylistResponse, type PlaylistsResponse, type PortalResponse, type RefreshResponse, type RegisterData, type ResourceOptions, type Room, type RoomBan, type RoomBansResponse, type RoomHistoryResponse, type RoomMember, RoomResource, type RoomResponse, type RoomRole, type RoomStaffResponse, type RoomUserState, type RoomsResponse, type SendMessageData, ShopResource, type ShuffleResponse, type SoundCloudSearchResponse, type SoundCloudTrackResponse, SourceResource, type SubscriptionPlan, SubscriptionResource, type SubscriptionStatus, type UpdateProfileData, type UpdateRoomData, type User, UserResource, type UserResponse, type VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, authResource, chatResource, friendResource, playlistResource, roomResource, shopResource, sourceResource, subscriptionResource, userResource };
805
+ export { Api, type ApiClient, type ApiConfig, ApiError, type ApiResponse, type AuthResource, type BackendErrorResponse, type ChatResource, type FriendResource, Logger, type PlaylistResource, type RoomResource, type ShopResource, type SourceResource, type SubscriptionResource, type UserResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
package/dist/index.d.ts CHANGED
@@ -23,14 +23,10 @@ declare class ApiError extends Error {
23
23
  constructor(message: string, status?: number, code?: string, response?: BackendErrorResponse);
24
24
  }
25
25
  declare class Api {
26
- private static instance;
27
26
  private readonly axios;
28
27
  private readonly logger;
29
28
  private readonly config;
30
- private constructor();
31
- static getInstance(config?: ApiConfig): Api;
32
- /** Reset the singleton (useful for testing or re-initializing with a new config) */
33
- static reset(): void;
29
+ constructor(config: ApiConfig);
34
30
  private setupInterceptors;
35
31
  private parseError;
36
32
  setAuthToken(token: string | null): void;
@@ -44,11 +40,12 @@ declare class Api {
44
40
  private wrapResponse;
45
41
  get axiosInstance(): AxiosInstance;
46
42
  }
43
+ declare const createApi: (config: ApiConfig) => Api;
47
44
 
48
45
  declare class Logger {
49
46
  private readonly name;
50
47
  private enabled;
51
- private constructor();
48
+ constructor(name: string, enabled?: boolean);
52
49
  static create(name: string): Logger;
53
50
  enable(): void;
54
51
  disable(): void;
@@ -59,39 +56,6 @@ declare class Logger {
59
56
  error(message: string, ...args: unknown[]): void;
60
57
  }
61
58
 
62
- interface PaginatedResponse<T> {
63
- data: T[];
64
- meta: {
65
- total: number;
66
- page: number;
67
- perPage: number;
68
- lastPage: number;
69
- };
70
- }
71
- interface ResourceOptions {
72
- params?: Record<string, unknown>;
73
- headers?: Record<string, string>;
74
- }
75
- declare abstract class ApiResource<T = unknown> {
76
- private _logger;
77
- protected abstract readonly endpoint: string;
78
- protected get api(): Api;
79
- protected get logger(): Logger;
80
- protected buildUrl(path?: string | number): string;
81
- protected buildConfig(options?: ResourceOptions): AxiosRequestConfig;
82
- index(options?: ResourceOptions): Promise<ApiResponse<T[]>>;
83
- paginate(page?: number, perPage?: number, options?: ResourceOptions): Promise<ApiResponse<PaginatedResponse<T>>>;
84
- show(id: string | number, options?: ResourceOptions): Promise<ApiResponse<T>>;
85
- store(data: Partial<T>, options?: ResourceOptions): Promise<ApiResponse<T>>;
86
- update(id: string | number, data: Partial<T>, options?: ResourceOptions): Promise<ApiResponse<T>>;
87
- patch(id: string | number, data: Partial<T>, options?: ResourceOptions): Promise<ApiResponse<T>>;
88
- destroy(id: string | number, options?: ResourceOptions): Promise<ApiResponse<void>>;
89
- protected get<R = T>(path: string, options?: ResourceOptions): Promise<ApiResponse<R>>;
90
- protected post<R = T>(path: string, data?: unknown, options?: ResourceOptions): Promise<ApiResponse<R>>;
91
- protected put<R = T>(path: string, data?: unknown, options?: ResourceOptions): Promise<ApiResponse<R>>;
92
- protected delete<R = void>(path: string, options?: ResourceOptions): Promise<ApiResponse<R>>;
93
- }
94
-
95
59
  interface AuthUser {
96
60
  id: number;
97
61
  email?: string;
@@ -144,8 +108,7 @@ interface MeResponse {
144
108
  user: AuthUser;
145
109
  };
146
110
  }
147
- declare class AuthResource extends ApiResource<AuthUser> {
148
- protected readonly endpoint = "/auth";
111
+ interface AuthResource {
149
112
  login(credentials: LoginCredentials): Promise<ApiResponse<AuthResponse>>;
150
113
  register(data: RegisterData): Promise<ApiResponse<AuthResponse>>;
151
114
  refresh(refreshToken: string): Promise<ApiResponse<RefreshResponse>>;
@@ -155,7 +118,7 @@ declare class AuthResource extends ApiResource<AuthUser> {
155
118
  }>>;
156
119
  me(): Promise<ApiResponse<MeResponse>>;
157
120
  }
158
- declare const authResource: AuthResource;
121
+ declare const createAuthResource: (api: Api) => AuthResource;
159
122
 
160
123
  interface User extends AuthUser {
161
124
  }
@@ -170,9 +133,8 @@ interface UserResponse {
170
133
  user: User;
171
134
  };
172
135
  }
173
- declare class UserResource extends ApiResource<User> {
174
- protected readonly endpoint = "/users";
175
- getById(id: number): Promise<ApiResponse<User>>;
136
+ interface UserResource {
137
+ getById(id: number): Promise<ApiResponse<UserResponse>>;
176
138
  getByUsername(username: string): Promise<ApiResponse<UserResponse>>;
177
139
  updateProfile(data: UpdateProfileData): Promise<ApiResponse<UserResponse>>;
178
140
  deleteAccount(): Promise<ApiResponse<{
@@ -185,7 +147,7 @@ declare class UserResource extends ApiResource<User> {
185
147
  data: null;
186
148
  }>>;
187
149
  }
188
- declare const userResource: UserResource;
150
+ declare const createUserResource: (api: Api) => UserResource;
189
151
 
190
152
  type RoomRole = 'user' | 'resident_dj' | 'bouncer' | 'manager' | 'cohost' | 'host';
191
153
  interface Room {
@@ -295,6 +257,23 @@ interface RoomBansResponse {
295
257
  bans: RoomBan[];
296
258
  };
297
259
  }
260
+ interface RoomMute {
261
+ id: number;
262
+ userId: number;
263
+ modById: number;
264
+ reason: string | null;
265
+ duration: number | null;
266
+ expiresAt: string | null;
267
+ createdAt: string;
268
+ username: string;
269
+ displayName: string | null;
270
+ }
271
+ interface RoomMutesResponse {
272
+ success: boolean;
273
+ data: {
274
+ mutes: RoomMute[];
275
+ };
276
+ }
298
277
  interface ModerateUserData {
299
278
  reason?: string;
300
279
  duration?: number;
@@ -351,11 +330,8 @@ interface BoothState {
351
330
  };
352
331
  }
353
332
  interface JoinMuteInfo {
354
- /** ISO timestamp when the mute expires, or null if permanent */
355
333
  expiresAt: string | null;
356
- /** Seconds remaining until unmute, or null if permanent */
357
334
  remainingSeconds: number | null;
358
- /** Optional reason given by the moderator */
359
335
  reason: string | null;
360
336
  }
361
337
  interface JoinRoomResponse {
@@ -371,7 +347,6 @@ interface JoinRoomResponse {
371
347
  role: RoomRole;
372
348
  users: RoomUserState[];
373
349
  booth: BoothState;
374
- /** Present when the joining user is currently muted in this room */
375
350
  mute: JoinMuteInfo | null;
376
351
  };
377
352
  }
@@ -441,8 +416,7 @@ interface RoomHistoryResponse {
441
416
  pagination: PaginationMeta;
442
417
  };
443
418
  }
444
- declare class RoomResource extends ApiResource<Room> {
445
- protected readonly endpoint = "/rooms";
419
+ interface RoomResource {
446
420
  list(): Promise<ApiResponse<RoomsResponse>>;
447
421
  featured(): Promise<ApiResponse<FeaturedRoomsResponse>>;
448
422
  getBySlug(slug: string): Promise<ApiResponse<RoomResponse>>;
@@ -453,6 +427,7 @@ declare class RoomResource extends ApiResource<Room> {
453
427
  }>>;
454
428
  getStaff(slug: string): Promise<ApiResponse<RoomStaffResponse>>;
455
429
  getBans(slug: string): Promise<ApiResponse<RoomBansResponse>>;
430
+ getMutes(slug: string): Promise<ApiResponse<RoomMutesResponse>>;
456
431
  updateUserRole(slug: string, userId: number, role: RoomRole): Promise<ApiResponse<{
457
432
  success: boolean;
458
433
  data: {
@@ -528,7 +503,7 @@ declare class RoomResource extends ApiResource<Room> {
528
503
  grabTrack(slug: string, playlistId?: number): Promise<ApiResponse<GrabResponse>>;
529
504
  getHistory(slug: string, page?: number, limit?: number): Promise<ApiResponse<RoomHistoryResponse>>;
530
505
  }
531
- declare const roomResource: RoomResource;
506
+ declare const createRoomResource: (api: Api) => RoomResource;
532
507
 
533
508
  interface ChatMessage {
534
509
  id: string;
@@ -560,8 +535,7 @@ interface ChatMessageResponse {
560
535
  message: ChatMessage;
561
536
  };
562
537
  }
563
- declare class ChatResource extends ApiResource<ChatMessage> {
564
- protected readonly endpoint = "/rooms";
538
+ interface ChatResource {
565
539
  sendMessage(slug: string, data: SendMessageData): Promise<ApiResponse<ChatMessageResponse>>;
566
540
  getMessages(slug: string, before?: string, limit?: number): Promise<ApiResponse<ChatMessagesResponse>>;
567
541
  deleteMessage(slug: string, messageId: string): Promise<ApiResponse<{
@@ -569,13 +543,13 @@ declare class ChatResource extends ApiResource<ChatMessage> {
569
543
  data: null;
570
544
  }>>;
571
545
  }
572
- declare const chatResource: ChatResource;
546
+ declare const createChatResource: (api: Api) => ChatResource;
573
547
 
574
- type MediaSource = 'youtube' | 'soundcloud';
548
+ type MediaSource$1 = 'youtube' | 'soundcloud';
575
549
  interface MediaItem {
576
550
  id: number;
577
551
  playlistId: number;
578
- source: MediaSource;
552
+ source: MediaSource$1;
579
553
  sourceId: string;
580
554
  title: string;
581
555
  artist: string | null;
@@ -614,7 +588,7 @@ interface MediaItemResponse {
614
588
  };
615
589
  }
616
590
  interface AddMediaData {
617
- source: MediaSource;
591
+ source: MediaSource$1;
618
592
  sourceId: string;
619
593
  }
620
594
  interface ShuffleResponse {
@@ -625,7 +599,7 @@ interface ShuffleResponse {
625
599
  };
626
600
  }
627
601
  interface ImportPlaylistData {
628
- source?: MediaSource;
602
+ source?: MediaSource$1;
629
603
  url: string;
630
604
  }
631
605
  interface ImportResult {
@@ -639,8 +613,7 @@ interface ImportPlaylistResponse {
639
613
  success: boolean;
640
614
  data: ImportResult;
641
615
  }
642
- declare class PlaylistResource extends ApiResource<Playlist> {
643
- protected readonly endpoint = "/playlists";
616
+ interface PlaylistResource {
644
617
  getAll(): Promise<ApiResponse<PlaylistsResponse>>;
645
618
  getById(playlistId: number): Promise<ApiResponse<PlaylistResponse>>;
646
619
  create(name: string): Promise<ApiResponse<PlaylistResponse>>;
@@ -657,8 +630,9 @@ declare class PlaylistResource extends ApiResource<Playlist> {
657
630
  moveItem(playlistId: number, itemId: number, position: number): Promise<ApiResponse<MediaItemResponse>>;
658
631
  importPlaylist(playlistId: number, data: ImportPlaylistData): Promise<ApiResponse<ImportPlaylistResponse>>;
659
632
  }
660
- declare const playlistResource: PlaylistResource;
633
+ declare const createPlaylistResource: (api: Api) => PlaylistResource;
661
634
 
635
+ type MediaSource = 'youtube' | 'soundcloud';
662
636
  interface MediaSearchResult {
663
637
  source: MediaSource;
664
638
  sourceId: string;
@@ -692,8 +666,7 @@ interface SoundCloudTrackResponse {
692
666
  track: MediaSearchResult;
693
667
  };
694
668
  }
695
- declare class SourceResource extends ApiResource<MediaSearchResult> {
696
- protected readonly endpoint = "/sources";
669
+ interface SourceResource {
697
670
  searchYouTube(query: string, limit?: number): Promise<ApiResponse<YouTubeSearchResponse>>;
698
671
  getYouTubeVideo(videoId: string): Promise<ApiResponse<YouTubeVideoResponse>>;
699
672
  searchSoundCloud(query: string, limit?: number): Promise<ApiResponse<SoundCloudSearchResponse>>;
@@ -701,16 +674,14 @@ declare class SourceResource extends ApiResource<MediaSearchResult> {
701
674
  resolveSoundCloudUrl(url: string): Promise<ApiResponse<SoundCloudTrackResponse>>;
702
675
  searchAll(query: string, limit?: number): Promise<MediaSearchResult[]>;
703
676
  }
704
- declare const sourceResource: SourceResource;
677
+ declare const createSourceResource: (api: Api) => SourceResource;
705
678
 
706
679
  type AvatarUnlockType = 'free' | 'level' | 'subscription';
707
680
  interface AvatarCatalogItem {
708
681
  id: string;
709
682
  unlockType: AvatarUnlockType;
710
683
  requiredLevel: number | null;
711
- /** Whether the user has unlocked (or has free access to) this avatar */
712
684
  unlocked: boolean;
713
- /** Whether the user currently meets the requirement to unlock it */
714
685
  eligible: boolean;
715
686
  }
716
687
  interface AvatarCatalogResponse {
@@ -721,11 +692,7 @@ interface AvatarCatalogResponse {
721
692
  xp: number;
722
693
  };
723
694
  }
724
- interface EquipAvatarData {
725
- avatarId: string;
726
- }
727
- declare class ShopResource extends ApiResource {
728
- protected readonly endpoint = "/shop";
695
+ interface ShopResource {
729
696
  getAvatarCatalog(): Promise<ApiResponse<AvatarCatalogResponse>>;
730
697
  unlockAvatar(avatarId: string): Promise<ApiResponse<{
731
698
  success: boolean;
@@ -741,7 +708,7 @@ declare class ShopResource extends ApiResource {
741
708
  };
742
709
  }>>;
743
710
  }
744
- declare const shopResource: ShopResource;
711
+ declare const createShopResource: (api: Api) => ShopResource;
745
712
 
746
713
  type SubscriptionPlan = 'monthly' | 'yearly';
747
714
  interface SubscriptionStatus {
@@ -764,8 +731,7 @@ interface PortalResponse {
764
731
  url: string;
765
732
  };
766
733
  }
767
- declare class SubscriptionResource extends ApiResource {
768
- protected readonly endpoint = "/subscriptions";
734
+ interface SubscriptionResource {
769
735
  getStatus(): Promise<ApiResponse<{
770
736
  success: boolean;
771
737
  data: SubscriptionStatus;
@@ -776,7 +742,7 @@ declare class SubscriptionResource extends ApiResource {
776
742
  }>>;
777
743
  createPortal(): Promise<ApiResponse<PortalResponse>>;
778
744
  }
779
- declare const subscriptionResource: SubscriptionResource;
745
+ declare const createSubscriptionResource: (api: Api) => SubscriptionResource;
780
746
 
781
747
  type FriendshipStatus = 'none' | 'pending_sent' | 'pending_received' | 'accepted' | 'blocked_by_me' | 'blocked_by_them';
782
748
  interface FriendEntry {
@@ -811,8 +777,7 @@ interface FriendActionResponse {
811
777
  status: FriendshipStatus;
812
778
  } | null;
813
779
  }
814
- declare class FriendResource extends ApiResource<FriendEntry> {
815
- protected readonly endpoint = "/friends";
780
+ interface FriendResource {
816
781
  list(): Promise<ApiResponse<FriendListResponse>>;
817
782
  getStatus(targetUserId: number): Promise<ApiResponse<FriendStatusResponse>>;
818
783
  sendRequest(targetUserId: number): Promise<ApiResponse<FriendActionResponse>>;
@@ -821,6 +786,20 @@ declare class FriendResource extends ApiResource<FriendEntry> {
821
786
  block(targetUserId: number): Promise<ApiResponse<FriendActionResponse>>;
822
787
  unblock(targetUserId: number): Promise<ApiResponse<FriendActionResponse>>;
823
788
  }
824
- declare const friendResource: FriendResource;
789
+ declare const createFriendResource: (api: Api) => FriendResource;
790
+
791
+ interface ApiClient {
792
+ api: Api;
793
+ auth: AuthResource;
794
+ user: UserResource;
795
+ room: RoomResource;
796
+ chat: ChatResource;
797
+ playlist: PlaylistResource;
798
+ source: SourceResource;
799
+ shop: ShopResource;
800
+ subscription: SubscriptionResource;
801
+ friend: FriendResource;
802
+ }
803
+ declare const createApiClient: (config: ApiConfig) => ApiClient;
825
804
 
826
- export { type AddMediaData, Api, type ApiConfig, ApiError, ApiResource, type ApiResponse, AuthResource, type AuthResponse, 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, ChatResource, type CreateIntentResponse, type CreateRoomData, type EquipAvatarData, type FeaturedRoomsResponse, type FriendActionResponse, type FriendEntry, type FriendList, type FriendListResponse, FriendResource, type FriendStatusResponse, type FriendshipStatus, type GlobalRole, type GrabResponse, type ImportPlaylistData, type ImportPlaylistResponse, type ImportResult, type JoinMuteInfo, type JoinRoomResponse, Logger, type LoginCredentials, type MeResponse, type MediaItem, type MediaItemResponse, type MediaSearchResult, type MediaSource, type ModerateUserData, type MuteResponse, type PaginatedResponse, type PaginationMeta, type PlayHistoryItem, type Playlist, PlaylistResource, type PlaylistResponse, type PlaylistsResponse, type PortalResponse, type RefreshResponse, type RegisterData, type ResourceOptions, type Room, type RoomBan, type RoomBansResponse, type RoomHistoryResponse, type RoomMember, RoomResource, type RoomResponse, type RoomRole, type RoomStaffResponse, type RoomUserState, type RoomsResponse, type SendMessageData, ShopResource, type ShuffleResponse, type SoundCloudSearchResponse, type SoundCloudTrackResponse, SourceResource, type SubscriptionPlan, SubscriptionResource, type SubscriptionStatus, type UpdateProfileData, type UpdateRoomData, type User, UserResource, type UserResponse, type VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, authResource, chatResource, friendResource, playlistResource, roomResource, shopResource, sourceResource, subscriptionResource, userResource };
805
+ export { Api, type ApiClient, type ApiConfig, ApiError, type ApiResponse, type AuthResource, type BackendErrorResponse, type ChatResource, type FriendResource, Logger, type PlaylistResource, type RoomResource, type ShopResource, type SourceResource, type SubscriptionResource, type UserResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };