-
Notifications
You must be signed in to change notification settings - Fork 7k
/
post_embed.go
33 lines (26 loc) · 936 Bytes
/
post_embed.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
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
const (
PostEmbedImage PostEmbedType = "image"
PostEmbedMessageAttachment PostEmbedType = "message_attachment"
PostEmbedOpengraph PostEmbedType = "opengraph"
PostEmbedLink PostEmbedType = "link"
PostEmbedPermalink PostEmbedType = "permalink"
PostEmbedBoards PostEmbedType = "boards"
)
type PostEmbedType string
type PostEmbed struct {
Type PostEmbedType `json:"type"`
// The URL of the embedded content. Used for image and OpenGraph embeds.
URL string `json:"url,omitempty"`
// Any additional data for the embedded content. Only used for OpenGraph embeds.
Data any `json:"data,omitempty"`
}
func (pe *PostEmbed) Auditable() map[string]any {
// filter out embedded content.
return map[string]any{
"type": pe.Type,
"url": pe.URL,
}
}