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 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'; var path = '/ocs/v1.php/apps/user_status/api/v1/heartbeat';
final queryParameters = <String, dynamic>{}; final queryParameters = <String, dynamic>{};
final headers = <String, String>{}; final headers = <String, String>{};
@ -3844,7 +3844,7 @@ class UserStatusClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw ApiException.fromResponse(response); // coverage:ignore-line
} }

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

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

9
specs/user_status.json

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

Loading…
Cancel
Save