Browse Source

specs,nextcloud: Fix user status heartbeat

pull/98/head
jld3103 2 years ago
parent
commit
ea990b9566
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 4
      packages/nextcloud/lib/src/nextcloud.openapi.dart
  2. 9
      packages/nextcloud/lib/src/nextcloud.openapi.json
  3. 22
      packages/nextcloud/test/user_status_test.dart
  4. 9
      specs/user_status.json

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

@ -3831,7 +3831,7 @@ class UserStatusClient {
throw ApiException.fromResponse(response); // coverage:ignore-line
}
Future heartbeat({required UserStatusType status}) async {
Future<UserStatus> heartbeat({required UserStatusType status}) async {
var path = '/ocs/v1.php/apps/user_status/api/v1/heartbeat';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
@ -3844,7 +3844,7 @@ class UserStatusClient {
body,
);
if (response.statusCode == 200) {
return;
return UserStatus.fromJson(json.decode(utf8.decode(response.body)) as Map<String, dynamic>);
}
throw ApiException.fromResponse(response); // coverage:ignore-line
}

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

@ -3706,7 +3706,14 @@
],
"responses": {
"200": {
"description": ""
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserStatus"
}
}
}
}
}
}

22
packages/nextcloud/test/user_status_test.dart

@ -158,18 +158,16 @@ Future main() async {
});
test('Heartbeat', () async {
await client.userStatus.heartbeat(status: UserStatusType.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, UserStatusType.online);
expect(response.ocs.data.userStatus!.statusIsUserDefined, false);
final response = await client.userStatus.heartbeat(status: UserStatusType.online);
expect(response.userId, 'user1');
expect(response.message, null);
expect(response.messageId, null);
expect(response.messageIsPredefined, false);
expect(response.icon, null);
expect(response.clearAt.userStatusClearAt, null);
expect(response.clearAt.int_, null);
expect(response.status, UserStatusType.online);
expect(response.statusIsUserDefined, false);
});
});
}

9
specs/user_status.json

@ -559,7 +559,14 @@
],
"responses": {
"200": {
"description": ""
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserStatus"
}
}
}
}
}
}

Loading…
Cancel
Save