Browse Source

feat(nextcloud): Add spreed internal signaling

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/366/head
jld3103 1 year ago
parent
commit
75325b00f2
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 660
      packages/nextcloud/lib/src/api/spreed.openapi.dart
  2. 2349
      packages/nextcloud/lib/src/api/spreed.openapi.g.dart
  3. 346
      packages/nextcloud/lib/src/api/spreed.openapi.json
  4. 342
      packages/nextcloud/lib/src/patches/spreed/internal-signaling.json
  5. 50
      packages/nextcloud/test/spreed_test.dart

660
packages/nextcloud/lib/src/api/spreed.openapi.dart

@ -12501,7 +12501,7 @@ class SignalingClient {
/// See: /// See:
/// * [sendMessagesRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. /// * [sendMessagesRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized.
Future<DynamiteResponse<SignalingSendMessagesResponseApplicationJson, void>> sendMessages({ Future<DynamiteResponse<SignalingSendMessagesResponseApplicationJson, void>> sendMessages({
required final String messages, required final ContentString<BuiltList<SignalingSendMessagesMessages>> messages,
required final String token, required final String token,
final SignalingSendMessagesApiVersion apiVersion = SignalingSendMessagesApiVersion.v3, final SignalingSendMessagesApiVersion apiVersion = SignalingSendMessagesApiVersion.v3,
final bool oCSAPIRequest = true, final bool oCSAPIRequest = true,
@ -12537,7 +12537,7 @@ class SignalingClient {
/// * [sendMessages] for an operation that returns a [DynamiteResponse] with a stable API. /// * [sendMessages] for an operation that returns a [DynamiteResponse] with a stable API.
@experimental @experimental
DynamiteRawResponse<SignalingSendMessagesResponseApplicationJson, void> sendMessagesRaw({ DynamiteRawResponse<SignalingSendMessagesResponseApplicationJson, void> sendMessagesRaw({
required final String messages, required final ContentString<BuiltList<SignalingSendMessagesMessages>> messages,
required final String token, required final String token,
final SignalingSendMessagesApiVersion apiVersion = SignalingSendMessagesApiVersion.v3, final SignalingSendMessagesApiVersion apiVersion = SignalingSendMessagesApiVersion.v3,
final bool oCSAPIRequest = true, final bool oCSAPIRequest = true,
@ -12564,7 +12564,12 @@ class SignalingClient {
} }
// coverage:ignore-end // coverage:ignore-end
queryParameters['messages'] = messages; queryParameters['messages'] = _jsonSerializers.serialize(
messages,
specifiedType: const FullType(ContentString, [
FullType(BuiltList, [FullType(SignalingSendMessagesMessages)]),
]),
);
dynamite_utils.checkPattern(token, RegExp(r'^[a-z0-9]{4,30}$'), 'token'); dynamite_utils.checkPattern(token, RegExp(r'^[a-z0-9]{4,30}$'), 'token');
pathParameters['token'] = token; pathParameters['token'] = token;
pathParameters['apiVersion'] = apiVersion.name; pathParameters['apiVersion'] = apiVersion.name;
@ -23343,26 +23348,352 @@ abstract class SignalingSession implements SignalingSessionInterface, Built<Sign
} }
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class SignalingPullMessagesResponseApplicationJson_Ocs_Data_DataInterface { abstract interface class SignalingSessionsInterface {
BuiltList<SignalingSession>? get builtListSignalingSession; String get type;
String? get string; BuiltList<SignalingSession> get data;
}
abstract class SignalingSessions
implements SignalingSessionsInterface, Built<SignalingSessions, SignalingSessionsBuilder> {
factory SignalingSessions([final void Function(SignalingSessionsBuilder)? b]) = _$SignalingSessions;
// coverage:ignore-start
const SignalingSessions._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingSessions.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
static Serializer<SignalingSessions> get serializer => _$signalingSessionsSerializer;
}
class SignalingMessageType extends EnumClass {
const SignalingMessageType._(super.name);
static const SignalingMessageType offer = _$signalingMessageTypeOffer;
static const SignalingMessageType answer = _$signalingMessageTypeAnswer;
static const SignalingMessageType candidate = _$signalingMessageTypeCandidate;
static const SignalingMessageType unshareScreen = _$signalingMessageTypeUnshareScreen;
@BuiltValueEnumConst(wireName: 'remove-candidates')
static const SignalingMessageType removeCandidates = _$signalingMessageTypeRemoveCandidates;
static const SignalingMessageType control = _$signalingMessageTypeControl;
static const SignalingMessageType forceMute = _$signalingMessageTypeForceMute;
static const SignalingMessageType mute = _$signalingMessageTypeMute;
static const SignalingMessageType unmute = _$signalingMessageTypeUnmute;
static const SignalingMessageType nickChanged = _$signalingMessageTypeNickChanged;
// coverage:ignore-start
static BuiltSet<SignalingMessageType> get values => _$signalingMessageTypeValues;
// coverage:ignore-end
static SignalingMessageType valueOf(final String name) => _$valueOfSignalingMessageType(name);
static Serializer<SignalingMessageType> get serializer => _$signalingMessageTypeSerializer;
}
class SignalingRoomType extends EnumClass {
const SignalingRoomType._(super.name);
static const SignalingRoomType video = _$signalingRoomTypeVideo;
static const SignalingRoomType screen = _$signalingRoomTypeScreen;
// coverage:ignore-start
static BuiltSet<SignalingRoomType> get values => _$signalingRoomTypeValues;
// coverage:ignore-end
static SignalingRoomType valueOf(final String name) => _$valueOfSignalingRoomType(name);
static Serializer<SignalingRoomType> get serializer => _$signalingRoomTypeSerializer;
}
class SignalingSessionDescriptionMessage_Payload_Type extends EnumClass {
const SignalingSessionDescriptionMessage_Payload_Type._(super.name);
static const SignalingSessionDescriptionMessage_Payload_Type offer =
_$signalingSessionDescriptionMessagePayloadTypeOffer;
static const SignalingSessionDescriptionMessage_Payload_Type answer =
_$signalingSessionDescriptionMessagePayloadTypeAnswer;
// coverage:ignore-start
static BuiltSet<SignalingSessionDescriptionMessage_Payload_Type> get values =>
_$signalingSessionDescriptionMessagePayloadTypeValues;
// coverage:ignore-end
static SignalingSessionDescriptionMessage_Payload_Type valueOf(final String name) =>
_$valueOfSignalingSessionDescriptionMessage_Payload_Type(name);
static Serializer<SignalingSessionDescriptionMessage_Payload_Type> get serializer =>
_$signalingSessionDescriptionMessagePayloadTypeSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class SignalingSessionDescriptionMessage_PayloadInterface {
SignalingSessionDescriptionMessage_Payload_Type get type;
String get sdp;
String get nick;
}
abstract class SignalingSessionDescriptionMessage_Payload
implements
SignalingSessionDescriptionMessage_PayloadInterface,
Built<SignalingSessionDescriptionMessage_Payload, SignalingSessionDescriptionMessage_PayloadBuilder> {
factory SignalingSessionDescriptionMessage_Payload([
final void Function(SignalingSessionDescriptionMessage_PayloadBuilder)? b,
]) = _$SignalingSessionDescriptionMessage_Payload;
// coverage:ignore-start
const SignalingSessionDescriptionMessage_Payload._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingSessionDescriptionMessage_Payload.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
static Serializer<SignalingSessionDescriptionMessage_Payload> get serializer =>
_$signalingSessionDescriptionMessagePayloadSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class SignalingSessionDescriptionMessageInterface {
String get from;
String get to;
SignalingMessageType get type;
SignalingRoomType? get roomType;
String? get sid;
SignalingSessionDescriptionMessage_Payload get payload;
}
abstract class SignalingSessionDescriptionMessage
implements
SignalingSessionDescriptionMessageInterface,
Built<SignalingSessionDescriptionMessage, SignalingSessionDescriptionMessageBuilder> {
factory SignalingSessionDescriptionMessage([final void Function(SignalingSessionDescriptionMessageBuilder)? b]) =
_$SignalingSessionDescriptionMessage;
// coverage:ignore-start
const SignalingSessionDescriptionMessage._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingSessionDescriptionMessage.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
static Serializer<SignalingSessionDescriptionMessage> get serializer =>
_$signalingSessionDescriptionMessageSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class SignalingICECandidateMessage_Payload_CandidateInterface {
int get sdpMLineIndex;
String get sdpMid;
String get candidate;
}
abstract class SignalingICECandidateMessage_Payload_Candidate
implements
SignalingICECandidateMessage_Payload_CandidateInterface,
Built<SignalingICECandidateMessage_Payload_Candidate, SignalingICECandidateMessage_Payload_CandidateBuilder> {
factory SignalingICECandidateMessage_Payload_Candidate([
final void Function(SignalingICECandidateMessage_Payload_CandidateBuilder)? b,
]) = _$SignalingICECandidateMessage_Payload_Candidate;
// coverage:ignore-start
const SignalingICECandidateMessage_Payload_Candidate._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingICECandidateMessage_Payload_Candidate.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
static Serializer<SignalingICECandidateMessage_Payload_Candidate> get serializer =>
_$signalingICECandidateMessagePayloadCandidateSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class SignalingICECandidateMessage_PayloadInterface {
SignalingICECandidateMessage_Payload_Candidate get candidate;
}
abstract class SignalingICECandidateMessage_Payload
implements
SignalingICECandidateMessage_PayloadInterface,
Built<SignalingICECandidateMessage_Payload, SignalingICECandidateMessage_PayloadBuilder> {
factory SignalingICECandidateMessage_Payload([final void Function(SignalingICECandidateMessage_PayloadBuilder)? b]) =
_$SignalingICECandidateMessage_Payload;
// coverage:ignore-start
const SignalingICECandidateMessage_Payload._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingICECandidateMessage_Payload.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
static Serializer<SignalingICECandidateMessage_Payload> get serializer =>
_$signalingICECandidateMessagePayloadSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class SignalingICECandidateMessageInterface {
String get from;
String get to;
SignalingMessageType get type;
SignalingRoomType? get roomType;
String? get sid;
SignalingICECandidateMessage_Payload get payload;
}
abstract class SignalingICECandidateMessage
implements
SignalingICECandidateMessageInterface,
Built<SignalingICECandidateMessage, SignalingICECandidateMessageBuilder> {
factory SignalingICECandidateMessage([final void Function(SignalingICECandidateMessageBuilder)? b]) =
_$SignalingICECandidateMessage;
// coverage:ignore-start
const SignalingICECandidateMessage._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingICECandidateMessage.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
static Serializer<SignalingICECandidateMessage> get serializer => _$signalingICECandidateMessageSerializer;
}
class SignalingMuteMessage_Payload_Name extends EnumClass {
const SignalingMuteMessage_Payload_Name._(super.name);
static const SignalingMuteMessage_Payload_Name audio = _$signalingMuteMessagePayloadNameAudio;
static const SignalingMuteMessage_Payload_Name video = _$signalingMuteMessagePayloadNameVideo;
// coverage:ignore-start
static BuiltSet<SignalingMuteMessage_Payload_Name> get values => _$signalingMuteMessagePayloadNameValues;
// coverage:ignore-end
static SignalingMuteMessage_Payload_Name valueOf(final String name) =>
_$valueOfSignalingMuteMessage_Payload_Name(name);
static Serializer<SignalingMuteMessage_Payload_Name> get serializer => _$signalingMuteMessagePayloadNameSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class SignalingMuteMessage_PayloadInterface {
SignalingMuteMessage_Payload_Name get name;
} }
abstract class SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data abstract class SignalingMuteMessage_Payload
implements implements
SignalingPullMessagesResponseApplicationJson_Ocs_Data_DataInterface, SignalingMuteMessage_PayloadInterface,
Built<SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data, Built<SignalingMuteMessage_Payload, SignalingMuteMessage_PayloadBuilder> {
SignalingPullMessagesResponseApplicationJson_Ocs_Data_DataBuilder> { factory SignalingMuteMessage_Payload([final void Function(SignalingMuteMessage_PayloadBuilder)? b]) =
factory SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data([ _$SignalingMuteMessage_Payload;
final void Function(SignalingPullMessagesResponseApplicationJson_Ocs_Data_DataBuilder)? b,
]) = _$SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data; // coverage:ignore-start
const SignalingMuteMessage_Payload._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingMuteMessage_Payload.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
static Serializer<SignalingMuteMessage_Payload> get serializer => _$signalingMuteMessagePayloadSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class SignalingMuteMessageInterface {
String get from;
String get to;
SignalingMessageType get type;
SignalingRoomType? get roomType;
String? get sid;
SignalingMuteMessage_Payload get payload;
}
abstract class SignalingMuteMessage
implements SignalingMuteMessageInterface, Built<SignalingMuteMessage, SignalingMuteMessageBuilder> {
factory SignalingMuteMessage([final void Function(SignalingMuteMessageBuilder)? b]) = _$SignalingMuteMessage;
// coverage:ignore-start // coverage:ignore-start
const SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data._(); const SignalingMuteMessage._();
// coverage:ignore-end // coverage:ignore-end
// coverage:ignore-start // coverage:ignore-start
factory SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data.fromJson(final Map<String, dynamic> json) => factory SignalingMuteMessage.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
static Serializer<SignalingMuteMessage> get serializer => _$signalingMuteMessageSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class SignalingMessageInterface {
SignalingSessionDescriptionMessage? get signalingSessionDescriptionMessage;
SignalingICECandidateMessage? get signalingICECandidateMessage;
SignalingMuteMessage? get signalingMuteMessage;
}
abstract class SignalingMessage implements SignalingMessageInterface, Built<SignalingMessage, SignalingMessageBuilder> {
factory SignalingMessage([final void Function(SignalingMessageBuilder)? b]) = _$SignalingMessage;
// coverage:ignore-start
const SignalingMessage._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingMessage.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!; _jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end // coverage:ignore-end
@ -23371,86 +23702,113 @@ abstract class SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data
// coverage:ignore-end // coverage:ignore-end
@BuiltValueSerializer(custom: true) @BuiltValueSerializer(custom: true)
static Serializer<SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data> get serializer => static Serializer<SignalingMessage> get serializer => _$SignalingMessageSerializer();
_$SignalingPullMessagesResponseApplicationJson_Ocs_Data_DataSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true) @BuiltValueHook(finalizeBuilder: true)
static void _validate(final SignalingPullMessagesResponseApplicationJson_Ocs_Data_DataBuilder b) { static void _validate(final SignalingMessageBuilder b) {
// When this is rebuild from another builder // When this is rebuild from another builder
if (b._data == null) { if (b._data == null) {
return; return;
} }
final match = [b._builtListSignalingSession, b._string].singleWhereOrNull((final x) => x != null); final match = [b._signalingSessionDescriptionMessage, b._signalingICECandidateMessage, b._signalingMuteMessage]
.singleWhereOrNull((final x) => x != null);
if (match == null) { if (match == null) {
throw StateError("Need exactly one of 'builtListSignalingSession', 'string' for ${b._data}"); throw StateError(
"Need exactly one of 'signalingSessionDescriptionMessage', 'signalingICECandidateMessage', 'signalingMuteMessage' for ${b._data}",
);
} }
} }
} }
class _$SignalingPullMessagesResponseApplicationJson_Ocs_Data_DataSerializer class _$SignalingMessageSerializer implements PrimitiveSerializer<SignalingMessage> {
implements PrimitiveSerializer<SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data> {
@override @override
final Iterable<Type> types = const [ final Iterable<Type> types = const [SignalingMessage, _$SignalingMessage];
SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data,
_$SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data,
];
@override @override
final String wireName = 'SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data'; final String wireName = 'SignalingMessage';
@override @override
Object serialize( Object serialize(
final Serializers serializers, final Serializers serializers,
final SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data object, { final SignalingMessage object, {
final FullType specifiedType = FullType.unspecified, final FullType specifiedType = FullType.unspecified,
}) => }) =>
object.data.value; object.data.value;
@override @override
SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data deserialize( SignalingMessage deserialize(
final Serializers serializers, final Serializers serializers,
final Object data, { final Object data, {
final FullType specifiedType = FullType.unspecified, final FullType specifiedType = FullType.unspecified,
}) { }) {
final result = SignalingPullMessagesResponseApplicationJson_Ocs_Data_DataBuilder()..data = JsonObject(data); final result = SignalingMessageBuilder()..data = JsonObject(data);
try { if (data is! Iterable) {
final value = _jsonSerializers.deserialize( throw StateError('Expected an Iterable but got ${data.runtimeType}');
data, }
specifiedType: const FullType(BuiltList, [FullType(SignalingSession)]), String? discriminator;
)! as BuiltList<SignalingSession>; final iterator = data.iterator;
result.builtListSignalingSession.replace(value); while (iterator.moveNext()) {
} catch (_) {} final key = iterator.current! as String;
try { iterator.moveNext();
final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String; final Object? value = iterator.current;
result.string = value; if (key == 'type') {
} catch (_) {} discriminator = value! as String;
break;
}
}
if (discriminator == 'SignalingSessionDescriptionMessage' ||
discriminator == 'offer' ||
discriminator == 'answer') {
try {
final value = _jsonSerializers.deserialize(
data,
specifiedType: const FullType(SignalingSessionDescriptionMessage),
)! as SignalingSessionDescriptionMessage;
result.signalingSessionDescriptionMessage.replace(value);
} catch (_) {
rethrow;
}
}
if (discriminator == 'SignalingICECandidateMessage' || discriminator == 'candidate') {
try {
final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(SignalingICECandidateMessage))!
as SignalingICECandidateMessage;
result.signalingICECandidateMessage.replace(value);
} catch (_) {
rethrow;
}
}
if (discriminator == 'SignalingMuteMessage' || discriminator == 'mute' || discriminator == 'unmute') {
try {
final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(SignalingMuteMessage))!
as SignalingMuteMessage;
result.signalingMuteMessage.replace(value);
} catch (_) {
rethrow;
}
}
return result.build(); return result.build();
} }
} }
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class SignalingPullMessagesResponseApplicationJson_Ocs_DataInterface { abstract interface class SignalingMessageWrapperInterface {
String get type; String get type;
SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data get data; ContentString<SignalingMessage> get data;
} }
abstract class SignalingPullMessagesResponseApplicationJson_Ocs_Data abstract class SignalingMessageWrapper
implements implements SignalingMessageWrapperInterface, Built<SignalingMessageWrapper, SignalingMessageWrapperBuilder> {
SignalingPullMessagesResponseApplicationJson_Ocs_DataInterface, factory SignalingMessageWrapper([final void Function(SignalingMessageWrapperBuilder)? b]) = _$SignalingMessageWrapper;
Built<SignalingPullMessagesResponseApplicationJson_Ocs_Data,
SignalingPullMessagesResponseApplicationJson_Ocs_DataBuilder> {
factory SignalingPullMessagesResponseApplicationJson_Ocs_Data([
final void Function(SignalingPullMessagesResponseApplicationJson_Ocs_DataBuilder)? b,
]) = _$SignalingPullMessagesResponseApplicationJson_Ocs_Data;
// coverage:ignore-start // coverage:ignore-start
const SignalingPullMessagesResponseApplicationJson_Ocs_Data._(); const SignalingMessageWrapper._();
// coverage:ignore-end // coverage:ignore-end
// coverage:ignore-start // coverage:ignore-start
factory SignalingPullMessagesResponseApplicationJson_Ocs_Data.fromJson(final Map<String, dynamic> json) => factory SignalingMessageWrapper.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!; _jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end // coverage:ignore-end
@ -23458,14 +23816,111 @@ abstract class SignalingPullMessagesResponseApplicationJson_Ocs_Data
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end // coverage:ignore-end
static Serializer<SignalingPullMessagesResponseApplicationJson_Ocs_Data> get serializer => static Serializer<SignalingMessageWrapper> get serializer => _$signalingMessageWrapperSerializer;
_$signalingPullMessagesResponseApplicationJsonOcsDataSerializer; }
@BuiltValue(instantiable: false)
abstract interface class SignalingDataInterface {
SignalingSessions? get signalingSessions;
SignalingMessageWrapper? get signalingMessageWrapper;
}
abstract class SignalingData implements SignalingDataInterface, Built<SignalingData, SignalingDataBuilder> {
factory SignalingData([final void Function(SignalingDataBuilder)? b]) = _$SignalingData;
// coverage:ignore-start
const SignalingData._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingData.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
@BuiltValueSerializer(custom: true)
static Serializer<SignalingData> get serializer => _$SignalingDataSerializer();
JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final SignalingDataBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._signalingSessions, b._signalingMessageWrapper].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of 'signalingSessions', 'signalingMessageWrapper' for ${b._data}");
}
}
}
class _$SignalingDataSerializer implements PrimitiveSerializer<SignalingData> {
@override
final Iterable<Type> types = const [SignalingData, _$SignalingData];
@override
final String wireName = 'SignalingData';
@override
Object serialize(
final Serializers serializers,
final SignalingData object, {
final FullType specifiedType = FullType.unspecified,
}) =>
object.data.value;
@override
SignalingData deserialize(
final Serializers serializers,
final Object data, {
final FullType specifiedType = FullType.unspecified,
}) {
final result = SignalingDataBuilder()..data = JsonObject(data);
if (data is! Iterable) {
throw StateError('Expected an Iterable but got ${data.runtimeType}');
}
String? discriminator;
final iterator = data.iterator;
while (iterator.moveNext()) {
final key = iterator.current! as String;
iterator.moveNext();
final Object? value = iterator.current;
if (key == 'type') {
discriminator = value! as String;
break;
}
}
if (discriminator == 'SignalingSessions' || discriminator == 'usersInRoom') {
try {
final value =
_jsonSerializers.deserialize(data, specifiedType: const FullType(SignalingSessions))! as SignalingSessions;
result.signalingSessions.replace(value);
} catch (_) {
rethrow;
}
}
if (discriminator == 'SignalingMessageWrapper' || discriminator == 'message') {
try {
final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(SignalingMessageWrapper))!
as SignalingMessageWrapper;
result.signalingMessageWrapper.replace(value);
} catch (_) {
rethrow;
}
}
return result.build();
}
} }
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class SignalingPullMessagesResponseApplicationJson_OcsInterface { abstract interface class SignalingPullMessagesResponseApplicationJson_OcsInterface {
OCSMeta get meta; OCSMeta get meta;
BuiltList<SignalingPullMessagesResponseApplicationJson_Ocs_Data> get data; BuiltList<SignalingData> get data;
} }
abstract class SignalingPullMessagesResponseApplicationJson_Ocs abstract class SignalingPullMessagesResponseApplicationJson_Ocs
@ -23524,6 +23979,39 @@ abstract class SignalingPullMessagesResponseApplicationJson
_$signalingPullMessagesResponseApplicationJsonSerializer; _$signalingPullMessagesResponseApplicationJsonSerializer;
} }
@BuiltValue(instantiable: false)
abstract interface class SignalingSendMessagesMessagesInterface {
String get ev;
ContentString<SignalingMessage> get fn;
String get sessionId;
}
abstract class SignalingSendMessagesMessages
implements
SignalingSendMessagesMessagesInterface,
Built<SignalingSendMessagesMessages, SignalingSendMessagesMessagesBuilder> {
factory SignalingSendMessagesMessages([final void Function(SignalingSendMessagesMessagesBuilder)? b]) =
_$SignalingSendMessagesMessages;
// coverage:ignore-start
const SignalingSendMessagesMessages._();
// coverage:ignore-end
// coverage:ignore-start
factory SignalingSendMessagesMessages.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end
// coverage:ignore-start
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
// coverage:ignore-end
static Serializer<SignalingSendMessagesMessages> get serializer => _$signalingSendMessagesMessagesSerializer;
@BuiltValueHook(initializeBuilder: true)
static void _defaults(final SignalingSendMessagesMessagesBuilder b) => b..ev = 'message';
}
class SignalingSendMessagesApiVersion extends EnumClass { class SignalingSendMessagesApiVersion extends EnumClass {
const SignalingSendMessagesApiVersion._(super.name); const SignalingSendMessagesApiVersion._(super.name);
@ -25511,22 +25999,60 @@ final Serializers _serializers = (Serializers().toBuilder()
SignalingPullMessagesResponseApplicationJson_Ocs.new, SignalingPullMessagesResponseApplicationJson_Ocs.new,
) )
..add(SignalingPullMessagesResponseApplicationJson_Ocs.serializer) ..add(SignalingPullMessagesResponseApplicationJson_Ocs.serializer)
..addBuilderFactory(const FullType(SignalingData), SignalingData.new)
..add(SignalingData.serializer)
..addBuilderFactory(const FullType(SignalingSessions), SignalingSessions.new)
..add(SignalingSessions.serializer)
..addBuilderFactory(const FullType(SignalingSession), SignalingSession.new)
..add(SignalingSession.serializer)
..addBuilderFactory(const FullType(BuiltList, [FullType(SignalingSession)]), ListBuilder<SignalingSession>.new)
..addBuilderFactory(const FullType(SignalingMessageWrapper), SignalingMessageWrapper.new)
..add(SignalingMessageWrapper.serializer)
..addBuilderFactory(const FullType(SignalingMessage), SignalingMessage.new)
..add(SignalingMessage.serializer)
..addBuilderFactory(const FullType(SignalingSessionDescriptionMessage), SignalingSessionDescriptionMessage.new)
..add(SignalingSessionDescriptionMessage.serializer)
..add(SignalingMessageType.serializer)
..add(SignalingRoomType.serializer)
..addBuilderFactory( ..addBuilderFactory(
const FullType(SignalingPullMessagesResponseApplicationJson_Ocs_Data), const FullType(SignalingSessionDescriptionMessage_Payload),
SignalingPullMessagesResponseApplicationJson_Ocs_Data.new, SignalingSessionDescriptionMessage_Payload.new,
) )
..add(SignalingPullMessagesResponseApplicationJson_Ocs_Data.serializer) ..add(SignalingSessionDescriptionMessage_Payload.serializer)
..add(SignalingSessionDescriptionMessage_Payload_Type.serializer)
..addBuilderFactory(const FullType(SignalingICECandidateMessage), SignalingICECandidateMessage.new)
..add(SignalingICECandidateMessage.serializer)
..addBuilderFactory( ..addBuilderFactory(
const FullType(SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data), const FullType(SignalingICECandidateMessage_Payload),
SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data.new, SignalingICECandidateMessage_Payload.new,
) )
..add(SignalingPullMessagesResponseApplicationJson_Ocs_Data_Data.serializer) ..add(SignalingICECandidateMessage_Payload.serializer)
..addBuilderFactory(const FullType(SignalingSession), SignalingSession.new) ..addBuilderFactory(
..add(SignalingSession.serializer) const FullType(SignalingICECandidateMessage_Payload_Candidate),
..addBuilderFactory(const FullType(BuiltList, [FullType(SignalingSession)]), ListBuilder<SignalingSession>.new) SignalingICECandidateMessage_Payload_Candidate.new,
)
..add(SignalingICECandidateMessage_Payload_Candidate.serializer)
..addBuilderFactory(const FullType(SignalingMuteMessage), SignalingMuteMessage.new)
..add(SignalingMuteMessage.serializer)
..addBuilderFactory(const FullType(SignalingMuteMessage_Payload), SignalingMuteMessage_Payload.new)
..add(SignalingMuteMessage_Payload.serializer)
..add(SignalingMuteMessage_Payload_Name.serializer)
..addBuilderFactory(
const FullType(ContentString, [FullType(SignalingMessage)]),
ContentString<SignalingMessage>.new,
)
..addBuilderFactory(const FullType(BuiltList, [FullType(SignalingData)]), ListBuilder<SignalingData>.new)
..addBuilderFactory(const FullType(SignalingSendMessagesMessages), SignalingSendMessagesMessages.new)
..add(SignalingSendMessagesMessages.serializer)
..addBuilderFactory( ..addBuilderFactory(
const FullType(BuiltList, [FullType(SignalingPullMessagesResponseApplicationJson_Ocs_Data)]), const FullType(BuiltList, [FullType(SignalingSendMessagesMessages)]),
ListBuilder<SignalingPullMessagesResponseApplicationJson_Ocs_Data>.new, ListBuilder<SignalingSendMessagesMessages>.new,
)
..addBuilderFactory(
const FullType(ContentString, [
FullType(BuiltList, [FullType(SignalingSendMessagesMessages)]),
]),
ContentString<BuiltList<SignalingSendMessagesMessages>>.new,
) )
..add(SignalingSendMessagesApiVersion.serializer) ..add(SignalingSendMessagesApiVersion.serializer)
..addBuilderFactory( ..addBuilderFactory(

2349
packages/nextcloud/lib/src/api/spreed.openapi.g.dart

File diff suppressed because it is too large Load Diff

346
packages/nextcloud/lib/src/api/spreed.openapi.json

@ -1213,6 +1213,248 @@
"nullable": true "nullable": true
} }
} }
},
"SignalingSessions": {
"type": "object",
"required": [
"type",
"data"
],
"properties": {
"type": {
"type": "string"
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SignalingSession"
}
}
}
},
"SignalingData": {
"discriminator": {
"propertyName": "type",
"mapping": {
"usersInRoom": "#/components/schemas/SignalingSessions",
"message": "#/components/schemas/SignalingMessageWrapper"
}
},
"oneOf": [
{
"$ref": "#/components/schemas/SignalingSessions"
},
{
"$ref": "#/components/schemas/SignalingMessageWrapper"
}
]
},
"SignalingMessageWrapper": {
"type": "object",
"required": [
"type",
"data"
],
"properties": {
"type": {
"type": "string"
},
"data": {
"type": "string",
"contentMediaType": "application/json",
"contentSchema": {
"$ref": "#/components/schemas/SignalingMessage"
}
}
}
},
"SignalingMessageType": {
"type": "string",
"enum": [
"offer",
"answer",
"candidate",
"unshareScreen",
"remove-candidates",
"control",
"forceMute",
"mute",
"unmute",
"nickChanged"
]
},
"SignalingMessage": {
"discriminator": {
"propertyName": "type",
"mapping": {
"offer": "#/components/schemas/SignalingSessionDescriptionMessage",
"answer": "#/components/schemas/SignalingSessionDescriptionMessage",
"candidate": "#/components/schemas/SignalingICECandidateMessage",
"mute": "#/components/schemas/SignalingMuteMessage",
"unmute": "#/components/schemas/SignalingMuteMessage"
}
},
"oneOf": [
{
"$ref": "#/components/schemas/SignalingSessionDescriptionMessage"
},
{
"$ref": "#/components/schemas/SignalingICECandidateMessage"
},
{
"$ref": "#/components/schemas/SignalingMuteMessage"
}
]
},
"SignalingRoomType": {
"type": "string",
"enum": [
"video",
"screen"
]
},
"SignalingSessionDescriptionMessage": {
"type": "object",
"required": [
"from",
"to",
"type",
"payload"
],
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/SignalingMessageType"
},
"roomType": {
"$ref": "#/components/schemas/SignalingRoomType"
},
"sid": {
"type": "string"
},
"payload": {
"type": "object",
"required": [
"type",
"sdp",
"nick"
],
"properties": {
"type": {
"type": "string",
"enum": [
"offer",
"answer"
]
},
"sdp": {
"type": "string"
},
"nick": {
"type": "string"
}
}
}
}
},
"SignalingICECandidateMessage": {
"type": "object",
"required": [
"from",
"to",
"type",
"payload"
],
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/SignalingMessageType"
},
"roomType": {
"$ref": "#/components/schemas/SignalingRoomType"
},
"sid": {
"type": "string"
},
"payload": {
"type": "object",
"required": [
"candidate"
],
"properties": {
"candidate": {
"type": "object",
"required": [
"sdpMLineIndex",
"sdpMid",
"candidate"
],
"properties": {
"sdpMLineIndex": {
"type": "integer"
},
"sdpMid": {
"type": "string"
},
"candidate": {
"type": "string"
}
}
}
}
}
}
},
"SignalingMuteMessage": {
"type": "object",
"required": [
"from",
"to",
"type",
"payload"
],
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/SignalingMessageType"
},
"roomType": {
"$ref": "#/components/schemas/SignalingRoomType"
},
"sid": {
"type": "string"
},
"payload": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": [
"audio",
"video"
]
}
}
}
}
} }
} }
}, },
@ -16254,8 +16496,36 @@
"in": "query", "in": "query",
"description": "JSON encoded messages", "description": "JSON encoded messages",
"required": true, "required": true,
"schema": { "content": {
"type": "string" "application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"ev",
"fn",
"sessionId"
],
"properties": {
"ev": {
"type": "string",
"default": "message"
},
"fn": {
"type": "string",
"contentMediaType": "application/json",
"contentSchema": {
"$ref": "#/components/schemas/SignalingMessage"
}
},
"sessionId": {
"type": "string"
}
}
}
}
}
} }
}, },
{ {
@ -16425,29 +16695,7 @@
"data": { "data": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object", "$ref": "#/components/schemas/SignalingData"
"required": [
"type",
"data"
],
"properties": {
"type": {
"type": "string"
},
"data": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/SignalingSession"
}
},
{
"type": "string"
}
]
}
}
} }
} }
} }
@ -16480,29 +16728,7 @@
"data": { "data": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object", "$ref": "#/components/schemas/SignalingData"
"required": [
"type",
"data"
],
"properties": {
"type": {
"type": "string"
},
"data": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/SignalingSession"
}
},
{
"type": "string"
}
]
}
}
} }
} }
} }
@ -16535,29 +16761,7 @@
"data": { "data": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object", "$ref": "#/components/schemas/SignalingData"
"required": [
"type",
"data"
],
"properties": {
"type": {
"type": "string"
},
"data": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/SignalingSession"
}
},
{
"type": "string"
}
]
}
}
} }
} }
} }

342
packages/nextcloud/lib/src/patches/spreed/internal-signaling.json

@ -0,0 +1,342 @@
[
{
"op": "replace",
"path": "/paths/~1ocs~1v2.php~1apps~1spreed~1api~1{apiVersion}~1signaling~1{token}/get/responses/200/content/application~1json/schema/properties/ocs/properties/data/items",
"value": {
"$ref": "#/components/schemas/SignalingData"
}
},
{
"op": "replace",
"path": "/paths/~1ocs~1v2.php~1apps~1spreed~1api~1{apiVersion}~1signaling~1{token}/get/responses/404/content/application~1json/schema/properties/ocs/properties/data/items",
"value": {
"$ref": "#/components/schemas/SignalingData"
}
},
{
"op": "replace",
"path": "/paths/~1ocs~1v2.php~1apps~1spreed~1api~1{apiVersion}~1signaling~1{token}/get/responses/409/content/application~1json/schema/properties/ocs/properties/data/items",
"value": {
"$ref": "#/components/schemas/SignalingData"
}
},
{
"op": "replace",
"path": "/paths/~1ocs~1v2.php~1apps~1spreed~1api~1{apiVersion}~1signaling~1{token}/post/parameters/0",
"value": {
"name": "messages",
"in": "query",
"description": "JSON encoded messages",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"required": [
"ev",
"fn",
"sessionId"
],
"properties": {
"ev": {
"type": "string",
"default": "message"
},
"fn": {
"type": "string",
"contentMediaType": "application/json",
"contentSchema": {
"$ref": "#/components/schemas/SignalingMessage"
}
},
"sessionId": {
"type": "string"
}
}
}
}
}
}
}
},
{
"op": "add",
"path": "/components/schemas/SignalingSessions",
"value": {
"type": "object",
"required": [
"type",
"data"
],
"properties": {
"type": {
"type": "string"
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SignalingSession"
}
}
}
}
},
{
"op": "add",
"path": "/components/schemas/SignalingData",
"value": {
"discriminator": {
"propertyName": "type",
"mapping": {
"usersInRoom": "#/components/schemas/SignalingSessions",
"message": "#/components/schemas/SignalingMessageWrapper"
}
},
"oneOf": [
{
"$ref": "#/components/schemas/SignalingSessions"
},
{
"$ref": "#/components/schemas/SignalingMessageWrapper"
}
]
}
},
{
"op": "add",
"path": "/components/schemas/SignalingMessageWrapper",
"value": {
"type": "object",
"required": [
"type",
"data"
],
"properties": {
"type": {
"type": "string"
},
"data": {
"type": "string",
"contentMediaType": "application/json",
"contentSchema": {
"$ref": "#/components/schemas/SignalingMessage"
}
}
}
}
},
{
"op": "add",
"path": "/components/schemas/SignalingMessageType",
"value": {
"type": "string",
"enum": [
"offer",
"answer",
"candidate",
"unshareScreen",
"remove-candidates",
"control",
"forceMute",
"mute",
"unmute",
"nickChanged"
]
}
},
{
"op": "add",
"path": "/components/schemas/SignalingMessage",
"value": {
"discriminator": {
"propertyName": "type",
"mapping": {
"offer": "#/components/schemas/SignalingSessionDescriptionMessage",
"answer": "#/components/schemas/SignalingSessionDescriptionMessage",
"candidate": "#/components/schemas/SignalingICECandidateMessage",
"mute": "#/components/schemas/SignalingMuteMessage",
"unmute": "#/components/schemas/SignalingMuteMessage"
}
},
"oneOf": [
{
"$ref": "#/components/schemas/SignalingSessionDescriptionMessage"
},
{
"$ref": "#/components/schemas/SignalingICECandidateMessage"
},
{
"$ref": "#/components/schemas/SignalingMuteMessage"
}
]
}
},
{
"op": "add",
"path": "/components/schemas/SignalingRoomType",
"value": {
"type": "string",
"enum": [
"video",
"screen"
]
}
},
{
"op": "add",
"path": "/components/schemas/SignalingSessionDescriptionMessage",
"value": {
"type": "object",
"required": [
"from",
"to",
"type",
"payload"
],
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/SignalingMessageType"
},
"roomType": {
"$ref": "#/components/schemas/SignalingRoomType"
},
"sid": {
"type": "string"
},
"payload": {
"type": "object",
"required": [
"type",
"sdp",
"nick"
],
"properties": {
"type": {
"type": "string",
"enum": [
"offer",
"answer"
]
},
"sdp": {
"type": "string"
},
"nick": {
"type": "string"
}
}
}
}
}
},
{
"op": "add",
"path": "/components/schemas/SignalingICECandidateMessage",
"value": {
"type": "object",
"required": [
"from",
"to",
"type",
"payload"
],
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/SignalingMessageType"
},
"roomType": {
"$ref": "#/components/schemas/SignalingRoomType"
},
"sid": {
"type": "string"
},
"payload": {
"type": "object",
"required": [
"candidate"
],
"properties": {
"candidate": {
"type": "object",
"required": [
"sdpMLineIndex",
"sdpMid",
"candidate"
],
"properties": {
"sdpMLineIndex": {
"type": "integer"
},
"sdpMid": {
"type": "string"
},
"candidate": {
"type": "string"
}
}
}
}
}
}
}
},
{
"op": "add",
"path": "/components/schemas/SignalingMuteMessage",
"value": {
"type": "object",
"required": [
"from",
"to",
"type",
"payload"
],
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/SignalingMessageType"
},
"roomType": {
"$ref": "#/components/schemas/SignalingRoomType"
},
"sid": {
"type": "string"
},
"payload": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": [
"audio",
"video"
]
}
}
}
}
}
}
]

50
packages/nextcloud/test/spreed_test.dart

@ -1,8 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'package:built_collection/built_collection.dart';
import 'package:built_value/json_object.dart'; import 'package:built_value/json_object.dart';
import 'package:nextcloud/core.dart' as core; import 'package:nextcloud/core.dart' as core;
import 'package:nextcloud/nextcloud.dart';
import 'package:nextcloud/spreed.dart' as spreed; import 'package:nextcloud/spreed.dart' as spreed;
import 'package:test/test.dart'; import 'package:test/test.dart';
@ -385,29 +386,46 @@ void main() {
final room2 = (await client2.spreed.room.joinRoom(token: room.token)).body.ocs.data; final room2 = (await client2.spreed.room.joinRoom(token: room.token)).body.ocs.data;
await client2.spreed.call.joinCall(token: room.token); await client2.spreed.call.joinCall(token: room.token);
final muteMessage = spreed.SignalingMuteMessage(
(final b) => b
..from = room1.sessionId
..to = room2.sessionId
..type = spreed.SignalingMessageType.mute
..payload.update(
(final b) => b..name = spreed.SignalingMuteMessage_Payload_Name.audio,
),
);
final message = spreed.SignalingMessage(
(final b) => b
..data = JsonObject(muteMessage.toJson())
..signalingMuteMessage = muteMessage.toBuilder(),
);
await client1.spreed.signaling.sendMessages( await client1.spreed.signaling.sendMessages(
token: room.token, token: room.token,
messages: json.encode([ messages: ContentString(
{ (final b) => b
'ev': 'message', ..content = BuiltList([
'sessionId': room1.sessionId, spreed.SignalingSendMessagesMessages(
'fn': json.encode({ (final b) => b
'to': room2.sessionId, ..sessionId = room1.sessionId
}), ..fn = ContentString<spreed.SignalingMessage>(
}, (final b) => b..content = message,
]), ).toBuilder(),
),
]),
),
); );
await Future<void>.delayed(const Duration(seconds: 1)); await Future<void>.delayed(const Duration(seconds: 1));
final messages = (await client2.spreed.signaling.pullMessages(token: room.token)).body.ocs.data; final messages = (await client2.spreed.signaling.pullMessages(token: room.token)).body.ocs.data;
expect(messages, hasLength(2)); expect(messages, hasLength(2));
expect(messages[0].type, 'message'); expect(messages[0].signalingMessageWrapper!.type, 'message');
expect(json.decode(messages[0].data.string!), {'to': room2.sessionId, 'from': room1.sessionId}); expect(messages[0].signalingMessageWrapper!.data.content, {'to': room2.sessionId, 'from': room1.sessionId});
expect(messages[1].type, 'usersInRoom'); expect(messages[1].signalingSessions!.type, 'usersInRoom');
expect(messages[1].data.builtListSignalingSession, hasLength(2)); expect(messages[1].signalingSessions!.data, hasLength(2));
expect(messages[1].data.builtListSignalingSession![0].userId, 'user1'); expect(messages[1].signalingSessions!.data[0].userId, 'user1');
expect(messages[1].data.builtListSignalingSession![1].userId, 'user2'); expect(messages[1].signalingSessions!.data[1].userId, 'user2');
}); });
}); });
}, },

Loading…
Cancel
Save