autocompleteUsers method

Future<MmUserAutocomplete?> autocompleteUsers(
  1. String name, {
  2. String? teamId,
  3. String? channelId,
  4. int? limit,
})

Autocomplete users

Get a list of users for the purpose of autocompleting based on the provided search term. Specify a combination of team_id and channel_id to filter results further. ##### Permissions Requires an active session and view_team and read_channel on any teams or channels used to filter the results further.

Parameters:

  • String name (required): Username, nickname first name or last name

  • String teamId: Team ID

  • String channelId: Channel ID

  • int limit: The maximum number of users to return in each subresult Available as of server version 5.6. Defaults to 100 if not provided or on an earlier server version.

Implementation

Future<MmUserAutocomplete?> autocompleteUsers(
  String name, {
  String? teamId,
  String? channelId,
  int? limit,
}) async {
  final response = await autocompleteUsersWithHttpInfo(
    name,
    teamId: teamId,
    channelId: channelId,
    limit: limit,
  );
  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),
      'MmUserAutocomplete',
    ) as MmUserAutocomplete;
  }
  return null;
}