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

35 lines
899 B
Go
Raw Normal View History

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