65 lines
1.4 KiB
Go
65 lines
1.4 KiB
Go
package domain
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
type User struct {
|
|
ID string `json:"id"`
|
|
Username string `json:"username"`
|
|
DisplayName string `json:"display_name"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type Chat struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"title"`
|
|
MemberIDs []string `json:"member_ids"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type Message struct {
|
|
ID string `json:"id"`
|
|
ChatID string `json:"chat_id"`
|
|
SenderID string `json:"sender_id"`
|
|
Text string `json:"text"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type MessagePage struct {
|
|
Items []Message `json:"items"`
|
|
NextCursor *string `json:"next_cursor"`
|
|
}
|
|
|
|
type ChatPage struct {
|
|
Items []Chat `json:"items"`
|
|
NextCursor *string `json:"next_cursor"`
|
|
}
|
|
|
|
type Session struct {
|
|
Token string `json:"token"`
|
|
TokenType string `json:"token_type"`
|
|
ExpiresAt time.Time `json:"expires_at"`
|
|
User User `json:"user"`
|
|
}
|
|
|
|
type ErrorBody struct {
|
|
Error ErrorDetail `json:"error"`
|
|
}
|
|
|
|
type ErrorDetail struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
RequestID string `json:"request_id"`
|
|
}
|
|
|
|
var (
|
|
ErrNotFound = errors.New("not found")
|
|
ErrConflict = errors.New("conflict")
|
|
ErrInvalid = errors.New("invalid request")
|
|
ErrUnauthorized = errors.New("unauthorized")
|
|
ErrTimeout = errors.New("timeout")
|
|
ErrUnavailable = errors.New("unavailable")
|
|
)
|