feat(wip): 新的客户端协议库
This commit is contained in:
14
client-protocol/bean/ChatBean.ts
Normal file
14
client-protocol/bean/ChatBean.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import ChatType from "./ChatType.ts"
|
||||
|
||||
export default class ChatBean {
|
||||
declare type: ChatType
|
||||
declare id: string
|
||||
declare title: string
|
||||
declare avatar_file_hash?: string
|
||||
declare settings?: { [key: string]: unknown }
|
||||
|
||||
declare is_member: boolean
|
||||
declare is_admin: boolean
|
||||
|
||||
[key: string]: unknown
|
||||
}
|
||||
3
client-protocol/bean/ChatType.ts
Normal file
3
client-protocol/bean/ChatType.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
type ChatType = 'private' | 'group'
|
||||
|
||||
export default ChatType
|
||||
14
client-protocol/bean/GroupSettingsBean.ts
Normal file
14
client-protocol/bean/GroupSettingsBean.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
interface GroupSettingsBean {
|
||||
allow_new_member_join?: boolean
|
||||
allow_new_member_from_invitation?: boolean
|
||||
new_member_join_method?: 'disabled' | 'allowed_by_admin' | 'answered_and_allowed_by_admin'
|
||||
answered_and_allowed_by_admin_question?: string
|
||||
|
||||
// 下面两个比较特殊, 由服务端给予
|
||||
group_title: string
|
||||
group_name: string
|
||||
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export default GroupSettingsBean
|
||||
8
client-protocol/bean/JoinRequestBean.ts
Normal file
8
client-protocol/bean/JoinRequestBean.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export default class JoinRequestBean {
|
||||
declare user_id: string
|
||||
declare title: string
|
||||
declare avatar?: string
|
||||
declare reason?: string
|
||||
|
||||
[key: string]: unknown
|
||||
}
|
||||
6
client-protocol/bean/MessageBean.ts
Normal file
6
client-protocol/bean/MessageBean.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export default class MessageBean {
|
||||
declare id: number
|
||||
declare text: string
|
||||
declare user_id: string
|
||||
declare time: string
|
||||
}
|
||||
5
client-protocol/bean/RecentChatBean.ts
Normal file
5
client-protocol/bean/RecentChatBean.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import ChatBean from "./ChatBean.ts"
|
||||
|
||||
export default class RecentChat extends ChatBean {
|
||||
declare content: string
|
||||
}
|
||||
6
client-protocol/bean/UserBean.ts
Normal file
6
client-protocol/bean/UserBean.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export default class UserBean {
|
||||
declare id: string
|
||||
declare username?: string
|
||||
declare nickname: string
|
||||
declare avatar_file_hash?: string
|
||||
}
|
||||
Reference in New Issue
Block a user