createGroup method

Future<GroupDto?> createGroup(
  1. String id,
  2. String name,
  3. String password,
  4. DatabaseInitialisationDto databaseInitialisationDto, {
  5. String? server,
  6. int? q,
  7. int? n,
})

Create a group

Create a new group and associated dbs. The created group will be manageable by the users that belong to the same group as the one that called createGroup. Several tasks can be executed during the group creation like DB replications towards the created DBs, users creation and healthcare parties creation

Parameters:

  • String id (required): The id of the group, also used for subsequent authentication against the db (can only contain digits, letters, - and _)

  • String name (required): The name of the group

  • String password (required): The password of the group (can only contain digits, letters, - and _)

  • DatabaseInitialisationDto databaseInitialisationDto (required):

  • String server: The server on which the group dbs will be created

  • int q: The number of shards for patient and healthdata dbs : 3-8 is a recommended range of value

  • int n: The number of replications for dbs : 3 is a recommended value

Implementation

Future<GroupDto?> createGroup(String id, String name, String password, DatabaseInitialisationDto databaseInitialisationDto, { String? server, int? q, int? n, }) async {
  final response = await createGroupWithHttpInfo(id, name, password, databaseInitialisationDto,  server: server, q: q, n: n, );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException.withRequestId(response.statusCode, await _decodeBodyBytes(response), response.headers["x-request-id"], response.request?.url.toString());
  }
  // 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) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'GroupDto',) as GroupDto;

  }
  return null;
}