From aa8e24b50776cdc11f0a403928bb3ec7469f21fe Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 21 Dec 2022 12:17:48 +0100 Subject: [PATCH] specs,tool,nextcloud,neon: Generate merged specs with automatic prefixes --- packages/neon/lib/src/blocs/user_status.dart | 5 +- .../neon/lib/src/widgets/account_avatar.dart | 4 +- .../nextcloud/lib/src/nextcloud.openapi.dart | 196 +++++++++--------- .../lib/src/nextcloud.openapi.g.dart | 35 ++-- .../nextcloud/lib/src/nextcloud.openapi.json | 22 +- packages/nextcloud/test/user_status.dart | 98 ++++----- specs/core.json | 24 +-- specs/news.json | 38 ++-- specs/notes.json | 18 +- specs/notifications.json | 32 +-- specs/provisioning_api.json | 10 +- specs/user_status.json | 56 ++--- tool/generate-nextcloud.sh | 19 +- 13 files changed, 284 insertions(+), 273 deletions(-) diff --git a/packages/neon/lib/src/blocs/user_status.dart b/packages/neon/lib/src/blocs/user_status.dart index b3fd2e6c..bda89ae8 100644 --- a/packages/neon/lib/src/blocs/user_status.dart +++ b/packages/neon/lib/src/blocs/user_status.dart @@ -3,7 +3,7 @@ part of '../neon.dart'; abstract class UserStatusBlocEvents {} abstract class UserStatusBlocStates { - BehaviorSubject> get userStatus; + BehaviorSubject> get userStatus; } class UserStatusBloc extends InteractiveBloc implements UserStatusBlocEvents, UserStatusBlocStates { @@ -30,7 +30,8 @@ class UserStatusBloc extends InteractiveBloc implements UserStatusBlocEvents, Us } @override - BehaviorSubject> userStatus = BehaviorSubject>(); + BehaviorSubject> userStatus = + BehaviorSubject>(); @override Future refresh() async { diff --git a/packages/neon/lib/src/widgets/account_avatar.dart b/packages/neon/lib/src/widgets/account_avatar.dart index cd2b26b8..866c0de1 100644 --- a/packages/neon/lib/src/widgets/account_avatar.dart +++ b/packages/neon/lib/src/widgets/account_avatar.dart @@ -39,7 +39,7 @@ class AccountAvatar extends StatelessWidget { ), ), ), - ResultBuilder( + ResultBuilder( stream: Provider.of(context, listen: false).getUserStatusBloc(account).userStatus, builder: (final context, final userStatus) => SizedBox( height: kAvatarSize, @@ -77,7 +77,7 @@ class AccountAvatar extends StatelessWidget { ); } - Color _userStatusToColor(final NextcloudUserStatus userStatus) { + Color _userStatusToColor(final NextcloudUserStatusStatus userStatus) { switch (userStatus.status) { case NextcloudUserStatusType.online: return const Color(0xFF49B382); diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index 5cae2e24..08ee0bed 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -1218,7 +1218,7 @@ class NextcloudUserStatusClient { throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } - Future getStatus() async { + Future getStatus() async { var path = '/ocs/v2.php/apps/user_status/api/v1/user_status'; final queryParameters = {}; final headers = {}; @@ -1230,13 +1230,13 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetUserStatus.fromJson( + return NextcloudUserStatusGetStatus.fromJson( json.decode(utf8.decode(response.body) as String) as Map); } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } - Future setStatus({required NextcloudUserStatusType statusType}) async { + Future setStatus({required NextcloudUserStatusType statusType}) async { var path = '/ocs/v2.php/apps/user_status/api/v1/user_status/status'; final queryParameters = {}; final headers = {}; @@ -1249,13 +1249,13 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetUserStatus.fromJson( + return NextcloudUserStatusGetStatus.fromJson( json.decode(utf8.decode(response.body) as String) as Map); } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } - Future setPredefinedMessage({ + Future setPredefinedMessage({ required String messageId, int? clearAt, }) async { @@ -1274,13 +1274,13 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetUserStatus.fromJson( + return NextcloudUserStatusGetStatus.fromJson( json.decode(utf8.decode(response.body) as String) as Map); } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } - Future setCustomMessage({ + Future setCustomMessage({ String? statusIcon, String? message, int? clearAt, @@ -1305,7 +1305,7 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetUserStatus.fromJson( + return NextcloudUserStatusGetStatus.fromJson( json.decode(utf8.decode(response.body) as String) as Map); } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line @@ -1346,7 +1346,7 @@ class NextcloudUserStatusClient { throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } - Future heartbeat({required NextcloudUserStatusType status}) async { + Future heartbeat({required NextcloudUserStatusType status}) async { var path = '/ocs/v2.php/apps/user_status/api/v1/heartbeat'; final queryParameters = {}; final headers = {}; @@ -1359,7 +1359,8 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatus.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + return NextcloudUserStatusStatus.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -4632,14 +4633,14 @@ class NextcloudUserStatusClearAt { static String? toJsonString(NextcloudUserStatusClearAt? data) => data == null ? null : json.encode(data.toJson()); } -class NextcloudUserStatusPublicUserStatus_ClearAt { - NextcloudUserStatusPublicUserStatus_ClearAt( +class NextcloudUserStatusPublicStatus_ClearAt { + NextcloudUserStatusPublicStatus_ClearAt( this._data, { this.userStatusClearAt, this.$int, }); - factory NextcloudUserStatusPublicUserStatus_ClearAt.fromJson(dynamic data) { + factory NextcloudUserStatusPublicStatus_ClearAt.fromJson(dynamic data) { NextcloudUserStatusClearAt? userStatusClearAt; int? $int; try { @@ -4648,7 +4649,7 @@ class NextcloudUserStatusPublicUserStatus_ClearAt { try { $int = (data as int); } catch (_) {} - return NextcloudUserStatusPublicUserStatus_ClearAt( + return NextcloudUserStatusPublicStatus_ClearAt( data, userStatusClearAt: userStatusClearAt, $int: $int, @@ -4656,8 +4657,8 @@ class NextcloudUserStatusPublicUserStatus_ClearAt { } // coverage:ignore-start - factory NextcloudUserStatusPublicUserStatus_ClearAt.fromJsonString(String data) => - NextcloudUserStatusPublicUserStatus_ClearAt.fromJson(json.decode(data)); + factory NextcloudUserStatusPublicStatus_ClearAt.fromJsonString(String data) => + NextcloudUserStatusPublicStatus_ClearAt.fromJson(json.decode(data)); // coverage:ignore-end final dynamic _data; @@ -4705,8 +4706,8 @@ enum NextcloudUserStatusType { } @JsonSerializable() -class NextcloudUserStatusPublicUserStatus { - NextcloudUserStatusPublicUserStatus({ +class NextcloudUserStatusPublicStatus { + NextcloudUserStatusPublicStatus({ required this.userId, this.message, this.icon, @@ -4715,13 +4716,13 @@ class NextcloudUserStatusPublicUserStatus { }); // coverage:ignore-start - factory NextcloudUserStatusPublicUserStatus.fromJson(Map json) => - _$NextcloudUserStatusPublicUserStatusFromJson(json); + factory NextcloudUserStatusPublicStatus.fromJson(Map json) => + _$NextcloudUserStatusPublicStatusFromJson(json); // coverage:ignore-end // coverage:ignore-start - factory NextcloudUserStatusPublicUserStatus.fromJsonString(String data) => - NextcloudUserStatusPublicUserStatus.fromJson(json.decode(data) as Map); + factory NextcloudUserStatusPublicStatus.fromJsonString(String data) => + NextcloudUserStatusPublicStatus.fromJson(json.decode(data) as Map); // coverage:ignore-end final String userId; @@ -4730,14 +4731,14 @@ class NextcloudUserStatusPublicUserStatus { final String? icon; - final NextcloudUserStatusPublicUserStatus_ClearAt clearAt; + final NextcloudUserStatusPublicStatus_ClearAt clearAt; final NextcloudUserStatusType status; // coverage:ignore-start - Map toJson() => _$NextcloudUserStatusPublicUserStatusToJson(this); + Map toJson() => _$NextcloudUserStatusPublicStatusToJson(this); // coverage:ignore-end - static String? toJsonString(NextcloudUserStatusPublicUserStatus? data) => + static String? toJsonString(NextcloudUserStatusPublicStatus? data) => data == null ? null : json.encode(data.toJson()); } @@ -4760,7 +4761,7 @@ class NextcloudUserStatusGetPublicStatuses_Ocs { final NextcloudOCSMeta meta; - final List data; + final List data; // coverage:ignore-start Map toJson() => _$NextcloudUserStatusGetPublicStatuses_OcsToJson(this); @@ -4795,17 +4796,17 @@ class NextcloudUserStatusGetPublicStatuses { class NextcloudUserStatusGetPublicStatus_Ocs_Data { NextcloudUserStatusGetPublicStatus_Ocs_Data( this._data, { - this.userStatusPublicUserStatus, + this.userStatusPublicStatus, }); factory NextcloudUserStatusGetPublicStatus_Ocs_Data.fromJson(dynamic data) { - NextcloudUserStatusPublicUserStatus? userStatusPublicUserStatus; + NextcloudUserStatusPublicStatus? userStatusPublicStatus; try { - userStatusPublicUserStatus = NextcloudUserStatusPublicUserStatus.fromJson(data as Map); + userStatusPublicStatus = NextcloudUserStatusPublicStatus.fromJson(data as Map); } catch (_) {} return NextcloudUserStatusGetPublicStatus_Ocs_Data( data, - userStatusPublicUserStatus: userStatusPublicUserStatus, + userStatusPublicStatus: userStatusPublicStatus, ); } @@ -4816,7 +4817,7 @@ class NextcloudUserStatusGetPublicStatus_Ocs_Data { final dynamic _data; - final NextcloudUserStatusPublicUserStatus? userStatusPublicUserStatus; + final NextcloudUserStatusPublicStatus? userStatusPublicStatus; // coverage:ignore-start dynamic toJson() => _data; @@ -4877,14 +4878,14 @@ class NextcloudUserStatusGetPublicStatus { data == null ? null : json.encode(data.toJson()); } -class NextcloudUserStatus_ClearAt { - NextcloudUserStatus_ClearAt( +class NextcloudUserStatusStatus_ClearAt { + NextcloudUserStatusStatus_ClearAt( this._data, { this.userStatusClearAt, this.$int, }); - factory NextcloudUserStatus_ClearAt.fromJson(dynamic data) { + factory NextcloudUserStatusStatus_ClearAt.fromJson(dynamic data) { NextcloudUserStatusClearAt? userStatusClearAt; int? $int; try { @@ -4893,7 +4894,7 @@ class NextcloudUserStatus_ClearAt { try { $int = (data as int); } catch (_) {} - return NextcloudUserStatus_ClearAt( + return NextcloudUserStatusStatus_ClearAt( data, userStatusClearAt: userStatusClearAt, $int: $int, @@ -4901,8 +4902,8 @@ class NextcloudUserStatus_ClearAt { } // coverage:ignore-start - factory NextcloudUserStatus_ClearAt.fromJsonString(String data) => - NextcloudUserStatus_ClearAt.fromJson(json.decode(data)); + factory NextcloudUserStatusStatus_ClearAt.fromJsonString(String data) => + NextcloudUserStatusStatus_ClearAt.fromJson(json.decode(data)); // coverage:ignore-end final dynamic _data; @@ -4921,8 +4922,8 @@ class NextcloudUserStatus_ClearAt { } @JsonSerializable() -class NextcloudUserStatus { - NextcloudUserStatus({ +class NextcloudUserStatusStatus { + NextcloudUserStatusStatus({ required this.userId, this.message, this.messageId, @@ -4934,12 +4935,12 @@ class NextcloudUserStatus { }); // coverage:ignore-start - factory NextcloudUserStatus.fromJson(Map json) => _$NextcloudUserStatusFromJson(json); + factory NextcloudUserStatusStatus.fromJson(Map json) => _$NextcloudUserStatusStatusFromJson(json); // coverage:ignore-end // coverage:ignore-start - factory NextcloudUserStatus.fromJsonString(String data) => - NextcloudUserStatus.fromJson(json.decode(data) as Map); + factory NextcloudUserStatusStatus.fromJsonString(String data) => + NextcloudUserStatusStatus.fromJson(json.decode(data) as Map); // coverage:ignore-end final String userId; @@ -4952,43 +4953,43 @@ class NextcloudUserStatus { final String? icon; - final NextcloudUserStatus_ClearAt clearAt; + final NextcloudUserStatusStatus_ClearAt clearAt; final NextcloudUserStatusType status; final bool statusIsUserDefined; // coverage:ignore-start - Map toJson() => _$NextcloudUserStatusToJson(this); + Map toJson() => _$NextcloudUserStatusStatusToJson(this); // coverage:ignore-end - static String? toJsonString(NextcloudUserStatus? data) => data == null ? null : json.encode(data.toJson()); + static String? toJsonString(NextcloudUserStatusStatus? data) => data == null ? null : json.encode(data.toJson()); } -class NextcloudUserStatusGetUserStatus_Ocs_Data { - NextcloudUserStatusGetUserStatus_Ocs_Data( +class NextcloudUserStatusGetStatus_Ocs_Data { + NextcloudUserStatusGetStatus_Ocs_Data( this._data, { - this.userStatus, + this.userStatusStatus, }); - factory NextcloudUserStatusGetUserStatus_Ocs_Data.fromJson(dynamic data) { - NextcloudUserStatus? userStatus; + factory NextcloudUserStatusGetStatus_Ocs_Data.fromJson(dynamic data) { + NextcloudUserStatusStatus? userStatusStatus; try { - userStatus = NextcloudUserStatus.fromJson(data as Map); + userStatusStatus = NextcloudUserStatusStatus.fromJson(data as Map); } catch (_) {} - return NextcloudUserStatusGetUserStatus_Ocs_Data( + return NextcloudUserStatusGetStatus_Ocs_Data( data, - userStatus: userStatus, + userStatusStatus: userStatusStatus, ); } // coverage:ignore-start - factory NextcloudUserStatusGetUserStatus_Ocs_Data.fromJsonString(String data) => - NextcloudUserStatusGetUserStatus_Ocs_Data.fromJson(json.decode(data)); + factory NextcloudUserStatusGetStatus_Ocs_Data.fromJsonString(String data) => + NextcloudUserStatusGetStatus_Ocs_Data.fromJson(json.decode(data)); // coverage:ignore-end final dynamic _data; - final NextcloudUserStatus? userStatus; + final NextcloudUserStatusStatus? userStatusStatus; // coverage:ignore-start dynamic toJson() => _data; @@ -4999,54 +5000,53 @@ class NextcloudUserStatusGetUserStatus_Ocs_Data { } @JsonSerializable() -class NextcloudUserStatusGetUserStatus_Ocs { - NextcloudUserStatusGetUserStatus_Ocs({ +class NextcloudUserStatusGetStatus_Ocs { + NextcloudUserStatusGetStatus_Ocs({ required this.meta, required this.data, }); // coverage:ignore-start - factory NextcloudUserStatusGetUserStatus_Ocs.fromJson(Map json) => - _$NextcloudUserStatusGetUserStatus_OcsFromJson(json); + factory NextcloudUserStatusGetStatus_Ocs.fromJson(Map json) => + _$NextcloudUserStatusGetStatus_OcsFromJson(json); // coverage:ignore-end // coverage:ignore-start - factory NextcloudUserStatusGetUserStatus_Ocs.fromJsonString(String data) => - NextcloudUserStatusGetUserStatus_Ocs.fromJson(json.decode(data) as Map); + factory NextcloudUserStatusGetStatus_Ocs.fromJsonString(String data) => + NextcloudUserStatusGetStatus_Ocs.fromJson(json.decode(data) as Map); // coverage:ignore-end final NextcloudOCSMeta meta; - final NextcloudUserStatusGetUserStatus_Ocs_Data data; + final NextcloudUserStatusGetStatus_Ocs_Data data; // coverage:ignore-start - Map toJson() => _$NextcloudUserStatusGetUserStatus_OcsToJson(this); + Map toJson() => _$NextcloudUserStatusGetStatus_OcsToJson(this); // coverage:ignore-end - static String? toJsonString(NextcloudUserStatusGetUserStatus_Ocs? data) => + static String? toJsonString(NextcloudUserStatusGetStatus_Ocs? data) => data == null ? null : json.encode(data.toJson()); } @JsonSerializable() -class NextcloudUserStatusGetUserStatus { - NextcloudUserStatusGetUserStatus({required this.ocs}); +class NextcloudUserStatusGetStatus { + NextcloudUserStatusGetStatus({required this.ocs}); // coverage:ignore-start - factory NextcloudUserStatusGetUserStatus.fromJson(Map json) => - _$NextcloudUserStatusGetUserStatusFromJson(json); + factory NextcloudUserStatusGetStatus.fromJson(Map json) => + _$NextcloudUserStatusGetStatusFromJson(json); // coverage:ignore-end // coverage:ignore-start - factory NextcloudUserStatusGetUserStatus.fromJsonString(String data) => - NextcloudUserStatusGetUserStatus.fromJson(json.decode(data) as Map); + factory NextcloudUserStatusGetStatus.fromJsonString(String data) => + NextcloudUserStatusGetStatus.fromJson(json.decode(data) as Map); // coverage:ignore-end - final NextcloudUserStatusGetUserStatus_Ocs ocs; + final NextcloudUserStatusGetStatus_Ocs ocs; // coverage:ignore-start - Map toJson() => _$NextcloudUserStatusGetUserStatusToJson(this); + Map toJson() => _$NextcloudUserStatusGetStatusToJson(this); // coverage:ignore-end - static String? toJsonString(NextcloudUserStatusGetUserStatus? data) => - data == null ? null : json.encode(data.toJson()); + static String? toJsonString(NextcloudUserStatusGetStatus? data) => data == null ? null : json.encode(data.toJson()); } class NextcloudUserStatusPredefinedStatus_ClearAt { @@ -5733,10 +5733,10 @@ final _deserializers = { List: (final data) => (data as List) .map((final e) => NextcloudUserStatusGetPublicStatuses_Ocs.fromJson(e as Map)) .toList(), - NextcloudUserStatusPublicUserStatus: (final data) => - NextcloudUserStatusPublicUserStatus.fromJson(data as Map), - List: (final data) => - (data as List).map((final e) => NextcloudUserStatusPublicUserStatus.fromJson(e as Map)).toList(), + NextcloudUserStatusPublicStatus: (final data) => + NextcloudUserStatusPublicStatus.fromJson(data as Map), + List: (final data) => + (data as List).map((final e) => NextcloudUserStatusPublicStatus.fromJson(e as Map)).toList(), NextcloudUserStatusClearAt: (final data) => NextcloudUserStatusClearAt.fromJson(data as Map), List: (final data) => (data as List).map((final e) => NextcloudUserStatusClearAt.fromJson(e as Map)).toList(), @@ -5749,18 +5749,16 @@ final _deserializers = { List: (final data) => (data as List) .map((final e) => NextcloudUserStatusGetPublicStatus_Ocs.fromJson(e as Map)) .toList(), - NextcloudUserStatusGetUserStatus: (final data) => - NextcloudUserStatusGetUserStatus.fromJson(data as Map), - List: (final data) => - (data as List).map((final e) => NextcloudUserStatusGetUserStatus.fromJson(e as Map)).toList(), - NextcloudUserStatusGetUserStatus_Ocs: (final data) => - NextcloudUserStatusGetUserStatus_Ocs.fromJson(data as Map), - List: (final data) => (data as List) - .map((final e) => NextcloudUserStatusGetUserStatus_Ocs.fromJson(e as Map)) - .toList(), - NextcloudUserStatus: (final data) => NextcloudUserStatus.fromJson(data as Map), - List: (final data) => - (data as List).map((final e) => NextcloudUserStatus.fromJson(e as Map)).toList(), + NextcloudUserStatusGetStatus: (final data) => NextcloudUserStatusGetStatus.fromJson(data as Map), + List: (final data) => + (data as List).map((final e) => NextcloudUserStatusGetStatus.fromJson(e as Map)).toList(), + NextcloudUserStatusGetStatus_Ocs: (final data) => + NextcloudUserStatusGetStatus_Ocs.fromJson(data as Map), + List: (final data) => + (data as List).map((final e) => NextcloudUserStatusGetStatus_Ocs.fromJson(e as Map)).toList(), + NextcloudUserStatusStatus: (final data) => NextcloudUserStatusStatus.fromJson(data as Map), + List: (final data) => + (data as List).map((final e) => NextcloudUserStatusStatus.fromJson(e as Map)).toList(), NextcloudUserStatusPredefinedStatuses: (final data) => NextcloudUserStatusPredefinedStatuses.fromJson(data as Map), List: (final data) => (data as List) @@ -6018,20 +6016,20 @@ final _serializers = { List: (final data) => data.map((final e) => e.toJson()).toList(), NextcloudUserStatusGetPublicStatuses_Ocs: (final data) => data.toJson(), List: (final data) => data.map((final e) => e.toJson()).toList(), - NextcloudUserStatusPublicUserStatus: (final data) => data.toJson(), - List: (final data) => data.map((final e) => e.toJson()).toList(), + NextcloudUserStatusPublicStatus: (final data) => data.toJson(), + List: (final data) => data.map((final e) => e.toJson()).toList(), NextcloudUserStatusClearAt: (final data) => data.toJson(), List: (final data) => data.map((final e) => e.toJson()).toList(), NextcloudUserStatusGetPublicStatus: (final data) => data.toJson(), List: (final data) => data.map((final e) => e.toJson()).toList(), NextcloudUserStatusGetPublicStatus_Ocs: (final data) => data.toJson(), List: (final data) => data.map((final e) => e.toJson()).toList(), - NextcloudUserStatusGetUserStatus: (final data) => data.toJson(), - List: (final data) => data.map((final e) => e.toJson()).toList(), - NextcloudUserStatusGetUserStatus_Ocs: (final data) => data.toJson(), - List: (final data) => data.map((final e) => e.toJson()).toList(), - NextcloudUserStatus: (final data) => data.toJson(), - List: (final data) => data.map((final e) => e.toJson()).toList(), + NextcloudUserStatusGetStatus: (final data) => data.toJson(), + List: (final data) => data.map((final e) => e.toJson()).toList(), + NextcloudUserStatusGetStatus_Ocs: (final data) => data.toJson(), + List: (final data) => data.map((final e) => e.toJson()).toList(), + NextcloudUserStatusStatus: (final data) => data.toJson(), + List: (final data) => data.map((final e) => e.toJson()).toList(), NextcloudUserStatusPredefinedStatuses: (final data) => data.toJson(), List: (final data) => data.map((final e) => e.toJson()).toList(), NextcloudUserStatusPredefinedStatuses_Ocs: (final data) => data.toJson(), diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.g.dart b/packages/nextcloud/lib/src/nextcloud.openapi.g.dart index d68bc5f3..97e4860a 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.g.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.g.dart @@ -1970,21 +1970,21 @@ const _$NextcloudUserStatusClearAt_TypeEnumMap = { NextcloudUserStatusClearAt_Type.endOf: 'end-of', }; -NextcloudUserStatusPublicUserStatus _$NextcloudUserStatusPublicUserStatusFromJson(Map json) { +NextcloudUserStatusPublicStatus _$NextcloudUserStatusPublicStatusFromJson(Map json) { $checkKeys( json, allowedKeys: const ['userId', 'message', 'icon', 'clearAt', 'status'], ); - return NextcloudUserStatusPublicUserStatus( + return NextcloudUserStatusPublicStatus( userId: json['userId'] as String, message: json['message'] as String?, icon: json['icon'] as String?, - clearAt: NextcloudUserStatusPublicUserStatus_ClearAt.fromJson(json['clearAt']), + clearAt: NextcloudUserStatusPublicStatus_ClearAt.fromJson(json['clearAt']), status: $enumDecode(_$NextcloudUserStatusTypeEnumMap, json['status']), ); } -Map _$NextcloudUserStatusPublicUserStatusToJson(NextcloudUserStatusPublicUserStatus instance) => +Map _$NextcloudUserStatusPublicStatusToJson(NextcloudUserStatusPublicStatus instance) => { 'userId': instance.userId, 'message': instance.message, @@ -2009,7 +2009,7 @@ NextcloudUserStatusGetPublicStatuses_Ocs _$NextcloudUserStatusGetPublicStatuses_ return NextcloudUserStatusGetPublicStatuses_Ocs( meta: NextcloudOCSMeta.fromJson(json['meta'] as Map), data: (json['data'] as List) - .map((e) => NextcloudUserStatusPublicUserStatus.fromJson(e as Map)) + .map((e) => NextcloudUserStatusPublicStatus.fromJson(e as Map)) .toList(), ); } @@ -2068,7 +2068,7 @@ Map _$NextcloudUserStatusGetPublicStatusToJson(NextcloudUserSta 'ocs': instance.ocs.toJson(), }; -NextcloudUserStatus _$NextcloudUserStatusFromJson(Map json) { +NextcloudUserStatusStatus _$NextcloudUserStatusStatusFromJson(Map json) { $checkKeys( json, allowedKeys: const [ @@ -2082,19 +2082,19 @@ NextcloudUserStatus _$NextcloudUserStatusFromJson(Map json) { 'statusIsUserDefined' ], ); - return NextcloudUserStatus( + return NextcloudUserStatusStatus( userId: json['userId'] as String, message: json['message'] as String?, messageId: json['messageId'] as String?, messageIsPredefined: json['messageIsPredefined'] as bool, icon: json['icon'] as String?, - clearAt: NextcloudUserStatus_ClearAt.fromJson(json['clearAt']), + clearAt: NextcloudUserStatusStatus_ClearAt.fromJson(json['clearAt']), status: $enumDecode(_$NextcloudUserStatusTypeEnumMap, json['status']), statusIsUserDefined: json['statusIsUserDefined'] as bool, ); } -Map _$NextcloudUserStatusToJson(NextcloudUserStatus instance) => { +Map _$NextcloudUserStatusStatusToJson(NextcloudUserStatusStatus instance) => { 'userId': instance.userId, 'message': instance.message, 'messageId': instance.messageId, @@ -2105,35 +2105,34 @@ Map _$NextcloudUserStatusToJson(NextcloudUserStatus instance) = 'statusIsUserDefined': instance.statusIsUserDefined, }; -NextcloudUserStatusGetUserStatus_Ocs _$NextcloudUserStatusGetUserStatus_OcsFromJson(Map json) { +NextcloudUserStatusGetStatus_Ocs _$NextcloudUserStatusGetStatus_OcsFromJson(Map json) { $checkKeys( json, allowedKeys: const ['meta', 'data'], ); - return NextcloudUserStatusGetUserStatus_Ocs( + return NextcloudUserStatusGetStatus_Ocs( meta: NextcloudOCSMeta.fromJson(json['meta'] as Map), - data: NextcloudUserStatusGetUserStatus_Ocs_Data.fromJson(json['data']), + data: NextcloudUserStatusGetStatus_Ocs_Data.fromJson(json['data']), ); } -Map _$NextcloudUserStatusGetUserStatus_OcsToJson(NextcloudUserStatusGetUserStatus_Ocs instance) => +Map _$NextcloudUserStatusGetStatus_OcsToJson(NextcloudUserStatusGetStatus_Ocs instance) => { 'meta': instance.meta.toJson(), 'data': instance.data.toJson(), }; -NextcloudUserStatusGetUserStatus _$NextcloudUserStatusGetUserStatusFromJson(Map json) { +NextcloudUserStatusGetStatus _$NextcloudUserStatusGetStatusFromJson(Map json) { $checkKeys( json, allowedKeys: const ['ocs'], ); - return NextcloudUserStatusGetUserStatus( - ocs: NextcloudUserStatusGetUserStatus_Ocs.fromJson(json['ocs'] as Map), + return NextcloudUserStatusGetStatus( + ocs: NextcloudUserStatusGetStatus_Ocs.fromJson(json['ocs'] as Map), ); } -Map _$NextcloudUserStatusGetUserStatusToJson(NextcloudUserStatusGetUserStatus instance) => - { +Map _$NextcloudUserStatusGetStatusToJson(NextcloudUserStatusGetStatus instance) => { 'ocs': instance.ocs.toJson(), }; diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.json b/packages/nextcloud/lib/src/nextcloud.openapi.json index d5cff1f7..f49328fd 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.json +++ b/packages/nextcloud/lib/src/nextcloud.openapi.json @@ -1842,7 +1842,7 @@ "invisible" ] }, - "UserStatusGetUserStatus": { + "UserStatusGetStatus": { "type": "object", "required": [ "ocs" @@ -1861,7 +1861,7 @@ "data": { "anyOf": [ { - "$ref": "#/components/schemas/UserStatus" + "$ref": "#/components/schemas/UserStatusStatus" } ] } @@ -1888,7 +1888,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/UserStatusPublicUserStatus" + "$ref": "#/components/schemas/UserStatusPublicStatus" } } } @@ -1914,7 +1914,7 @@ "data": { "anyOf": [ { - "$ref": "#/components/schemas/UserStatusPublicUserStatus" + "$ref": "#/components/schemas/UserStatusPublicStatus" } ] } @@ -1922,7 +1922,7 @@ } } }, - "UserStatus": { + "UserStatusStatus": { "type": "object", "required": [ "userId", @@ -1966,7 +1966,7 @@ } } }, - "UserStatusPublicUserStatus": { + "UserStatusPublicStatus": { "type": "object", "required": [ "userId", @@ -3524,7 +3524,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetUserStatus" + "$ref": "#/components/schemas/UserStatusGetStatus" } } } @@ -3554,7 +3554,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetUserStatus" + "$ref": "#/components/schemas/UserStatusGetStatus" } } } @@ -3592,7 +3592,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetUserStatus" + "$ref": "#/components/schemas/UserStatusGetStatus" } } } @@ -3638,7 +3638,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetUserStatus" + "$ref": "#/components/schemas/UserStatusGetStatus" } } } @@ -3701,7 +3701,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatus" + "$ref": "#/components/schemas/UserStatusStatus" } } } diff --git a/packages/nextcloud/test/user_status.dart b/packages/nextcloud/test/user_status.dart index e69512da..727a251a 100644 --- a/packages/nextcloud/test/user_status.dart +++ b/packages/nextcloud/test/user_status.dart @@ -52,15 +52,15 @@ Future run(final DockerImage image) async { test('Set status', () async { final response = await client.userStatus.setStatus(statusType: NextcloudUserStatusType.online); - expect(response.ocs.data.userStatus!.userId, 'user1'); - expect(response.ocs.data.userStatus!.message, null); - expect(response.ocs.data.userStatus!.messageId, null); - expect(response.ocs.data.userStatus!.messageIsPredefined, false); - expect(response.ocs.data.userStatus!.icon, null); - expect(response.ocs.data.userStatus!.clearAt.userStatusClearAt, null); - expect(response.ocs.data.userStatus!.clearAt.$int, null); - expect(response.ocs.data.userStatus!.status, NextcloudUserStatusType.online); - expect(response.ocs.data.userStatus!.statusIsUserDefined, true); + expect(response.ocs.data.userStatusStatus!.userId, 'user1'); + expect(response.ocs.data.userStatusStatus!.message, null); + expect(response.ocs.data.userStatusStatus!.messageId, null); + expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false); + expect(response.ocs.data.userStatusStatus!.icon, null); + expect(response.ocs.data.userStatusStatus!.clearAt.userStatusClearAt, null); + expect(response.ocs.data.userStatusStatus!.clearAt.$int, null); + expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.online); + expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, true); }); test('Get status', () async { @@ -69,15 +69,15 @@ Future run(final DockerImage image) async { await client.userStatus.setStatus(statusType: NextcloudUserStatusType.online); final response = await client.userStatus.getStatus(); - expect(response.ocs.data.userStatus!.userId, 'user1'); - expect(response.ocs.data.userStatus!.message, null); - expect(response.ocs.data.userStatus!.messageId, null); - expect(response.ocs.data.userStatus!.messageIsPredefined, false); - expect(response.ocs.data.userStatus!.icon, null); - expect(response.ocs.data.userStatus!.clearAt.userStatusClearAt, null); - expect(response.ocs.data.userStatus!.clearAt.$int, null); - expect(response.ocs.data.userStatus!.status, NextcloudUserStatusType.online); - expect(response.ocs.data.userStatus!.statusIsUserDefined, true); + expect(response.ocs.data.userStatusStatus!.userId, 'user1'); + expect(response.ocs.data.userStatusStatus!.message, null); + expect(response.ocs.data.userStatusStatus!.messageId, null); + expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false); + expect(response.ocs.data.userStatusStatus!.icon, null); + expect(response.ocs.data.userStatusStatus!.clearAt.userStatusClearAt, null); + expect(response.ocs.data.userStatusStatus!.clearAt.$int, null); + expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.online); + expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, true); }); test('Find all statuses', () async { @@ -101,12 +101,12 @@ Future run(final DockerImage image) async { await client.userStatus.setStatus(statusType: NextcloudUserStatusType.online); final response = await client.userStatus.getPublicStatus(userId: 'user1'); - expect(response.ocs.data.userStatusPublicUserStatus!.userId, 'user1'); - expect(response.ocs.data.userStatusPublicUserStatus!.message, null); - expect(response.ocs.data.userStatusPublicUserStatus!.icon, null); - expect(response.ocs.data.userStatusPublicUserStatus!.clearAt.userStatusClearAt, null); - expect(response.ocs.data.userStatusPublicUserStatus!.clearAt.$int, null); - expect(response.ocs.data.userStatusPublicUserStatus!.status, NextcloudUserStatusType.online); + expect(response.ocs.data.userStatusPublicStatus!.userId, 'user1'); + expect(response.ocs.data.userStatusPublicStatus!.message, null); + expect(response.ocs.data.userStatusPublicStatus!.icon, null); + expect(response.ocs.data.userStatusPublicStatus!.clearAt.userStatusClearAt, null); + expect(response.ocs.data.userStatusPublicStatus!.clearAt.$int, null); + expect(response.ocs.data.userStatusPublicStatus!.status, NextcloudUserStatusType.online); }); test('Set predefined message', () async { @@ -115,14 +115,14 @@ Future run(final DockerImage image) async { messageId: 'meeting', clearAt: clearAt, ); - expect(response.ocs.data.userStatus!.userId, 'user1'); - expect(response.ocs.data.userStatus!.message, null); - expect(response.ocs.data.userStatus!.messageId, 'meeting'); - expect(response.ocs.data.userStatus!.messageIsPredefined, true); - expect(response.ocs.data.userStatus!.icon, null); - expect(response.ocs.data.userStatus!.clearAt.$int, clearAt); - expect(response.ocs.data.userStatus!.status, NextcloudUserStatusType.offline); - expect(response.ocs.data.userStatus!.statusIsUserDefined, false); + expect(response.ocs.data.userStatusStatus!.userId, 'user1'); + expect(response.ocs.data.userStatusStatus!.message, null); + expect(response.ocs.data.userStatusStatus!.messageId, 'meeting'); + expect(response.ocs.data.userStatusStatus!.messageIsPredefined, true); + expect(response.ocs.data.userStatusStatus!.icon, null); + expect(response.ocs.data.userStatusStatus!.clearAt.$int, clearAt); + expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.offline); + expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, false); }); test('Set custom message', () async { @@ -132,14 +132,14 @@ Future run(final DockerImage image) async { message: 'bla', clearAt: clearAt, ); - expect(response.ocs.data.userStatus!.userId, 'user1'); - expect(response.ocs.data.userStatus!.message, 'bla'); - expect(response.ocs.data.userStatus!.messageId, null); - expect(response.ocs.data.userStatus!.messageIsPredefined, false); - expect(response.ocs.data.userStatus!.icon, '😀'); - expect(response.ocs.data.userStatus!.clearAt.$int, clearAt); - expect(response.ocs.data.userStatus!.status, NextcloudUserStatusType.offline); - expect(response.ocs.data.userStatus!.statusIsUserDefined, false); + expect(response.ocs.data.userStatusStatus!.userId, 'user1'); + expect(response.ocs.data.userStatusStatus!.message, 'bla'); + expect(response.ocs.data.userStatusStatus!.messageId, null); + expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false); + expect(response.ocs.data.userStatusStatus!.icon, '😀'); + expect(response.ocs.data.userStatusStatus!.clearAt.$int, clearAt); + expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.offline); + expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, false); }); test('Clear message', () async { @@ -152,15 +152,15 @@ Future run(final DockerImage image) async { await client.userStatus.clearMessage(); final response = await client.userStatus.getStatus(); - expect(response.ocs.data.userStatus!.userId, 'user1'); - expect(response.ocs.data.userStatus!.message, null); - expect(response.ocs.data.userStatus!.messageId, null); - expect(response.ocs.data.userStatus!.messageIsPredefined, false); - expect(response.ocs.data.userStatus!.icon, null); - expect(response.ocs.data.userStatus!.clearAt.userStatusClearAt, null); - expect(response.ocs.data.userStatus!.clearAt.$int, null); - expect(response.ocs.data.userStatus!.status, NextcloudUserStatusType.offline); - expect(response.ocs.data.userStatus!.statusIsUserDefined, false); + expect(response.ocs.data.userStatusStatus!.userId, 'user1'); + expect(response.ocs.data.userStatusStatus!.message, null); + expect(response.ocs.data.userStatusStatus!.messageId, null); + expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false); + expect(response.ocs.data.userStatusStatus!.icon, null); + expect(response.ocs.data.userStatusStatus!.clearAt.userStatusClearAt, null); + expect(response.ocs.data.userStatusStatus!.clearAt.$int, null); + expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.offline); + expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, false); }); test('Heartbeat', () async { diff --git a/specs/core.json b/specs/core.json index 94b475f6..a95c2115 100644 --- a/specs/core.json +++ b/specs/core.json @@ -81,7 +81,7 @@ } } }, - "CoreServerStatus": { + "ServerStatus": { "type": "object", "required": [ "installed", @@ -120,7 +120,7 @@ } } }, - "CoreServerCapabilities": { + "ServerCapabilities": { "type": "object", "required": [ "ocs" @@ -783,7 +783,7 @@ } } }, - "CoreNavigationApps": { + "NavigationApps": { "type": "object", "required": [ "ocs" @@ -857,7 +857,7 @@ } } }, - "CoreLoginFlowInit": { + "LoginFlowInit": { "type": "object", "required": [ "poll", @@ -884,7 +884,7 @@ } } }, - "CoreLoginFlowResult": { + "LoginFlowResult": { "type": "object", "required": [ "server", @@ -903,7 +903,7 @@ } } }, - "CoreAutocompleteResult": { + "AutocompleteResult": { "type": "object", "required": [ "ocs" @@ -986,7 +986,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CoreServerStatus" + "$ref": "#/components/schemas/ServerStatus" } } } @@ -1006,7 +1006,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CoreServerCapabilities" + "$ref": "#/components/schemas/ServerCapabilities" } } } @@ -1026,7 +1026,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CoreNavigationApps" + "$ref": "#/components/schemas/NavigationApps" } } } @@ -1046,7 +1046,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CoreLoginFlowInit" + "$ref": "#/components/schemas/LoginFlowInit" } } } @@ -1076,7 +1076,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CoreLoginFlowResult" + "$ref": "#/components/schemas/LoginFlowResult" } } } @@ -1306,7 +1306,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CoreAutocompleteResult" + "$ref": "#/components/schemas/AutocompleteResult" } } } diff --git a/specs/news.json b/specs/news.json index 053b5992..860b5103 100644 --- a/specs/news.json +++ b/specs/news.json @@ -81,7 +81,7 @@ } } }, - "NewsListFeeds": { + "ListFeeds": { "type": "object", "required": [ "feeds" @@ -96,12 +96,12 @@ "feeds": { "type": "array", "items": { - "$ref": "#/components/schemas/NewsFeed" + "$ref": "#/components/schemas/Feed" } } } }, - "NewsFeed": { + "Feed": { "type": "object", "required": [ "id", @@ -154,12 +154,12 @@ "items": { "type": "array", "items": { - "$ref": "#/components/schemas/NewsArticle" + "$ref": "#/components/schemas/Article" } } } }, - "NewsArticle": { + "Article": { "type": "object", "required": [ "id", @@ -239,7 +239,7 @@ } } }, - "NewsListArticles": { + "ListArticles": { "type": "object", "required": [ "items" @@ -248,12 +248,12 @@ "items": { "type": "array", "items": { - "$ref": "#/components/schemas/NewsArticle" + "$ref": "#/components/schemas/Article" } } } }, - "NewsListFolders": { + "ListFolders": { "type": "object", "required": [ "folders" @@ -262,12 +262,12 @@ "folders": { "type": "array", "items": { - "$ref": "#/components/schemas/NewsFolder" + "$ref": "#/components/schemas/Folder" } } } }, - "NewsFolder": { + "Folder": { "type": "object", "required": [ "id", @@ -290,12 +290,12 @@ "deprecated": true, "type": "array", "items": { - "$ref": "#/components/schemas/NewsFeed" + "$ref": "#/components/schemas/Feed" } } } }, - "NewsSupportedAPIVersions": { + "SupportedAPIVersions": { "type": "object", "properties": { "apiLevels": { @@ -327,7 +327,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NewsSupportedAPIVersions" + "$ref": "#/components/schemas/SupportedAPIVersions" } } } @@ -347,7 +347,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NewsListFolders" + "$ref": "#/components/schemas/ListFolders" } } } @@ -375,7 +375,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NewsListFolders" + "$ref": "#/components/schemas/ListFolders" } } } @@ -474,7 +474,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NewsListFeeds" + "$ref": "#/components/schemas/ListFeeds" } } } @@ -510,7 +510,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NewsListFeeds" + "$ref": "#/components/schemas/ListFeeds" } } } @@ -708,7 +708,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NewsListArticles" + "$ref": "#/components/schemas/ListArticles" } } } @@ -757,7 +757,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NewsListArticles" + "$ref": "#/components/schemas/ListArticles" } } } diff --git a/specs/notes.json b/specs/notes.json index 97b13ea5..94fbe3b9 100644 --- a/specs/notes.json +++ b/specs/notes.json @@ -81,7 +81,7 @@ } } }, - "NotesNote": { + "Note": { "type": "object", "required": [ "id", @@ -128,7 +128,7 @@ } } }, - "NotesSettings": { + "Settings": { "type": "object", "required": [ "notesPath", @@ -226,7 +226,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/NotesNote" + "$ref": "#/components/schemas/Note" } } } @@ -292,7 +292,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotesNote" + "$ref": "#/components/schemas/Note" } } } @@ -340,7 +340,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotesNote" + "$ref": "#/components/schemas/Note" } } } @@ -408,7 +408,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotesNote" + "$ref": "#/components/schemas/Note" } } } @@ -446,7 +446,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotesSettings" + "$ref": "#/components/schemas/Settings" } } } @@ -463,7 +463,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotesSettings" + "$ref": "#/components/schemas/Settings" } } } @@ -474,7 +474,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotesSettings" + "$ref": "#/components/schemas/Settings" } } } diff --git a/specs/notifications.json b/specs/notifications.json index 01e82cb4..52bc4864 100644 --- a/specs/notifications.json +++ b/specs/notifications.json @@ -81,7 +81,7 @@ } } }, - "NotificationsNotification": { + "Notification": { "type": "object", "required": [ "notification_id", @@ -156,12 +156,12 @@ "actions": { "type": "array", "items": { - "$ref": "#/components/schemas/NotificationsNotificationAction" + "$ref": "#/components/schemas/NotificationAction" } } } }, - "NotificationsNotificationAction": { + "NotificationAction": { "type": "object", "required": [ "label", @@ -183,7 +183,7 @@ } } }, - "NotificationsListNotifications": { + "ListNotifications": { "type": "object", "required": [ "ocs" @@ -202,14 +202,14 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/NotificationsNotification" + "$ref": "#/components/schemas/Notification" } } } } } }, - "NotificationsGetNotification": { + "GetNotification": { "type": "object", "required": [ "ocs" @@ -226,13 +226,13 @@ "$ref": "#/components/schemas/OCSMeta" }, "data": { - "$ref": "#/components/schemas/NotificationsNotification" + "$ref": "#/components/schemas/Notification" } } } } }, - "NotificationsPushServerSubscription": { + "PushServerSubscription": { "type": "object", "required": [ "publicKey", @@ -254,7 +254,7 @@ } } }, - "NotificationsPushServerRegistration": { + "PushServerRegistration": { "type": "object", "required": [ "ocs" @@ -271,13 +271,13 @@ "$ref": "#/components/schemas/OCSMeta" }, "data": { - "$ref": "#/components/schemas/NotificationsPushServerSubscription" + "$ref": "#/components/schemas/PushServerSubscription" } } } } }, - "NotificationsPushNotification": { + "PushNotification": { "type": "object", "required": [ "accountID", @@ -296,11 +296,11 @@ "type": "string" }, "subject": { - "$ref": "#/components/schemas/NotificationsPushNotificationDecryptedSubject" + "$ref": "#/components/schemas/PushNotificationDecryptedSubject" } } }, - "NotificationsPushNotificationDecryptedSubject": { + "PushNotificationDecryptedSubject": { "type": "object", "properties": { "nid": { @@ -347,7 +347,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotificationsListNotifications" + "$ref": "#/components/schemas/ListNotifications" } } } @@ -395,7 +395,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotificationsGetNotification" + "$ref": "#/components/schemas/GetNotification" } } } @@ -460,7 +460,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotificationsPushServerRegistration" + "$ref": "#/components/schemas/PushServerRegistration" } } } diff --git a/specs/provisioning_api.json b/specs/provisioning_api.json index c4ec4e01..f5a356bf 100644 --- a/specs/provisioning_api.json +++ b/specs/provisioning_api.json @@ -81,7 +81,7 @@ } } }, - "ProvisioningApiUser": { + "User": { "type": "object", "required": [ "ocs" @@ -98,13 +98,13 @@ "$ref": "#/components/schemas/OCSMeta" }, "data": { - "$ref": "#/components/schemas/ProvisioningApiUserDetails" + "$ref": "#/components/schemas/UserDetails" } } } } }, - "ProvisioningApiUserDetails": { + "UserDetails": { "type": "object", "required": [ "storageLocation", @@ -327,7 +327,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProvisioningApiUser" + "$ref": "#/components/schemas/User" } } } @@ -357,7 +357,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProvisioningApiUser" + "$ref": "#/components/schemas/User" } } } diff --git a/specs/user_status.json b/specs/user_status.json index 08ad3d72..ecac29b5 100644 --- a/specs/user_status.json +++ b/specs/user_status.json @@ -81,7 +81,7 @@ } } }, - "UserStatusPredefinedStatuses": { + "PredefinedStatuses": { "type": "object", "required": [ "ocs" @@ -100,14 +100,14 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/UserStatusPredefinedStatus" + "$ref": "#/components/schemas/PredefinedStatus" } } } } } }, - "UserStatusPredefinedStatus": { + "PredefinedStatus": { "type": "object", "required": [ "id", @@ -128,7 +128,7 @@ "clearAt": { "anyOf": [ { - "$ref": "#/components/schemas/UserStatusClearAt" + "$ref": "#/components/schemas/ClearAt" }, { "type": "integer", @@ -138,7 +138,7 @@ } } }, - "UserStatusClearAt": { + "ClearAt": { "type": "object", "required": [ "type", @@ -169,7 +169,7 @@ } } }, - "UserStatusType": { + "Type": { "type": "string", "enum": [ "online", @@ -179,7 +179,7 @@ "invisible" ] }, - "UserStatusGetUserStatus": { + "GetStatus": { "type": "object", "required": [ "ocs" @@ -198,7 +198,7 @@ "data": { "anyOf": [ { - "$ref": "#/components/schemas/UserStatus" + "$ref": "#/components/schemas/Status" } ] } @@ -206,7 +206,7 @@ } } }, - "UserStatusGetPublicStatuses": { + "GetPublicStatuses": { "type": "object", "required": [ "ocs" @@ -225,14 +225,14 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/UserStatusPublicUserStatus" + "$ref": "#/components/schemas/PublicStatus" } } } } } }, - "UserStatusGetPublicStatus": { + "GetPublicStatus": { "type": "object", "required": [ "ocs" @@ -251,7 +251,7 @@ "data": { "anyOf": [ { - "$ref": "#/components/schemas/UserStatusPublicUserStatus" + "$ref": "#/components/schemas/PublicStatus" } ] } @@ -259,7 +259,7 @@ } } }, - "UserStatus": { + "Status": { "type": "object", "required": [ "userId", @@ -287,7 +287,7 @@ "clearAt": { "anyOf": [ { - "$ref": "#/components/schemas/UserStatusClearAt" + "$ref": "#/components/schemas/ClearAt" }, { "type": "integer", @@ -296,14 +296,14 @@ ] }, "status": { - "$ref": "#/components/schemas/UserStatusType" + "$ref": "#/components/schemas/Type" }, "statusIsUserDefined": { "type": "boolean" } } }, - "UserStatusPublicUserStatus": { + "PublicStatus": { "type": "object", "required": [ "userId", @@ -323,7 +323,7 @@ "clearAt": { "anyOf": [ { - "$ref": "#/components/schemas/UserStatusClearAt" + "$ref": "#/components/schemas/ClearAt" }, { "type": "integer", @@ -332,7 +332,7 @@ ] }, "status": { - "$ref": "#/components/schemas/UserStatusType" + "$ref": "#/components/schemas/Type" } } } @@ -357,7 +357,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetPublicStatuses" + "$ref": "#/components/schemas/GetPublicStatuses" } } } @@ -387,7 +387,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetPublicStatus" + "$ref": "#/components/schemas/GetPublicStatus" } } } @@ -407,7 +407,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetUserStatus" + "$ref": "#/components/schemas/GetStatus" } } } @@ -427,7 +427,7 @@ "in": "query", "required": true, "schema": { - "$ref": "#/components/schemas/UserStatusType" + "$ref": "#/components/schemas/Type" } } ], @@ -437,7 +437,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetUserStatus" + "$ref": "#/components/schemas/GetStatus" } } } @@ -475,7 +475,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetUserStatus" + "$ref": "#/components/schemas/GetStatus" } } } @@ -521,7 +521,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusGetUserStatus" + "$ref": "#/components/schemas/GetStatus" } } } @@ -554,7 +554,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatusPredefinedStatuses" + "$ref": "#/components/schemas/PredefinedStatuses" } } } @@ -574,7 +574,7 @@ "in": "query", "required": true, "schema": { - "$ref": "#/components/schemas/UserStatusType" + "$ref": "#/components/schemas/Type" } } ], @@ -584,7 +584,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserStatus" + "$ref": "#/components/schemas/Status" } } } diff --git a/tool/generate-nextcloud.sh b/tool/generate-nextcloud.sh index 53c29aa0..408f9bc3 100755 --- a/tool/generate-nextcloud.sh +++ b/tool/generate-nextcloud.sh @@ -6,12 +6,25 @@ rm -rf /tmp/nextcloud-neon mkdir -p /tmp/nextcloud-neon codenames=(core news notes notifications provisioning_api user_status) +prefixes=(Core News Notes Notifications ProvisioningApi UserStatus) base_spec=/tmp/nextcloud-neon/base.json merged_spec=/tmp/nextcloud-neon/merged.json -for codename in ${codenames[*]}; do +for i in $(seq 0 $((${#codenames[@]} - 1))); do + codename=${codenames[i]} + prefix=${prefixes[i]} + cp specs/"$codename".json /tmp/nextcloud-neon/"$codename".json + jq \ + --arg prefix "$prefix" \ + -s \ + '.[] + | .components.schemas = (.components.schemas | with_entries(.key = if .key == "OCSMeta" or .key == "EmptyOCS" then .key else $prefix + .key end)) + | walk(if type == "object" and has("$ref") and ."$ref" != "#/components/schemas/OCSMeta" and ."$ref" != "#/components/schemas/EmptyOCS" then ."$ref" |= sub("#/components/schemas/";"#/components/schemas/" + $prefix) else . end)' \ + /tmp/nextcloud-neon/"$codename".json \ + > /tmp/nextcloud-neon/"$codename"-prefixed.json + if [ ! -f $base_spec ]; then - cp specs/"$codename".json $base_spec + cp /tmp/nextcloud-neon/"$codename"-prefixed.json $base_spec else jq \ -s \ @@ -23,7 +36,7 @@ for codename in ${codenames[*]}; do paths: (.[0].paths * .[1].paths), }' \ $base_spec \ - specs/"$codename".json \ + /tmp/nextcloud-neon/"$codename"-prefixed.json \ > $merged_spec cp $merged_spec $base_spec fi