Files

class matterapi.endpoints.async_api.FilesApi(client: matterapi.client.base.BaseClient, skip_response_parsing: bool = False)

Endpoints for uploading and interacting with files.

async get_file(file_id: str) None

Get a file

Gets a file that has been uploaded previously.

Permissions:

Must have read_channel permission or be uploader of the file.

Api Reference:

GetFile

async get_file_info(file_id: str) matterapi.models.FileInfo

Get metadata for a file

Gets a file’s info.

Permissions:

Must have read_channel permission or be uploader of the file.

Api Reference:

GetFileInfo

Get a public file link

Gets a public link for a file that can be accessed without logging into Mattermost.

Permissions:

Must have read_channel permission or be uploader of the file.

Api Reference:

GetFileLink

async get_file_preview(file_id: str) None

Get a file’s preview

Gets a file’s preview.

Permissions:

Must have read_channel permission or be uploader of the file.

Api Reference:

GetFilePreview

async get_file_public(file_id: str, *, h: str) None

Get a public file

Permissions:

No permissions required.

Api Reference:

GetFilePublic

async get_file_thumbnail(file_id: str) None

Get a file’s thumbnail

Gets a file’s thumbnail.

Permissions:

Must have read_channel permission or be uploader of the file.

Api Reference:

GetFileThumbnail

async search_files(team_id: str, *, multipart_data: Union[matterapi.models.SearchFilesMultipartData, Dict]) matterapi.models.FileInfoList

Search files in a team

Search for files in a team based on file name, extention and file content (if file content extraction is enabled and supported for the files).

Permissions:

Must be authenticated and have the view_team permission.

Minimum Server Version:

5.34

Api Reference:

SearchFiles

async upload_file(*, multipart_data: Union[matterapi.models.UploadFileMultipartData, Dict], channel_id: Optional[str] = None, filename: Optional[str] = None) matterapi.models.UploadFileResponse201

Upload a file

Uploads a file that can later be attached to a post.

This request can either be a multipart/form-data request with a channel_id, files and optional client_ids defined in the FormData, or it can be a request with the channel_id and filename defined as query parameters with the contents of a single file in the body of the request.

Only multipart/form-data requests are supported by server versions up to and including 4.7. Server versions 4.8 and higher support both types of requests.

Permissions:

Must have upload_file permission.

Api Reference:

UploadFile