Browse Source

Merge pull request #974 from nextcloud/fix/nextcloud/app_id_sorting

fix(nextcloud): fix appid sorting
pull/979/head
Nikolas Rimikis 1 year ago committed by GitHub
parent
commit
69ddcf2cab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      packages/nextcloud/bin/generate_exports.dart
  2. 72
      packages/nextcloud/lib/ids.dart

19
packages/nextcloud/bin/generate_exports.dart

@ -5,10 +5,14 @@ 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 files = Directory('lib/src/api')
.listSync()
.cast<File>()
.where((final file) => file.path.endsWith('.openapi.dart'))
.toList()
..sort((final a, final b) => a.path.compareTo(b.path));
final idStatements = <String>[];
final idStatements = StringBuffer();
for (final file in files) {
final basename = p.basename(file.path);
@ -16,7 +20,9 @@ void main() {
final variablePrefix = toDartName(id);
final classPrefix = toDartName(id, uppercaseFirstCharacter: true);
idStatements.add(" static const $variablePrefix = '$id';");
idStatements
..writeln(' /// ID for the $id app.')
..writeln(" static const $variablePrefix = '$id';");
final exports = ["export 'src/api/$id.openapi.dart';"];
if (File('lib/src/helpers/$id.dart').existsSync()) {
@ -41,10 +47,9 @@ extension ${classPrefix}Extension on NextcloudClient {
}
File('lib/ids.dart').writeAsStringSync('''
// ignore_for_file: public_member_api_docs
/// IDs of the apps.
final class AppIDs {
${idStatements.join('\n')}
$idStatements
}
''');
}

72
packages/nextcloud/lib/ids.dart

@ -1,25 +1,65 @@
// ignore_for_file: public_member_api_docs
/// IDs of the apps.
final class AppIDs {
static const filesSharing = 'files_sharing';
static const filesVersions = 'files_versions';
static const files = 'files';
static const updatenotification = 'updatenotification';
/// ID for the comments app.
static const comments = 'comments';
/// ID for the core app.
static const core = 'core';
/// ID for the dashboard app.
static const dashboard = 'dashboard';
static const uppush = 'uppush';
static const settings = 'settings';
/// ID for the dav app.
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';
/// ID for the files app.
static const files = 'files';
/// ID for the files_external app.
static const filesExternal = 'files_external';
/// ID for the files_reminders app.
static const filesReminders = 'files_reminders';
/// ID for the files_sharing app.
static const filesSharing = 'files_sharing';
/// ID for the files_trashbin app.
static const filesTrashbin = 'files_trashbin';
/// ID for the files_versions app.
static const filesVersions = 'files_versions';
/// ID for the news app.
static const news = 'news';
/// ID for the notes app.
static const notes = 'notes';
/// ID for the notifications app.
static const notifications = 'notifications';
/// ID for the provisioning_api app.
static const provisioningApi = 'provisioning_api';
/// ID for the settings app.
static const settings = 'settings';
/// ID for the sharebymail app.
static const sharebymail = 'sharebymail';
/// ID for the theming app.
static const theming = 'theming';
/// ID for the updatenotification app.
static const updatenotification = 'updatenotification';
/// ID for the uppush app.
static const uppush = 'uppush';
/// ID for the user_status app.
static const userStatus = 'user_status';
/// ID for the weather_status app.
static const weatherStatus = 'weather_status';
}

Loading…
Cancel
Save