matterbridge/vendor/github.com/mattermost/mattermost-server/model/file.go

35 lines
855 B
Go
Raw Normal View History

2017-08-16 21:37:37 +00:00
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2016-04-10 21:39:38 +00:00
// See License.txt for license information.
package model
import (
"encoding/json"
"io"
)
2017-03-25 20:04:10 +00:00
const (
MaxImageSize = 6048 * 4032 // 24 megapixels, roughly 36MB as a raw image
)
2016-04-10 21:39:38 +00:00
var (
IMAGE_EXTENSIONS = [5]string{".jpg", ".jpeg", ".gif", ".bmp", ".png"}
IMAGE_MIME_TYPES = map[string]string{".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff"}
)
type FileUploadResponse struct {
2016-11-12 21:00:53 +00:00
FileInfos []*FileInfo `json:"file_infos"`
ClientIds []string `json:"client_ids"`
2016-04-10 21:39:38 +00:00
}
func FileUploadResponseFromJson(data io.Reader) *FileUploadResponse {
var o *FileUploadResponse
json.NewDecoder(data).Decode(&o)
return o
2016-04-10 21:39:38 +00:00
}
func (o *FileUploadResponse) ToJson() string {
b, _ := json.Marshal(o)
return string(b)
2016-04-10 21:39:38 +00:00
}