autocompleteUsersWithHttpInfo method

Future<Response> autocompleteUsersWithHttpInfo(
  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.

Note: This method returns the HTTP Response.

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<Response> autocompleteUsersWithHttpInfo(
  String name, {
  String? teamId,
  String? channelId,
  int? limit,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/users/autocomplete';

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <MmQueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (teamId != null) {
    queryParams.addAll(_queryParams('', 'team_id', teamId));
  }
  if (channelId != null) {
    queryParams.addAll(_queryParams('', 'channel_id', channelId));
  }
  queryParams.addAll(_queryParams('', 'name', name));
  if (limit != null) {
    queryParams.addAll(_queryParams('', 'limit', limit));
  }

  const contentTypes = <String>[];

  return apiClient.invokeAPI(
    path,
    'GET',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}