Source code for mattermostautodriver.endpoints.files

from .base import Base


[docs]class Files(Base):
[docs] def upload_file(self, files, data=None): """Upload a file files: A file to be uploaded channel_id: The ID of the channel that this file will be uploaded to client_ids: A unique identifier for the file that will be returned in the response `Read in Mattermost API docs (files - UploadFile) <https://api.mattermost.com/#tag/files/operation/UploadFile>`_ """ return self.client.post("""/api/v4/files""", files=files, data=data)
[docs] def get_file(self, file_id): """Get a file file_id: The ID of the file to get `Read in Mattermost API docs (files - GetFile) <https://api.mattermost.com/#tag/files/operation/GetFile>`_ """ return self.client.get(f"/api/v4/files/{file_id}")
[docs] def get_file_thumbnail(self, file_id): """Get a file's thumbnail file_id: The ID of the file to get `Read in Mattermost API docs (files - GetFileThumbnail) <https://api.mattermost.com/#tag/files/operation/GetFileThumbnail>`_ """ return self.client.get(f"/api/v4/files/{file_id}/thumbnail")
[docs] def get_file_preview(self, file_id): """Get a file's preview file_id: The ID of the file to get `Read in Mattermost API docs (files - GetFilePreview) <https://api.mattermost.com/#tag/files/operation/GetFilePreview>`_ """ return self.client.get(f"/api/v4/files/{file_id}/preview")
[docs] def get_file_info(self, file_id): """Get metadata for a file file_id: The ID of the file info to get `Read in Mattermost API docs (files - GetFileInfo) <https://api.mattermost.com/#tag/files/operation/GetFileInfo>`_ """ return self.client.get(f"/api/v4/files/{file_id}/info")
[docs] def get_file_public(self, file_id, params=None): """Get a public file file_id: The ID of the file to get h: File hash `Read in Mattermost API docs (files - GetFilePublic) <https://api.mattermost.com/#tag/files/operation/GetFilePublic>`_ """ return self.client.get(f"/files/{file_id}/public", params=params)
[docs] def search_files(self, team_id, data): """Search files in a team team_id: Team GUID terms: The search terms as inputed by the user. To search for files from a user include ``from:someusername``, using a user's username. To search in a specific channel include ``in:somechannel``, using the channel name (not the display name). To search for specific extensions included ``ext:extension``. is_or_search: Set to true if an Or search should be performed vs an And search. time_zone_offset: Offset from UTC of user timezone for date searches. include_deleted_channels: Set to true if deleted channels should be included in the search. (archived channels) page: The page to select. (Only works with Elasticsearch) per_page: The number of posts per page. (Only works with Elasticsearch) `Read in Mattermost API docs (files - SearchFiles) <https://api.mattermost.com/#tag/files/operation/SearchFiles>`_ """ return self.client.post(f"/api/v4/teams/{team_id}/files/search", data=data)