github.com/rajatvaryani/mattermost-server@v5.11.1+incompatible/model/post_metadata.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"encoding/json"
     8  )
     9  
    10  type PostMetadata struct {
    11  	// Embeds holds information required to render content embedded in the post. This includes the OpenGraph metadata
    12  	// for links in the post.
    13  	Embeds []*PostEmbed `json:"embeds,omitempty"`
    14  
    15  	// Emojis holds all custom emojis used in the post or used in reaction to the post.
    16  	Emojis []*Emoji `json:"emojis,omitempty"`
    17  
    18  	// Files holds information about the file attachments on the post.
    19  	Files []*FileInfo `json:"files,omitempty"`
    20  
    21  	// Images holds the dimensions of all external images in the post as a map of the image URL to its diemsnions.
    22  	// This includes image embeds (when the message contains a plaintext link to an image), Markdown images, images
    23  	// contained in the OpenGraph metadata, and images contained in message attachments. It does not contain
    24  	// the dimensions of any file attachments as those are stored in FileInfos.
    25  	Images map[string]*PostImage `json:"images,omitempty"`
    26  
    27  	// Reactions holds reactions made to the post.
    28  	Reactions []*Reaction `json:"reactions,omitempty"`
    29  }
    30  
    31  type PostImage struct {
    32  	Width  int `json:"width"`
    33  	Height int `json:"height"`
    34  
    35  	// Format is the name of the image format as used by image/go such as "png", "gif", or "jpeg".
    36  	Format string `json:"format"`
    37  
    38  	// FrameCount stores the number of frames in this image, if it is an animated gif. It will be 0 for other formats.
    39  	FrameCount int `json:"frame_count"`
    40  }
    41  
    42  func (o *PostImage) ToJson() string {
    43  	b, _ := json.Marshal(o)
    44  	return string(b)
    45  }