getBots method

Future<List<MmBot>?> getBots({
  1. int? page,
  2. int? perPage,
  3. bool? includeDeleted,
  4. bool? onlyOrphaned,
})

Get bots

Get a page of a list of bots. ##### Permissions Must have read_bots permission for bots you are managing, and read_others_bots permission for bots others are managing. Minimum server version: 5.10

Parameters:

  • int page: The page to select.

  • int perPage: The number of users per page. There is a maximum limit of 200 users per page.

  • bool includeDeleted: If deleted bots should be returned.

  • bool onlyOrphaned: When true, only orphaned bots will be returned. A bot is consitered orphaned if it's owner has been deactivated.

Implementation

Future<List<MmBot>?> getBots({
  int? page,
  int? perPage,
  bool? includeDeleted,
  bool? onlyOrphaned,
}) async {
  final response = await getBotsWithHttpInfo(
    page: page,
    perPage: perPage,
    includeDeleted: includeDeleted,
    onlyOrphaned: onlyOrphaned,
  );
  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) {
    final responseBody = await _decodeBodyBytes(response);
    return (await apiClient.deserializeAsync(responseBody, 'List<MmBot>') as List).cast<MmBot>().toList();
  }
  return null;
}