createRoom method

Future<DynamiteResponse<RoomCreateRoomResponseApplicationJson, void>> createRoom({
  1. required int roomType,
  2. String? invite,
  3. String? roomName,
  4. String? source,
  5. String? objectType,
  6. String? objectId,
  7. RoomCreateRoomApiVersion? apiVersion,
  8. bool? oCSAPIRequest,
})

Create a room with a user, a group or a circle.

Returns a Future containing a DynamiteResponse with the status code, deserialized body and headers. Throws a DynamiteApiException if the API call does not return an expected status code.

Parameters:

  • roomType Type of the room.
  • invite User, group, … ID to invite. Defaults to "".
  • roomName Name of the room. Defaults to "".
  • source Source of the invite ID ('circles' to create a room with a circle, etc.). Defaults to "".
  • objectType Type of the object. Defaults to "".
  • objectId ID of the object. Defaults to "".
  • apiVersion Defaults to "v4".
  • oCSAPIRequest Required to be true for the API request to pass. Defaults to true.

Status codes:

  • 200: Room already existed
  • 201: Room created successfully
  • 400: Room type invalid
  • 403: Missing permissions to create room
  • 404: User, group or other target to invite was not found

See:

Implementation

Future<_i1.DynamiteResponse<RoomCreateRoomResponseApplicationJson, void>> createRoom({
  required int roomType,
  String? invite,
  String? roomName,
  String? source,
  String? objectType,
  String? objectId,
  RoomCreateRoomApiVersion? apiVersion,
  bool? oCSAPIRequest,
}) async {
  final _request = $createRoom_Request(
    roomType: roomType,
    invite: invite,
    roomName: roomName,
    source: source,
    objectType: objectType,
    objectId: objectId,
    apiVersion: apiVersion,
    oCSAPIRequest: oCSAPIRequest,
  );
  final _response = await _rootClient.httpClient.send(_request);

  final _serializer = $createRoom_Serializer();
  final _rawResponse =
      await _i1.ResponseConverter<RoomCreateRoomResponseApplicationJson, void>(_serializer).convert(_response);
  return _i1.DynamiteResponse.fromRawResponse(_rawResponse);
}