コード例 #1
0
 /// <summary>
 /// Gets recent messages in a group chat with the specified name.
 /// </summary>
 /// <param name="groupName">Group chat name.</param>
 /// <param name="count">Number of messages to get.</param>
 /// <returns>Chat messages.</returns>
 /// <remarks>Catches <see cref="HttpRequestException"/> and <see cref="System.Text.Json.JsonException"/> instances, throws <see cref="RocketChatApiException"/> instead.</remarks>
 private async Task <MessageDto[]> GetRecentMessagesInGroupAsync(string groupName, int count)
 {
     try
     {
         return(await _restApiClient.GetRecentMessagesInGroupAsync(groupName, count).ConfigureAwait(false));
     }
     catch (HttpRequestException ex)
     {
         throw new RocketChatApiException(ex);
     }
     catch (JsonException ex)
     {
         throw new RocketChatApiException(ex);
     }
 }
コード例 #2
0
        public async Task GetRecentMessagesInGroupAsync_ShouldReturnLastMessages()
        {
            var message = await _client.GetRecentMessagesInGroupAsync(_groupChatName, 10).ConfigureAwait(false);

            Assert.NotNull(message);
        }