feat: expose member playlists over HTTP

This commit is contained in:
DiheChen committed 2026-11-09 21:27:41 +08:00
1 parent 95a56267a4
commit fafde9041c
13 files changed
+1280 -33

No files matched your search

+36 -1
View File
@@ -1,6 +1,14 @@
// Code generated by protocolgen from protocol/idl.json; DO NOT EDIT.
import type { APIKey, Account, AdminAccount, ErrorInfo, Member, QQLoginType, QRLogin, QRLoginResult, RoomListing, SourceAccount, StoredMedia } from '../realtime/protocol.gen'
import type { APIKey, Account, AdminAccount, ErrorInfo, Member, MyPlaylist, MyPlaylistItem, QQLoginType, QRLogin, QRLoginResult, RoomListing, SourceAccount, StoredMedia, Track } from '../realtime/protocol.gen'
export interface AddMyPlaylistItemRequest {
track: Track
}
export interface AddMyPlaylistItemResponse {
item: MyPlaylistItem
}
export interface AdminCheckBilibiliLoginRequest {
key: string
@@ -108,6 +116,10 @@ export interface CreateMemberResponse {
memberToken: string
}
export interface CreateMyPlaylistRequest {
name: string
}
export interface CreateRoomRequest {
description: string
name: string
@@ -136,6 +148,14 @@ export interface GetSiteResponse {
registrationOpen: boolean
}
export interface ListMyPlaylistItemsResponse {
items: MyPlaylistItem[]
}
export interface ListMyPlaylistsResponse {
items: MyPlaylist[]
}
export interface ListRoomsResponse {
items: RoomListing[]
}
@@ -162,6 +182,14 @@ export interface RegisterResponse {
account: Account
}
export interface RemoveMyPlaylistItemRequest {
track: Track
}
export interface RenameMyPlaylistRequest {
name: string
}
export interface UpdateMeRequest {
email?: string
name?: string
@@ -195,6 +223,13 @@ export function httpClient(send: HttpSend) {
changePassword: (body: ChangePasswordRequest) => send<void>({ method: 'PUT', path: '/api/account/password', auth: 'member', body }),
login: (body: LoginRequest) => send<LoginResponse>({ method: 'POST', path: '/api/sessions', auth: 'member', body }),
logout: () => send<void>({ method: 'DELETE', path: '/api/sessions/current', auth: 'member' }),
listMyPlaylists: () => send<ListMyPlaylistsResponse>({ method: 'GET', path: '/api/me/playlists', auth: 'member' }),
createMyPlaylist: (body: CreateMyPlaylistRequest) => send<MyPlaylist>({ method: 'POST', path: '/api/me/playlists', auth: 'member', body }),
renameMyPlaylist: (id: string, body: RenameMyPlaylistRequest) => send<void>({ method: 'PATCH', path: `/api/me/playlists/${encodeURIComponent(id)}`, auth: 'member', body }),
deleteMyPlaylist: (id: string) => send<void>({ method: 'DELETE', path: `/api/me/playlists/${encodeURIComponent(id)}`, auth: 'member' }),
listMyPlaylistItems: (id: string) => send<ListMyPlaylistItemsResponse>({ method: 'GET', path: `/api/me/playlists/${encodeURIComponent(id)}/items`, auth: 'member' }),
addMyPlaylistItem: (id: string, body: AddMyPlaylistItemRequest) => send<AddMyPlaylistItemResponse>({ method: 'POST', path: `/api/me/playlists/${encodeURIComponent(id)}/items`, auth: 'member', body }),
removeMyPlaylistItem: (id: string, body: RemoveMyPlaylistItemRequest) => send<void>({ method: 'POST', path: `/api/me/playlists/${encodeURIComponent(id)}/removals`, auth: 'member', body }),
listRooms: () => send<ListRoomsResponse>({ method: 'GET', path: '/api/rooms', auth: 'none' }),
getRoom: (ref: string) => send<RoomListing>({ method: 'GET', path: `/api/rooms/${encodeURIComponent(ref)}`, auth: 'none' }),
createRoom: (body: CreateRoomRequest) => send<CreateRoomResponse>({ method: 'POST', path: '/api/rooms', auth: 'none', body }),
+16 -1
View File
@@ -1,6 +1,6 @@
// Code generated by protocolgen from protocol/idl.json; DO NOT EDIT.
export const PROTOCOL_VERSION = '000a0b37ea0f0adc'
export const PROTOCOL_VERSION = '7380d77bc52d7f95'
export interface APIKey {
key: string
@@ -72,6 +72,21 @@ export interface Members {
sessions: Member[]
}
export interface MyPlaylist {
coverUrl: string | null
createdAtMs: number
favorites: boolean
id: string
name: string
trackCount: number
updatedAtMs: number
}
export interface MyPlaylistItem {
meta: TrackMeta
track: Track
}
export interface NowPlaying {
durationMs: number
entry: Entry