52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type Time struct {
|
|
time.Time
|
|
}
|
|
|
|
func NewTime(t time.Time) Time { return Time{Time: t} }
|
|
|
|
func (t Time) MarshalJSON() ([]byte, error) {
|
|
return []byte(`"` + t.UTC().Format("2006-01-02T15:04:05.000Z") + `"`), nil
|
|
}
|
|
|
|
type User struct {
|
|
ID string `json:"id"`
|
|
Username string `json:"username"`
|
|
DisplayName string `json:"display_name"`
|
|
CreatedAt Time `json:"created_at"`
|
|
}
|
|
|
|
type Chat struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"title"`
|
|
MemberIDs []string `json:"member_ids"`
|
|
CreatedAt 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 `json:"created_at"`
|
|
}
|
|
|
|
type Page[T any] struct {
|
|
Items []T `json:"items"`
|
|
NextCursor *string `json:"next_cursor"`
|
|
}
|
|
|
|
type Health struct {
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type Session struct {
|
|
Token string `json:"token"`
|
|
TokenType string `json:"token_type"`
|
|
ExpiresAt Time `json:"expires_at"`
|
|
User User `json:"user"`
|
|
}
|