searchFilesWithHttpInfo method

Future<Response> searchFilesWithHttpInfo(
  1. String teamId,
  2. String terms,
  3. bool isOrSearch, {
  4. int? timeZoneOffset,
  5. bool? includeDeletedChannels,
  6. int? page,
  7. int? perPage,
})

Search files in a team

Search for files in a team based on file name, extention and file content (if file content extraction is enabled and supported for the files). Minimum server version: 5.34 ##### Permissions Must be authenticated and have the view_team permission.

Note: This method returns the HTTP Response.

Parameters:

  • String teamId (required): Team GUID

  • String terms (required): The search terms as inputed by the user. To search for files from a user include from:someusername, using a user's username. To search in a specific channel include in:somechannel, using the channel name (not the display name). To search for specific extensions included ext:extension.

  • bool isOrSearch (required): Set to true if an Or search should be performed vs an And search.

  • int timeZoneOffset: Offset from UTC of user timezone for date searches.

  • bool includeDeletedChannels: Set to true if deleted channels should be included in the search. (archived channels)

  • int page: The page to select. (Only works with Elasticsearch)

  • int perPage: The number of posts per page. (Only works with Elasticsearch)

Implementation

Future<Response> searchFilesWithHttpInfo(
  String teamId,
  String terms,
  bool isOrSearch, {
  int? timeZoneOffset,
  bool? includeDeletedChannels,
  int? page,
  int? perPage,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/teams/{team_id}/files/search'.replaceAll('{team_id}', teamId);

  // ignore: prefer_final_locals
  Object? postBody;

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

  const contentTypes = <String>['multipart/form-data'];

  bool hasFields = false;
  final mp = MultipartRequest('POST', Uri.parse(path));
  if (terms != null) {
    hasFields = true;
    mp.fields[r'terms'] = parameterToString(terms);
  }
  if (isOrSearch != null) {
    hasFields = true;
    mp.fields[r'is_or_search'] = parameterToString(isOrSearch);
  }
  if (timeZoneOffset != null) {
    hasFields = true;
    mp.fields[r'time_zone_offset'] = parameterToString(timeZoneOffset);
  }
  if (includeDeletedChannels != null) {
    hasFields = true;
    mp.fields[r'include_deleted_channels'] = parameterToString(includeDeletedChannels);
  }
  if (page != null) {
    hasFields = true;
    mp.fields[r'page'] = parameterToString(page);
  }
  if (perPage != null) {
    hasFields = true;
    mp.fields[r'per_page'] = parameterToString(perPage);
  }
  if (hasFields) {
    postBody = mp;
  }

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