searchAllChannels method

Future<MmSearchAllChannels200Response?> searchAllChannels(
  1. MmSearchAllChannelsRequest mmSearchAllChannelsRequest, {
  2. bool? systemConsole,
})

Search all private and open type channels across all teams

Returns all private and open type channels where 'term' matches on the name, display name, or purpose of the channel. Configured 'default' channels (ex Town Square and Off-Topic) can be excluded from the results with the exclude_default_channels boolean parameter. Channels that are associated (via GroupChannel records) to a given group can be excluded from the results with the not_associated_to_group parameter and a group id string.

Parameters:

  • MmSearchAllChannelsRequest mmSearchAllChannelsRequest (required): The search terms and logic to use in the search.

  • bool systemConsole: Is the request from system_console. If this is set to true, it filters channels by the logged in user.

Implementation

Future<MmSearchAllChannels200Response?> searchAllChannels(
  MmSearchAllChannelsRequest mmSearchAllChannelsRequest, {
  bool? systemConsole,
}) async {
  final response = await searchAllChannelsWithHttpInfo(
    mmSearchAllChannelsRequest,
    systemConsole: systemConsole,
  );
  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),
      'MmSearchAllChannels200Response',
    ) as MmSearchAllChannels200Response;
  }
  return null;
}