-
-
Notifications
You must be signed in to change notification settings - Fork 9
mattermost MattermostClient
.NET API client for Mattermost servers with websocket polling.
flowchart LR
classDef interfaceStyle stroke-dasharray: 5 5;
classDef abstractStyle stroke-width:4px
subgraph Mattermost
Mattermost.MattermostClient[[MattermostClient]]
Mattermost.IMattermostClient[[IMattermostClient]]
class Mattermost.IMattermostClient interfaceStyle;
end
Mattermost.IMattermostClient --> Mattermost.MattermostClient
| Type | Name | Methods |
|---|---|---|
User |
CurrentUserInfoBot user information. |
get |
Uri |
ServerAddressBase server address. |
get |
| 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) |
.NET API client for Mattermost servers with websocket polling.
public MattermostClient(string apiToken)| Type | Name | Description |
|---|---|---|
string |
apiToken | JWT API token. |
Create MattermostClient with specified JWT access token.
| Name | Description |
|---|---|
| ArgumentException |
public MattermostClient(string serverUrl, string apiToken)| Type | Name | Description |
|---|---|---|
string |
serverUrl | Server URL with HTTP(S) scheme. |
string |
apiToken | JWT API token. |
Create MattermostClient with specified server address JWT access token.
| Name | Description |
|---|---|
| ArgumentException |
public MattermostClient(Uri serverUri, string apiToken)| Type | Name | Description |
|---|---|---|
Uri |
serverUri | Server URI with HTTP(S) scheme. |
string |
apiToken | JWT API token. |
Create MattermostClient with specified server address JWT access token.
| Name | Description |
|---|---|
| ArgumentException |
public virtual Task StartReceivingAsync()Create receiver Task with websocket polling.
Receiver task.
| Name | Description |
|---|---|
| ApiKeyException |
public virtual async Task StartReceivingAsync(CancellationToken cancellationToken)| Type | Name | Description |
|---|---|---|
CancellationToken |
cancellationToken |
Create receiver Task with websocket polling.
Receiver task.
| Name | Description |
|---|---|
| ApiKeyException |
public virtual async Task<Post> SendMessageAsync(string channelId, string message, string replyToPostId, MessagePriority priority, IEnumerable<string> files)| Type | Name | Description |
|---|---|---|
string |
channelId | |
string |
message | |
string |
replyToPostId | |
MessagePriority |
priority | |
IEnumerable<string> |
files |
public virtual async Task<Post> UpdatePostAsync(string postId, string newText)| Type | Name | Description |
|---|---|---|
string |
postId | Post identifier. |
string |
newText | New message text (Markdown supported). |
Update message text for specified post identifier.
Updated post.
public virtual async Task<bool> DeletePostAsync(string postId)| Type | Name | Description |
|---|---|---|
string |
postId | Post identifier. |
Delete post with specified post identifier.
True if deleted, otherwise false.
public virtual async Task<Channel> CreateGroupChannelAsync(string[] userIds)| Type | Name | Description |
|---|---|---|
string``[] |
userIds | Participant users. |
Create group channel with specified users.
Created channel info.
public virtual async Task<Channel> CreateChannelAsync(string teamId, string name, string displayName, ChannelType channelType, string purpose, string header)| 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). |
Create simple channel with specified users.
Created channel info.
public virtual async Task<User> GetUserAsync(string userId)| Type | Name | Description |
|---|---|---|
string |
userId | User identifier. |
Get user by identifier.
User information.
public virtual async Task<User> GetUserByUsernameAsync(string username)| Type | Name | Description |
|---|---|---|
string |
username | Username. |
Get user by username.
User information.
public virtual async Task<ChannelUserInfo> AddUserToChannelAsync(string channelId, string userId)| Type | Name | Description |
|---|---|---|
string |
channelId | Channel identifier. |
string |
userId | User identifier. |
Add user to channel.
Channel user information.
public virtual async Task<bool> DeleteUserFromChannelAsync(string channelId, string userId)| Type | Name | Description |
|---|---|---|
string |
channelId | Channel identifier. |
string |
userId | User identifier. |
Delete user from channel.
True if deleted, otherwise false.
public virtual async Task<FileDetails> UploadFileAsync(string channelId, string filePath, Action<int> progressChanged)| Type | Name | Description |
|---|---|---|
string |
channelId | |
string |
filePath | |
Action<int> |
progressChanged |
public virtual async Task<FileDetails> GetFileDetailsAsync(string fileId)| Type | Name | Description |
|---|---|---|
string |
fileId | File identifier. |
Get file details by specified identifier.
File details.
public virtual async Task<Channel> FindChannelByName(string teamId, string channelName)| Type | Name | Description |
|---|---|---|
string |
teamId | Team identifier where channel is exists. |
string |
channelName | Channel name. |
Find channel by channel name and team identifier.
Channel info.
public virtual async Task<bool> SetChannelCallStateAsync(string channelId, bool isCallsEnabled)| Type | Name | Description |
|---|---|---|
string |
channelId | Channel identifier where calls must be in specified state. |
bool |
isCallsEnabled | New state. |
Set call state for channel identifier.
public virtual async Task<bool> ArchiveChannelAsync(string channelId)| Type | Name | Description |
|---|---|---|
string |
channelId | Channel identifier. |
Archive channel by specified channel identifier.
public virtual async Task<Post> GetPostAsync(string postId)| Type | Name | Description |
|---|---|---|
string |
postId | Post identifier. |
Get post by identifier.
Post information.
public virtual async Task<byte> GetFileAsync(string fileId)| Type | Name | Description |
|---|---|---|
string |
fileId | File identifier. |
Get file by identifier.
File bytes.
public virtual User CurrentUserInfo { get; }Bot user information.
public virtual Uri ServerAddress { get; }Base server address.
public event EventHandler<MessageEventArgs> OnMessageReceivedEvent called when new message received.
public event EventHandler<LogEventArgs> OnLogMessageEvent callen when log message created.
Generated with ModularDoc