From ea990b9566d67a68630a26b6eb2152a0e753b508 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 23 Oct 2022 19:36:40 +0200 Subject: [PATCH] specs,nextcloud: Fix user status heartbeat --- .../nextcloud/lib/src/nextcloud.openapi.dart | 4 ++-- .../nextcloud/lib/src/nextcloud.openapi.json | 9 +++++++- packages/nextcloud/test/user_status_test.dart | 22 +++++++++---------- specs/user_status.json | 9 +++++++- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index 9ad0f003..cbb2daf0 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/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 heartbeat({required UserStatusType status}) async { var path = '/ocs/v1.php/apps/user_status/api/v1/heartbeat'; final queryParameters = {}; final headers = {}; @@ -3844,7 +3844,7 @@ class UserStatusClient { body, ); if (response.statusCode == 200) { - return; + return UserStatus.fromJson(json.decode(utf8.decode(response.body)) as Map); } throw ApiException.fromResponse(response); // coverage:ignore-line } diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.json b/packages/nextcloud/lib/src/nextcloud.openapi.json index 81145aa2..b82dda4e 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.json +++ b/packages/nextcloud/lib/src/nextcloud.openapi.json @@ -3706,7 +3706,14 @@ ], "responses": { "200": { - "description": "" + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserStatus" + } + } + } } } } diff --git a/packages/nextcloud/test/user_status_test.dart b/packages/nextcloud/test/user_status_test.dart index 05271727..70e2f220 100644 --- a/packages/nextcloud/test/user_status_test.dart +++ b/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); }); }); } diff --git a/specs/user_status.json b/specs/user_status.json index c8c44ed9..c5d9659d 100644 --- a/specs/user_status.json +++ b/specs/user_status.json @@ -559,7 +559,14 @@ ], "responses": { "200": { - "description": "" + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserStatus" + } + } + } } } }