Browse Source

Merge pull request #208 from provokateurin/feature/suggest-nextpush

Suggest NextPush
pull/209/head
Kate 2 years ago committed by GitHub
parent
commit
e821984428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .gitmodules
  2. 1
      external/nextcloud-uppush
  3. 8
      packages/neon/integration_test/screenshot_test.dart
  4. 5
      packages/neon/lib/l10n/en.arb
  5. 30
      packages/neon/lib/l10n/localizations.dart
  6. 16
      packages/neon/lib/l10n/localizations_en.dart
  7. 4
      packages/neon/lib/main.dart
  8. 20
      packages/neon/lib/src/app.dart
  9. 77
      packages/neon/lib/src/blocs/next_push.dart
  10. 2
      packages/neon/lib/src/neon.dart
  11. 20
      packages/neon/lib/src/pages/home.dart
  12. 4
      packages/neon/lib/src/utils/global_options.dart
  13. 72
      packages/neon/lib/src/utils/global_popups.dart
  14. 689
      packages/nextcloud/lib/src/nextcloud.openapi.dart
  15. 229
      packages/nextcloud/lib/src/nextcloud.openapi.g.dart
  16. 416
      packages/nextcloud/lib/src/nextcloud.openapi.json
  17. 66
      packages/nextcloud/test/uppush.dart
  18. 444
      specs/uppush.json
  19. 1
      tool/Dockerfile.dev
  20. 4
      tool/generate-nextcloud.sh

3
.gitmodules vendored

@ -13,3 +13,6 @@
[submodule "external/nextcloud-notifications"] [submodule "external/nextcloud-notifications"]
path = external/nextcloud-notifications path = external/nextcloud-notifications
url = https://github.com/nextcloud/notifications url = https://github.com/nextcloud/notifications
[submodule "external/nextcloud-uppush"]
path = external/nextcloud-uppush
url = git@github.com:UP-NextPush/server-app.git

1
external/nextcloud-uppush vendored

@ -0,0 +1 @@
Subproject commit ea2264cc05443f295a662030ad13c4a40c744eb9

8
packages/neon/integration_test/screenshot_test.dart

@ -132,6 +132,11 @@ Future pumpAppPage(
sharedPreferences, sharedPreferences,
disabled: true, disabled: true,
); );
final nextPushBloc = NextPushBloc(
accountsBloc,
globalOptions,
disabled: true,
);
// ignore: close_sinks // ignore: close_sinks
final userThemeStream = BehaviorSubject<NextcloudTheme?>(); final userThemeStream = BehaviorSubject<NextcloudTheme?>();
@ -163,6 +168,9 @@ Future pumpAppPage(
Provider<FirstLaunchBloc>( Provider<FirstLaunchBloc>(
create: (final _) => firstLaunchBloc, create: (final _) => firstLaunchBloc,
), ),
Provider<NextPushBloc>(
create: (final _) => nextPushBloc,
),
Provider<List<AppImplementation>>( Provider<List<AppImplementation>>(
create: (final _) => allAppImplementations, create: (final _) => allAppImplementations,
), ),

5
packages/neon/lib/l10n/en.arb

@ -51,6 +51,10 @@
"showSlashHide": "Show/Hide", "showSlashHide": "Show/Hide",
"exit": "Exit", "exit": "Exit",
"disabled": "Disabled", "disabled": "Disabled",
"firstLaunchGoToSettingsToEnablePushNotifications": "Go to the settings to enable push notifications",
"nextPushSupported": "NextPush is supported!",
"nextPushSupportedText": "NextPush is a FOSS way of receiving push notifications using the UnifiedPush protocol via a Nextcloud instance.\nYou can install NextPush from the F-Droid app store.",
"nextPushSupportedInstall": "Install NextPush",
"settings": "Settings", "settings": "Settings",
"settingsApps": "Apps", "settingsApps": "Apps",
"settingsExport": "Export settings", "settingsExport": "Export settings",
@ -65,7 +69,6 @@
} }
} }
}, },
"settingsGoToSettingsToEnablePushNotifications": "Go to the settings to enable push notifications",
"optionsCategoryGeneral": "General", "optionsCategoryGeneral": "General",
"optionsCategoryTheme": "Theme", "optionsCategoryTheme": "Theme",
"optionsCategoryPushNotifications": "Push notifications", "optionsCategoryPushNotifications": "Push notifications",

30
packages/neon/lib/l10n/localizations.dart

@ -269,6 +269,30 @@ abstract class AppLocalizations {
/// **'Disabled'** /// **'Disabled'**
String get disabled; String get disabled;
/// No description provided for @firstLaunchGoToSettingsToEnablePushNotifications.
///
/// In en, this message translates to:
/// **'Go to the settings to enable push notifications'**
String get firstLaunchGoToSettingsToEnablePushNotifications;
/// No description provided for @nextPushSupported.
///
/// In en, this message translates to:
/// **'NextPush is supported!'**
String get nextPushSupported;
/// No description provided for @nextPushSupportedText.
///
/// In en, this message translates to:
/// **'NextPush is a FOSS way of receiving push notifications using the UnifiedPush protocol via a Nextcloud instance.\nYou can install NextPush from the F-Droid app store.'**
String get nextPushSupportedText;
/// No description provided for @nextPushSupportedInstall.
///
/// In en, this message translates to:
/// **'Install NextPush'**
String get nextPushSupportedInstall;
/// No description provided for @settings. /// No description provided for @settings.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
@ -311,12 +335,6 @@ abstract class AppLocalizations {
/// **'Do you want to reset all settings for {name}?'** /// **'Do you want to reset all settings for {name}?'**
String settingsResetForConfirmation(String name); String settingsResetForConfirmation(String name);
/// No description provided for @settingsGoToSettingsToEnablePushNotifications.
///
/// In en, this message translates to:
/// **'Go to the settings to enable push notifications'**
String get settingsGoToSettingsToEnablePushNotifications;
/// No description provided for @optionsCategoryGeneral. /// No description provided for @optionsCategoryGeneral.
/// ///
/// In en, this message translates to: /// In en, this message translates to:

16
packages/neon/lib/l10n/localizations_en.dart

@ -103,6 +103,19 @@ class AppLocalizationsEn extends AppLocalizations {
@override @override
String get disabled => 'Disabled'; String get disabled => 'Disabled';
@override
String get firstLaunchGoToSettingsToEnablePushNotifications => 'Go to the settings to enable push notifications';
@override
String get nextPushSupported => 'NextPush is supported!';
@override
String get nextPushSupportedText =>
'NextPush is a FOSS way of receiving push notifications using the UnifiedPush protocol via a Nextcloud instance.\nYou can install NextPush from the F-Droid app store.';
@override
String get nextPushSupportedInstall => 'Install NextPush';
@override @override
String get settings => 'Settings'; String get settings => 'Settings';
@ -126,9 +139,6 @@ class AppLocalizationsEn extends AppLocalizations {
return 'Do you want to reset all settings for $name?'; return 'Do you want to reset all settings for $name?';
} }
@override
String get settingsGoToSettingsToEnablePushNotifications => 'Go to the settings to enable push notifications';
@override @override
String get optionsCategoryGeneral => 'General'; String get optionsCategoryGeneral => 'General';

4
packages/neon/lib/main.dart

@ -55,6 +55,7 @@ Future main() async {
platform, platform,
); );
final firstLaunchBloc = FirstLaunchBloc(sharedPreferences); final firstLaunchBloc = FirstLaunchBloc(sharedPreferences);
final nextPushBloc = NextPushBloc(accountsBloc, globalOptions);
runApp( runApp(
MultiProvider( MultiProvider(
@ -83,6 +84,9 @@ Future main() async {
Provider<FirstLaunchBloc>( Provider<FirstLaunchBloc>(
create: (final _) => firstLaunchBloc, create: (final _) => firstLaunchBloc,
), ),
Provider<NextPushBloc>(
create: (final _) => nextPushBloc,
),
Provider<List<AppImplementation>>( Provider<List<AppImplementation>>(
create: (final _) => allAppImplementations, create: (final _) => allAppImplementations,
), ),

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

@ -27,6 +27,7 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra
late NeonPlatform _platform; late NeonPlatform _platform;
late GlobalOptions _globalOptions; late GlobalOptions _globalOptions;
late AccountsBloc _accountsBloc; late AccountsBloc _accountsBloc;
final _globalPopups = const GlobalPopups();
NextcloudCoreServerCapabilities_Ocs_Data_Capabilities_Theming? _nextcloudTheme; NextcloudCoreServerCapabilities_Ocs_Data_Capabilities_Theming? _nextcloudTheme;
final _platformBrightness = BehaviorSubject<Brightness>.seeded(WidgetsBinding.instance.window.platformBrightness); final _platformBrightness = BehaviorSubject<Brightness>.seeded(WidgetsBinding.instance.window.platformBrightness);
@ -71,13 +72,18 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra
name: 'home', name: 'home',
); );
Widget builder(final context) => Scaffold( Widget builder(final context) => Scaffold(
body: HomePage( body: Stack(
account: activeAccount, children: [
onThemeChanged: (final nextcloudTheme) { _globalPopups,
setState(() { HomePage(
_nextcloudTheme = nextcloudTheme; account: activeAccount,
}); onThemeChanged: (final nextcloudTheme) {
}, setState(() {
_nextcloudTheme = nextcloudTheme;
});
},
),
],
), ),
); );
await _navigatorKey.currentState!.pushAndRemoveUntil( await _navigatorKey.currentState!.pushAndRemoveUntil(

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

@ -0,0 +1,77 @@
part of '../neon.dart';
abstract class NextPushBlocEvents {}
abstract class NextPushBlocStates {
BehaviorSubject get onNextPushSupported;
}
class NextPushBloc extends Bloc implements NextPushBlocEvents, NextPushBlocStates {
NextPushBloc(
this._accountsBloc,
this._globalOptions, {
final bool disabled = false,
}) {
if (disabled) {
return;
}
Rx.merge([
_globalOptions.pushNotificationsEnabled.stream,
_globalOptions.pushNotificationsDistributor.stream,
_globalOptions.pushNotificationsDistributor.values,
_accountsBloc.accounts,
]).debounceTime(const Duration(milliseconds: 100)).listen((final _) async {
if (!_globalOptions.pushNotificationsEnabled.enabled.hasValue ||
!_globalOptions.pushNotificationsEnabled.enabled.value ||
!_globalOptions.pushNotificationsEnabled.hasValue ||
!_globalOptions.pushNotificationsEnabled.value) {
return;
}
if (_globalOptions.pushNotificationsDistributor.value != null) {
return;
}
if (_globalOptions.pushNotificationsDistributor.values.value.containsKey(unifiedPushNextPushID)) {
// NextPush is already installed
return;
}
var supported = false;
for (final account in _accountsBloc.accounts.value) {
if (!_supported.containsKey(account)) {
try {
_supported[account] = (await account.client.unifiedPushProvider.check()).success;
} catch (e, s) {
debugPrint(e.toString());
debugPrint(s.toString());
_supported[account] = false;
}
}
if (_supported[account]!) {
supported = true;
break;
}
}
if (!supported) {
return;
}
if (onNextPushSupported.hasValue) {
return;
}
onNextPushSupported.add(null);
});
}
final AccountsBloc _accountsBloc;
final GlobalOptions _globalOptions;
final _supported = <Account, bool>{};
@override
void dispose() {
unawaited(onNextPushSupported.close());
}
@override
BehaviorSubject onNextPushSupported = BehaviorSubject();
}

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

@ -52,6 +52,7 @@ part 'blocs/apps.dart';
part 'blocs/capabilities.dart'; part 'blocs/capabilities.dart';
part 'blocs/first_launch.dart'; part 'blocs/first_launch.dart';
part 'blocs/login.dart'; part 'blocs/login.dart';
part 'blocs/next_push.dart';
part 'blocs/push_notifications.dart'; part 'blocs/push_notifications.dart';
part 'blocs/user_details.dart'; part 'blocs/user_details.dart';
part 'blocs/user_status.dart'; part 'blocs/user_status.dart';
@ -71,6 +72,7 @@ part 'utils/confirmation_dialog.dart';
part 'utils/env.dart'; part 'utils/env.dart';
part 'utils/global.dart'; part 'utils/global.dart';
part 'utils/global_options.dart'; part 'utils/global_options.dart';
part 'utils/global_popups.dart';
part 'utils/hex_color.dart'; part 'utils/hex_color.dart';
part 'utils/localizations.dart'; part 'utils/localizations.dart';
part 'utils/missing_permission_exception.dart'; part 'utils/missing_permission_exception.dart';

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

@ -24,7 +24,6 @@ class _HomePageState extends State<HomePage> {
late AccountsBloc _accountsBloc; late AccountsBloc _accountsBloc;
late AppsBloc _appsBloc; late AppsBloc _appsBloc;
late CapabilitiesBloc _capabilitiesBloc; late CapabilitiesBloc _capabilitiesBloc;
late FirstLaunchBloc _firstLaunchBloc;
@override @override
void initState() { void initState() {
@ -34,7 +33,6 @@ class _HomePageState extends State<HomePage> {
_accountsBloc = Provider.of<AccountsBloc>(context, listen: false); _accountsBloc = Provider.of<AccountsBloc>(context, listen: false);
_appsBloc = _accountsBloc.getAppsBloc(widget.account); _appsBloc = _accountsBloc.getAppsBloc(widget.account);
_capabilitiesBloc = _accountsBloc.getCapabilitiesBloc(widget.account); _capabilitiesBloc = _accountsBloc.getCapabilitiesBloc(widget.account);
_firstLaunchBloc = Provider.of<FirstLaunchBloc>(context, listen: false);
_appsBloc.openNotifications.listen((final _) async { _appsBloc.openNotifications.listen((final _) async {
final notificationsAppImplementation = _appsBloc.notificationsAppImplementation.valueOrNull; final notificationsAppImplementation = _appsBloc.notificationsAppImplementation.valueOrNull;
@ -98,24 +96,6 @@ class _HomePageState extends State<HomePage> {
} }
}); });
_firstLaunchBloc.onFirstLaunch.listen((final _) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context).settingsGoToSettingsToEnablePushNotifications),
action: SnackBarAction(
label: AppLocalizations.of(context).settings,
onPressed: () async {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (final context) => const SettingsPage(),
),
);
},
),
),
);
});
unawaited(_checkMaintenanceMode()); unawaited(_checkMaintenanceMode());
} }

4
packages/neon/lib/src/utils/global_options.dart

@ -1,5 +1,7 @@
part of '../neon.dart'; part of '../neon.dart';
const unifiedPushNextPushID = 'org.unifiedpush.distributor.nextpush';
class GlobalOptions { class GlobalOptions {
GlobalOptions( GlobalOptions(
this._storage, this._storage,
@ -63,7 +65,7 @@ class GlobalOptions {
'io.heckel.ntfy': (final context) => AppLocalizations.of(context).globalOptionsPushNotificationsDistributorNtfy, 'io.heckel.ntfy': (final context) => AppLocalizations.of(context).globalOptionsPushNotificationsDistributorNtfy,
'org.unifiedpush.distributor.fcm': (final context) => 'org.unifiedpush.distributor.fcm': (final context) =>
AppLocalizations.of(context).globalOptionsPushNotificationsDistributorFCMUP, AppLocalizations.of(context).globalOptionsPushNotificationsDistributorFCMUP,
'org.unifiedpush.distributor.nextpush': (final context) => unifiedPushNextPushID: (final context) =>
AppLocalizations.of(context).globalOptionsPushNotificationsDistributorNextPush, AppLocalizations.of(context).globalOptionsPushNotificationsDistributorNextPush,
'org.unifiedpush.distributor.noprovider2push': (final context) => 'org.unifiedpush.distributor.noprovider2push': (final context) =>
AppLocalizations.of(context).globalOptionsPushNotificationsDistributorNoProvider2Push, AppLocalizations.of(context).globalOptionsPushNotificationsDistributorNoProvider2Push,

72
packages/neon/lib/src/utils/global_popups.dart

@ -0,0 +1,72 @@
part of '../neon.dart';
class GlobalPopups extends StatefulWidget {
const GlobalPopups({
super.key,
});
@override
State<GlobalPopups> createState() => _GlobalPopupsState();
}
class _GlobalPopupsState extends State<GlobalPopups> {
late FirstLaunchBloc _firstLaunchBloc;
late NextPushBloc _nextPushBloc;
@override
void initState() {
super.initState();
_firstLaunchBloc = Provider.of<FirstLaunchBloc>(context, listen: false);
_nextPushBloc = Provider.of<NextPushBloc>(context, listen: false);
_firstLaunchBloc.onFirstLaunch.listen((final _) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context).firstLaunchGoToSettingsToEnablePushNotifications),
action: SnackBarAction(
label: AppLocalizations.of(context).settings,
onPressed: () async {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (final context) => const SettingsPage(),
),
);
},
),
),
);
});
_nextPushBloc.onNextPushSupported.listen((final _) async {
await showDialog(
context: context,
builder: (final context) => AlertDialog(
title: Text(AppLocalizations.of(context).nextPushSupported),
content: Text(AppLocalizations.of(context).nextPushSupportedText),
actions: [
OutlinedButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(AppLocalizations.of(context).no),
),
ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
launchUrlString(
'https://f-droid.org/packages/$unifiedPushNextPushID',
mode: LaunchMode.externalApplication,
);
},
child: Text(AppLocalizations.of(context).nextPushSupportedInstall),
),
],
),
);
});
}
@override
Widget build(final BuildContext context) => Container();
}

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

@ -157,6 +157,7 @@ class NextcloudClient {
NextcloudNotesClient get notes => NextcloudNotesClient(this); NextcloudNotesClient get notes => NextcloudNotesClient(this);
NextcloudNotificationsClient get notifications => NextcloudNotificationsClient(this); NextcloudNotificationsClient get notifications => NextcloudNotificationsClient(this);
NextcloudProvisioningApiClient get provisioningApi => NextcloudProvisioningApiClient(this); NextcloudProvisioningApiClient get provisioningApi => NextcloudProvisioningApiClient(this);
NextcloudUnifiedPushProviderClient get unifiedPushProvider => NextcloudUnifiedPushProviderClient(this);
NextcloudUserStatusClient get userStatus => NextcloudUserStatusClient(this); NextcloudUserStatusClient get userStatus => NextcloudUserStatusClient(this);
} }
@ -1177,6 +1178,240 @@ class NextcloudProvisioningApiClient {
} }
} }
class NextcloudUnifiedPushProviderClient {
NextcloudUnifiedPushProviderClient(this.rootClient);
final NextcloudClient rootClient;
/// Check if the UnifiedPush provider is present
Future<NextcloudUnifiedPushProviderCheckResponse200ApplicationJson> check() async {
var path = '/index.php/apps/uppush';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
final response = await rootClient.doRequest(
'get',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderCheckResponse200ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Set keepalive interval.
Future<NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson> setKeepalive(
{required String keepalive}) async {
var path = '/index.php/apps/uppush/keepalive';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
queryParameters['keepalive'] = keepalive;
final response = await rootClient.doRequest(
'put',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Request to create a new deviceId.
Future<NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson> createDevice(
{required String deviceName}) async {
var path = '/index.php/apps/uppush/device';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
queryParameters['deviceName'] = deviceName;
final response = await rootClient.doRequest(
'put',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Request to get push messages.
/// This is a public page since it has to be handle by the non-connected app (NextPush app and not Nextcloud-app)
Future<NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson> syncDevice(
{required String deviceId}) async {
var path = '/index.php/apps/uppush/device/{deviceId}';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
path = path.replaceAll('{deviceId}', Uri.encodeQueryComponent(deviceId));
final response = await rootClient.doRequest(
'get',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 401) {
return NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Delete a device.
Future<NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson> deleteDevice(
{required String deviceId}) async {
var path = '/index.php/apps/uppush/device/{deviceId}';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
path = path.replaceAll('{deviceId}', Uri.encodeQueryComponent(deviceId));
final response = await rootClient.doRequest(
'delete',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Create an authorization token for a new 3rd party service.
Future<NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson> createApp({
required String deviceId,
required String appName,
}) async {
var path = '/index.php/apps/uppush/app';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
queryParameters['deviceId'] = deviceId;
queryParameters['appName'] = appName;
final response = await rootClient.doRequest(
'put',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Delete an authorization token.
Future<NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson> deleteApp({required String token}) async {
var path = '/index.php/apps/uppush/app/{token}';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
path = path.replaceAll('{token}', Uri.encodeQueryComponent(token));
final response = await rootClient.doRequest(
'delete',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Unifiedpush discovery Following specifications
Future<NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson> unifiedpushDiscovery(
{required String token}) async {
var path = '/index.php/apps/uppush/push/{token}';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
path = path.replaceAll('{token}', Uri.encodeQueryComponent(token));
final response = await rootClient.doRequest(
'get',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Receive notifications from 3rd parties.
Future<NextcloudUnifiedPushProviderPushResponse201ApplicationJson> push({required String token}) async {
var path = '/index.php/apps/uppush/push/{token}';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
path = path.replaceAll('{token}', Uri.encodeQueryComponent(token));
final response = await rootClient.doRequest(
'post',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 201) {
return NextcloudUnifiedPushProviderPushResponse201ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Matrix Gateway discovery
Future<NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson> gatewayMatrixDiscovery() async {
var path = '/index.php/apps/uppush/gateway/matrix';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
final response = await rootClient.doRequest(
'get',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
/// Matrix Gateway
Future<NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson> gatewayMatrix() async {
var path = '/index.php/apps/uppush/gateway/matrix';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
Uint8List? body;
final response = await rootClient.doRequest(
'post',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
headers,
body,
);
if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson.fromJson(
json.decode(utf8.decode(response.body) as String) as Map<String, dynamic>);
}
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
}
}
class NextcloudUserStatusClient { class NextcloudUserStatusClient {
NextcloudUserStatusClient(this.rootClient); NextcloudUserStatusClient(this.rootClient);
@ -4523,6 +4758,338 @@ class NextcloudProvisioningApiUser {
static String? toJsonString(NextcloudProvisioningApiUser? data) => data == null ? null : json.encode(data.toJson()); static String? toJsonString(NextcloudProvisioningApiUser? data) => data == null ? null : json.encode(data.toJson());
} }
@JsonSerializable()
class NextcloudUnifiedPushProviderCheckResponse200ApplicationJson {
NextcloudUnifiedPushProviderCheckResponse200ApplicationJson({required this.success});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderCheckResponse200ApplicationJson.fromJson(Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderCheckResponse200ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderCheckResponse200ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderCheckResponse200ApplicationJson.fromJson(json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final bool success;
// coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUnifiedPushProviderCheckResponse200ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderCheckResponse200ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson {
NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson({required this.success});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson.fromJson(Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final bool success;
// coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson {
NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson({
required this.success,
required this.deviceId,
});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson.fromJson(Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final bool success;
final String deviceId;
// coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson {
NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson({required this.success});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson.fromJson(Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final bool success;
// coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson {
NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson({required this.success});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson.fromJson(Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final bool success;
// coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson {
NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson({
required this.success,
required this.token,
});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson.fromJson(Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final bool success;
final String token;
// coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson {
NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson({required this.success});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson.fromJson(Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final bool success;
// coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush {
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush({required this.version});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_UnifiedpushFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush.fromJsonString(
String data) =>
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final int version;
// coverage:ignore-start
Map<String, dynamic> toJson() =>
_$NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_UnifiedpushToJson(this);
// coverage:ignore-end
static String? toJsonString(
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson {
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson({required this.unifiedpush});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson.fromJson(
Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush unifiedpush;
// coverage:ignore-start
Map<String, dynamic> toJson() =>
_$NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderPushResponse201ApplicationJson {
NextcloudUnifiedPushProviderPushResponse201ApplicationJson({required this.success});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderPushResponse201ApplicationJson.fromJson(Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderPushResponse201ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderPushResponse201ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderPushResponse201ApplicationJson.fromJson(json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final bool success;
// coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUnifiedPushProviderPushResponse201ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderPushResponse201ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush {
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush({required this.gateway});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_UnifiedpushFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush.fromJsonString(
String data) =>
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final String gateway;
// coverage:ignore-start
Map<String, dynamic> toJson() =>
_$NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_UnifiedpushToJson(this);
// coverage:ignore-end
static String? toJsonString(
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson {
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson({required this.unifiedpush});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson.fromJson(
Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush unifiedpush;
// coverage:ignore-start
Map<String, dynamic> toJson() =>
_$NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
@JsonSerializable()
class NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson {
NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson({required this.rejected});
// coverage:ignore-start
factory NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson.fromJson(Map<String, dynamic> json) =>
_$NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJsonFromJson(json);
// coverage:ignore-end
// coverage:ignore-start
factory NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson.fromJsonString(String data) =>
NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson.fromJson(
json.decode(data) as Map<String, dynamic>);
// coverage:ignore-end
final List<String> rejected;
// coverage:ignore-start
Map<String, dynamic> toJson() => _$NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJsonToJson(this);
// coverage:ignore-end
static String? toJsonString(NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson? data) =>
data == null ? null : json.encode(data.toJson());
}
enum NextcloudUserStatusClearAt_Type { enum NextcloudUserStatusClearAt_Type {
period('period'), period('period'),
@JsonValue('end-of') @JsonValue('end-of')
@ -5690,6 +6257,88 @@ final _deserializers = <Type, dynamic Function(dynamic)>{
List<NextcloudProvisioningApiUserDetails_BackendCapabilities>: (final data) => (data as List) List<NextcloudProvisioningApiUserDetails_BackendCapabilities>: (final data) => (data as List)
.map((final e) => NextcloudProvisioningApiUserDetails_BackendCapabilities.fromJson(e as Map<String, dynamic>)) .map((final e) => NextcloudProvisioningApiUserDetails_BackendCapabilities.fromJson(e as Map<String, dynamic>))
.toList(), .toList(),
NextcloudUnifiedPushProviderCheckResponse200ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderCheckResponse200ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderCheckResponse200ApplicationJson>: (final data) => (data as List)
.map((final e) => NextcloudUnifiedPushProviderCheckResponse200ApplicationJson.fromJson(e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson>: (final data) => (data as List)
.map((final e) =>
NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson.fromJson(e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson>: (final data) => (data as List)
.map((final e) =>
NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson.fromJson(e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson>: (final data) => (data as List)
.map((final e) =>
NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson.fromJson(e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson>: (final data) => (data as List)
.map((final e) =>
NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson.fromJson(e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson>: (final data) => (data as List)
.map((final e) =>
NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson.fromJson(e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson>: (final data) => (data as List)
.map((final e) =>
NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson.fromJson(e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson>: (final data) => (data as List)
.map((final e) => NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson.fromJson(
e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush: (final data) =>
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush>: (final data) => (data
as List)
.map((final e) => NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderPushResponse201ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderPushResponse201ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderPushResponse201ApplicationJson>: (final data) => (data as List)
.map((final e) => NextcloudUnifiedPushProviderPushResponse201ApplicationJson.fromJson(e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson.fromJson(
data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson>: (final data) => (data as List)
.map((final e) => NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson.fromJson(
e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush: (final data) =>
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush>: (final data) =>
(data as List)
.map((final e) =>
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
e as Map<String, dynamic>))
.toList(),
NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson: (final data) =>
NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson.fromJson(data as Map<String, dynamic>),
List<NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson>: (final data) => (data as List)
.map((final e) =>
NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson.fromJson(e as Map<String, dynamic>))
.toList(),
NextcloudUserStatusGetPublicStatuses: (final data) => NextcloudUserStatusGetPublicStatuses: (final data) =>
NextcloudUserStatusGetPublicStatuses.fromJson(data as Map<String, dynamic>), NextcloudUserStatusGetPublicStatuses.fromJson(data as Map<String, dynamic>),
List<NextcloudUserStatusGetPublicStatuses>: (final data) => (data as List) List<NextcloudUserStatusGetPublicStatuses>: (final data) => (data as List)
@ -5974,6 +6623,46 @@ final _serializers = <Type, dynamic Function(dynamic)>{
NextcloudProvisioningApiUserDetails_BackendCapabilities: (final data) => data.toJson(), NextcloudProvisioningApiUserDetails_BackendCapabilities: (final data) => data.toJson(),
List<NextcloudProvisioningApiUserDetails_BackendCapabilities>: (final data) => List<NextcloudProvisioningApiUserDetails_BackendCapabilities>: (final data) =>
data.map((final e) => e.toJson()).toList(), data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderCheckResponse200ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderCheckResponse200ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderPushResponse201ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderPushResponse201ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush: (final data) =>
data.toJson(),
List<NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson: (final data) => data.toJson(),
List<NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson>: (final data) =>
data.map((final e) => e.toJson()).toList(),
NextcloudUserStatusGetPublicStatuses: (final data) => data.toJson(), NextcloudUserStatusGetPublicStatuses: (final data) => data.toJson(),
List<NextcloudUserStatusGetPublicStatuses>: (final data) => data.map((final e) => e.toJson()).toList(), List<NextcloudUserStatusGetPublicStatuses>: (final data) => data.map((final e) => e.toJson()).toList(),
NextcloudUserStatusGetPublicStatuses_Ocs: (final data) => data.toJson(), NextcloudUserStatusGetPublicStatuses_Ocs: (final data) => data.toJson(),

229
packages/nextcloud/lib/src/nextcloud.openapi.g.dart

@ -1949,6 +1949,235 @@ Map<String, dynamic> _$NextcloudProvisioningApiUserToJson(NextcloudProvisioningA
'ocs': instance.ocs.toJson(), 'ocs': instance.ocs.toJson(),
}; };
NextcloudUnifiedPushProviderCheckResponse200ApplicationJson
_$NextcloudUnifiedPushProviderCheckResponse200ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['success'],
);
return NextcloudUnifiedPushProviderCheckResponse200ApplicationJson(
success: json['success'] as bool,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderCheckResponse200ApplicationJsonToJson(
NextcloudUnifiedPushProviderCheckResponse200ApplicationJson instance) =>
<String, dynamic>{
'success': instance.success,
};
NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson
_$NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['success'],
);
return NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson(
success: json['success'] as bool,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJsonToJson(
NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson instance) =>
<String, dynamic>{
'success': instance.success,
};
NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson
_$NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['success', 'deviceId'],
);
return NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson(
success: json['success'] as bool,
deviceId: json['deviceId'] as String,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJsonToJson(
NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson instance) =>
<String, dynamic>{
'success': instance.success,
'deviceId': instance.deviceId,
};
NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson
_$NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['success'],
);
return NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson(
success: json['success'] as bool,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJsonToJson(
NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson instance) =>
<String, dynamic>{
'success': instance.success,
};
NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson
_$NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['success'],
);
return NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson(
success: json['success'] as bool,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJsonToJson(
NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson instance) =>
<String, dynamic>{
'success': instance.success,
};
NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson
_$NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['success', 'token'],
);
return NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson(
success: json['success'] as bool,
token: json['token'] as String,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJsonToJson(
NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson instance) =>
<String, dynamic>{
'success': instance.success,
'token': instance.token,
};
NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson
_$NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['success'],
);
return NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson(
success: json['success'] as bool,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJsonToJson(
NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson instance) =>
<String, dynamic>{
'success': instance.success,
};
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush
_$NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_UnifiedpushFromJson(
Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['version'],
);
return NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush(
version: json['version'] as int,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_UnifiedpushToJson(
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush instance) =>
<String, dynamic>{
'version': instance.version,
};
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson
_$NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['unifiedpush'],
);
return NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson(
unifiedpush: NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
json['unifiedpush'] as Map<String, dynamic>),
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJsonToJson(
NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson instance) =>
<String, dynamic>{
'unifiedpush': instance.unifiedpush.toJson(),
};
NextcloudUnifiedPushProviderPushResponse201ApplicationJson
_$NextcloudUnifiedPushProviderPushResponse201ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['success'],
);
return NextcloudUnifiedPushProviderPushResponse201ApplicationJson(
success: json['success'] as bool,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderPushResponse201ApplicationJsonToJson(
NextcloudUnifiedPushProviderPushResponse201ApplicationJson instance) =>
<String, dynamic>{
'success': instance.success,
};
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush
_$NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_UnifiedpushFromJson(
Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['gateway'],
);
return NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush(
gateway: json['gateway'] as String,
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_UnifiedpushToJson(
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush instance) =>
<String, dynamic>{
'gateway': instance.gateway,
};
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson
_$NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['unifiedpush'],
);
return NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson(
unifiedpush: NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson_Unifiedpush.fromJson(
json['unifiedpush'] as Map<String, dynamic>),
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJsonToJson(
NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson instance) =>
<String, dynamic>{
'unifiedpush': instance.unifiedpush.toJson(),
};
NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson
_$NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJsonFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['rejected'],
);
return NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson(
rejected: (json['rejected'] as List<dynamic>).map((e) => e as String).toList(),
);
}
Map<String, dynamic> _$NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJsonToJson(
NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson instance) =>
<String, dynamic>{
'rejected': instance.rejected,
};
NextcloudUserStatusClearAt _$NextcloudUserStatusClearAtFromJson(Map<String, dynamic> json) { NextcloudUserStatusClearAt _$NextcloudUserStatusClearAtFromJson(Map<String, dynamic> json) {
$checkKeys( $checkKeys(
json, json,

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

@ -3419,6 +3419,422 @@
} }
} }
}, },
"/index.php/apps/uppush": {
"get": {
"tags": [
"unified_push_provider"
],
"summary": "Check if the UnifiedPush provider is present",
"operationId": "unified_push_provider-check",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/keepalive": {
"put": {
"tags": [
"unified_push_provider"
],
"summary": "Set keepalive interval.",
"operationId": "unified_push_provider-set-keepalive",
"parameters": [
{
"name": "keepalive",
"in": "query",
"description": "Keep alive value in seconds",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/device": {
"put": {
"tags": [
"unified_push_provider"
],
"summary": "Request to create a new deviceId.",
"operationId": "unified_push_provider-create-device",
"parameters": [
{
"name": "deviceName",
"in": "query",
"description": "Name of the device",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"success",
"deviceId"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"deviceId": {
"type": "string"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/device/{deviceId}": {
"parameters": [
{
"name": "deviceId",
"in": "path",
"description": "ID of the device",
"required": true,
"schema": {
"type": "string"
}
}
],
"get": {
"tags": [
"unified_push_provider"
],
"summary": "Request to get push messages.",
"description": "This is a public page since it has to be handle by the non-connected app (NextPush app and not Nextcloud-app)",
"operationId": "unified_push_provider-sync-device",
"responses": {
"401": {
"description": "Missing permissions to sync device",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
},
"delete": {
"tags": [
"unified_push_provider"
],
"summary": "Delete a device.",
"operationId": "unified_push_provider-delete-device",
"responses": {
"200": {
"description": "Device deleted successfully",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/app": {
"put": {
"tags": [
"unified_push_provider"
],
"summary": "Create an authorization token for a new 3rd party service.",
"operationId": "unified_push_provider-create-app",
"parameters": [
{
"name": "deviceId",
"in": "query",
"description": "ID of the device",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "appName",
"in": "query",
"description": "Name of the app",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "App created successfully",
"content": {
"application/json": {
"schema": {
"required": [
"success",
"token"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"token": {
"type": "string"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/app/{token}": {
"parameters": [
{
"name": "token",
"in": "path",
"description": "Token of the app",
"required": true,
"schema": {
"type": "string"
}
}
],
"delete": {
"tags": [
"unified_push_provider"
],
"summary": "Delete an authorization token.",
"operationId": "unified_push_provider-delete-app",
"responses": {
"200": {
"description": "App deleted successfully",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/push/{token}": {
"parameters": [
{
"name": "token",
"in": "path",
"description": "Token of the app to push to",
"required": true,
"schema": {
"type": "string"
}
}
],
"post": {
"tags": [
"unified_push_provider"
],
"summary": "Receive notifications from 3rd parties.",
"operationId": "unified_push_provider-push",
"responses": {
"201": {
"description": "Notification pushed successfully",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
},
"get": {
"tags": [
"unified_push_provider"
],
"summary": "Unifiedpush discovery Following specifications",
"operationId": "unified_push_provider-unifiedpush-discovery",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"unifiedpush"
],
"type": "object",
"properties": {
"unifiedpush": {
"required": [
"version"
],
"type": "object",
"properties": {
"version": {
"type": "integer"
}
}
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/gateway/matrix": {
"get": {
"tags": [
"unified_push_provider"
],
"summary": "Matrix Gateway discovery",
"operationId": "unified_push_provider-gateway-matrix-discovery",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"unifiedpush"
],
"type": "object",
"properties": {
"unifiedpush": {
"required": [
"gateway"
],
"type": "object",
"properties": {
"gateway": {
"type": "string"
}
}
}
}
}
}
}
}
}
},
"post": {
"tags": [
"unified_push_provider"
],
"summary": "Matrix Gateway",
"operationId": "unified_push_provider-gateway-matrix",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"rejected"
],
"type": "object",
"properties": {
"rejected": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/user_status/api/v1/statuses": { "/ocs/v2.php/apps/user_status/api/v1/statuses": {
"get": { "get": {
"operationId": "get-public-statuses", "operationId": "get-public-statuses",

66
packages/nextcloud/test/uppush.dart

@ -0,0 +1,66 @@
import 'package:test/test.dart';
import 'helper.dart';
Future main() async {
await run(await getDockerImage());
}
Future run(final DockerImage image) async {
group('uppush', () {
late DockerContainer container;
late TestNextcloudClient client;
setUp(() async {
container = await getDockerContainer(image);
client = await getTestClient(
container,
username: 'admin',
password: 'admin',
);
});
tearDown(() => container.destroy());
test('Is installed', () async {
final response = await client.unifiedPushProvider.check();
expect(response.success, isTrue);
});
test('Set keepalive', () async {
final response = await client.unifiedPushProvider.setKeepalive(keepalive: '10');
expect(response.success, isTrue);
});
test('Create device', () async {
final response = await client.unifiedPushProvider.createDevice(deviceName: 'Test');
expect(response.success, isTrue);
expect(response.deviceId, isNotEmpty);
});
test('Delete device', () async {
final deviceId = (await client.unifiedPushProvider.createDevice(deviceName: 'Test')).deviceId;
final response = await client.unifiedPushProvider.deleteDevice(deviceId: deviceId);
expect(response.success, isTrue);
});
test('Create app', () async {
final deviceId = (await client.unifiedPushProvider.createDevice(deviceName: 'Test')).deviceId;
final response = await client.unifiedPushProvider.createApp(deviceId: deviceId, appName: 'Test');
expect(response.success, isTrue);
expect(response.token, isNotEmpty);
});
test('UnifiedPush discovery', () async {
final response = await client.unifiedPushProvider.unifiedpushDiscovery(token: 'example');
expect(response.unifiedpush.version, 1);
});
test('Matrix gateway discovery', () async {
final response = await client.unifiedPushProvider.gatewayMatrixDiscovery();
expect(response.unifiedpush.gateway, 'matrix');
});
// Deleting an app, sending a notification (also via matrix gateway) or listening for notifications is not possible because redis is not set up
});
}

444
specs/uppush.json

@ -0,0 +1,444 @@
{
"openapi": "3.0.3",
"info": {
"title": "UnifiedPush Provider",
"description": "Use Nextcloud as a push provider for mobile phones' notifications",
"license": {
"name": "agpl"
},
"version": "1.2.0"
},
"paths": {
"/index.php/apps/uppush": {
"get": {
"tags": [
"unified_push_provider"
],
"summary": "Check if the UnifiedPush provider is present",
"operationId": "unified_push_provider-check",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/keepalive": {
"put": {
"tags": [
"unified_push_provider"
],
"summary": "Set keepalive interval.",
"operationId": "unified_push_provider-set-keepalive",
"parameters": [
{
"name": "keepalive",
"in": "query",
"description": "Keep alive value in seconds",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/device": {
"put": {
"tags": [
"unified_push_provider"
],
"summary": "Request to create a new deviceId.",
"operationId": "unified_push_provider-create-device",
"parameters": [
{
"name": "deviceName",
"in": "query",
"description": "Name of the device",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"success",
"deviceId"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"deviceId": {
"type": "string"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/device/{deviceId}": {
"parameters": [
{
"name": "deviceId",
"in": "path",
"description": "ID of the device",
"required": true,
"schema": {
"type": "string"
}
}
],
"get": {
"tags": [
"unified_push_provider"
],
"summary": "Request to get push messages.",
"description": "This is a public page since it has to be handle by the non-connected app (NextPush app and not Nextcloud-app)",
"operationId": "unified_push_provider-sync-device",
"responses": {
"401": {
"description": "Missing permissions to sync device",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
},
"delete": {
"tags": [
"unified_push_provider"
],
"summary": "Delete a device.",
"operationId": "unified_push_provider-delete-device",
"responses": {
"200": {
"description": "Device deleted successfully",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/app": {
"put": {
"tags": [
"unified_push_provider"
],
"summary": "Create an authorization token for a new 3rd party service.",
"operationId": "unified_push_provider-create-app",
"parameters": [
{
"name": "deviceId",
"in": "query",
"description": "ID of the device",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "appName",
"in": "query",
"description": "Name of the app",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "App created successfully",
"content": {
"application/json": {
"schema": {
"required": [
"success",
"token"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"token": {
"type": "string"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/app/{token}": {
"parameters": [
{
"name": "token",
"in": "path",
"description": "Token of the app",
"required": true,
"schema": {
"type": "string"
}
}
],
"delete": {
"tags": [
"unified_push_provider"
],
"summary": "Delete an authorization token.",
"operationId": "unified_push_provider-delete-app",
"responses": {
"200": {
"description": "App deleted successfully",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/push/{token}": {
"parameters": [
{
"name": "token",
"in": "path",
"description": "Token of the app to push to",
"required": true,
"schema": {
"type": "string"
}
}
],
"post": {
"tags": [
"unified_push_provider"
],
"summary": "Receive notifications from 3rd parties.",
"operationId": "unified_push_provider-push",
"responses": {
"201": {
"description": "Notification pushed successfully",
"content": {
"application/json": {
"schema": {
"required": [
"success"
],
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}
}
},
"get": {
"tags": [
"unified_push_provider"
],
"summary": "Unifiedpush discovery Following specifications",
"operationId": "unified_push_provider-unifiedpush-discovery",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"unifiedpush"
],
"type": "object",
"properties": {
"unifiedpush": {
"required": [
"version"
],
"type": "object",
"properties": {
"version": {
"type": "integer"
}
}
}
}
}
}
}
}
}
}
},
"/index.php/apps/uppush/gateway/matrix": {
"get": {
"tags": [
"unified_push_provider"
],
"summary": "Matrix Gateway discovery",
"operationId": "unified_push_provider-gateway-matrix-discovery",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"unifiedpush"
],
"type": "object",
"properties": {
"unifiedpush": {
"required": [
"gateway"
],
"type": "object",
"properties": {
"gateway": {
"type": "string"
}
}
}
}
}
}
}
}
}
},
"post": {
"tags": [
"unified_push_provider"
],
"summary": "Matrix Gateway",
"operationId": "unified_push_provider-gateway-matrix",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"required": [
"rejected"
],
"type": "object",
"properties": {
"rejected": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {},
"securitySchemes": {
"basic_auth": {
"type": "http",
"scheme": "basic"
}
}
},
"security": [
{
"basic_auth": []
}
],
"tags": []
}

1
tool/Dockerfile.dev

@ -13,6 +13,7 @@ RUN OC_PASS="user2" ./occ user:add --password-from-env --display-name "User Two"
RUN ./occ app:install news # 21.0.0 RUN ./occ app:install news # 21.0.0
RUN ./occ app:install notes # 4.6.0 RUN ./occ app:install notes # 4.6.0
RUN ./occ app:install uppush # 1.2.0
RUN ./occ app:enable password_policy RUN ./occ app:enable password_policy
# TODO: This stopped working randomly with apache not being able to bind to the port during build. Must be some docker changes? # TODO: This stopped working randomly with apache not being able to bind to the port during build. Must be some docker changes?

4
tool/generate-nextcloud.sh

@ -5,8 +5,8 @@ cd "$(dirname "$0")/.."
rm -rf /tmp/nextcloud-neon rm -rf /tmp/nextcloud-neon
mkdir -p /tmp/nextcloud-neon mkdir -p /tmp/nextcloud-neon
codenames=(core news notes notifications provisioning_api user_status) codenames=(core news notes notifications provisioning_api uppush user_status)
prefixes=(Core News Notes Notifications ProvisioningApi UserStatus) prefixes=(Core News Notes Notifications ProvisioningApi UnifiedPushProvider UserStatus)
base_spec=/tmp/nextcloud-neon/base.json base_spec=/tmp/nextcloud-neon/base.json
merged_spec=/tmp/nextcloud-neon/merged.json merged_spec=/tmp/nextcloud-neon/merged.json

Loading…
Cancel
Save