@borealise/api 2.0.0-alpha.10 → 2.0.0-alpha.12
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/README.md +3 -3
- package/dist/index.d.mts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Create a client once, then use resources:
|
|
|
26
26
|
import { createApiClient } from '@borealise/api'
|
|
27
27
|
|
|
28
28
|
const client = createApiClient({
|
|
29
|
-
baseURL: 'https://prod.borealise.com',
|
|
29
|
+
baseURL: 'https://prod.borealise.com/api',
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
// Login
|
|
@@ -45,7 +45,7 @@ If you need more control, create the API and resources separately:
|
|
|
45
45
|
import { createApi, createAuthResource, createRoomResource } from '@borealise/api'
|
|
46
46
|
|
|
47
47
|
const api = createApi({
|
|
48
|
-
baseURL: 'https://prod.borealise.com',
|
|
48
|
+
baseURL: 'https://prod.borealise.com/api',
|
|
49
49
|
timeout: 15000,
|
|
50
50
|
logging: false,
|
|
51
51
|
})
|
|
@@ -63,7 +63,7 @@ await auth.login({ login: 'you@example.com', password: 'secret' })
|
|
|
63
63
|
|
|
64
64
|
```ts
|
|
65
65
|
createApiClient({
|
|
66
|
-
baseURL: 'https://prod.borealise.com', // required
|
|
66
|
+
baseURL: 'https://prod.borealise.com/api', // required
|
|
67
67
|
timeout: 15000, // optional, default: 30000ms
|
|
68
68
|
logging: false, // optional, disable all console output
|
|
69
69
|
headers: { 'X-Custom-Header': 'value' } // optional, custom headers
|
package/dist/index.d.mts
CHANGED
|
@@ -128,6 +128,32 @@ declare const createAuthResource: (api: Api) => AuthResource;
|
|
|
128
128
|
|
|
129
129
|
interface User extends AuthUser {
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Public user profile — never contains private fields (email, flags, etc.)
|
|
133
|
+
*/
|
|
134
|
+
interface PublicUser {
|
|
135
|
+
id: number;
|
|
136
|
+
username: string;
|
|
137
|
+
displayName: string | null;
|
|
138
|
+
avatarId: string;
|
|
139
|
+
bio: string | null;
|
|
140
|
+
globalRole: string;
|
|
141
|
+
xp: number;
|
|
142
|
+
level: number;
|
|
143
|
+
subscriptionType?: string | null;
|
|
144
|
+
createdAt?: string;
|
|
145
|
+
friendsCount: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A friend entry as shown on a public profile.
|
|
149
|
+
*/
|
|
150
|
+
interface PublicProfileFriend {
|
|
151
|
+
id: number;
|
|
152
|
+
username: string;
|
|
153
|
+
displayName: string | null;
|
|
154
|
+
avatarId: string;
|
|
155
|
+
level: number;
|
|
156
|
+
}
|
|
131
157
|
interface UpdateProfileData {
|
|
132
158
|
displayName?: string;
|
|
133
159
|
bio?: string;
|
|
@@ -136,7 +162,8 @@ type GlobalRole = 'user' | 'moderator' | 'admin' | 'owner';
|
|
|
136
162
|
interface UserResponse {
|
|
137
163
|
success: boolean;
|
|
138
164
|
data: {
|
|
139
|
-
user:
|
|
165
|
+
user: PublicUser;
|
|
166
|
+
friends: PublicProfileFriend[];
|
|
140
167
|
};
|
|
141
168
|
}
|
|
142
169
|
interface MyViolation {
|
|
@@ -978,4 +1005,4 @@ interface ApiClient {
|
|
|
978
1005
|
}
|
|
979
1006
|
declare const createApiClient: (config: ApiConfig) => ApiClient;
|
|
980
1007
|
|
|
981
|
-
export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, Api, type ApiClient, type ApiConfig, ApiError, 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 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 };
|
|
1008
|
+
export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, Api, type ApiClient, type ApiConfig, ApiError, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -128,6 +128,32 @@ declare const createAuthResource: (api: Api) => AuthResource;
|
|
|
128
128
|
|
|
129
129
|
interface User extends AuthUser {
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Public user profile — never contains private fields (email, flags, etc.)
|
|
133
|
+
*/
|
|
134
|
+
interface PublicUser {
|
|
135
|
+
id: number;
|
|
136
|
+
username: string;
|
|
137
|
+
displayName: string | null;
|
|
138
|
+
avatarId: string;
|
|
139
|
+
bio: string | null;
|
|
140
|
+
globalRole: string;
|
|
141
|
+
xp: number;
|
|
142
|
+
level: number;
|
|
143
|
+
subscriptionType?: string | null;
|
|
144
|
+
createdAt?: string;
|
|
145
|
+
friendsCount: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A friend entry as shown on a public profile.
|
|
149
|
+
*/
|
|
150
|
+
interface PublicProfileFriend {
|
|
151
|
+
id: number;
|
|
152
|
+
username: string;
|
|
153
|
+
displayName: string | null;
|
|
154
|
+
avatarId: string;
|
|
155
|
+
level: number;
|
|
156
|
+
}
|
|
131
157
|
interface UpdateProfileData {
|
|
132
158
|
displayName?: string;
|
|
133
159
|
bio?: string;
|
|
@@ -136,7 +162,8 @@ type GlobalRole = 'user' | 'moderator' | 'admin' | 'owner';
|
|
|
136
162
|
interface UserResponse {
|
|
137
163
|
success: boolean;
|
|
138
164
|
data: {
|
|
139
|
-
user:
|
|
165
|
+
user: PublicUser;
|
|
166
|
+
friends: PublicProfileFriend[];
|
|
140
167
|
};
|
|
141
168
|
}
|
|
142
169
|
interface MyViolation {
|
|
@@ -978,4 +1005,4 @@ interface ApiClient {
|
|
|
978
1005
|
}
|
|
979
1006
|
declare const createApiClient: (config: ApiConfig) => ApiClient;
|
|
980
1007
|
|
|
981
|
-
export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, Api, type ApiClient, type ApiConfig, ApiError, 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 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 };
|
|
1008
|
+
export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, Api, type ApiClient, type ApiConfig, ApiError, 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 };
|
package/dist/index.js
CHANGED
|
@@ -154,13 +154,16 @@ var Api = class {
|
|
|
154
154
|
parseError(error) {
|
|
155
155
|
if (error.response) {
|
|
156
156
|
const responseData = error.response.data;
|
|
157
|
+
const isObjectResponse = typeof responseData === "object" && responseData !== null;
|
|
157
158
|
let message;
|
|
158
159
|
let backendResponse;
|
|
159
|
-
if (
|
|
160
|
+
if (isObjectResponse && "error" in responseData && responseData.error) {
|
|
160
161
|
message = responseData.error;
|
|
161
162
|
backendResponse = responseData;
|
|
162
|
-
} else if (
|
|
163
|
+
} else if (isObjectResponse && "message" in responseData && responseData.message) {
|
|
163
164
|
message = responseData.message;
|
|
165
|
+
} else if (typeof responseData === "string" && responseData) {
|
|
166
|
+
message = responseData;
|
|
164
167
|
} else {
|
|
165
168
|
message = error.message;
|
|
166
169
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -104,13 +104,16 @@ var Api = class {
|
|
|
104
104
|
parseError(error) {
|
|
105
105
|
if (error.response) {
|
|
106
106
|
const responseData = error.response.data;
|
|
107
|
+
const isObjectResponse = typeof responseData === "object" && responseData !== null;
|
|
107
108
|
let message;
|
|
108
109
|
let backendResponse;
|
|
109
|
-
if (
|
|
110
|
+
if (isObjectResponse && "error" in responseData && responseData.error) {
|
|
110
111
|
message = responseData.error;
|
|
111
112
|
backendResponse = responseData;
|
|
112
|
-
} else if (
|
|
113
|
+
} else if (isObjectResponse && "message" in responseData && responseData.message) {
|
|
113
114
|
message = responseData.message;
|
|
115
|
+
} else if (typeof responseData === "string" && responseData) {
|
|
116
|
+
message = responseData;
|
|
114
117
|
} else {
|
|
115
118
|
message = error.message;
|
|
116
119
|
}
|