listUsers method

Future<ListUsersResponse<T>> listUsers({
  1. String? searchValue,
  2. String? searchField,
  3. SearchOperator? searchOperator,
  4. int? limit,
  5. int? offset,
  6. String? sortBy,
  7. String? sortDirection,
  8. String? filterField,
  9. String? filterOperator,
  10. String? filterValue,
})

List all users

searchValue The value to search for searchField The field to search in searchOperator The operator to use for the search limit The number of users to return offset The offset to start from sortBy The field to sort by sortDirection The direction to sort in filterField The field to filter by filterOperator The operator to use for the filter filterValue The value to filter by

Implementation

Future<ListUsersResponse<T>> listUsers({
  String? searchValue,
  String? searchField,
  SearchOperator? searchOperator,
  int? limit,
  int? offset,
  String? sortBy,
  String? sortDirection,
  String? filterField,
  String? filterOperator,
  String? filterValue,
}) async {
  try {
    final response = await super.dio.get(
      "/admin/list-users",
      data: {
        "searchValue": searchValue,
        "searchField": searchField,
        "searchOperator": searchOperator?.value,
        "limit": limit,
        "offset": offset,
        "sortBy": sortBy,
        "sortDirection": sortDirection,
        "filterField": filterField,
        "filterOperator": filterOperator,
        "filterValue": filterValue,
      }..removeWhere((key, value) => value == null),
      options: await super.getOptions(isTokenRequired: true),
    );
    return ListUsersResponse<T>.fromJson(response.data, super.fromJsonUser);
  } catch (e) {
    final message = getErrorMessage(e);
    if (message == null) rethrow;
    throw message;
  }
}