-
Notifications
You must be signed in to change notification settings - Fork 2
/
attachment.go
52 lines (38 loc) · 1.25 KB
/
attachment.go
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
package revoltgo
type AttachmentMetadataType string
const (
AttachmentMetadataTypeFile AttachmentMetadataType = "File"
AttachmentMetadataTypeText AttachmentMetadataType = "Text"
AttachmentMetadataTypeImage AttachmentMetadataType = "Image"
AttachmentMetadataTypeVideo AttachmentMetadataType = "Video"
AttachmentMetadataTypeAudio AttachmentMetadataType = "Audio"
)
type Attachment struct {
ID string `json:"_id"`
// Tag / bucket this file was uploaded to
Tag string `json:"tag"`
// Original filename
FileName string `json:"filename"`
// Metadata associated with file
Metadata *AttachmentMetadata `json:"metadata"`
// Raw content type of this file
ContentType string `json:"content_type"`
// Size of this file (in bytes)
Size int `json:"size"`
// Whether this file was deleted
Deleted bool `json:"deleted"`
// Whether this file was reported
Reported bool `json:"reported"`
MessageID string `json:"message_id"`
UserID string `json:"user_id"`
ServerID string `json:"server_id"`
ObjectID string `json:"object_id"`
}
func (a *Attachment) URL(size string) string {
return EndpointAutumn(a.Tag, a.ID, size)
}
type AttachmentMetadata struct {
Type AttachmentMetadataType `json:"type"`
Width int `json:"width"`
Height int `json:"height"`
}