viewChannel method
Future<MmViewChannel200Response?>
viewChannel(
- String userId,
- MmViewChannelRequest mmViewChannelRequest
View channel
Perform all the actions involved in viewing a channel. This includes marking channels as read, clearing push notifications, and updating the active channel. ##### Permissions Must be logged in as user or have edit_other_users
permission. Response only includes last_viewed_at_times
in Mattermost server 4.3 and newer.
Parameters:
-
String userId (required): User ID to perform the view action for
-
MmViewChannelRequest mmViewChannelRequest (required): Paremeters affecting how and which channels to view
Implementation
Future<MmViewChannel200Response?> viewChannel(
String userId,
MmViewChannelRequest mmViewChannelRequest,
) async {
final response = await viewChannelWithHttpInfo(
userId,
mmViewChannelRequest,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw MmApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'MmViewChannel200Response',
) as MmViewChannel200Response;
}
return null;
}