-
-
Notifications
You must be signed in to change notification settings - Fork 3
API設計(deprecated)
yuta-ike edited this page Oct 22, 2021
·
1 revision
type Message = {
"id": string // アイテムID
"topic_id": string // トピックID
"type": "message" // コメントタイプ
"icon_id": string // アイコンID
"timestamp": number // 経過時間のタイムスタンプ
"content": string // メッセージの内容
"is_question": boolean // 質問コメントかどうか
}
type Reaction = {
"id": string // アイテムID
"topic_id": string // トピックID
"type": "reaction" // コメントタイプ
"icon_id": string // アイコンID
"timestamp": number // 経過時間のタイムスタンプ
"target": {
"id": string // リアクションを行なった対象のメッセージID
"content": string // リアクションを行なった対象のメッセージの内容
}
}
type ChatItem = Message | Reaction
type Topic = {
"id": string
"title": string
"description": string
}
Client to Sever
{
"type": "message" // アイテムタイプ
"id": string // フロントで生成したアイテムID
"topic_id": string // トピックID
"content": string // コメントの中身
"isQuestion": boolean
}
Client to Sever
{
"type": "reaction" // アイテムタイプ
"id": string // フロントで生成したアイテムID
"topic_id": string // トピックID
"reaction_to_id": string // リアクションを送るメッセージのID
}
- Server to Client
// 入力開始アクション
type InsertEditingAction = {
type: "insert-editing",
content: {
id: string,
topic_id: string
icon_id: string
}
}
// 入力中断アクション
type RemoveEditingAction = {
type: "remove-editing"
content: {
"id": string
"topic_id": string
}
}
// 入力完了&チャット送信アクション
type ConfirmToSendAction = {
type: "confirm-to-send",
content: ChatItem
}
// チャット送信アクション(何らかの理由で入力中イベントが送信されていない状態でチャットが送信された場合)
type InsertChatItemAction = {
type: "insert-chatitem",
content: ChatItem
}
{
actions: (InsertEditingAction | RemoveEditingAction | ConfirmToSendAction | InsertChatItemAction)[]
}
Client to Server
{
"id": string // フロントで生成したアイテムID
"topic_id": string // トピックID
}
Client to Server
{
"id": string // フロントで生成したアイテムID
"topic_id": string // トピックID
}
Client to Server
[request]
{
"room_id": string
"icon_id": string
}
[response]
{
"chatItems": Message[]
"editingInfo": { id: number, topicId: number, iconId: number }[]
"topics": Topic[]
"active_user_count": number
}
Server to Client
{
iconId: number
activeUserCount: number
}
Server to Client
{
iconId: number
activeUserCount: number
}
{<empty>}
{
count: number
}
Client to Server
[request]
{
"topics": Topics[]
}
[response]
{
"room_id": Topics[]
}