Browse Source

refactor(nextcloud): Use extensions for clients and generate exports and app IDs

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/869/head
jld3103 1 year ago
parent
commit
fe7331c7ec
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 1
      .cspell/dart_flutter.txt
  2. 1
      packages/neon/neon/lib/models.dart
  3. 1
      packages/neon/neon/lib/src/app.dart
  4. 1
      packages/neon/neon/lib/src/blocs/accounts.dart
  5. 1
      packages/neon/neon/lib/src/blocs/apps.dart
  6. 1
      packages/neon/neon/lib/src/blocs/next_push.dart
  7. 6
      packages/neon/neon/lib/src/models/app_ids.dart
  8. 1
      packages/neon/neon/lib/src/pages/home.dart
  9. 2
      packages/neon/neon/lib/src/settings/models/storage.dart
  10. 2
      packages/neon/neon/lib/src/widgets/cached_image.dart
  11. 2
      packages/neon/neon_files/lib/routes.dart
  12. 2
      packages/neon/neon_news/lib/routes.dart
  13. 2
      packages/neon/neon_notes/lib/routes.dart
  14. 2
      packages/neon/neon_notifications/lib/routes.dart
  15. 62
      packages/nextcloud/bin/generate_exports.dart
  16. 12
      packages/nextcloud/lib/comments.dart
  17. 13
      packages/nextcloud/lib/core.dart
  18. 12
      packages/nextcloud/lib/dashboard.dart
  19. 12
      packages/nextcloud/lib/dav.dart
  20. 12
      packages/nextcloud/lib/files.dart
  21. 12
      packages/nextcloud/lib/files_external.dart
  22. 12
      packages/nextcloud/lib/files_reminders.dart
  23. 12
      packages/nextcloud/lib/files_sharing.dart
  24. 12
      packages/nextcloud/lib/files_trashbin.dart
  25. 12
      packages/nextcloud/lib/files_versions.dart
  26. 25
      packages/nextcloud/lib/ids.dart
  27. 13
      packages/nextcloud/lib/news.dart
  28. 55
      packages/nextcloud/lib/nextcloud.dart
  29. 13
      packages/nextcloud/lib/notes.dart
  30. 13
      packages/nextcloud/lib/notifications.dart
  31. 12
      packages/nextcloud/lib/provisioning_api.dart
  32. 12
      packages/nextcloud/lib/settings.dart
  33. 12
      packages/nextcloud/lib/sharebymail.dart
  34. 89
      packages/nextcloud/lib/src/client.dart
  35. 2
      packages/nextcloud/lib/src/helpers/notifications.dart
  36. 12
      packages/nextcloud/lib/theming.dart
  37. 13
      packages/nextcloud/lib/updatenotification.dart
  38. 12
      packages/nextcloud/lib/uppush.dart
  39. 12
      packages/nextcloud/lib/user_status.dart
  40. 12
      packages/nextcloud/lib/weather_status.dart
  41. 15
      packages/nextcloud/lib/webdav.dart
  42. 1
      packages/nextcloud/pubspec.yaml
  43. 2
      packages/nextcloud/test/core_test.dart
  44. 1
      packages/nextcloud/test/dashboard_test.dart
  45. 2
      packages/nextcloud/test/news_test.dart
  46. 3
      packages/nextcloud/test/notes_test.dart
  47. 2
      packages/nextcloud/test/notifications_test.dart
  48. 1
      packages/nextcloud/test/provisioning_api_test.dart
  49. 1
      packages/nextcloud/test/settings_test.dart
  50. 1
      packages/nextcloud/test/uppush_test.dart
  51. 2
      packages/nextcloud/test/user_status_test.dart
  52. 1
      tool/generate-nextcloud.sh

1
.cspell/dart_flutter.txt

@ -1,4 +1,5 @@
autofocus
expando
gapless
lerp
pubspec

1
packages/neon/neon/lib/models.dart

@ -1,4 +1,3 @@
export 'package:neon/src/models/account.dart' hide Credentials, LoginQRcode;
export 'package:neon/src/models/app_ids.dart';
export 'package:neon/src/models/app_implementation.dart';
export 'package:neon/src/models/notifications_interface.dart';

1
packages/neon/neon/lib/src/app.dart

@ -10,7 +10,6 @@ import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/bloc/result_builder.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/models/app_ids.dart';
import 'package:neon/src/models/app_implementation.dart';
import 'package:neon/src/models/notifications_interface.dart';
import 'package:neon/src/models/push_notification.dart';

1
packages/neon/neon/lib/src/blocs/accounts.dart

@ -16,6 +16,7 @@ import 'package:neon/src/models/app_implementation.dart';
import 'package:neon/src/settings/models/storage.dart';
import 'package:neon/src/utils/account_options.dart';
import 'package:neon/src/utils/global_options.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
const _keyAccounts = 'accounts';

1
packages/neon/neon/lib/src/blocs/apps.dart

@ -7,7 +7,6 @@ import 'package:neon/src/bloc/result.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/capabilities.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/models/app_ids.dart';
import 'package:neon/src/models/app_implementation.dart';
import 'package:neon/src/models/notifications_interface.dart';
import 'package:neon/src/settings/models/options_collection.dart';

1
packages/neon/neon/lib/src/blocs/next_push.dart

@ -6,6 +6,7 @@ import 'package:neon/src/bloc/bloc.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/utils/global_options.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
@internal

6
packages/neon/neon/lib/src/models/app_ids.dart

@ -1,6 +0,0 @@
sealed class AppIDs {
static const files = 'files';
static const news = 'news';
static const notes = 'notes';
static const notifications = 'notifications';
}

1
packages/neon/neon/lib/src/pages/home.dart

@ -16,6 +16,7 @@ import 'package:neon/src/widgets/app_bar.dart';
import 'package:neon/src/widgets/drawer.dart';
import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/unified_search_results.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:provider/provider.dart';
@internal

2
packages/neon/neon/lib/src/settings/models/storage.dart

@ -1,5 +1,5 @@
import 'package:meta/meta.dart';
import 'package:neon/src/models/app_ids.dart';
import 'package:nextcloud/ids.dart';
import 'package:shared_preferences/shared_preferences.dart';
@internal

2
packages/neon/neon/lib/src/widgets/cached_image.dart

@ -5,12 +5,12 @@ import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:neon/nextcloud.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/utils/provider.dart';
import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart';
import 'package:nextcloud/nextcloud.dart';
typedef CacheReviver = FutureOr<Uint8List?> Function(CacheManager cacheManager);
typedef ImageDownloader = FutureOr<Uint8List> Function();

2
packages/neon/neon_files/lib/routes.dart

@ -1,6 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';
import 'package:neon/models.dart';
import 'package:neon/nextcloud.dart';
import 'package:neon/utils.dart';
import 'package:neon_files/neon_files.dart';

2
packages/neon/neon_news/lib/routes.dart

@ -1,6 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';
import 'package:neon/models.dart';
import 'package:neon/nextcloud.dart';
import 'package:neon/utils.dart';
import 'package:neon_news/neon_news.dart';

2
packages/neon/neon_notes/lib/routes.dart

@ -1,6 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';
import 'package:neon/models.dart';
import 'package:neon/nextcloud.dart';
import 'package:neon/utils.dart';
import 'package:neon_notes/neon_notes.dart';

2
packages/neon/neon_notifications/lib/routes.dart

@ -1,6 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';
import 'package:neon/models.dart';
import 'package:neon/nextcloud.dart';
import 'package:neon/utils.dart';
import 'package:neon_notifications/neon_notifications.dart';

62
packages/nextcloud/bin/generate_exports.dart

@ -0,0 +1,62 @@
// ignore_for_file: depend_on_referenced_packages
import 'dart:io';
import 'package:collection/collection.dart';
import 'package:dynamite/src/helpers/dart_helpers.dart';
import 'package:path/path.dart' as p;
void main() {
final files =
Directory('lib/src/api').listSync().cast<File>().where((final file) => file.path.endsWith('.openapi.dart'));
final idStatements = <String>[];
final exportStatements = <String>[
"export 'ids.dart';",
"export 'src/client.dart';",
"export 'webdav.dart';",
];
for (final file in files) {
final basename = p.basename(file.path);
final id = basename.substring(0, basename.length - 13);
final variablePrefix = toDartName(id);
final classPrefix = toDartName(id, uppercaseFirstCharacter: true);
idStatements.add(" static const $variablePrefix = '$id';");
exportStatements.add("export '$id.dart';");
final exports = ["export 'src/api/$id.openapi.dart';"];
if (File('lib/src/helpers/$id.dart').existsSync()) {
exports.add("export 'src/helpers/$id.dart';");
}
File('lib/$id.dart').writeAsStringSync('''
import 'package:nextcloud/src/api/$id.openapi.dart';
import 'package:nextcloud/src/client.dart';
${exports.join('\n')}
// ignore: public_member_api_docs
extension ${classPrefix}Extension on NextcloudClient {
static final _$variablePrefix = Expando<${classPrefix}Client>();
/// Client for the $id APIs
${classPrefix}Client get $variablePrefix => _$variablePrefix[this] ??= ${classPrefix}Client.fromClient(this);
}
''');
}
File('lib/ids.dart').writeAsStringSync('''
// ignore_for_file: public_member_api_docs
final class AppIDs {
${idStatements.join('\n')}
}
''');
File('lib/nextcloud.dart').writeAsStringSync('''
export 'package:dynamite_runtime/http_client.dart' show CookieJar, DynamiteApiException, DynamiteRawResponse, DynamiteResponse;
${exportStatements.sorted((final a, final b) => a.compareTo(b)).join('\n')}
''');
}

12
packages/nextcloud/lib/comments.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/comments.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/comments.openapi.dart';
// ignore: public_member_api_docs
extension CommentsExtension on NextcloudClient {
static final _comments = Expando<CommentsClient>();
/// Client for the comments APIs
CommentsClient get comments => _comments[this] ??= CommentsClient.fromClient(this);
}

13
packages/nextcloud/lib/core.dart

@ -0,0 +1,13 @@
import 'package:nextcloud/src/api/core.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/core.openapi.dart';
export 'src/helpers/core.dart';
// ignore: public_member_api_docs
extension CoreExtension on NextcloudClient {
static final _core = Expando<CoreClient>();
/// Client for the core APIs
CoreClient get core => _core[this] ??= CoreClient.fromClient(this);
}

12
packages/nextcloud/lib/dashboard.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/dashboard.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/dashboard.openapi.dart';
// ignore: public_member_api_docs
extension DashboardExtension on NextcloudClient {
static final _dashboard = Expando<DashboardClient>();
/// Client for the dashboard APIs
DashboardClient get dashboard => _dashboard[this] ??= DashboardClient.fromClient(this);
}

12
packages/nextcloud/lib/dav.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/dav.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/dav.openapi.dart';
// ignore: public_member_api_docs
extension DavExtension on NextcloudClient {
static final _dav = Expando<DavClient>();
/// Client for the dav APIs
DavClient get dav => _dav[this] ??= DavClient.fromClient(this);
}

12
packages/nextcloud/lib/files.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/files.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/files.openapi.dart';
// ignore: public_member_api_docs
extension FilesExtension on NextcloudClient {
static final _files = Expando<FilesClient>();
/// Client for the files APIs
FilesClient get files => _files[this] ??= FilesClient.fromClient(this);
}

12
packages/nextcloud/lib/files_external.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/files_external.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/files_external.openapi.dart';
// ignore: public_member_api_docs
extension FilesExternalExtension on NextcloudClient {
static final _filesExternal = Expando<FilesExternalClient>();
/// Client for the files_external APIs
FilesExternalClient get filesExternal => _filesExternal[this] ??= FilesExternalClient.fromClient(this);
}

12
packages/nextcloud/lib/files_reminders.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/files_reminders.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/files_reminders.openapi.dart';
// ignore: public_member_api_docs
extension FilesRemindersExtension on NextcloudClient {
static final _filesReminders = Expando<FilesRemindersClient>();
/// Client for the files_reminders APIs
FilesRemindersClient get filesReminders => _filesReminders[this] ??= FilesRemindersClient.fromClient(this);
}

12
packages/nextcloud/lib/files_sharing.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/files_sharing.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/files_sharing.openapi.dart';
// ignore: public_member_api_docs
extension FilesSharingExtension on NextcloudClient {
static final _filesSharing = Expando<FilesSharingClient>();
/// Client for the files_sharing APIs
FilesSharingClient get filesSharing => _filesSharing[this] ??= FilesSharingClient.fromClient(this);
}

12
packages/nextcloud/lib/files_trashbin.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/files_trashbin.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/files_trashbin.openapi.dart';
// ignore: public_member_api_docs
extension FilesTrashbinExtension on NextcloudClient {
static final _filesTrashbin = Expando<FilesTrashbinClient>();
/// Client for the files_trashbin APIs
FilesTrashbinClient get filesTrashbin => _filesTrashbin[this] ??= FilesTrashbinClient.fromClient(this);
}

12
packages/nextcloud/lib/files_versions.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/files_versions.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/files_versions.openapi.dart';
// ignore: public_member_api_docs
extension FilesVersionsExtension on NextcloudClient {
static final _filesVersions = Expando<FilesVersionsClient>();
/// Client for the files_versions APIs
FilesVersionsClient get filesVersions => _filesVersions[this] ??= FilesVersionsClient.fromClient(this);
}

25
packages/nextcloud/lib/ids.dart

@ -0,0 +1,25 @@
// ignore_for_file: public_member_api_docs
final class AppIDs {
static const filesSharing = 'files_sharing';
static const filesVersions = 'files_versions';
static const files = 'files';
static const updatenotification = 'updatenotification';
static const dashboard = 'dashboard';
static const uppush = 'uppush';
static const settings = 'settings';
static const dav = 'dav';
static const userStatus = 'user_status';
static const notifications = 'notifications';
static const notes = 'notes';
static const news = 'news';
static const core = 'core';
static const filesTrashbin = 'files_trashbin';
static const comments = 'comments';
static const sharebymail = 'sharebymail';
static const filesExternal = 'files_external';
static const filesReminders = 'files_reminders';
static const provisioningApi = 'provisioning_api';
static const theming = 'theming';
static const weatherStatus = 'weather_status';
}

13
packages/nextcloud/lib/news.dart

@ -0,0 +1,13 @@
import 'package:nextcloud/src/api/news.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/news.openapi.dart';
export 'src/helpers/news.dart';
// ignore: public_member_api_docs
extension NewsExtension on NextcloudClient {
static final _news = Expando<NewsClient>();
/// Client for the news APIs
NewsClient get news => _news[this] ??= NewsClient.fromClient(this);
}

55
packages/nextcloud/lib/nextcloud.dart

@ -1,32 +1,27 @@
export 'package:crypton/crypton.dart' show RSAKeypair, RSAPrivateKey, RSAPublicKey;
export 'package:dynamite_runtime/http_client.dart'
show CookieJar, DynamiteApiException, DynamiteRawResponse, DynamiteResponse;
export 'src/api/comments.openapi.dart';
export 'src/api/core.openapi.dart';
export 'src/api/dashboard.openapi.dart';
export 'src/api/dav.openapi.dart';
export 'src/api/files.openapi.dart';
export 'src/api/files_external.openapi.dart';
export 'src/api/files_reminders.openapi.dart';
export 'src/api/files_sharing.openapi.dart';
export 'src/api/files_trashbin.openapi.dart';
export 'src/api/files_versions.openapi.dart';
export 'src/api/news.openapi.dart';
export 'src/api/notes.openapi.dart';
export 'src/api/notifications.openapi.dart';
export 'src/api/provisioning_api.openapi.dart';
export 'src/api/settings.openapi.dart';
export 'src/api/sharebymail.openapi.dart';
export 'src/api/theming.openapi.dart';
export 'src/api/updatenotification.openapi.dart';
export 'src/api/uppush.openapi.dart';
export 'src/api/user_status.openapi.dart';
export 'src/api/weather_status.openapi.dart';
export 'comments.dart';
export 'core.dart';
export 'dashboard.dart';
export 'dav.dart';
export 'files.dart';
export 'files_external.dart';
export 'files_reminders.dart';
export 'files_sharing.dart';
export 'files_trashbin.dart';
export 'files_versions.dart';
export 'ids.dart';
export 'news.dart';
export 'notes.dart';
export 'notifications.dart';
export 'provisioning_api.dart';
export 'settings.dart';
export 'sharebymail.dart';
export 'src/client.dart';
export 'src/helpers/core.dart';
export 'src/helpers/news.dart';
export 'src/helpers/notes.dart';
export 'src/helpers/notifications.dart';
export 'src/webdav/client.dart';
export 'src/webdav/file.dart';
export 'src/webdav/props.dart';
export 'src/webdav/webdav.dart';
export 'theming.dart';
export 'updatenotification.dart';
export 'uppush.dart';
export 'user_status.dart';
export 'weather_status.dart';
export 'webdav.dart';

13
packages/nextcloud/lib/notes.dart

@ -0,0 +1,13 @@
import 'package:nextcloud/src/api/notes.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/notes.openapi.dart';
export 'src/helpers/notes.dart';
// ignore: public_member_api_docs
extension NotesExtension on NextcloudClient {
static final _notes = Expando<NotesClient>();
/// Client for the notes APIs
NotesClient get notes => _notes[this] ??= NotesClient.fromClient(this);
}

13
packages/nextcloud/lib/notifications.dart

@ -0,0 +1,13 @@
import 'package:nextcloud/src/api/notifications.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/notifications.openapi.dart';
export 'src/helpers/notifications.dart';
// ignore: public_member_api_docs
extension NotificationsExtension on NextcloudClient {
static final _notifications = Expando<NotificationsClient>();
/// Client for the notifications APIs
NotificationsClient get notifications => _notifications[this] ??= NotificationsClient.fromClient(this);
}

12
packages/nextcloud/lib/provisioning_api.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/provisioning_api.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/provisioning_api.openapi.dart';
// ignore: public_member_api_docs
extension ProvisioningApiExtension on NextcloudClient {
static final _provisioningApi = Expando<ProvisioningApiClient>();
/// Client for the provisioning_api APIs
ProvisioningApiClient get provisioningApi => _provisioningApi[this] ??= ProvisioningApiClient.fromClient(this);
}

12
packages/nextcloud/lib/settings.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/settings.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/settings.openapi.dart';
// ignore: public_member_api_docs
extension SettingsExtension on NextcloudClient {
static final _settings = Expando<SettingsClient>();
/// Client for the settings APIs
SettingsClient get settings => _settings[this] ??= SettingsClient.fromClient(this);
}

12
packages/nextcloud/lib/sharebymail.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/sharebymail.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/sharebymail.openapi.dart';
// ignore: public_member_api_docs
extension SharebymailExtension on NextcloudClient {
static final _sharebymail = Expando<SharebymailClient>();
/// Client for the sharebymail APIs
SharebymailClient get sharebymail => _sharebymail[this] ??= SharebymailClient.fromClient(this);
}

89
packages/nextcloud/lib/src/client.dart

@ -1,4 +1,4 @@
import 'package:nextcloud/nextcloud.dart';
import 'package:dynamite_runtime/http_client.dart';
/// Different app types to register for
enum AppType {
@ -51,91 +51,4 @@ class NextcloudClient extends DynamiteClient {
/// Identifier used for authentication. This can be the username or email or something else.
final String? loginName;
WebDavClient? _webdav;
CommentsClient? _comments;
CoreClient? _core;
DashboardClient? _dashboard;
DavClient? _dav;
FilesClient? _files;
FilesExternalClient? _filesExternal;
FilesRemindersClient? _filesReminders;
FilesSharingClient? _filesSharing;
FilesTrashbinClient? _filesTrashbin;
FilesVersionsClient? _filesVersions;
NewsClient? _news;
NotesClient? _notes;
NotificationsClient? _notifications;
ProvisioningApiClient? _provisioningApi;
SettingsClient? _settings;
ThemingClient? _theming;
UpdatenotificationClient? _updatenotification;
UppushClient? _uppush;
UserStatusClient? _userStatus;
WeatherStatusClient? _weatherStatus;
/// Client for WebDAV
WebDavClient get webdav => _webdav ??= WebDavClient(this);
/// Client for the comments APIs
CommentsClient get comments => _comments ??= CommentsClient.fromClient(this);
/// Client for the core APIs
CoreClient get core => _core ??= CoreClient.fromClient(this);
/// Client for the dashboard APIs
DashboardClient get dashboard => _dashboard ??= DashboardClient.fromClient(this);
/// Client for the dav APIs
///
/// This client does not expose WebDAV functionality. Use [webdav] instead.
DavClient get dav => _dav ??= DavClient.fromClient(this);
/// Client for the files APIs
FilesClient get files => _files ??= FilesClient.fromClient(this);
/// Client for the files external APIs
FilesExternalClient get filesExternal => _filesExternal ??= FilesExternalClient.fromClient(this);
/// Client for the files reminders APIs
FilesRemindersClient get filesReminders => _filesReminders ??= FilesRemindersClient.fromClient(this);
/// Client for the files sharing APIs
FilesSharingClient get filesSharing => _filesSharing ??= FilesSharingClient.fromClient(this);
/// Client for the files trashbin APIs
FilesTrashbinClient get filesTrashbin => _filesTrashbin ??= FilesTrashbinClient.fromClient(this);
/// Client for the files versions APIs
FilesVersionsClient get filesVersions => _filesVersions ??= FilesVersionsClient.fromClient(this);
/// Client for the news app APIs
NewsClient get news => _news ??= NewsClient.fromClient(this);
/// Client for the notes app APIs
NotesClient get notes => _notes ??= NotesClient.fromClient(this);
/// Client for the notifications app APIs
NotificationsClient get notifications => _notifications ??= NotificationsClient.fromClient(this);
/// Client for the provisioning APIs
ProvisioningApiClient get provisioningApi => _provisioningApi ??= ProvisioningApiClient.fromClient(this);
/// Client for the settings APIs
SettingsClient get settings => _settings ??= SettingsClient.fromClient(this);
/// Client for the theming APIs
ThemingClient get theming => _theming ??= ThemingClient.fromClient(this);
/// Client for the updatenotification APIs
UpdatenotificationClient get updatenotification => _updatenotification ??= UpdatenotificationClient.fromClient(this);
/// Client for the uppush app APIs
UppushClient get uppush => _uppush ??= UppushClient.fromClient(this);
/// Client for the user status APIs
UserStatusClient get userStatus => _userStatus ??= UserStatusClient.fromClient(this);
/// Client for the weather status APIs
WeatherStatusClient get weatherStatus => _weatherStatus ??= WeatherStatusClient.fromClient(this);
}

2
packages/nextcloud/lib/src/helpers/notifications.dart

@ -6,6 +6,8 @@ import 'package:crypto/crypto.dart';
import 'package:crypton/crypton.dart';
import 'package:json_annotation/json_annotation.dart';
export 'package:crypton/crypton.dart' show RSAKeypair, RSAPrivateKey, RSAPublicKey;
part 'notifications.g.dart';
/// Generates the push token hash which is just sha512

12
packages/nextcloud/lib/theming.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/theming.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/theming.openapi.dart';
// ignore: public_member_api_docs
extension ThemingExtension on NextcloudClient {
static final _theming = Expando<ThemingClient>();
/// Client for the theming APIs
ThemingClient get theming => _theming[this] ??= ThemingClient.fromClient(this);
}

13
packages/nextcloud/lib/updatenotification.dart

@ -0,0 +1,13 @@
import 'package:nextcloud/src/api/updatenotification.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/updatenotification.openapi.dart';
// ignore: public_member_api_docs
extension UpdatenotificationExtension on NextcloudClient {
static final _updatenotification = Expando<UpdatenotificationClient>();
/// Client for the updatenotification APIs
UpdatenotificationClient get updatenotification =>
_updatenotification[this] ??= UpdatenotificationClient.fromClient(this);
}

12
packages/nextcloud/lib/uppush.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/uppush.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/uppush.openapi.dart';
// ignore: public_member_api_docs
extension UppushExtension on NextcloudClient {
static final _uppush = Expando<UppushClient>();
/// Client for the uppush APIs
UppushClient get uppush => _uppush[this] ??= UppushClient.fromClient(this);
}

12
packages/nextcloud/lib/user_status.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/user_status.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/user_status.openapi.dart';
// ignore: public_member_api_docs
extension UserStatusExtension on NextcloudClient {
static final _userStatus = Expando<UserStatusClient>();
/// Client for the user_status APIs
UserStatusClient get userStatus => _userStatus[this] ??= UserStatusClient.fromClient(this);
}

12
packages/nextcloud/lib/weather_status.dart

@ -0,0 +1,12 @@
import 'package:nextcloud/src/api/weather_status.openapi.dart';
import 'package:nextcloud/src/client.dart';
export 'src/api/weather_status.openapi.dart';
// ignore: public_member_api_docs
extension WeatherStatusExtension on NextcloudClient {
static final _weatherStatus = Expando<WeatherStatusClient>();
/// Client for the weather_status APIs
WeatherStatusClient get weatherStatus => _weatherStatus[this] ??= WeatherStatusClient.fromClient(this);
}

15
packages/nextcloud/lib/webdav.dart

@ -0,0 +1,15 @@
import 'package:nextcloud/src/client.dart';
import 'package:nextcloud/src/webdav/client.dart';
export 'src/webdav/client.dart';
export 'src/webdav/file.dart';
export 'src/webdav/props.dart';
export 'src/webdav/webdav.dart';
// ignore: public_member_api_docs
extension WebDAVExtension on NextcloudClient {
static final _webdav = Expando<WebDavClient>();
/// Client for WebDAV
WebDavClient get webdav => _webdav[this] ??= WebDavClient(this);
}

1
packages/nextcloud/pubspec.yaml

@ -36,6 +36,7 @@ dev_dependencies:
git:
url: https://github.com/nextcloud/neon
path: packages/neon_lints
path: ^1.8.3
process_run: ^0.13.1
test: ^1.24.6
xml_serializable: ^2.3.0

2
packages/nextcloud/test/core_test.dart

@ -1,4 +1,4 @@
import 'package:nextcloud/nextcloud.dart';
import 'package:nextcloud/core.dart';
import 'package:test/test.dart';
import 'helper.dart';

1
packages/nextcloud/test/dashboard_test.dart

@ -1,3 +1,4 @@
import 'package:nextcloud/dashboard.dart';
import 'package:test/test.dart';
import 'helper.dart';

2
packages/nextcloud/test/news_test.dart

@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:io';
import 'package:nextcloud/nextcloud.dart';
import 'package:nextcloud/news.dart';
import 'package:test/test.dart';
import 'helper.dart';

3
packages/nextcloud/test/notes_test.dart

@ -1,4 +1,5 @@
import 'package:nextcloud/nextcloud.dart';
import 'package:nextcloud/core.dart';
import 'package:nextcloud/notes.dart';
import 'package:test/test.dart';
import 'helper.dart';

2
packages/nextcloud/test/notifications_test.dart

@ -1,6 +1,6 @@
import 'dart:async';
import 'package:nextcloud/nextcloud.dart';
import 'package:nextcloud/notifications.dart';
import 'package:test/test.dart';
import 'helper.dart';

1
packages/nextcloud/test/provisioning_api_test.dart

@ -1,3 +1,4 @@
import 'package:nextcloud/provisioning_api.dart';
import 'package:test/test.dart';
import 'helper.dart';

1
packages/nextcloud/test/settings_test.dart

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:nextcloud/settings.dart';
import 'package:test/test.dart';
import 'helper.dart';

1
packages/nextcloud/test/uppush_test.dart

@ -1,3 +1,4 @@
import 'package:nextcloud/uppush.dart';
import 'package:test/test.dart';
import 'helper.dart';

2
packages/nextcloud/test/user_status_test.dart

@ -1,4 +1,4 @@
import 'package:nextcloud/nextcloud.dart';
import 'package:nextcloud/user_status.dart';
import 'package:test/test.dart';
import 'helper.dart';

1
tool/generate-nextcloud.sh

@ -7,6 +7,7 @@ cd "$(dirname "$0")/.."
rm -rf .dart_tool/build
fvm dart run nextcloud:generate_props
fvm dart pub run build_runner build --delete-conflicting-outputs
fvm dart run nextcloud:generate_exports
# For some reason we need to fix and format twice, otherwise not everything gets fixed
fvm dart fix --apply lib/src/api/
melos run format

Loading…
Cancel
Save