diff --git a/.cspell/nextcloud.txt b/.cspell/nextcloud.txt index 96907207373..ef7dd5d0f4e 100644 --- a/.cspell/nextcloud.txt +++ b/.cspell/nextcloud.txt @@ -1,3 +1,4 @@ +addressbook apirequest apppassword bigfilechunking diff --git a/packages/neon/neon_talk/lib/src/widgets/message.dart b/packages/neon/neon_talk/lib/src/widgets/message.dart index 989574d069a..7a3510f2078 100644 --- a/packages/neon/neon_talk/lib/src/widgets/message.dart +++ b/packages/neon/neon_talk/lib/src/widgets/message.dart @@ -163,40 +163,35 @@ InlineSpan buildRichObjectParameter({ required TextStyle? textStyle, required bool isPreview, }) { - Widget child; - - if (isPreview) { - child = Text( - parameter.name, - style: textStyle, - ); - } else { - switch (parameter.type) { - case 'user' || 'call' || 'guest' || 'user-group' || 'group': - child = TalkRichObjectMention( - parameter: parameter, - textStyle: textStyle, - ); - case 'file': - child = TalkRichObjectFile( - parameter: parameter, - textStyle: textStyle, - ); - case 'deck-card': - child = TalkRichObjectDeckCard( - parameter: parameter, - ); - default: - child = TalkRichObjectFallback( - parameter: parameter, - textStyle: textStyle, - ); - } - } - return WidgetSpan( alignment: PlaceholderAlignment.middle, - child: child, + child: isPreview + ? Text( + parameter.name, + style: textStyle, + ) + : switch (parameter.type) { + spreed.RichObjectParameter_Type.user || + spreed.RichObjectParameter_Type.call || + spreed.RichObjectParameter_Type.guest || + spreed.RichObjectParameter_Type.userGroup || + spreed.RichObjectParameter_Type.group => + TalkRichObjectMention( + parameter: parameter, + textStyle: textStyle, + ), + spreed.RichObjectParameter_Type.file => TalkRichObjectFile( + parameter: parameter, + textStyle: textStyle, + ), + spreed.RichObjectParameter_Type.deckCard => TalkRichObjectDeckCard( + parameter: parameter, + ), + _ => TalkRichObjectFallback( + parameter: parameter, + textStyle: textStyle, + ), + }, ); } diff --git a/packages/neon/neon_talk/lib/src/widgets/rich_object/file.dart b/packages/neon/neon_talk/lib/src/widgets/rich_object/file.dart index 2a959cd112c..ce05ad68f4d 100644 --- a/packages/neon/neon_talk/lib/src/widgets/rich_object/file.dart +++ b/packages/neon/neon_talk/lib/src/widgets/rich_object/file.dart @@ -24,7 +24,7 @@ class TalkRichObjectFile extends StatelessWidget { Widget build(BuildContext context) { Widget child; - if (parameter.previewAvailable == spreed.RichObjectParameter_PreviewAvailable.yes) { + if (parameter.previewAvailable == 'yes') { child = TalkRichObjectFilePreview( parameter: parameter, ); diff --git a/packages/neon/neon_talk/lib/src/widgets/rich_object/mention.dart b/packages/neon/neon_talk/lib/src/widgets/rich_object/mention.dart index d75699c6199..e41c9e52a4c 100644 --- a/packages/neon/neon_talk/lib/src/widgets/rich_object/mention.dart +++ b/packages/neon/neon_talk/lib/src/widgets/rich_object/mention.dart @@ -28,7 +28,7 @@ class TalkRichObjectMention extends StatelessWidget { final bool highlight; switch (parameter.type) { - case 'user': + case spreed.RichObjectParameter_Type.user: final account = NeonProvider.of(context); highlight = account.username == parameter.id; @@ -37,7 +37,7 @@ class TalkRichObjectMention extends StatelessWidget { account: NeonProvider.of(context), userStatusBloc: null, ); - case 'call': + case spreed.RichObjectParameter_Type.call: highlight = true; child = CircleAvatar( child: ClipOval( @@ -47,13 +47,13 @@ class TalkRichObjectMention extends StatelessWidget { ), ), ); - case 'guest': + case spreed.RichObjectParameter_Type.guest: // TODO: Add highlighting when the mention is about the current guest user. highlight = false; child = CircleAvatar( child: Icon(AdaptiveIcons.person), ); - case 'user-group' || 'group': + case spreed.RichObjectParameter_Type.userGroup || spreed.RichObjectParameter_Type.group: final userDetailsBloc = NeonProvider.of(context); final groups = userDetailsBloc.userDetails.valueOrNull?.data?.groups ?? BuiltList(); diff --git a/packages/neon/neon_talk/test/message_test.dart b/packages/neon/neon_talk/test/message_test.dart index 2672fbace26..bc1eb2ba8c2 100644 --- a/packages/neon/neon_talk/test/message_test.dart +++ b/packages/neon/neon_talk/test/message_test.dart @@ -1173,8 +1173,14 @@ void main() { for (final isPreview in [true, false]) { group(isPreview ? 'As preview' : 'Complete', () { group('Mention', () { - for (final type in ['user', 'call', 'guest', 'user-group', 'group']) { - testWidgets(type, (tester) async { + for (final type in [ + spreed.RichObjectParameter_Type.user, + spreed.RichObjectParameter_Type.call, + spreed.RichObjectParameter_Type.guest, + spreed.RichObjectParameter_Type.userGroup, + spreed.RichObjectParameter_Type.group, + ]) { + testWidgets(type.value, (tester) async { final userDetails = MockUserDetails(); when(() => userDetails.groups).thenReturn(BuiltList()); @@ -1221,7 +1227,7 @@ void main() { text: buildRichObjectParameter( parameter: spreed.RichObjectParameter( (b) => b - ..type = 'file' + ..type = spreed.RichObjectParameter_Type.file ..id = '' ..name = 'name', ), @@ -1243,7 +1249,7 @@ void main() { text: buildRichObjectParameter( parameter: spreed.RichObjectParameter( (b) => b - ..type = 'deck-card' + ..type = spreed.RichObjectParameter_Type.deckCard ..id = '' ..name = 'name' ..boardname = 'boardname' @@ -1267,7 +1273,7 @@ void main() { text: buildRichObjectParameter( parameter: spreed.RichObjectParameter( (b) => b - ..type = 'unknown' + ..type = spreed.RichObjectParameter_Type.addressbook ..id = '' ..name = 'name', ), @@ -1319,7 +1325,7 @@ void main() { BuiltMap({ type: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.user ..id = '' ..name = '', ), @@ -1344,7 +1350,7 @@ void main() { BuiltMap({ 'file': spreed.RichObjectParameter( (b) => b - ..type = 'file' + ..type = spreed.RichObjectParameter_Type.file ..id = '' ..name = '', ), @@ -1371,13 +1377,13 @@ void main() { BuiltMap({ 'actor1': spreed.RichObjectParameter( (b) => b - ..type = 'user' + ..type = spreed.RichObjectParameter_Type.user ..id = '' ..name = '', ), 'actor2': spreed.RichObjectParameter( (b) => b - ..type = 'user' + ..type = spreed.RichObjectParameter_Type.user ..id = '' ..name = '', ), diff --git a/packages/neon/neon_talk/test/rich_object_test.dart b/packages/neon/neon_talk/test/rich_object_test.dart index 233b2787603..f9b4f31ac85 100644 --- a/packages/neon/neon_talk/test/rich_object_test.dart +++ b/packages/neon/neon_talk/test/rich_object_test.dart @@ -50,7 +50,7 @@ void main() { child: TalkRichObjectDeckCard( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.deckCard ..id = '' ..name = 'name' ..boardname = 'boardname' @@ -82,7 +82,7 @@ void main() { child: TalkRichObjectMention( parameter: spreed.RichObjectParameter( (b) => b - ..type = 'user' + ..type = spreed.RichObjectParameter_Type.user ..id = 'username' ..name = 'name', ), @@ -107,7 +107,7 @@ void main() { child: TalkRichObjectMention( parameter: spreed.RichObjectParameter( (b) => b - ..type = 'user' + ..type = spreed.RichObjectParameter_Type.user ..id = 'other' ..name = 'name', ), @@ -133,7 +133,7 @@ void main() { child: TalkRichObjectMention( parameter: spreed.RichObjectParameter( (b) => b - ..type = 'call' + ..type = spreed.RichObjectParameter_Type.call ..id = '' ..name = 'name' ..iconUrl = '', @@ -156,7 +156,7 @@ void main() { child: TalkRichObjectMention( parameter: spreed.RichObjectParameter( (b) => b - ..type = 'guest' + ..type = spreed.RichObjectParameter_Type.guest ..id = '' ..name = 'name', ), @@ -172,8 +172,11 @@ void main() { ); }); - for (final type in ['user-group', 'group']) { - testWidgets(type, (tester) async { + for (final type in [ + spreed.RichObjectParameter_Type.userGroup, + spreed.RichObjectParameter_Type.group, + ]) { + testWidgets(type.value, (tester) async { final userDetails = MockUserDetails(); when(() => userDetails.groups).thenReturn(BuiltList(['group'])); @@ -200,7 +203,7 @@ void main() { expect(find.text('name'), findsOne); await expectLater( find.byType(TalkRichObjectMention), - matchesGoldenFile('goldens/rich_object_mention_${type}_highlight.png'), + matchesGoldenFile('goldens/rich_object_mention_${type.value}_highlight.png'), ); await tester.pumpWidgetWithAccessibility( @@ -223,7 +226,7 @@ void main() { expect(find.text('name'), findsOne); await expectLater( find.byType(TalkRichObjectMention), - matchesGoldenFile('goldens/rich_object_mention_${type}_other.png'), + matchesGoldenFile('goldens/rich_object_mention_${type.value}_other.png'), ); }); } @@ -239,10 +242,10 @@ void main() { child: TalkRichObjectFile( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.file ..id = '0' ..name = 'name' - ..previewAvailable = spreed.RichObjectParameter_PreviewAvailable.no + ..previewAvailable = 'no' ..path = '' ..link = '/link', ), @@ -264,10 +267,10 @@ void main() { child: TalkRichObjectFile( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.file ..id = '0' ..name = 'name' - ..previewAvailable = spreed.RichObjectParameter_PreviewAvailable.yes + ..previewAvailable = 'yes' ..path = '', ), textStyle: null, @@ -283,10 +286,10 @@ void main() { child: TalkRichObjectFile( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.file ..id = '0' ..name = 'name' - ..previewAvailable = spreed.RichObjectParameter_PreviewAvailable.no + ..previewAvailable = 'no' ..path = '', ), textStyle: null, @@ -316,10 +319,10 @@ void main() { child: TalkRichObjectFile( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.file ..id = '0' ..name = 'name' - ..previewAvailable = spreed.RichObjectParameter_PreviewAvailable.yes + ..previewAvailable = 'yes' ..path = 'path', ), textStyle: null, @@ -347,10 +350,10 @@ void main() { child: TalkRichObjectFile( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.file ..id = '0' ..name = 'name' - ..previewAvailable = spreed.RichObjectParameter_PreviewAvailable.yes + ..previewAvailable = 'yes' ..path = 'path' ..width = ($int: width, string: null) ..height = ($int: height, string: null), @@ -380,10 +383,10 @@ void main() { child: TalkRichObjectFile( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.file ..id = '0' ..name = 'name' - ..previewAvailable = spreed.RichObjectParameter_PreviewAvailable.yes + ..previewAvailable = 'yes' ..path = 'path' ..width = ($int: (maxWidth * widthFactor) * pixelRatio, string: null) ..height = ($int: (maxHeight * heightFactor) * pixelRatio, string: null), @@ -414,10 +417,10 @@ void main() { child: TalkRichObjectFile( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.file ..id = '0' ..name = 'name' - ..previewAvailable = spreed.RichObjectParameter_PreviewAvailable.yes + ..previewAvailable = 'yes' ..path = 'path' ..mimetype = 'image/gif', ), @@ -447,7 +450,7 @@ void main() { child: TalkRichObjectFallback( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.calendarEvent ..id = '' ..name = 'name' ..link = '/link', @@ -467,7 +470,7 @@ void main() { child: TalkRichObjectFallback( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.addressbook ..id = '' ..name = 'name', ), @@ -492,7 +495,7 @@ void main() { child: TalkRichObjectFallback( parameter: spreed.RichObjectParameter( (b) => b - ..type = '' + ..type = spreed.RichObjectParameter_Type.addressbook ..id = '' ..name = 'name' ..iconUrl = '', diff --git a/packages/nextcloud/lib/src/api/spreed.openapi.dart b/packages/nextcloud/lib/src/api/spreed.openapi.dart index 11128e983ac..481c74bc5dd 100644 --- a/packages/nextcloud/lib/src/api/spreed.openapi.dart +++ b/packages/nextcloud/lib/src/api/spreed.openapi.dart @@ -15316,261 +15316,181 @@ class _$ActorTypeSerializer implements PrimitiveSerializer { _fromWire[serialized]!; } -class RichObjectParameter_CallType extends EnumClass { - const RichObjectParameter_CallType._(super.name); +class RichObjectParameter_Type extends EnumClass { + const RichObjectParameter_Type._(super.name); - /// `one2one` - static const RichObjectParameter_CallType one2one = _$richObjectParameterCallTypeOne2one; + /// `addressbook` + static const RichObjectParameter_Type addressbook = _$richObjectParameterTypeAddressbook; - /// `group` - static const RichObjectParameter_CallType group = _$richObjectParameterCallTypeGroup; - - /// `public` - static const RichObjectParameter_CallType public = _$richObjectParameterCallTypePublic; - - /// Returns a set with all values this enum contains. - // coverage:ignore-start - static BuiltSet get values => _$richObjectParameterCallTypeValues; - // coverage:ignore-end - - /// Returns the enum value associated to the [name]. - static RichObjectParameter_CallType valueOf(String name) => _$valueOfRichObjectParameter_CallType(name); - - /// Returns the serialized value of this enum value. - String get value => _$jsonSerializers.serializeWith(serializer, this)! as String; - - /// Serializer for RichObjectParameter_CallType. - @BuiltValueSerializer(custom: true) - static Serializer get serializer => const _$RichObjectParameter_CallTypeSerializer(); -} - -class _$RichObjectParameter_CallTypeSerializer implements PrimitiveSerializer { - const _$RichObjectParameter_CallTypeSerializer(); - - static const Map _toWire = { - RichObjectParameter_CallType.one2one: 'one2one', - RichObjectParameter_CallType.group: 'group', - RichObjectParameter_CallType.public: 'public', - }; - - static const Map _fromWire = { - 'one2one': RichObjectParameter_CallType.one2one, - 'group': RichObjectParameter_CallType.group, - 'public': RichObjectParameter_CallType.public, - }; + /// `addressbook-contact` + @BuiltValueEnumConst(wireName: 'addressbook-contact') + static const RichObjectParameter_Type addressbookContact = _$richObjectParameterTypeAddressbookContact; - @override - Iterable get types => const [RichObjectParameter_CallType]; + /// `announcement` + static const RichObjectParameter_Type announcement = _$richObjectParameterTypeAnnouncement; - @override - String get wireName => 'RichObjectParameter_CallType'; - - @override - Object serialize( - Serializers serializers, - RichObjectParameter_CallType object, { - FullType specifiedType = FullType.unspecified, - }) => - _toWire[object]!; + /// `app` + static const RichObjectParameter_Type app = _$richObjectParameterTypeApp; - @override - RichObjectParameter_CallType deserialize( - Serializers serializers, - Object serialized, { - FullType specifiedType = FullType.unspecified, - }) => - _fromWire[serialized]!; -} + /// `calendar` + static const RichObjectParameter_Type calendar = _$richObjectParameterTypeCalendar; -typedef RichObjectParameter_Size = ({int? $int, String? string}); + /// `calendar-event` + @BuiltValueEnumConst(wireName: 'calendar-event') + static const RichObjectParameter_Type calendarEvent = _$richObjectParameterTypeCalendarEvent; -class RichObjectParameter_PreviewAvailable extends EnumClass { - const RichObjectParameter_PreviewAvailable._(super.name); - - /// `yes` - static const RichObjectParameter_PreviewAvailable yes = _$richObjectParameterPreviewAvailableYes; - - /// `no` - static const RichObjectParameter_PreviewAvailable no = _$richObjectParameterPreviewAvailableNo; - - /// Returns a set with all values this enum contains. - // coverage:ignore-start - static BuiltSet get values => _$richObjectParameterPreviewAvailableValues; - // coverage:ignore-end - - /// Returns the enum value associated to the [name]. - static RichObjectParameter_PreviewAvailable valueOf(String name) => - _$valueOfRichObjectParameter_PreviewAvailable(name); - - /// Returns the serialized value of this enum value. - String get value => _$jsonSerializers.serializeWith(serializer, this)! as String; - - /// Serializer for RichObjectParameter_PreviewAvailable. - @BuiltValueSerializer(custom: true) - static Serializer get serializer => - const _$RichObjectParameter_PreviewAvailableSerializer(); -} - -class _$RichObjectParameter_PreviewAvailableSerializer - implements PrimitiveSerializer { - const _$RichObjectParameter_PreviewAvailableSerializer(); - - static const Map _toWire = - { - RichObjectParameter_PreviewAvailable.yes: 'yes', - RichObjectParameter_PreviewAvailable.no: 'no', - }; - - static const Map _fromWire = - { - 'yes': RichObjectParameter_PreviewAvailable.yes, - 'no': RichObjectParameter_PreviewAvailable.no, - }; - - @override - Iterable get types => const [RichObjectParameter_PreviewAvailable]; - - @override - String get wireName => 'RichObjectParameter_PreviewAvailable'; - - @override - Object serialize( - Serializers serializers, - RichObjectParameter_PreviewAvailable object, { - FullType specifiedType = FullType.unspecified, - }) => - _toWire[object]!; - - @override - RichObjectParameter_PreviewAvailable deserialize( - Serializers serializers, - Object serialized, { - FullType specifiedType = FullType.unspecified, - }) => - _fromWire[serialized]!; -} + /// `call` + static const RichObjectParameter_Type call = _$richObjectParameterTypeCall; -class RichObjectParameter_Visibility extends EnumClass { - const RichObjectParameter_Visibility._(super.name); + /// `circle` + static const RichObjectParameter_Type circle = _$richObjectParameterTypeCircle; - /// `0` - @BuiltValueEnumConst(wireName: '0') - static const RichObjectParameter_Visibility $0 = _$richObjectParameterVisibility$0; + /// `deck-board` + @BuiltValueEnumConst(wireName: 'deck-board') + static const RichObjectParameter_Type deckBoard = _$richObjectParameterTypeDeckBoard; - /// `1` - @BuiltValueEnumConst(wireName: '1') - static const RichObjectParameter_Visibility $1 = _$richObjectParameterVisibility$1; + /// `deck-card` + @BuiltValueEnumConst(wireName: 'deck-card') + static const RichObjectParameter_Type deckCard = _$richObjectParameterTypeDeckCard; - /// Returns a set with all values this enum contains. - // coverage:ignore-start - static BuiltSet get values => _$richObjectParameterVisibilityValues; - // coverage:ignore-end + /// `email` + static const RichObjectParameter_Type email = _$richObjectParameterTypeEmail; - /// Returns the enum value associated to the [name]. - static RichObjectParameter_Visibility valueOf(String name) => _$valueOfRichObjectParameter_Visibility(name); + /// `file` + static const RichObjectParameter_Type file = _$richObjectParameterTypeFile; - /// Returns the serialized value of this enum value. - String get value => _$jsonSerializers.serializeWith(serializer, this)! as String; + /// `forms-form` + @BuiltValueEnumConst(wireName: 'forms-form') + static const RichObjectParameter_Type formsForm = _$richObjectParameterTypeFormsForm; - /// Serializer for RichObjectParameter_Visibility. - @BuiltValueSerializer(custom: true) - static Serializer get serializer => - const _$RichObjectParameter_VisibilitySerializer(); -} + /// `guest` + static const RichObjectParameter_Type guest = _$richObjectParameterTypeGuest; -class _$RichObjectParameter_VisibilitySerializer implements PrimitiveSerializer { - const _$RichObjectParameter_VisibilitySerializer(); + /// `highlight` + static const RichObjectParameter_Type highlight = _$richObjectParameterTypeHighlight; - static const Map _toWire = { - RichObjectParameter_Visibility.$0: '0', - RichObjectParameter_Visibility.$1: '1', - }; + /// `geo-location` + @BuiltValueEnumConst(wireName: 'geo-location') + static const RichObjectParameter_Type geoLocation = _$richObjectParameterTypeGeoLocation; - static const Map _fromWire = { - '0': RichObjectParameter_Visibility.$0, - '1': RichObjectParameter_Visibility.$1, - }; + /// `open-graph` + @BuiltValueEnumConst(wireName: 'open-graph') + static const RichObjectParameter_Type openGraph = _$richObjectParameterTypeOpenGraph; - @override - Iterable get types => const [RichObjectParameter_Visibility]; + /// `pending-federated-share` + @BuiltValueEnumConst(wireName: 'pending-federated-share') + static const RichObjectParameter_Type pendingFederatedShare = _$richObjectParameterTypePendingFederatedShare; - @override - String get wireName => 'RichObjectParameter_Visibility'; + /// `systemtag` + static const RichObjectParameter_Type systemtag = _$richObjectParameterTypeSystemtag; - @override - Object serialize( - Serializers serializers, - RichObjectParameter_Visibility object, { - FullType specifiedType = FullType.unspecified, - }) => - _toWire[object]!; + /// `talk-attachment` + @BuiltValueEnumConst(wireName: 'talk-attachment') + static const RichObjectParameter_Type talkAttachment = _$richObjectParameterTypeTalkAttachment; - @override - RichObjectParameter_Visibility deserialize( - Serializers serializers, - Object serialized, { - FullType specifiedType = FullType.unspecified, - }) => - _fromWire[serialized]!; -} + /// `talk-poll` + @BuiltValueEnumConst(wireName: 'talk-poll') + static const RichObjectParameter_Type talkPoll = _$richObjectParameterTypeTalkPoll; -class RichObjectParameter_Assignable extends EnumClass { - const RichObjectParameter_Assignable._(super.name); + /// `user` + static const RichObjectParameter_Type user = _$richObjectParameterTypeUser; - /// `0` - @BuiltValueEnumConst(wireName: '0') - static const RichObjectParameter_Assignable $0 = _$richObjectParameterAssignable$0; + /// `user-group` + @BuiltValueEnumConst(wireName: 'user-group') + static const RichObjectParameter_Type userGroup = _$richObjectParameterTypeUserGroup; - /// `1` - @BuiltValueEnumConst(wireName: '1') - static const RichObjectParameter_Assignable $1 = _$richObjectParameterAssignable$1; + /// `group` + static const RichObjectParameter_Type group = _$richObjectParameterTypeGroup; /// Returns a set with all values this enum contains. // coverage:ignore-start - static BuiltSet get values => _$richObjectParameterAssignableValues; + static BuiltSet get values => _$richObjectParameterTypeValues; // coverage:ignore-end /// Returns the enum value associated to the [name]. - static RichObjectParameter_Assignable valueOf(String name) => _$valueOfRichObjectParameter_Assignable(name); + static RichObjectParameter_Type valueOf(String name) => _$valueOfRichObjectParameter_Type(name); /// Returns the serialized value of this enum value. String get value => _$jsonSerializers.serializeWith(serializer, this)! as String; - /// Serializer for RichObjectParameter_Assignable. + /// Serializer for RichObjectParameter_Type. @BuiltValueSerializer(custom: true) - static Serializer get serializer => - const _$RichObjectParameter_AssignableSerializer(); -} - -class _$RichObjectParameter_AssignableSerializer implements PrimitiveSerializer { - const _$RichObjectParameter_AssignableSerializer(); - - static const Map _toWire = { - RichObjectParameter_Assignable.$0: '0', - RichObjectParameter_Assignable.$1: '1', - }; - - static const Map _fromWire = { - '0': RichObjectParameter_Assignable.$0, - '1': RichObjectParameter_Assignable.$1, - }; - - @override - Iterable get types => const [RichObjectParameter_Assignable]; - - @override - String get wireName => 'RichObjectParameter_Assignable'; + static Serializer get serializer => const _$RichObjectParameter_TypeSerializer(); +} + +class _$RichObjectParameter_TypeSerializer implements PrimitiveSerializer { + const _$RichObjectParameter_TypeSerializer(); + + static const Map _toWire = { + RichObjectParameter_Type.addressbook: 'addressbook', + RichObjectParameter_Type.addressbookContact: 'addressbook-contact', + RichObjectParameter_Type.announcement: 'announcement', + RichObjectParameter_Type.app: 'app', + RichObjectParameter_Type.calendar: 'calendar', + RichObjectParameter_Type.calendarEvent: 'calendar-event', + RichObjectParameter_Type.call: 'call', + RichObjectParameter_Type.circle: 'circle', + RichObjectParameter_Type.deckBoard: 'deck-board', + RichObjectParameter_Type.deckCard: 'deck-card', + RichObjectParameter_Type.email: 'email', + RichObjectParameter_Type.file: 'file', + RichObjectParameter_Type.formsForm: 'forms-form', + RichObjectParameter_Type.guest: 'guest', + RichObjectParameter_Type.highlight: 'highlight', + RichObjectParameter_Type.geoLocation: 'geo-location', + RichObjectParameter_Type.openGraph: 'open-graph', + RichObjectParameter_Type.pendingFederatedShare: 'pending-federated-share', + RichObjectParameter_Type.systemtag: 'systemtag', + RichObjectParameter_Type.talkAttachment: 'talk-attachment', + RichObjectParameter_Type.talkPoll: 'talk-poll', + RichObjectParameter_Type.user: 'user', + RichObjectParameter_Type.userGroup: 'user-group', + RichObjectParameter_Type.group: 'group', + }; + + static const Map _fromWire = { + 'addressbook': RichObjectParameter_Type.addressbook, + 'addressbook-contact': RichObjectParameter_Type.addressbookContact, + 'announcement': RichObjectParameter_Type.announcement, + 'app': RichObjectParameter_Type.app, + 'calendar': RichObjectParameter_Type.calendar, + 'calendar-event': RichObjectParameter_Type.calendarEvent, + 'call': RichObjectParameter_Type.call, + 'circle': RichObjectParameter_Type.circle, + 'deck-board': RichObjectParameter_Type.deckBoard, + 'deck-card': RichObjectParameter_Type.deckCard, + 'email': RichObjectParameter_Type.email, + 'file': RichObjectParameter_Type.file, + 'forms-form': RichObjectParameter_Type.formsForm, + 'guest': RichObjectParameter_Type.guest, + 'highlight': RichObjectParameter_Type.highlight, + 'geo-location': RichObjectParameter_Type.geoLocation, + 'open-graph': RichObjectParameter_Type.openGraph, + 'pending-federated-share': RichObjectParameter_Type.pendingFederatedShare, + 'systemtag': RichObjectParameter_Type.systemtag, + 'talk-attachment': RichObjectParameter_Type.talkAttachment, + 'talk-poll': RichObjectParameter_Type.talkPoll, + 'user': RichObjectParameter_Type.user, + 'user-group': RichObjectParameter_Type.userGroup, + 'group': RichObjectParameter_Type.group, + }; + + @override + Iterable get types => const [RichObjectParameter_Type]; + + @override + String get wireName => 'RichObjectParameter_Type'; @override Object serialize( Serializers serializers, - RichObjectParameter_Assignable object, { + RichObjectParameter_Type object, { FullType specifiedType = FullType.unspecified, }) => _toWire[object]!; @override - RichObjectParameter_Assignable deserialize( + RichObjectParameter_Type deserialize( Serializers serializers, Object serialized, { FullType specifiedType = FullType.unspecified, @@ -15578,38 +15498,77 @@ class _$RichObjectParameter_AssignableSerializer implements PrimitiveSerializer< _fromWire[serialized]!; } +typedef RichObjectParameter_Size = ({int? $int, String? string}); typedef RichObjectParameter_Width = ({int? $int, String? string}); typedef RichObjectParameter_Height = ({int? $int, String? string}); @BuiltValue(instantiable: false) sealed class $RichObjectParameterInterface { - String get type; + RichObjectParameter_Type get type; String get id; String get name; - String? get server; + + /// The full URL to the file. String? get link; + + /// The type of the call: one2one, group or public. @BuiltValueField(wireName: 'call-type') - RichObjectParameter_CallType? get callType; + String? get callType; + + /// The icon url to use as avatar. @BuiltValueField(wireName: 'icon-url') String? get iconUrl; + + /// The id of a message that was referred to. @BuiltValueField(wireName: 'message-id') String? get messageId; + + /// The display name of board which contains the card. String? get boardname; + + /// The display name of the stack which contains the card in the board. String? get stackname; RichObjectParameter_Size? get size; + + /// The full path of the file for the user, should not start with a slash. String? get path; + + /// The mimetype of the file/folder to allow clients to show a placeholder. String? get mimetype; + + /// Whether or not a preview is available. If `no` the mimetype icon should be used. @BuiltValueField(wireName: 'preview-available') - RichObjectParameter_PreviewAvailable? get previewAvailable; + String? get previewAvailable; + + /// The mtime of the file/folder as unix timestamp. String? get mtime; + + /// The latitude of the location MUST be the same as in the id. String? get latitude; + + /// The longitude of the location MUST be the same as in the id. String? get longitude; + + /// The open graph description from the website. String? get description; + + /// The full URL of the open graph thumbnail. String? get thumb; + + /// The name of the described website. String? get website; - RichObjectParameter_Visibility? get visibility; - RichObjectParameter_Assignable? get assignable; + + /// If the user can see the systemtag. + String? get visibility; + + /// If the user can assign the systemtag. + String? get assignable; + + /// The token of the conversation. String? get conversation; + + /// The URL of the instance the user lives on. + String? get server; String? get etag; RichObjectParameter_Width? get width; RichObjectParameter_Height? get height; @@ -50038,11 +49997,8 @@ final Serializers _$serializers = (Serializers().toBuilder() ..add(BaseMessage.serializer) ..addBuilderFactory(const FullType(RichObjectParameter), RichObjectParameterBuilder.new) ..add(RichObjectParameter.serializer) - ..add(RichObjectParameter_CallType.serializer) + ..add(RichObjectParameter_Type.serializer) ..add($b2c4857c0136baea42828d89c87c757dExtension._serializer) - ..add(RichObjectParameter_PreviewAvailable.serializer) - ..add(RichObjectParameter_Visibility.serializer) - ..add(RichObjectParameter_Assignable.serializer) ..addBuilderFactory( const FullType(BuiltMap, [FullType(String), FullType(RichObjectParameter)]), MapBuilder.new, diff --git a/packages/nextcloud/lib/src/api/spreed.openapi.g.dart b/packages/nextcloud/lib/src/api/spreed.openapi.g.dart index a20f107c127..413087f02d6 100644 --- a/packages/nextcloud/lib/src/api/spreed.openapi.g.dart +++ b/packages/nextcloud/lib/src/api/spreed.openapi.g.dart @@ -85,90 +85,114 @@ final BuiltSet _$actorTypeValues = BuiltSet(const _$richObjectParameterCallTypeValues = - BuiltSet(const [ - _$richObjectParameterCallTypeOne2one, - _$richObjectParameterCallTypeGroup, - _$richObjectParameterCallTypePublic, -]); - -const RichObjectParameter_PreviewAvailable _$richObjectParameterPreviewAvailableYes = - RichObjectParameter_PreviewAvailable._('yes'); -const RichObjectParameter_PreviewAvailable _$richObjectParameterPreviewAvailableNo = - RichObjectParameter_PreviewAvailable._('no'); - -RichObjectParameter_PreviewAvailable _$valueOfRichObjectParameter_PreviewAvailable(String name) { - switch (name) { - case 'yes': - return _$richObjectParameterPreviewAvailableYes; - case 'no': - return _$richObjectParameterPreviewAvailableNo; - default: - throw ArgumentError(name); - } -} - -final BuiltSet _$richObjectParameterPreviewAvailableValues = - BuiltSet(const [ - _$richObjectParameterPreviewAvailableYes, - _$richObjectParameterPreviewAvailableNo, -]); - -const RichObjectParameter_Visibility _$richObjectParameterVisibility$0 = RichObjectParameter_Visibility._('\$0'); -const RichObjectParameter_Visibility _$richObjectParameterVisibility$1 = RichObjectParameter_Visibility._('\$1'); - -RichObjectParameter_Visibility _$valueOfRichObjectParameter_Visibility(String name) { - switch (name) { - case '\$0': - return _$richObjectParameterVisibility$0; - case '\$1': - return _$richObjectParameterVisibility$1; + return _$richObjectParameterTypeGroup; default: throw ArgumentError(name); } } -final BuiltSet _$richObjectParameterVisibilityValues = - BuiltSet(const [ - _$richObjectParameterVisibility$0, - _$richObjectParameterVisibility$1, -]); - -const RichObjectParameter_Assignable _$richObjectParameterAssignable$0 = RichObjectParameter_Assignable._('\$0'); -const RichObjectParameter_Assignable _$richObjectParameterAssignable$1 = RichObjectParameter_Assignable._('\$1'); - -RichObjectParameter_Assignable _$valueOfRichObjectParameter_Assignable(String name) { - switch (name) { - case '\$0': - return _$richObjectParameterAssignable$0; - case '\$1': - return _$richObjectParameterAssignable$1; - default: - throw ArgumentError(name); - } -} - -final BuiltSet _$richObjectParameterAssignableValues = - BuiltSet(const [ - _$richObjectParameterAssignable$0, - _$richObjectParameterAssignable$1, +final BuiltSet _$richObjectParameterTypeValues = + BuiltSet(const [ + _$richObjectParameterTypeAddressbook, + _$richObjectParameterTypeAddressbookContact, + _$richObjectParameterTypeAnnouncement, + _$richObjectParameterTypeApp, + _$richObjectParameterTypeCalendar, + _$richObjectParameterTypeCalendarEvent, + _$richObjectParameterTypeCall, + _$richObjectParameterTypeCircle, + _$richObjectParameterTypeDeckBoard, + _$richObjectParameterTypeDeckCard, + _$richObjectParameterTypeEmail, + _$richObjectParameterTypeFile, + _$richObjectParameterTypeFormsForm, + _$richObjectParameterTypeGuest, + _$richObjectParameterTypeHighlight, + _$richObjectParameterTypeGeoLocation, + _$richObjectParameterTypeOpenGraph, + _$richObjectParameterTypePendingFederatedShare, + _$richObjectParameterTypeSystemtag, + _$richObjectParameterTypeTalkAttachment, + _$richObjectParameterTypeTalkPoll, + _$richObjectParameterTypeUser, + _$richObjectParameterTypeUserGroup, + _$richObjectParameterTypeGroup, ]); const MessageType _$messageTypeComment = MessageType._('comment'); @@ -3783,19 +3807,13 @@ class _$RichObjectParameterSerializer implements StructuredSerializer[ 'type', - serializers.serialize(object.type, specifiedType: const FullType(String)), + serializers.serialize(object.type, specifiedType: const FullType(RichObjectParameter_Type)), 'id', serializers.serialize(object.id, specifiedType: const FullType(String)), 'name', serializers.serialize(object.name, specifiedType: const FullType(String)), ]; Object? value; - value = object.server; - if (value != null) { - result - ..add('server') - ..add(serializers.serialize(value, specifiedType: const FullType(String))); - } value = object.link; if (value != null) { result @@ -3806,7 +3824,7 @@ class _$RichObjectParameterSerializer implements StructuredSerializer, $OCSMetaInterf abstract mixin class $RichObjectParameterInterfaceBuilder { void replace($RichObjectParameterInterface other); void update(void Function($RichObjectParameterInterfaceBuilder) updates); - String? get type; - set type(String? type); + RichObjectParameter_Type? get type; + set type(RichObjectParameter_Type? type); String? get id; set id(String? id); @@ -22979,14 +22999,11 @@ abstract mixin class $RichObjectParameterInterfaceBuilder { String? get name; set name(String? name); - String? get server; - set server(String? server); - String? get link; set link(String? link); - RichObjectParameter_CallType? get callType; - set callType(RichObjectParameter_CallType? callType); + String? get callType; + set callType(String? callType); String? get iconUrl; set iconUrl(String? iconUrl); @@ -23009,8 +23026,8 @@ abstract mixin class $RichObjectParameterInterfaceBuilder { String? get mimetype; set mimetype(String? mimetype); - RichObjectParameter_PreviewAvailable? get previewAvailable; - set previewAvailable(RichObjectParameter_PreviewAvailable? previewAvailable); + String? get previewAvailable; + set previewAvailable(String? previewAvailable); String? get mtime; set mtime(String? mtime); @@ -23030,15 +23047,18 @@ abstract mixin class $RichObjectParameterInterfaceBuilder { String? get website; set website(String? website); - RichObjectParameter_Visibility? get visibility; - set visibility(RichObjectParameter_Visibility? visibility); + String? get visibility; + set visibility(String? visibility); - RichObjectParameter_Assignable? get assignable; - set assignable(RichObjectParameter_Assignable? assignable); + String? get assignable; + set assignable(String? assignable); String? get conversation; set conversation(String? conversation); + String? get server; + set server(String? server); + String? get etag; set etag(String? etag); @@ -23051,17 +23071,15 @@ abstract mixin class $RichObjectParameterInterfaceBuilder { class _$RichObjectParameter extends RichObjectParameter { @override - final String type; + final RichObjectParameter_Type type; @override final String id; @override final String name; @override - final String? server; - @override final String? link; @override - final RichObjectParameter_CallType? callType; + final String? callType; @override final String? iconUrl; @override @@ -23077,7 +23095,7 @@ class _$RichObjectParameter extends RichObjectParameter { @override final String? mimetype; @override - final RichObjectParameter_PreviewAvailable? previewAvailable; + final String? previewAvailable; @override final String? mtime; @override @@ -23091,12 +23109,14 @@ class _$RichObjectParameter extends RichObjectParameter { @override final String? website; @override - final RichObjectParameter_Visibility? visibility; + final String? visibility; @override - final RichObjectParameter_Assignable? assignable; + final String? assignable; @override final String? conversation; @override + final String? server; + @override final String? etag; @override final RichObjectParameter_Width? width; @@ -23110,7 +23130,6 @@ class _$RichObjectParameter extends RichObjectParameter { {required this.type, required this.id, required this.name, - this.server, this.link, this.callType, this.iconUrl, @@ -23130,6 +23149,7 @@ class _$RichObjectParameter extends RichObjectParameter { this.visibility, this.assignable, this.conversation, + this.server, this.etag, this.width, this.height}) @@ -23154,7 +23174,6 @@ class _$RichObjectParameter extends RichObjectParameter { type == other.type && id == other.id && name == other.name && - server == other.server && link == other.link && callType == other.callType && iconUrl == other.iconUrl && @@ -23174,6 +23193,7 @@ class _$RichObjectParameter extends RichObjectParameter { visibility == other.visibility && assignable == other.assignable && conversation == other.conversation && + server == other.server && etag == other.etag && width == _$dynamicOther.width && height == _$dynamicOther.height; @@ -23185,7 +23205,6 @@ class _$RichObjectParameter extends RichObjectParameter { _$hash = $jc(_$hash, type.hashCode); _$hash = $jc(_$hash, id.hashCode); _$hash = $jc(_$hash, name.hashCode); - _$hash = $jc(_$hash, server.hashCode); _$hash = $jc(_$hash, link.hashCode); _$hash = $jc(_$hash, callType.hashCode); _$hash = $jc(_$hash, iconUrl.hashCode); @@ -23205,6 +23224,7 @@ class _$RichObjectParameter extends RichObjectParameter { _$hash = $jc(_$hash, visibility.hashCode); _$hash = $jc(_$hash, assignable.hashCode); _$hash = $jc(_$hash, conversation.hashCode); + _$hash = $jc(_$hash, server.hashCode); _$hash = $jc(_$hash, etag.hashCode); _$hash = $jc(_$hash, width.hashCode); _$hash = $jc(_$hash, height.hashCode); @@ -23218,7 +23238,6 @@ class _$RichObjectParameter extends RichObjectParameter { ..add('type', type) ..add('id', id) ..add('name', name) - ..add('server', server) ..add('link', link) ..add('callType', callType) ..add('iconUrl', iconUrl) @@ -23238,6 +23257,7 @@ class _$RichObjectParameter extends RichObjectParameter { ..add('visibility', visibility) ..add('assignable', assignable) ..add('conversation', conversation) + ..add('server', server) ..add('etag', etag) ..add('width', width) ..add('height', height)) @@ -23249,9 +23269,9 @@ class RichObjectParameterBuilder implements Builder, $RichObjectParameterInterfaceBuilder { _$RichObjectParameter? _$v; - String? _type; - String? get type => _$this._type; - set type(covariant String? type) => _$this._type = type; + RichObjectParameter_Type? _type; + RichObjectParameter_Type? get type => _$this._type; + set type(covariant RichObjectParameter_Type? type) => _$this._type = type; String? _id; String? get id => _$this._id; @@ -23261,17 +23281,13 @@ class RichObjectParameterBuilder String? get name => _$this._name; set name(covariant String? name) => _$this._name = name; - String? _server; - String? get server => _$this._server; - set server(covariant String? server) => _$this._server = server; - String? _link; String? get link => _$this._link; set link(covariant String? link) => _$this._link = link; - RichObjectParameter_CallType? _callType; - RichObjectParameter_CallType? get callType => _$this._callType; - set callType(covariant RichObjectParameter_CallType? callType) => _$this._callType = callType; + String? _callType; + String? get callType => _$this._callType; + set callType(covariant String? callType) => _$this._callType = callType; String? _iconUrl; String? get iconUrl => _$this._iconUrl; @@ -23301,10 +23317,9 @@ class RichObjectParameterBuilder String? get mimetype => _$this._mimetype; set mimetype(covariant String? mimetype) => _$this._mimetype = mimetype; - RichObjectParameter_PreviewAvailable? _previewAvailable; - RichObjectParameter_PreviewAvailable? get previewAvailable => _$this._previewAvailable; - set previewAvailable(covariant RichObjectParameter_PreviewAvailable? previewAvailable) => - _$this._previewAvailable = previewAvailable; + String? _previewAvailable; + String? get previewAvailable => _$this._previewAvailable; + set previewAvailable(covariant String? previewAvailable) => _$this._previewAvailable = previewAvailable; String? _mtime; String? get mtime => _$this._mtime; @@ -23330,18 +23345,22 @@ class RichObjectParameterBuilder String? get website => _$this._website; set website(covariant String? website) => _$this._website = website; - RichObjectParameter_Visibility? _visibility; - RichObjectParameter_Visibility? get visibility => _$this._visibility; - set visibility(covariant RichObjectParameter_Visibility? visibility) => _$this._visibility = visibility; + String? _visibility; + String? get visibility => _$this._visibility; + set visibility(covariant String? visibility) => _$this._visibility = visibility; - RichObjectParameter_Assignable? _assignable; - RichObjectParameter_Assignable? get assignable => _$this._assignable; - set assignable(covariant RichObjectParameter_Assignable? assignable) => _$this._assignable = assignable; + String? _assignable; + String? get assignable => _$this._assignable; + set assignable(covariant String? assignable) => _$this._assignable = assignable; String? _conversation; String? get conversation => _$this._conversation; set conversation(covariant String? conversation) => _$this._conversation = conversation; + String? _server; + String? get server => _$this._server; + set server(covariant String? server) => _$this._server = server; + String? _etag; String? get etag => _$this._etag; set etag(covariant String? etag) => _$this._etag = etag; @@ -23364,7 +23383,6 @@ class RichObjectParameterBuilder _type = $v.type; _id = $v.id; _name = $v.name; - _server = $v.server; _link = $v.link; _callType = $v.callType; _iconUrl = $v.iconUrl; @@ -23384,6 +23402,7 @@ class RichObjectParameterBuilder _visibility = $v.visibility; _assignable = $v.assignable; _conversation = $v.conversation; + _server = $v.server; _etag = $v.etag; _width = $v.width; _height = $v.height; @@ -23413,7 +23432,6 @@ class RichObjectParameterBuilder type: BuiltValueNullFieldError.checkNotNull(type, r'RichObjectParameter', 'type'), id: BuiltValueNullFieldError.checkNotNull(id, r'RichObjectParameter', 'id'), name: BuiltValueNullFieldError.checkNotNull(name, r'RichObjectParameter', 'name'), - server: server, link: link, callType: callType, iconUrl: iconUrl, @@ -23433,6 +23451,7 @@ class RichObjectParameterBuilder visibility: visibility, assignable: assignable, conversation: conversation, + server: server, etag: etag, width: width, height: height); diff --git a/packages/nextcloud/lib/src/api/spreed.openapi.json b/packages/nextcloud/lib/src/api/spreed.openapi.json index 5fa224c4323..4941382ded8 100644 --- a/packages/nextcloud/lib/src/api/spreed.openapi.json +++ b/packages/nextcloud/lib/src/api/spreed.openapi.json @@ -900,7 +900,33 @@ ], "properties": { "type": { - "type": "string" + "type": "string", + "enum": [ + "addressbook", + "addressbook-contact", + "announcement", + "app", + "calendar", + "calendar-event", + "call", + "circle", + "deck-board", + "deck-card", + "email", + "file", + "forms-form", + "guest", + "highlight", + "geo-location", + "open-graph", + "pending-federated-share", + "systemtag", + "talk-attachment", + "talk-poll", + "user", + "user-group", + "group" + ] }, "id": { "type": "string" @@ -908,31 +934,35 @@ "name": { "type": "string" }, - "server": { - "type": "string" - }, "link": { - "type": "string" + "type": "string", + "description": "The full URL to the file", + "example": "http://localhost/index.php/apps/announcements/#23" }, "call-type": { "type": "string", - "enum": [ - "one2one", - "group", - "public" - ] + "description": "The type of the call: one2one, group or public", + "example": "one2one" }, "icon-url": { - "type": "string" + "type": "string", + "description": "The icon url to use as avatar", + "example": "https://localhost/ocs/v2.php/apps/spreed/api/v1/room/R4nd0mToken/avatar" }, "message-id": { - "type": "string" + "type": "string", + "description": "The id of a message that was referred to", + "example": "12345" }, "boardname": { - "type": "string" + "type": "string", + "description": "The display name of board which contains the card", + "example": "Personal" }, "stackname": { - "type": "string" + "type": "string", + "description": "The display name of the stack which contains the card in the board", + "example": "To do" }, "size": { "oneOf": [ @@ -945,52 +975,69 @@ ] }, "path": { - "type": "string" + "type": "string", + "description": "The full path of the file for the user, should not start with a slash", + "example": "path/to/file.txt" }, "mimetype": { - "type": "string" + "type": "string", + "description": "The mimetype of the file/folder to allow clients to show a placeholder", + "example": "text/plain" }, "preview-available": { "type": "string", - "enum": [ - "yes", - "no" - ] + "description": "Whether or not a preview is available. If `no` the mimetype icon should be used", + "example": "yes" }, "mtime": { - "type": "string" + "type": "string", + "description": "The mtime of the file/folder as unix timestamp", + "example": "1661854213" }, "latitude": { - "type": "string" + "type": "string", + "description": "The latitude of the location MUST be the same as in the id", + "example": "52.5450511" }, "longitude": { - "type": "string" + "type": "string", + "description": "The longitude of the location MUST be the same as in the id", + "example": "13.3741463" }, "description": { - "type": "string" + "type": "string", + "description": "The open graph description from the website", + "example": "This is the description of the website" }, "thumb": { - "type": "string" + "type": "string", + "description": "The full URL of the open graph thumbnail", + "example": "http://localhost/index.php/apps/mood/data/image?url=https%3A%2F%2Fthumb.example.com%2Fimage.png" }, "website": { - "type": "string" + "type": "string", + "description": "The name of the described website", + "example": "Nextcloud - App Store" }, "visibility": { "type": "string", - "enum": [ - "0", - "1" - ] + "description": "If the user can see the systemtag", + "example": "1" }, "assignable": { "type": "string", - "enum": [ - "0", - "1" - ] + "description": "If the user can assign the systemtag", + "example": "0" }, "conversation": { - "type": "string" + "type": "string", + "description": "The token of the conversation", + "example": "a1b2c3d4" + }, + "server": { + "type": "string", + "description": "The URL of the instance the user lives on", + "example": "localhost" }, "etag": { "type": "string" diff --git a/packages/nextcloud/lib/src/patches/spreed/1-message-parameters.json b/packages/nextcloud/lib/src/patches/spreed/1-message-parameters.json index f2eefe064f8..0d9b57cafae 100644 --- a/packages/nextcloud/lib/src/patches/spreed/1-message-parameters.json +++ b/packages/nextcloud/lib/src/patches/spreed/1-message-parameters.json @@ -1,51 +1,167 @@ [ - { - "op": "replace", - "path": "/components/schemas/RichObjectParameter/properties/size", - "value": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" + { + "op": "replace", + "path": "/components/schemas/BaseMessage/properties/messageParameters/additionalProperties", + "value": { + "$ref": "#/components/schemas/RichObjectParameter" } - ] - } - }, - { - "op": "add", - "path": "/components/schemas/RichObjectParameter/properties/etag", - "value": { - "type": "string" - } - }, - { - "op": "add", - "path": "/components/schemas/RichObjectParameter/properties/width", - "value": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "op": "add", - "path": "/components/schemas/RichObjectParameter/properties/height", - "value": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" + }, + { + "op": "add", + "path": "/components/schemas/RichObjectParameter", + "value": { + "type": "object", + "required": [ + "type", + "id", + "name" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "addressbook", + "addressbook-contact", + "announcement", + "app", + "calendar", + "calendar-event", + "call", + "circle", + "deck-board", + "deck-card", + "email", + "file", + "forms-form", + "guest", + "highlight", + "geo-location", + "open-graph", + "pending-federated-share", + "systemtag", + "talk-attachment", + "talk-poll", + "user", + "user-group", + "group" + ] + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "link": { + "type": "string", + "description": "The full URL to the file", + "example": "http://localhost/index.php/apps/announcements/#23" + }, + "call-type": { + "type": "string", + "description": "The type of the call: one2one, group or public", + "example": "one2one" + }, + "icon-url": { + "type": "string", + "description": "The icon url to use as avatar", + "example": "https://localhost/ocs/v2.php/apps/spreed/api/v1/room/R4nd0mToken/avatar" + }, + "message-id": { + "type": "string", + "description": "The id of a message that was referred to", + "example": "12345" + }, + "boardname": { + "type": "string", + "description": "The display name of board which contains the card", + "example": "Personal" + }, + "stackname": { + "type": "string", + "description": "The display name of the stack which contains the card in the board", + "example": "To do" + }, + "size": { + "type": "string", + "description": "The file size in bytes", + "example": "3145728" + }, + "path": { + "type": "string", + "description": "The full path of the file for the user, should not start with a slash", + "example": "path/to/file.txt" + }, + "mimetype": { + "type": "string", + "description": "The mimetype of the file/folder to allow clients to show a placeholder", + "example": "text/plain" + }, + "preview-available": { + "type": "string", + "description": "Whether or not a preview is available. If `no` the mimetype icon should be used", + "example": "yes" + }, + "mtime": { + "type": "string", + "description": "The mtime of the file/folder as unix timestamp", + "example": "1661854213" + }, + "latitude": { + "type": "string", + "description": "The latitude of the location MUST be the same as in the id", + "example": "52.5450511" + }, + "longitude": { + "type": "string", + "description": "The longitude of the location MUST be the same as in the id", + "example": "13.3741463" + }, + "description": { + "type": "string", + "description": "The open graph description from the website", + "example": "This is the description of the website" + }, + "thumb": { + "type": "string", + "description": "The full URL of the open graph thumbnail", + "example": "http://localhost/index.php/apps/mood/data/image?url=https%3A%2F%2Fthumb.example.com%2Fimage.png" + }, + "website": { + "type": "string", + "description": "The name of the described website", + "example": "Nextcloud - App Store" + }, + "visibility": { + "type": "string", + "description": "If the user can see the systemtag", + "example": "1" + }, + "assignable": { + "type": "string", + "description": "If the user can assign the systemtag", + "example": "0" + }, + "conversation": { + "type": "string", + "description": "The token of the conversation", + "example": "a1b2c3d4" + }, + "server": { + "type": "string", + "description": "The URL of the instance the user lives on", + "example": "localhost" + }, + "etag": { + "type": "string" + }, + "width": { + "type": "string" + }, + "height": { + "type": "string" + } + } } - ] } - } -] +] \ No newline at end of file diff --git a/packages/nextcloud/lib/src/patches/spreed/3-compatibility-18.json b/packages/nextcloud/lib/src/patches/spreed/3-compatibility-18.json index 90c62a1dfa5..776af7af986 100644 --- a/packages/nextcloud/lib/src/patches/spreed/3-compatibility-18.json +++ b/packages/nextcloud/lib/src/patches/spreed/3-compatibility-18.json @@ -23,5 +23,47 @@ "statusIcon", "statusMessage" ] + }, + { + "op": "replace", + "path": "/components/schemas/RichObjectParameter/properties/width", + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + } + }, + { + "op": "replace", + "path": "/components/schemas/RichObjectParameter/properties/height", + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + } + }, + { + "op": "replace", + "path": "/components/schemas/RichObjectParameter/properties/size", + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + } } ] diff --git a/tool/generate-rich-objects-patch.php b/tool/generate-rich-objects-patch.php new file mode 100755 index 00000000000..e03943ab49e --- /dev/null +++ b/tool/generate-rich-objects-patch.php @@ -0,0 +1,52 @@ +#!/usr/bin/env php +definitions; + +$properties = [ + 'type' => [ + 'type' => 'string', + 'enum' => array_keys($definitions), + ], + 'id' => ['type' => 'string'], + 'name' => ['type' => 'string'], +]; + +foreach ($definitions as $type => $object) { + foreach ($object['parameters'] as $name => $parameter) { + $properties[$name] ??= [ + 'type' => 'string', + 'description' => $parameter['description'], + 'example' => $parameter['example'], + ]; + } +} + +$properties['type']['enum'][] = 'group'; +$properties['etag'] = ['type' => 'string']; +$properties['width'] = ['type' => 'string']; +$properties['height'] = ['type' => 'string']; + +$patch = [ + [ + 'op' => 'replace', + 'path' => '/components/schemas/BaseMessage/properties/messageParameters/additionalProperties', + 'value' => [ + '$ref' => '#/components/schemas/RichObjectParameter', + ], + ], + [ + 'op' => 'add', + 'path' => '/components/schemas/RichObjectParameter', + 'value' => [ + 'type' => 'object', + 'required' => ['type', 'id', 'name'], + 'properties' => $properties, + ], + ], +]; + +file_put_contents('packages/nextcloud/lib/src/patches/spreed/1-message-parameters.json', json_encode($patch, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)); diff --git a/tool/generate-specs.sh b/tool/generate-specs.sh index 8c6077d3e55..2d2faf24fed 100755 --- a/tool/generate-specs.sh +++ b/tool/generate-specs.sh @@ -57,6 +57,8 @@ function generate_spec() { > /tmp/nextcloud-neon/cookbook.openapi.json ) +./tool/generate-rich-objects-patch.php + for spec in /tmp/nextcloud-neon/*.openapi.json; do name="$(basename "$spec" | cut -d "." -f 1)" if [[ "$name" == "core" ]]; then