batchToggleUserSuspendStatus method

Future<BatchToggleUserSuspendStatusResponse> batchToggleUserSuspendStatus({
  1. required String networkId,
  2. required bool suspend,
  3. required List<String> userIds,
  4. String? clientToken,
})

Suspends or unsuspends multiple users in a Wickr network. Suspended users cannot access the network until they are unsuspended. This operation is useful for temporarily restricting access without deleting user accounts.

May throw BadRequestError. May throw ForbiddenError. May throw InternalServerError. May throw RateLimitError. May throw ResourceNotFoundError. May throw UnauthorizedError. May throw ValidationError.

Parameter networkId : The ID of the Wickr network where users will be suspended or unsuspended.

Parameter suspend : A boolean value indicating whether to suspend (true) or unsuspend (false) the specified users.

Parameter userIds : A list of user IDs identifying the users whose suspend status will be toggled. Maximum 50 users per batch request.

Parameter clientToken : A unique identifier for this request to ensure idempotency.

Implementation

Future<BatchToggleUserSuspendStatusResponse> batchToggleUserSuspendStatus({
  required String networkId,
  required bool suspend,
  required List<String> userIds,
  String? clientToken,
}) async {
  final headers = <String, String>{
    if (clientToken != null) 'X-Client-Token': clientToken.toString(),
  };
  final $query = <String, List<String>>{
    'suspend': [suspend.toString()],
  };
  final $payload = <String, dynamic>{
    'userIds': userIds,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/networks/${Uri.encodeComponent(networkId)}/users/toggleSuspend',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return BatchToggleUserSuspendStatusResponse.fromJson(response);
}