public GetConversationAsync ( string conversationId, int page = null, int offset = null ) : Task |
||
conversationId | string | The conversation id. |
page | int | /// Page of message thread. Starting at 1 for the most recent 25 messages and counting upwards. Default: /// null /// |
offset | int | Additional offset in current page. |
Результат | Task |
public async Task<IConversation> GetConversationAsync(string conversationId, int? page = null,
int? offset = null)
{
if (string.IsNullOrWhiteSpace(conversationId))
throw new ArgumentNullException(nameof(conversationId));
if (ApiClient.OAuth2Token == null)
throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);
var url = $"conversations/{conversationId}/{page ?? 1}/{offset ?? 0}";
using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
{
var conversation = await SendRequestAsync<Conversation>(request).ConfigureAwait(false);
return conversation;
}
}
public async Task GetConversationAsync_WithOAuth2TokenNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new ConversationEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.GetConversationAsync("1234").ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }