Browse Source

fix problems in the spec

Signed-off-by: Nikolas Rimikis <rimikis.nikolas@gmail.com>
pull/228/head
Nikolas Rimikis 2 years ago
parent
commit
ee828fc524
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 114
      packages/nextcloud/lib/src/nextcloud.openapi.dart
  2. 22
      packages/nextcloud/lib/src/nextcloud.openapi.g.dart
  3. 49
      packages/nextcloud/lib/src/nextcloud.openapi.json
  4. 8
      packages/nextcloud/test/notifications.dart
  5. 33
      packages/nextcloud/test/user_status.dart
  6. 8
      specs/core.json
  7. 14
      specs/notifications.json
  8. 27
      specs/user_status.json

114
packages/nextcloud/lib/src/nextcloud.openapi.dart

@ -3709,16 +3709,23 @@ class NextcloudCoreLoginFlowResult {
class NextcloudCoreAutocompleteResult_Ocs_Data_Status { class NextcloudCoreAutocompleteResult_Ocs_Data_Status {
NextcloudCoreAutocompleteResult_Ocs_Data_Status( NextcloudCoreAutocompleteResult_Ocs_Data_Status(
this._data, { this._data, {
this.listDynamic,
this.string, this.string,
}); });
factory NextcloudCoreAutocompleteResult_Ocs_Data_Status.fromJson(dynamic data) { factory NextcloudCoreAutocompleteResult_Ocs_Data_Status.fromJson(dynamic data) {
List<dynamic>? listDynamic;
String? string; String? string;
try {
listDynamic = (data as List).map((final e) => (e as dynamic)).toList();
} catch (_) {}
try { try {
string = (data as String); string = (data as String);
} catch (_) {} } catch (_) {}
assert([listDynamic, string].where((final x) => x != null).length == 1, 'Need oneOf for $data');
return NextcloudCoreAutocompleteResult_Ocs_Data_Status( return NextcloudCoreAutocompleteResult_Ocs_Data_Status(
data, data,
listDynamic: listDynamic,
string: string, string: string,
); );
} }
@ -3730,6 +3737,8 @@ class NextcloudCoreAutocompleteResult_Ocs_Data_Status {
final dynamic _data; final dynamic _data;
final List<dynamic>? listDynamic;
final String? string; final String? string;
// coverage:ignore-start // coverage:ignore-start
@ -4202,74 +4211,6 @@ class NextcloudNotesSettings {
static String? toJsonString(NextcloudNotesSettings? data) => data == null ? null : json.encode(data.toJson()); static String? toJsonString(NextcloudNotesSettings? data) => data == null ? null : json.encode(data.toJson());
} }
class NextcloudNotificationsNotification_SubjectRichParameters {
NextcloudNotificationsNotification_SubjectRichParameters(
this._data, {
this.mapStringDynamic,
});
factory NextcloudNotificationsNotification_SubjectRichParameters.fromJson(dynamic data) {
Map<String, dynamic>? mapStringDynamic;
try {
mapStringDynamic = (data as Map<String, dynamic>);
} catch (_) {}
return NextcloudNotificationsNotification_SubjectRichParameters(
data,
mapStringDynamic: mapStringDynamic,
);
}
// coverage:ignore-start
factory NextcloudNotificationsNotification_SubjectRichParameters.fromJsonString(String data) =>
NextcloudNotificationsNotification_SubjectRichParameters.fromJson(json.decode(data));
// coverage:ignore-end
final dynamic _data;
final Map<String, dynamic>? mapStringDynamic;
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
// coverage:ignore-start
static String toJsonString(dynamic data) => json.encode(data);
// coverage:ignore-end
}
class NextcloudNotificationsNotification_MessageRichParameters {
NextcloudNotificationsNotification_MessageRichParameters(
this._data, {
this.mapStringDynamic,
});
factory NextcloudNotificationsNotification_MessageRichParameters.fromJson(dynamic data) {
Map<String, dynamic>? mapStringDynamic;
try {
mapStringDynamic = (data as Map<String, dynamic>);
} catch (_) {}
return NextcloudNotificationsNotification_MessageRichParameters(
data,
mapStringDynamic: mapStringDynamic,
);
}
// coverage:ignore-start
factory NextcloudNotificationsNotification_MessageRichParameters.fromJsonString(String data) =>
NextcloudNotificationsNotification_MessageRichParameters.fromJson(json.decode(data));
// coverage:ignore-end
final dynamic _data;
final Map<String, dynamic>? mapStringDynamic;
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
// coverage:ignore-start
static String toJsonString(dynamic data) => json.encode(data);
// coverage:ignore-end
}
@JsonSerializable() @JsonSerializable()
class NextcloudNotificationsNotificationAction { class NextcloudNotificationsNotificationAction {
NextcloudNotificationsNotificationAction({ NextcloudNotificationsNotificationAction({
@ -4357,11 +4298,11 @@ class NextcloudNotificationsNotification {
final String subjectRich; final String subjectRich;
final NextcloudNotificationsNotification_SubjectRichParameters subjectRichParameters; final dynamic subjectRichParameters;
final String messageRich; final String messageRich;
final NextcloudNotificationsNotification_MessageRichParameters messageRichParameters; final dynamic messageRichParameters;
final String icon; final String icon;
@ -5330,6 +5271,7 @@ class NextcloudUserStatusPublicStatus_ClearAt {
try { try {
$int = (data as int); $int = (data as int);
} catch (_) {} } catch (_) {}
assert([userStatusClearAt, $int].where((final x) => x != null).length == 1, 'Need oneOf for $data');
return NextcloudUserStatusPublicStatus_ClearAt( return NextcloudUserStatusPublicStatus_ClearAt(
data, data,
userStatusClearAt: userStatusClearAt, userStatusClearAt: userStatusClearAt,
@ -5392,7 +5334,7 @@ class NextcloudUserStatusPublicStatus {
required this.userId, required this.userId,
this.message, this.message,
this.icon, this.icon,
required this.clearAt, this.clearAt,
required this.status, required this.status,
}); });
@ -5412,7 +5354,7 @@ class NextcloudUserStatusPublicStatus {
final String? icon; final String? icon;
final NextcloudUserStatusPublicStatus_ClearAt clearAt; final NextcloudUserStatusPublicStatus_ClearAt? clearAt;
final NextcloudUserStatusType status; final NextcloudUserStatusType status;
@ -5477,16 +5419,23 @@ class NextcloudUserStatusGetPublicStatuses {
class NextcloudUserStatusGetPublicStatus_Ocs_Data { class NextcloudUserStatusGetPublicStatus_Ocs_Data {
NextcloudUserStatusGetPublicStatus_Ocs_Data( NextcloudUserStatusGetPublicStatus_Ocs_Data(
this._data, { this._data, {
this.listDynamic,
this.userStatusPublicStatus, this.userStatusPublicStatus,
}); });
factory NextcloudUserStatusGetPublicStatus_Ocs_Data.fromJson(dynamic data) { factory NextcloudUserStatusGetPublicStatus_Ocs_Data.fromJson(dynamic data) {
List<dynamic>? listDynamic;
NextcloudUserStatusPublicStatus? userStatusPublicStatus; NextcloudUserStatusPublicStatus? userStatusPublicStatus;
try {
listDynamic = (data as List).map((final e) => (e as dynamic)).toList();
} catch (_) {}
try { try {
userStatusPublicStatus = NextcloudUserStatusPublicStatus.fromJson(data as Map<String, dynamic>); userStatusPublicStatus = NextcloudUserStatusPublicStatus.fromJson(data as Map<String, dynamic>);
} catch (_) {} } catch (_) {}
assert([listDynamic, userStatusPublicStatus].where((final x) => x != null).length == 1, 'Need oneOf for $data');
return NextcloudUserStatusGetPublicStatus_Ocs_Data( return NextcloudUserStatusGetPublicStatus_Ocs_Data(
data, data,
listDynamic: listDynamic,
userStatusPublicStatus: userStatusPublicStatus, userStatusPublicStatus: userStatusPublicStatus,
); );
} }
@ -5498,6 +5447,8 @@ class NextcloudUserStatusGetPublicStatus_Ocs_Data {
final dynamic _data; final dynamic _data;
final List<dynamic>? listDynamic;
final NextcloudUserStatusPublicStatus? userStatusPublicStatus; final NextcloudUserStatusPublicStatus? userStatusPublicStatus;
// coverage:ignore-start // coverage:ignore-start
@ -5575,6 +5526,7 @@ class NextcloudUserStatusStatus_ClearAt {
try { try {
$int = (data as int); $int = (data as int);
} catch (_) {} } catch (_) {}
assert([userStatusClearAt, $int].where((final x) => x != null).length == 1, 'Need oneOf for $data');
return NextcloudUserStatusStatus_ClearAt( return NextcloudUserStatusStatus_ClearAt(
data, data,
userStatusClearAt: userStatusClearAt, userStatusClearAt: userStatusClearAt,
@ -5610,7 +5562,7 @@ class NextcloudUserStatusStatus {
this.messageId, this.messageId,
required this.messageIsPredefined, required this.messageIsPredefined,
this.icon, this.icon,
required this.clearAt, this.clearAt,
required this.status, required this.status,
required this.statusIsUserDefined, required this.statusIsUserDefined,
}); });
@ -5634,7 +5586,7 @@ class NextcloudUserStatusStatus {
final String? icon; final String? icon;
final NextcloudUserStatusStatus_ClearAt clearAt; final NextcloudUserStatusStatus_ClearAt? clearAt;
final NextcloudUserStatusType status; final NextcloudUserStatusType status;
@ -5649,16 +5601,23 @@ class NextcloudUserStatusStatus {
class NextcloudUserStatusGetStatus_Ocs_Data { class NextcloudUserStatusGetStatus_Ocs_Data {
NextcloudUserStatusGetStatus_Ocs_Data( NextcloudUserStatusGetStatus_Ocs_Data(
this._data, { this._data, {
this.listDynamic,
this.userStatusStatus, this.userStatusStatus,
}); });
factory NextcloudUserStatusGetStatus_Ocs_Data.fromJson(dynamic data) { factory NextcloudUserStatusGetStatus_Ocs_Data.fromJson(dynamic data) {
List<dynamic>? listDynamic;
NextcloudUserStatusStatus? userStatusStatus; NextcloudUserStatusStatus? userStatusStatus;
try {
listDynamic = (data as List).map((final e) => (e as dynamic)).toList();
} catch (_) {}
try { try {
userStatusStatus = NextcloudUserStatusStatus.fromJson(data as Map<String, dynamic>); userStatusStatus = NextcloudUserStatusStatus.fromJson(data as Map<String, dynamic>);
} catch (_) {} } catch (_) {}
assert([listDynamic, userStatusStatus].where((final x) => x != null).length == 1, 'Need oneOf for $data');
return NextcloudUserStatusGetStatus_Ocs_Data( return NextcloudUserStatusGetStatus_Ocs_Data(
data, data,
listDynamic: listDynamic,
userStatusStatus: userStatusStatus, userStatusStatus: userStatusStatus,
); );
} }
@ -5670,6 +5629,8 @@ class NextcloudUserStatusGetStatus_Ocs_Data {
final dynamic _data; final dynamic _data;
final List<dynamic>? listDynamic;
final NextcloudUserStatusStatus? userStatusStatus; final NextcloudUserStatusStatus? userStatusStatus;
// coverage:ignore-start // coverage:ignore-start
@ -5746,6 +5707,7 @@ class NextcloudUserStatusPredefinedStatus_ClearAt {
try { try {
$int = (data as int); $int = (data as int);
} catch (_) {} } catch (_) {}
assert([userStatusClearAt, $int].where((final x) => x != null).length == 1, 'Need oneOf for $data');
return NextcloudUserStatusPredefinedStatus_ClearAt( return NextcloudUserStatusPredefinedStatus_ClearAt(
data, data,
userStatusClearAt: userStatusClearAt, userStatusClearAt: userStatusClearAt,
@ -5779,7 +5741,7 @@ class NextcloudUserStatusPredefinedStatus {
required this.id, required this.id,
required this.icon, required this.icon,
required this.message, required this.message,
required this.clearAt, this.clearAt,
}); });
// coverage:ignore-start // coverage:ignore-start
@ -5798,7 +5760,7 @@ class NextcloudUserStatusPredefinedStatus {
final String message; final String message;
final NextcloudUserStatusPredefinedStatus_ClearAt clearAt; final NextcloudUserStatusPredefinedStatus_ClearAt? clearAt;
// coverage:ignore-start // coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUserStatusPredefinedStatusToJson(this); Map<String, dynamic> toJson() => _$NextcloudUserStatusPredefinedStatusToJson(this);

22
packages/nextcloud/lib/src/nextcloud.openapi.g.dart

@ -1555,11 +1555,9 @@ NextcloudNotificationsNotification _$NextcloudNotificationsNotificationFromJson(
message: json['message'] as String, message: json['message'] as String,
link: json['link'] as String, link: json['link'] as String,
subjectRich: json['subjectRich'] as String, subjectRich: json['subjectRich'] as String,
subjectRichParameters: subjectRichParameters: json['subjectRichParameters'],
NextcloudNotificationsNotification_SubjectRichParameters.fromJson(json['subjectRichParameters']),
messageRich: json['messageRich'] as String, messageRich: json['messageRich'] as String,
messageRichParameters: messageRichParameters: json['messageRichParameters'],
NextcloudNotificationsNotification_MessageRichParameters.fromJson(json['messageRichParameters']),
icon: json['icon'] as String, icon: json['icon'] as String,
actions: (json['actions'] as List<dynamic>) actions: (json['actions'] as List<dynamic>)
.map((e) => NextcloudNotificationsNotificationAction.fromJson(e as Map<String, dynamic>)) .map((e) => NextcloudNotificationsNotificationAction.fromJson(e as Map<String, dynamic>))
@ -1579,9 +1577,9 @@ Map<String, dynamic> _$NextcloudNotificationsNotificationToJson(NextcloudNotific
'message': instance.message, 'message': instance.message,
'link': instance.link, 'link': instance.link,
'subjectRich': instance.subjectRich, 'subjectRich': instance.subjectRich,
'subjectRichParameters': instance.subjectRichParameters.toJson(), 'subjectRichParameters': instance.subjectRichParameters,
'messageRich': instance.messageRich, 'messageRich': instance.messageRich,
'messageRichParameters': instance.messageRichParameters.toJson(), 'messageRichParameters': instance.messageRichParameters,
'icon': instance.icon, 'icon': instance.icon,
'actions': instance.actions.map((e) => e.toJson()).toList(), 'actions': instance.actions.map((e) => e.toJson()).toList(),
}; };
@ -2215,7 +2213,7 @@ NextcloudUserStatusPublicStatus _$NextcloudUserStatusPublicStatusFromJson(Map<St
userId: json['userId'] as String, userId: json['userId'] as String,
message: json['message'] as String?, message: json['message'] as String?,
icon: json['icon'] as String?, icon: json['icon'] as String?,
clearAt: NextcloudUserStatusPublicStatus_ClearAt.fromJson(json['clearAt']), clearAt: json['clearAt'] == null ? null : NextcloudUserStatusPublicStatus_ClearAt.fromJson(json['clearAt']),
status: $enumDecode(_$NextcloudUserStatusTypeEnumMap, json['status']), status: $enumDecode(_$NextcloudUserStatusTypeEnumMap, json['status']),
); );
} }
@ -2225,7 +2223,7 @@ Map<String, dynamic> _$NextcloudUserStatusPublicStatusToJson(NextcloudUserStatus
'userId': instance.userId, 'userId': instance.userId,
'message': instance.message, 'message': instance.message,
'icon': instance.icon, 'icon': instance.icon,
'clearAt': instance.clearAt.toJson(), 'clearAt': instance.clearAt?.toJson(),
'status': _$NextcloudUserStatusTypeEnumMap[instance.status]!, 'status': _$NextcloudUserStatusTypeEnumMap[instance.status]!,
}; };
@ -2324,7 +2322,7 @@ NextcloudUserStatusStatus _$NextcloudUserStatusStatusFromJson(Map<String, dynami
messageId: json['messageId'] as String?, messageId: json['messageId'] as String?,
messageIsPredefined: json['messageIsPredefined'] as bool, messageIsPredefined: json['messageIsPredefined'] as bool,
icon: json['icon'] as String?, icon: json['icon'] as String?,
clearAt: NextcloudUserStatusStatus_ClearAt.fromJson(json['clearAt']), clearAt: json['clearAt'] == null ? null : NextcloudUserStatusStatus_ClearAt.fromJson(json['clearAt']),
status: $enumDecode(_$NextcloudUserStatusTypeEnumMap, json['status']), status: $enumDecode(_$NextcloudUserStatusTypeEnumMap, json['status']),
statusIsUserDefined: json['statusIsUserDefined'] as bool, statusIsUserDefined: json['statusIsUserDefined'] as bool,
); );
@ -2336,7 +2334,7 @@ Map<String, dynamic> _$NextcloudUserStatusStatusToJson(NextcloudUserStatusStatus
'messageId': instance.messageId, 'messageId': instance.messageId,
'messageIsPredefined': instance.messageIsPredefined, 'messageIsPredefined': instance.messageIsPredefined,
'icon': instance.icon, 'icon': instance.icon,
'clearAt': instance.clearAt.toJson(), 'clearAt': instance.clearAt?.toJson(),
'status': _$NextcloudUserStatusTypeEnumMap[instance.status]!, 'status': _$NextcloudUserStatusTypeEnumMap[instance.status]!,
'statusIsUserDefined': instance.statusIsUserDefined, 'statusIsUserDefined': instance.statusIsUserDefined,
}; };
@ -2381,7 +2379,7 @@ NextcloudUserStatusPredefinedStatus _$NextcloudUserStatusPredefinedStatusFromJso
id: json['id'] as String, id: json['id'] as String,
icon: json['icon'] as String, icon: json['icon'] as String,
message: json['message'] as String, message: json['message'] as String,
clearAt: NextcloudUserStatusPredefinedStatus_ClearAt.fromJson(json['clearAt']), clearAt: json['clearAt'] == null ? null : NextcloudUserStatusPredefinedStatus_ClearAt.fromJson(json['clearAt']),
); );
} }
@ -2390,7 +2388,7 @@ Map<String, dynamic> _$NextcloudUserStatusPredefinedStatusToJson(NextcloudUserSt
'id': instance.id, 'id': instance.id,
'icon': instance.icon, 'icon': instance.icon,
'message': instance.message, 'message': instance.message,
'clearAt': instance.clearAt.toJson(), 'clearAt': instance.clearAt?.toJson(),
}; };
NextcloudUserStatusPredefinedStatuses_Ocs _$NextcloudUserStatusPredefinedStatuses_OcsFromJson( NextcloudUserStatusPredefinedStatuses_Ocs _$NextcloudUserStatusPredefinedStatuses_OcsFromJson(

49
packages/nextcloud/lib/src/nextcloud.openapi.json

@ -942,7 +942,13 @@
"type": "string" "type": "string"
}, },
"status": { "status": {
"anyOf": [ "oneOf": [
{
"type": "array",
"items": {
"type": "object"
}
},
{ {
"type": "string" "type": "string"
} }
@ -1307,23 +1313,13 @@
"type": "string" "type": "string"
}, },
"subjectRichParameters": { "subjectRichParameters": {
"anyOf": [ "type": "object"
{
"type": "object",
"properties": {}
}
]
}, },
"messageRich": { "messageRich": {
"type": "string" "type": "string"
}, },
"messageRichParameters": { "messageRichParameters": {
"anyOf": [ "type": "object"
{
"type": "object",
"properties": {}
}
]
}, },
"icon": { "icon": {
"type": "string" "type": "string"
@ -1741,8 +1737,7 @@
"required": [ "required": [
"id", "id",
"icon", "icon",
"message", "message"
"clearAt"
], ],
"properties": { "properties": {
"id": { "id": {
@ -1755,7 +1750,7 @@
"type": "string" "type": "string"
}, },
"clearAt": { "clearAt": {
"anyOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/UserStatusClearAt" "$ref": "#/components/schemas/UserStatusClearAt"
}, },
@ -1825,7 +1820,13 @@
"$ref": "#/components/schemas/OCSMeta" "$ref": "#/components/schemas/OCSMeta"
}, },
"data": { "data": {
"anyOf": [ "oneOf": [
{
"type": "array",
"items": {
"type": "object"
}
},
{ {
"$ref": "#/components/schemas/UserStatusStatus" "$ref": "#/components/schemas/UserStatusStatus"
} }
@ -1878,7 +1879,13 @@
"$ref": "#/components/schemas/OCSMeta" "$ref": "#/components/schemas/OCSMeta"
}, },
"data": { "data": {
"anyOf": [ "oneOf": [
{
"type": "array",
"items": {
"type": "object"
}
},
{ {
"$ref": "#/components/schemas/UserStatusPublicStatus" "$ref": "#/components/schemas/UserStatusPublicStatus"
} }
@ -1893,7 +1900,6 @@
"required": [ "required": [
"userId", "userId",
"messageIsPredefined", "messageIsPredefined",
"clearAt",
"status", "status",
"statusIsUserDefined" "statusIsUserDefined"
], ],
@ -1914,7 +1920,7 @@
"type": "string" "type": "string"
}, },
"clearAt": { "clearAt": {
"anyOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/UserStatusClearAt" "$ref": "#/components/schemas/UserStatusClearAt"
}, },
@ -1936,7 +1942,6 @@
"type": "object", "type": "object",
"required": [ "required": [
"userId", "userId",
"clearAt",
"status" "status"
], ],
"properties": { "properties": {
@ -1950,7 +1955,7 @@
"type": "string" "type": "string"
}, },
"clearAt": { "clearAt": {
"anyOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/UserStatusClearAt" "$ref": "#/components/schemas/UserStatusClearAt"
}, },

8
packages/nextcloud/test/notifications.dart

@ -51,9 +51,9 @@ Future run(final DockerImage image) async {
expect(response.ocs.data[0].message, '456'); expect(response.ocs.data[0].message, '456');
expect(response.ocs.data[0].link, ''); expect(response.ocs.data[0].link, '');
expect(response.ocs.data[0].subjectRich, ''); expect(response.ocs.data[0].subjectRich, '');
expect(response.ocs.data[0].subjectRichParameters.mapStringDynamic, null); expect(response.ocs.data[0].subjectRichParameters, isEmpty);
expect(response.ocs.data[0].messageRich, ''); expect(response.ocs.data[0].messageRich, '');
expect(response.ocs.data[0].messageRichParameters.mapStringDynamic, null); expect(response.ocs.data[0].messageRichParameters, isEmpty);
expect(response.ocs.data[0].icon, isNotEmpty); expect(response.ocs.data[0].icon, isNotEmpty);
expect(response.ocs.data[0].actions, hasLength(0)); expect(response.ocs.data[0].actions, hasLength(0));
}); });
@ -73,9 +73,9 @@ Future run(final DockerImage image) async {
expect(response.ocs.data.message, '456'); expect(response.ocs.data.message, '456');
expect(response.ocs.data.link, ''); expect(response.ocs.data.link, '');
expect(response.ocs.data.subjectRich, ''); expect(response.ocs.data.subjectRich, '');
expect(response.ocs.data.subjectRichParameters.mapStringDynamic, null); expect(response.ocs.data.subjectRichParameters, isEmpty);
expect(response.ocs.data.messageRich, ''); expect(response.ocs.data.messageRich, '');
expect(response.ocs.data.messageRichParameters.mapStringDynamic, null); expect(response.ocs.data.messageRichParameters, isEmpty);
expect(response.ocs.data.icon, isNotEmpty); expect(response.ocs.data.icon, isNotEmpty);
expect(response.ocs.data.actions, hasLength(0)); expect(response.ocs.data.actions, hasLength(0));
}); });

33
packages/nextcloud/test/user_status.dart

@ -28,25 +28,24 @@ Future run(final DockerImage image) async {
expect(status.message, isNotNull); expect(status.message, isNotNull);
} }
final meeting = response.ocs.data.singleWhere((final s) => s.id == 'meeting').clearAt.userStatusClearAt!; final meeting = response.ocs.data.singleWhere((final s) => s.id == 'meeting').clearAt!.userStatusClearAt!;
expect(meeting.type, NextcloudUserStatusClearAt_Type.period); expect(meeting.type, NextcloudUserStatusClearAt_Type.period);
expect(meeting.time.$int, 3600); expect(meeting.time.$int, 3600);
final commuting = response.ocs.data.singleWhere((final s) => s.id == 'commuting').clearAt.userStatusClearAt!; final commuting = response.ocs.data.singleWhere((final s) => s.id == 'commuting').clearAt!.userStatusClearAt!;
expect(commuting.type, NextcloudUserStatusClearAt_Type.period); expect(commuting.type, NextcloudUserStatusClearAt_Type.period);
expect(commuting.time.$int, 1800); expect(commuting.time.$int, 1800);
final remoteWork = response.ocs.data.singleWhere((final s) => s.id == 'remote-work').clearAt.userStatusClearAt!; final remoteWork = response.ocs.data.singleWhere((final s) => s.id == 'remote-work').clearAt!.userStatusClearAt!;
expect(remoteWork.type, NextcloudUserStatusClearAt_Type.endOf); expect(remoteWork.type, NextcloudUserStatusClearAt_Type.endOf);
expect(remoteWork.time.userStatusClearAtTime0, NextcloudUserStatusClearAt_Time0.day); expect(remoteWork.time.userStatusClearAtTime0, NextcloudUserStatusClearAt_Time0.day);
final sickLeave = response.ocs.data.singleWhere((final s) => s.id == 'sick-leave').clearAt.userStatusClearAt!; final sickLeave = response.ocs.data.singleWhere((final s) => s.id == 'sick-leave').clearAt!.userStatusClearAt!;
expect(sickLeave.type, NextcloudUserStatusClearAt_Type.endOf); expect(sickLeave.type, NextcloudUserStatusClearAt_Type.endOf);
expect(sickLeave.time.userStatusClearAtTime0, NextcloudUserStatusClearAt_Time0.day); expect(sickLeave.time.userStatusClearAtTime0, NextcloudUserStatusClearAt_Time0.day);
final vacationing = response.ocs.data.singleWhere((final s) => s.id == 'vacationing').clearAt; final vacationing = response.ocs.data.singleWhere((final s) => s.id == 'vacationing').clearAt;
expect(vacationing.userStatusClearAt, null); expect(vacationing, null);
expect(vacationing.$int, null);
}); });
test('Set status', () async { test('Set status', () async {
@ -57,8 +56,7 @@ Future run(final DockerImage image) async {
expect(response.ocs.data.userStatusStatus!.messageId, null); expect(response.ocs.data.userStatusStatus!.messageId, null);
expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false); expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false);
expect(response.ocs.data.userStatusStatus!.icon, null); expect(response.ocs.data.userStatusStatus!.icon, null);
expect(response.ocs.data.userStatusStatus!.clearAt.userStatusClearAt, null); expect(response.ocs.data.userStatusStatus!.clearAt, null);
expect(response.ocs.data.userStatusStatus!.clearAt.$int, null);
expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.online); expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.online);
expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, true); expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, true);
}); });
@ -74,8 +72,7 @@ Future run(final DockerImage image) async {
expect(response.ocs.data.userStatusStatus!.messageId, null); expect(response.ocs.data.userStatusStatus!.messageId, null);
expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false); expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false);
expect(response.ocs.data.userStatusStatus!.icon, null); expect(response.ocs.data.userStatusStatus!.icon, null);
expect(response.ocs.data.userStatusStatus!.clearAt.userStatusClearAt, null); expect(response.ocs.data.userStatusStatus!.clearAt, null);
expect(response.ocs.data.userStatusStatus!.clearAt.$int, null);
expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.online); expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.online);
expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, true); expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, true);
}); });
@ -91,8 +88,7 @@ Future run(final DockerImage image) async {
expect(response.ocs.data[0].userId, 'user1'); expect(response.ocs.data[0].userId, 'user1');
expect(response.ocs.data[0].message, null); expect(response.ocs.data[0].message, null);
expect(response.ocs.data[0].icon, null); expect(response.ocs.data[0].icon, null);
expect(response.ocs.data[0].clearAt.userStatusClearAt, null); expect(response.ocs.data[0].clearAt, null);
expect(response.ocs.data[0].clearAt.$int, null);
expect(response.ocs.data[0].status, NextcloudUserStatusType.online); expect(response.ocs.data[0].status, NextcloudUserStatusType.online);
}); });
@ -104,8 +100,7 @@ Future run(final DockerImage image) async {
expect(response.ocs.data.userStatusPublicStatus!.userId, 'user1'); expect(response.ocs.data.userStatusPublicStatus!.userId, 'user1');
expect(response.ocs.data.userStatusPublicStatus!.message, null); expect(response.ocs.data.userStatusPublicStatus!.message, null);
expect(response.ocs.data.userStatusPublicStatus!.icon, null); expect(response.ocs.data.userStatusPublicStatus!.icon, null);
expect(response.ocs.data.userStatusPublicStatus!.clearAt.userStatusClearAt, null); expect(response.ocs.data.userStatusPublicStatus!.clearAt, null);
expect(response.ocs.data.userStatusPublicStatus!.clearAt.$int, null);
expect(response.ocs.data.userStatusPublicStatus!.status, NextcloudUserStatusType.online); expect(response.ocs.data.userStatusPublicStatus!.status, NextcloudUserStatusType.online);
}); });
@ -120,7 +115,7 @@ Future run(final DockerImage image) async {
expect(response.ocs.data.userStatusStatus!.messageId, 'meeting'); expect(response.ocs.data.userStatusStatus!.messageId, 'meeting');
expect(response.ocs.data.userStatusStatus!.messageIsPredefined, true); expect(response.ocs.data.userStatusStatus!.messageIsPredefined, true);
expect(response.ocs.data.userStatusStatus!.icon, null); expect(response.ocs.data.userStatusStatus!.icon, null);
expect(response.ocs.data.userStatusStatus!.clearAt.$int, clearAt); expect(response.ocs.data.userStatusStatus!.clearAt!.$int, clearAt);
expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.offline); expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.offline);
expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, false); expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, false);
}); });
@ -137,7 +132,7 @@ Future run(final DockerImage image) async {
expect(response.ocs.data.userStatusStatus!.messageId, null); expect(response.ocs.data.userStatusStatus!.messageId, null);
expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false); expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false);
expect(response.ocs.data.userStatusStatus!.icon, '😀'); expect(response.ocs.data.userStatusStatus!.icon, '😀');
expect(response.ocs.data.userStatusStatus!.clearAt.$int, clearAt); expect(response.ocs.data.userStatusStatus!.clearAt!.$int, clearAt);
expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.offline); expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.offline);
expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, false); expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, false);
}); });
@ -157,8 +152,7 @@ Future run(final DockerImage image) async {
expect(response.ocs.data.userStatusStatus!.messageId, null); expect(response.ocs.data.userStatusStatus!.messageId, null);
expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false); expect(response.ocs.data.userStatusStatus!.messageIsPredefined, false);
expect(response.ocs.data.userStatusStatus!.icon, null); expect(response.ocs.data.userStatusStatus!.icon, null);
expect(response.ocs.data.userStatusStatus!.clearAt.userStatusClearAt, null); expect(response.ocs.data.userStatusStatus!.clearAt, null);
expect(response.ocs.data.userStatusStatus!.clearAt.$int, null);
expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.offline); expect(response.ocs.data.userStatusStatus!.status, NextcloudUserStatusType.offline);
expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, false); expect(response.ocs.data.userStatusStatus!.statusIsUserDefined, false);
}); });
@ -170,8 +164,7 @@ Future run(final DockerImage image) async {
expect(response.ocs.data.messageId, null); expect(response.ocs.data.messageId, null);
expect(response.ocs.data.messageIsPredefined, false); expect(response.ocs.data.messageIsPredefined, false);
expect(response.ocs.data.icon, null); expect(response.ocs.data.icon, null);
expect(response.ocs.data.clearAt.userStatusClearAt, null); expect(response.ocs.data.clearAt, null);
expect(response.ocs.data.clearAt.$int, null);
expect(response.ocs.data.status, NextcloudUserStatusType.online); expect(response.ocs.data.status, NextcloudUserStatusType.online);
expect(response.ocs.data.statusIsUserDefined, false); expect(response.ocs.data.statusIsUserDefined, false);
}); });

8
specs/core.json

@ -942,7 +942,13 @@
"type": "string" "type": "string"
}, },
"status": { "status": {
"anyOf": [ "oneOf": [
{
"type": "array",
"items": {
"type": "object"
}
},
{ {
"type": "string" "type": "string"
} }

14
specs/notifications.json

@ -128,23 +128,13 @@
"type": "string" "type": "string"
}, },
"subjectRichParameters": { "subjectRichParameters": {
"anyOf": [ "type": "object"
{
"type": "object",
"properties": {}
}
]
}, },
"messageRich": { "messageRich": {
"type": "string" "type": "string"
}, },
"messageRichParameters": { "messageRichParameters": {
"anyOf": [ "type": "object"
{
"type": "object",
"properties": {}
}
]
}, },
"icon": { "icon": {
"type": "string" "type": "string"

27
specs/user_status.json

@ -108,8 +108,7 @@
"required": [ "required": [
"id", "id",
"icon", "icon",
"message", "message"
"clearAt"
], ],
"properties": { "properties": {
"id": { "id": {
@ -122,7 +121,7 @@
"type": "string" "type": "string"
}, },
"clearAt": { "clearAt": {
"anyOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/ClearAt" "$ref": "#/components/schemas/ClearAt"
}, },
@ -192,7 +191,13 @@
"$ref": "#/components/schemas/OCSMeta" "$ref": "#/components/schemas/OCSMeta"
}, },
"data": { "data": {
"anyOf": [ "oneOf": [
{
"type": "array",
"items": {
"type": "object"
}
},
{ {
"$ref": "#/components/schemas/Status" "$ref": "#/components/schemas/Status"
} }
@ -245,7 +250,13 @@
"$ref": "#/components/schemas/OCSMeta" "$ref": "#/components/schemas/OCSMeta"
}, },
"data": { "data": {
"anyOf": [ "oneOf": [
{
"type": "array",
"items": {
"type": "object"
}
},
{ {
"$ref": "#/components/schemas/PublicStatus" "$ref": "#/components/schemas/PublicStatus"
} }
@ -260,7 +271,6 @@
"required": [ "required": [
"userId", "userId",
"messageIsPredefined", "messageIsPredefined",
"clearAt",
"status", "status",
"statusIsUserDefined" "statusIsUserDefined"
], ],
@ -281,7 +291,7 @@
"type": "string" "type": "string"
}, },
"clearAt": { "clearAt": {
"anyOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/ClearAt" "$ref": "#/components/schemas/ClearAt"
}, },
@ -303,7 +313,6 @@
"type": "object", "type": "object",
"required": [ "required": [
"userId", "userId",
"clearAt",
"status" "status"
], ],
"properties": { "properties": {
@ -317,7 +326,7 @@
"type": "string" "type": "string"
}, },
"clearAt": { "clearAt": {
"anyOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/ClearAt" "$ref": "#/components/schemas/ClearAt"
}, },

Loading…
Cancel
Save