Skip to content

mattermost IMattermostClient

BigMakCode edited this page Aug 5, 2024 · 1 revision

IMattermostClient Public interface

Description

Mattermost client interface.

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph Mattermost
  Mattermost.IMattermostClient[[IMattermostClient]]
  class Mattermost.IMattermostClient interfaceStyle;
  end
Loading

Members

Properties

Public properties

Type Name Methods
User CurrentUserInfo
Bot user information.
get
Uri ServerAddress
Base server address.
get

Methods

Public methods

Returns Name
Task<ChannelUserInfo> AddUserToChannelAsync(string channelId, string userId)
Add user to channel.
Task<bool> ArchiveChannelAsync(string channelId)
Archive channel by specified channel identifier.
Task<Channel> CreateChannelAsync(string teamId, string name, string displayName, ChannelType channelType, string purpose, string header)
Create simple channel with specified users.
Task<Channel> CreateGroupChannelAsync(string``[] userIds)
Create group channel with specified users.
Task<bool> DeletePostAsync(string postId)
Delete post with specified post identifier.
Task<bool> DeleteUserFromChannelAsync(string channelId, string userId)
Delete user from channel.
Task<Channel> FindChannelByName(string teamId, string channelName)
Find channel by channel name and team identifier.
Task<byte``[]> GetFileAsync(string fileId)
Get file by identifier.
Task<FileDetails> GetFileDetailsAsync(string fileId)
Get file details by specified identifier.
Task<Post> GetPostAsync(string postId)
Get post by identifier.
Task<User> GetUserAsync(string userId)
Get user by identifier.
Task<User> GetUserByUsernameAsync(string username)
Get user by username.
Task<Post> SendMessageAsync(string channelId, string message, string replyToPostId, MessagePriority priority, IEnumerable<string> files)
Task<bool> SetChannelCallStateAsync(string channelId, bool isCallsEnabled)
Set call state for channel identifier.
Task StartReceivingAsync(...)
Create receiver Task with websocket polling.
Task<Post> UpdatePostAsync(string postId, string newText)
Update message text for specified post identifier.
Task<FileDetails> UploadFileAsync(string channelId, string filePath, Action<int> progressChanged)

Details

Summary

Mattermost client interface.

Methods

StartReceivingAsync [1/2]

public Task StartReceivingAsync()
Summary

Create receiver Task with websocket polling.

Returns

Receiver task.

StartReceivingAsync [2/2]

public Task StartReceivingAsync(CancellationToken cancellationToken)
Arguments
Type Name Description
CancellationToken cancellationToken
Summary

Create receiver Task with websocket polling.

Returns

Receiver task.

SendMessageAsync

public Task<Post> SendMessageAsync(string channelId, string message, string replyToPostId, MessagePriority priority, IEnumerable<string> files)
Arguments
Type Name Description
string channelId
string message
string replyToPostId
MessagePriority priority
IEnumerable<string> files

UpdatePostAsync

public Task<Post> UpdatePostAsync(string postId, string newText)
Arguments
Type Name Description
string postId Post identifier.
string newText New message text (Markdown supported).
Summary

Update message text for specified post identifier.

Returns

Updated post.

DeletePostAsync

public Task<bool> DeletePostAsync(string postId)
Arguments
Type Name Description
string postId Post identifier.
Summary

Delete post with specified post identifier.

Returns

True if deleted, otherwise false.

CreateGroupChannelAsync

public Task<Channel> CreateGroupChannelAsync(string[] userIds)
Arguments
Type Name Description
string``[] userIds Participant users.
Summary

Create group channel with specified users.

Returns

Created channel info.

CreateChannelAsync

public Task<Channel> CreateChannelAsync(string teamId, string name, string displayName, ChannelType channelType, string purpose, string header)
Arguments
Type Name Description
string teamId Team identifier.
string name Channel name.
string displayName Channel display name.
ChannelType channelType Channel type: open or private.
string purpose Channel purpose (optional).
string header Channel header (optional).
Summary

Create simple channel with specified users.

Returns

Created channel info.

GetUserAsync

public Task<User> GetUserAsync(string userId)
Arguments
Type Name Description
string userId User identifier.
Summary

Get user by identifier.

Returns

User information.

AddUserToChannelAsync

public Task<ChannelUserInfo> AddUserToChannelAsync(string channelId, string userId)
Arguments
Type Name Description
string channelId Channel identifier.
string userId User identifier.
Summary

Add user to channel.

Returns

Channel user information.

DeleteUserFromChannelAsync

public Task<bool> DeleteUserFromChannelAsync(string channelId, string userId)
Arguments
Type Name Description
string channelId Channel identifier.
string userId User identifier.
Summary

Delete user from channel.

Returns

True if deleted, otherwise false.

GetUserByUsernameAsync

public Task<User> GetUserByUsernameAsync(string username)
Arguments
Type Name Description
string username Username.
Summary

Get user by username.

Returns

User information.

UploadFileAsync

public Task<FileDetails> UploadFileAsync(string channelId, string filePath, Action<int> progressChanged)
Arguments
Type Name Description
string channelId
string filePath
Action<int> progressChanged

GetFileDetailsAsync

public Task<FileDetails> GetFileDetailsAsync(string fileId)
Arguments
Type Name Description
string fileId File identifier.
Summary

Get file details by specified identifier.

Returns

File details.

FindChannelByName

public Task<Channel> FindChannelByName(string teamId, string channelName)
Arguments
Type Name Description
string teamId Team identifier where channel is exists.
string channelName Channel name.
Summary

Find channel by channel name and team identifier.

Returns

Channel info.

SetChannelCallStateAsync

public Task<bool> SetChannelCallStateAsync(string channelId, bool isCallsEnabled)
Arguments
Type Name Description
string channelId Channel identifier where calls must be in specified state.
bool isCallsEnabled New state.
Summary

Set call state for channel identifier.

Returns

True if calls state setted, otherwise false.

ArchiveChannelAsync

public Task<bool> ArchiveChannelAsync(string channelId)
Arguments
Type Name Description
string channelId Channel identifier.
Summary

Archive channel by specified channel identifier.

Returns

True if archieved, otherwise false.

GetPostAsync

public Task<Post> GetPostAsync(string postId)
Arguments
Type Name Description
string postId Post identifier.
Summary

Get post by identifier.

Returns

Post information.

GetFileAsync

public Task<byte> GetFileAsync(string fileId)
Arguments
Type Name Description
string fileId File identifier.
Summary

Get file by identifier.

Returns

File bytes.

Properties

CurrentUserInfo

public User CurrentUserInfo { get; }
Summary

Bot user information.

ServerAddress

public Uri ServerAddress { get; }
Summary

Base server address.

Events

OnMessageReceived

public event EventHandler<MessageEventArgs> OnMessageReceived
Summary

Event called in independent thread when new message received.

OnLogMessage

public event EventHandler<LogEventArgs> OnLogMessage
Summary

Event callen in independent thread when log message created.

Generated with ModularDoc

Clone this wiki locally