joinCallRaw method

  1. @experimental
DynamiteRawResponse<CallJoinCallResponseApplicationJson, void> joinCallRaw({
  1. required String token,
  2. CallJoinCallFlags? flags,
  3. CallJoinCallForcePermissions? forcePermissions,
  4. int? silent,
  5. int? recordingConsent,
  6. CallJoinCallApiVersion? apiVersion,
  7. bool? oCSAPIRequest,
})

Join a call.

This method and the response it returns is experimental. The API might change without a major version bump.

Returns a Future containing a DynamiteRawResponse with the raw HttpClientResponse and serialization helpers. Throws a DynamiteApiException if the API call does not return an expected status code.

Parameters:

  • flags In-Call flags.
  • forcePermissions In-call permissions.
  • silent Join the call silently. Defaults to 0.
  • recordingConsent When the user ticked a checkbox and agreed with being recorded (Only needed when the config => call => recording-consent capability is set to {@see RecordingService::CONSENT_REQUIRED_YES} or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL} and the conversation recordingConsent value is {@see RecordingService::CONSENT_REQUIRED_YES} ). Defaults to 0.
  • apiVersion Defaults to v4.
  • token
  • oCSAPIRequest Required to be true for the API request to pass. Defaults to true.

Status codes:

  • 200: Call joined successfully
  • 404: Call not found
  • 400: No recording consent was given

See:

Implementation

@experimental
DynamiteRawResponse<CallJoinCallResponseApplicationJson, void> joinCallRaw({
  required String token,
  CallJoinCallFlags? flags,
  CallJoinCallForcePermissions? forcePermissions,
  int? silent,
  int? recordingConsent,
  CallJoinCallApiVersion? apiVersion,
  bool? oCSAPIRequest,
}) {
  final _parameters = <String, dynamic>{};
  final _headers = <String, String>{
    'Accept': 'application/json',
  };

// coverage:ignore-start
  final authentication = _rootClient.authentications.firstWhereOrNull(
    (auth) => switch (auth) {
      DynamiteHttpBearerAuthentication() || DynamiteHttpBasicAuthentication() => true,
      _ => false,
    },
  );

  if (authentication != null) {
    _headers.addAll(
      authentication.headers,
    );
  }

// coverage:ignore-end
  final $token = jsonSerializers.serialize(token, specifiedType: const FullType(String));
  dynamite_utils.checkPattern($token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token');
  _parameters['token'] = $token;

  final $flags = jsonSerializers.serialize(flags, specifiedType: const FullType(CallJoinCallFlags));
  _parameters['flags'] = $flags;

  final $forcePermissions =
      jsonSerializers.serialize(forcePermissions, specifiedType: const FullType(CallJoinCallForcePermissions));
  _parameters['forcePermissions'] = $forcePermissions;

  var $silent = jsonSerializers.serialize(silent, specifiedType: const FullType(int));
  $silent ??= 0;
  _parameters['silent'] = $silent;

  var $recordingConsent = jsonSerializers.serialize(recordingConsent, specifiedType: const FullType(int));
  $recordingConsent ??= 0;
  _parameters['recordingConsent'] = $recordingConsent;

  var $apiVersion = jsonSerializers.serialize(apiVersion, specifiedType: const FullType(CallJoinCallApiVersion));
  $apiVersion ??= 'v4';
  _parameters['apiVersion'] = $apiVersion;

  var $oCSAPIRequest = jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool));
  $oCSAPIRequest ??= true;
  _headers['OCS-APIRequest'] = const dynamite_utils.HeaderEncoder().convert($oCSAPIRequest);

  final _path = UriTemplate(
    '/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}{?flags*,forcePermissions*,silent*,recordingConsent*}',
  ).expand(_parameters);
  return DynamiteRawResponse<CallJoinCallResponseApplicationJson, void>(
    response: _rootClient.executeRequest(
      'post',
      _path,
      _headers,
      null,
      const {200, 404},
    ),
    bodyType: const FullType(CallJoinCallResponseApplicationJson),
    headersType: null,
    serializers: jsonSerializers,
  );
}