batchCreateUser method

Future<BatchCreateUserResponse> batchCreateUser({
  1. required String networkId,
  2. required List<BatchCreateUserRequestItem> users,
  3. String? clientToken,
})

Creates multiple users in a specified Wickr network. This operation allows you to provision multiple user accounts simultaneously, optionally specifying security groups, and validation requirements for each user.

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 created.

Parameter users : A list of user objects containing the details for each user to be created, including username, name, security groups, and optional invite codes. Maximum 50 users per batch request.

Parameter clientToken : A unique identifier for this request to ensure idempotency. If you retry a request with the same client token, the service will return the same response without creating duplicate users.

Implementation

Future<BatchCreateUserResponse> batchCreateUser({
  required String networkId,
  required List<BatchCreateUserRequestItem> users,
  String? clientToken,
}) async {
  final headers = <String, String>{
    if (clientToken != null) 'X-Client-Token': clientToken.toString(),
  };
  final $payload = <String, dynamic>{
    'users': users,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/networks/${Uri.encodeComponent(networkId)}/users',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return BatchCreateUserResponse.fromJson(response);
}