summaryrefslogtreecommitdiff
path: root/shrine/types/letter/response.go
blob: fe1c0d7289a410d2a7a5be2961af2233c7b62949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package letter

import (
	"shrine/types/user"
	"time"
)

type ParticipantResponse struct {
	Username    string `json:"username"`
	DisplayName string `json:"display_name"`
	AvatarURL   string `json:"avatar_url"`
	Role        string `json:"role"`
}

type AttachmentResponse struct {
	Ref         string `json:"ref"`
	FileName    string `json:"file_name"`
	URL         string `json:"url"`
	FileSize    int64  `json:"file_size"`
	ContentType string `json:"content_type"`
	Category    string `json:"category"`
}

type MessageResponse struct {
	Ref         string                       `json:"ref"`
	Sender      *user.CitizenSummaryResponse `json:"sender"`
	Body        string                       `json:"body"`
	Attachments []AttachmentResponse         `json:"attachments"`
	EditedAt    *time.Time                   `json:"edited_at"`
	CreatedAt   time.Time                    `json:"created_at"`
	Deleted     bool                         `json:"deleted"`
}

type LetterResponse struct {
	Ref          string                `json:"ref"`
	Title        string                `json:"title"`
	IsSystem     bool                  `json:"is_system"`
	SystemRef    string                `json:"system_ref,omitempty"`
	Participants []ParticipantResponse `json:"participants"`
	LastMessage  *MessageResponse      `json:"last_message,omitempty"`
	Unread       bool                  `json:"unread"`
	UpdatedAt    time.Time             `json:"updated_at"`
}

type DetailResponse struct {
	Ref          string                `json:"ref"`
	Title        string                `json:"title"`
	IsSystem     bool                  `json:"is_system"`
	SystemRef    string                `json:"system_ref,omitempty"`
	Participants []ParticipantResponse `json:"participants"`
	Messages     []MessageResponse     `json:"messages"`
	CreatedAt    time.Time             `json:"created_at"`
}