From a4c0b26325447e43dc0b3a05c15ac8987a893212 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Sun, 24 Sep 2023 21:42:17 +0200 Subject: [PATCH] style(dynamite,dynamite_runtime,nextcloud): unify responses and exceptions Signed-off-by: Nikolas Rimikis --- .../dynamite/lib/src/builder/client.dart | 105 +------------ .../dynamite_runtime/lib/src/http_client.dart | 78 +++++++++- .../lib/src/api/comments.openapi.dart | 37 ----- .../nextcloud/lib/src/api/core.openapi.dart | 139 +++++++----------- .../lib/src/api/dashboard.openapi.dart | 43 +----- .../nextcloud/lib/src/api/dav.openapi.dart | 39 +---- .../nextcloud/lib/src/api/files.openapi.dart | 63 ++------ .../lib/src/api/files_external.openapi.dart | 39 +---- .../lib/src/api/files_reminders.openapi.dart | 43 +----- .../lib/src/api/files_sharing.openapi.dart | 83 +++-------- .../lib/src/api/files_trashbin.openapi.dart | 39 +---- .../lib/src/api/files_versions.openapi.dart | 39 +---- .../nextcloud/lib/src/api/news.openapi.dart | 73 +++------ .../nextcloud/lib/src/api/notes.openapi.dart | 51 +------ .../lib/src/api/notifications.openapi.dart | 61 ++------ .../lib/src/api/provisioning_api.openapi.dart | 123 ++++++---------- .../lib/src/api/settings.openapi.dart | 43 +----- .../lib/src/api/sharebymail.openapi.dart | 37 ----- .../lib/src/api/theming.openapi.dart | 59 ++------ .../src/api/updatenotification.openapi.dart | 39 +---- .../nextcloud/lib/src/api/uppush.openapi.dart | 59 ++------ .../lib/src/api/user_status.openapi.dart | 57 ++----- .../lib/src/api/weather_status.openapi.dart | 51 +------ packages/nextcloud/test/helper.dart | 2 +- 24 files changed, 295 insertions(+), 1107 deletions(-) diff --git a/packages/dynamite/dynamite/lib/src/builder/client.dart b/packages/dynamite/dynamite/lib/src/builder/client.dart index 51a4fefa..ba62edac 100644 --- a/packages/dynamite/dynamite/lib/src/builder/client.dart +++ b/packages/dynamite/dynamite/lib/src/builder/client.dart @@ -11,109 +11,10 @@ import 'package:dynamite/src/models/openapi.dart' as openapi; import 'package:dynamite/src/models/type_result.dart'; import 'package:intersperse/intersperse.dart'; -List generateDynamiteOverrides(final State state) => [ - Class( - (final b) => b - ..name = '${state.classPrefix}Response' - ..types.addAll([ - refer('T'), - refer('U'), - ]) - ..extend = refer('DynamiteResponse') - ..constructors.add( - Constructor( - (final b) => b - ..requiredParameters.addAll( - ['data', 'headers'].map( - (final name) => Parameter( - (final b) => b - ..name = name - ..toSuper = true, - ), - ), - ), - ), - ) - ..methods.add( - Method( - (final b) => b - ..name = 'toString' - ..returns = refer('String') - ..annotations.add(refer('override')) - ..lambda = true - ..body = Code( - "'${state.classPrefix}Response(data: \$data, headers: \$headers)'", - ), - ), - ), - ), - Class( - (final b) => b - ..name = '${state.classPrefix}ApiException' - ..extend = refer('DynamiteApiException') - ..constructors.add( - Constructor( - (final b) => b - ..requiredParameters.addAll( - ['statusCode', 'headers', 'body'].map( - (final name) => Parameter( - (final b) => b - ..name = name - ..toSuper = true, - ), - ), - ), - ), - ) - ..methods.addAll([ - Method( - (final b) => b - ..name = 'fromResponse' - ..returns = refer('Future<${state.classPrefix}ApiException>') - ..static = true - ..modifier = MethodModifier.async - ..requiredParameters.add( - Parameter( - (final b) => b - ..name = 'response' - ..type = refer('HttpClientResponse'), - ), - ) - ..body = Code(''' -String body; -try { - body = await response.body; -} on FormatException { - body = 'binary'; -} - -return ${state.classPrefix}ApiException( - response.statusCode, - response.responseHeaders, - body, -); -'''), - ), - Method( - (final b) => b - ..name = 'toString' - ..returns = refer('String') - ..annotations.add(refer('override')) - ..lambda = true - ..body = Code( - "'${state.classPrefix}ApiException(statusCode: \$statusCode, headers: \$headers, body: \$body)'", - ), - ), - ]), - ), - ]; - Iterable generateClients( final openapi.OpenAPI spec, final State state, ) sync* { - yield* generateDynamiteOverrides(state); - final tags = generateTags(spec); yield buildRootClient(spec, state, tags); @@ -560,9 +461,9 @@ final _response = await $client.doRequest( } if (headersType != null && dataType != null) { - b.returns = refer('Future<${state.classPrefix}Response<$dataType, $headersType>>'); + b.returns = refer('Future>'); code.write( - 'return ${state.classPrefix}Response<$dataType, $headersType>(${dataNeedsAwait ?? false ? 'await ' : ''}$dataValue, $headersValue,);', + 'return DynamiteResponse<$dataType, $headersType>(${dataNeedsAwait ?? false ? 'await ' : ''}$dataValue, $headersValue,);', ); } else if (headersType != null) { b.returns = refer('Future<$headersType>'); @@ -578,7 +479,7 @@ final _response = await $client.doRequest( code.write('}'); } code.write( - 'throw await ${state.classPrefix}ApiException.fromResponse(_response); // coverage:ignore-line\n', + 'throw await DynamiteApiException.fromResponse(_response); // coverage:ignore-line\n', ); b.body = Code(code.toString()); diff --git a/packages/dynamite/dynamite_runtime/lib/src/http_client.dart b/packages/dynamite/dynamite_runtime/lib/src/http_client.dart index eb16c8b2..d1a4f4b2 100644 --- a/packages/dynamite/dynamite_runtime/lib/src/http_client.dart +++ b/packages/dynamite/dynamite_runtime/lib/src/http_client.dart @@ -32,31 +32,74 @@ extension DynamiteHttpClientResponseBody on HttpClientResponse { } } -class DynamiteResponse { - DynamiteResponse( - this.data, +/// Response returned by operations of a [DynamiteClient]. +/// +/// See: +/// * [DynamiteApiException] as the exception that can be thrown in operations +/// * [DynamiteAuthentication] for providing authentication methods. +/// * [DynamiteClient] for the client providing operations. +class DynamiteResponse { + /// Creates a new dynamite response. + const DynamiteResponse( + this.statusCode, + this.body, this.headers, ); - final T data; + /// The status code of the response. + final int statusCode; + + /// The decoded body of the response. + final B body; - final U headers; + /// The decoded headers of the response. + final H headers; @override - String toString() => 'DynamiteResponse(data: $data, headers: $headers)'; + String toString() => 'DynamiteResponse(data: $body, headers: $headers, statusCode: $statusCode)'; } +/// The exception thrown by operations of a [DynamiteClient]. +/// +/// +/// See: +/// * [DynamiteResponse] as the response returned by an operation. +/// * [DynamiteAuthentication] for providing authentication methods. +/// * [DynamiteClient] for the client providing operations. +@immutable class DynamiteApiException implements Exception { - DynamiteApiException( + /// Creates a new dynamite exception with the given information. + const DynamiteApiException( this.statusCode, this.headers, this.body, ); + /// Creates a new Exception from the given [response]. + /// + /// Tries to decode the `response` into a string. + static Future fromResponse(final HttpClientResponse response) async { + String body; + try { + body = await response.body; + } on FormatException { + body = 'binary'; + } + + return DynamiteApiException( + response.statusCode, + response.responseHeaders, + body, + ); + } + + /// The returned status code when the exception was thrown. final int statusCode; + /// The returned headers when the exception was thrown. final Map headers; + /// The returned body code when the exception was thrown. final String body; @override @@ -129,7 +172,17 @@ class DynamiteHttpBearerAuthentication extends DynamiteAuthentication { }; } +/// A client for making network requests. +/// +/// See: +/// * [DynamiteResponse] as the response returned by an operation. +/// * [DynamiteApiException] as the exception that can be thrown in operations +/// * [DynamiteAuthentication] for providing authentication methods. class DynamiteClient { + /// Creates a new dynamite network client. + /// + /// If [httpClient] is not provided a default one will be created. + /// The [baseURL] will be normalized, removing any trailing `/`. DynamiteClient( final Uri baseURL, { this.baseHeaders, @@ -140,16 +193,27 @@ class DynamiteClient { }) : httpClient = (httpClient ?? HttpClient())..userAgent = userAgent, baseURL = baseURL.normalizeEmptyPath(); + /// The base server url used to build the request uri. + /// + /// See `https://swagger.io/docs/specification/api-host-and-base-path` for + /// further information. final Uri baseURL; + /// The base headers added to each request. final Map? baseHeaders; + /// The base http client. final HttpClient httpClient; + /// The optional cookie jar to persist the response cookies. final CookieJar? cookieJar; + /// The available authentications for this client. + /// + /// The first one matching the required authentication type will be used. final List authentications; + /// Makes a request against a given [path]. Future doRequest( final String method, final Uri path, diff --git a/packages/nextcloud/lib/src/api/comments.openapi.dart b/packages/nextcloud/lib/src/api/comments.openapi.dart index 9edddb21..a37ddc5a 100644 --- a/packages/nextcloud/lib/src/api/comments.openapi.dart +++ b/packages/nextcloud/lib/src/api/comments.openapi.dart @@ -7,48 +7,11 @@ import 'package:built_value/serializer.dart'; import 'package:built_value/standard_json_plugin.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'comments.openapi.g.dart'; -class CommentsResponse extends DynamiteResponse { - CommentsResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'CommentsResponse(data: $data, headers: $headers)'; -} - -class CommentsApiException extends DynamiteApiException { - CommentsApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return CommentsApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'CommentsApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class CommentsClient extends DynamiteClient { CommentsClient( super.baseURL, { diff --git a/packages/nextcloud/lib/src/api/core.openapi.dart b/packages/nextcloud/lib/src/api/core.openapi.dart index 0e4c38e1..4d2c581b 100644 --- a/packages/nextcloud/lib/src/api/core.openapi.dart +++ b/packages/nextcloud/lib/src/api/core.openapi.dart @@ -12,48 +12,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'core.openapi.g.dart'; -class CoreResponse extends DynamiteResponse { - CoreResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'CoreResponse(data: $data, headers: $headers)'; -} - -class CoreApiException extends DynamiteApiException { - CoreApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return CoreApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'CoreApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class CoreClient extends DynamiteClient { CoreClient( super.baseURL, { @@ -129,7 +92,7 @@ class CoreClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(CoreStatus))! as CoreStatus; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -177,7 +140,7 @@ class CoreAppPasswordClient { specifiedType: const FullType(CoreAppPasswordGetAppPasswordResponseApplicationJson), )! as CoreAppPasswordGetAppPasswordResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Rotate app password @@ -221,7 +184,7 @@ class CoreAppPasswordClient { specifiedType: const FullType(CoreAppPasswordRotateAppPasswordResponseApplicationJson), )! as CoreAppPasswordRotateAppPasswordResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete app password @@ -265,7 +228,7 @@ class CoreAppPasswordClient { specifiedType: const FullType(CoreAppPasswordDeleteAppPasswordResponseApplicationJson), )! as CoreAppPasswordDeleteAppPasswordResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -337,7 +300,7 @@ class CoreAutoCompleteClient { specifiedType: const FullType(CoreAutoCompleteGetResponseApplicationJson), )! as CoreAutoCompleteGetResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -348,7 +311,7 @@ class CoreAvatarClient { final CoreClient _rootClient; /// Get the dark avatar - Future> getAvatarDark({ + Future> getAvatarDark({ required final String userId, required final int size, }) async { @@ -383,7 +346,7 @@ class CoreAvatarClient { body, ); if (response.statusCode == 200) { - return CoreResponse( + return DynamiteResponse( await response.bodyBytes, _jsonSerializers.deserialize( response.responseHeaders, @@ -391,11 +354,11 @@ class CoreAvatarClient { )! as CoreAvatarAvatarGetAvatarDarkHeaders, ); } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the avatar - Future> getAvatar({ + Future> getAvatar({ required final String userId, required final int size, }) async { @@ -430,7 +393,7 @@ class CoreAvatarClient { body, ); if (response.statusCode == 200) { - return CoreResponse( + return DynamiteResponse( await response.bodyBytes, _jsonSerializers.deserialize( response.responseHeaders, @@ -438,7 +401,7 @@ class CoreAvatarClient { )! as CoreAvatarAvatarGetAvatarHeaders, ); } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -484,7 +447,7 @@ class CoreClientFlowLoginV2Client { specifiedType: const FullType(CoreLoginFlowV2Credentials), )! as CoreLoginFlowV2Credentials; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Init a login flow @@ -521,7 +484,7 @@ class CoreClientFlowLoginV2Client { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(CoreLoginFlowV2))! as CoreLoginFlowV2; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -573,7 +536,7 @@ class CoreCollaborationResourcesClient { specifiedType: const FullType(CoreCollaborationResourcesSearchCollectionsResponseApplicationJson), )! as CoreCollaborationResourcesSearchCollectionsResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a collection @@ -619,7 +582,7 @@ class CoreCollaborationResourcesClient { specifiedType: const FullType(CoreCollaborationResourcesListCollectionResponseApplicationJson), )! as CoreCollaborationResourcesListCollectionResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Rename a collection @@ -667,7 +630,7 @@ class CoreCollaborationResourcesClient { specifiedType: const FullType(CoreCollaborationResourcesRenameCollectionResponseApplicationJson), )! as CoreCollaborationResourcesRenameCollectionResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Add a resource to a collection @@ -717,7 +680,7 @@ class CoreCollaborationResourcesClient { specifiedType: const FullType(CoreCollaborationResourcesAddResourceResponseApplicationJson), )! as CoreCollaborationResourcesAddResourceResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Remove a resource from a collection @@ -767,7 +730,7 @@ class CoreCollaborationResourcesClient { specifiedType: const FullType(CoreCollaborationResourcesRemoveResourceResponseApplicationJson), )! as CoreCollaborationResourcesRemoveResourceResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get collections by resource @@ -815,7 +778,7 @@ class CoreCollaborationResourcesClient { specifiedType: const FullType(CoreCollaborationResourcesGetCollectionsByResourceResponseApplicationJson), )! as CoreCollaborationResourcesGetCollectionsByResourceResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Create a collection for a resource @@ -865,7 +828,7 @@ class CoreCollaborationResourcesClient { specifiedType: const FullType(CoreCollaborationResourcesCreateCollectionOnResourceResponseApplicationJson), )! as CoreCollaborationResourcesCreateCollectionOnResourceResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -913,7 +876,7 @@ class CoreGuestAvatarClient { if (response.statusCode == 200 || response.statusCode == 201) { return response.bodyBytes; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Returns a guest avatar image response @@ -960,7 +923,7 @@ class CoreGuestAvatarClient { if (response.statusCode == 200 || response.statusCode == 201) { return response.bodyBytes; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1012,7 +975,7 @@ class CoreHoverCardClient { specifiedType: const FullType(CoreHoverCardGetUserResponseApplicationJson), )! as CoreHoverCardGetUserResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1066,7 +1029,7 @@ class CoreNavigationClient { specifiedType: const FullType(CoreNavigationGetAppsNavigationResponseApplicationJson), )! as CoreNavigationGetAppsNavigationResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the settings navigation @@ -1114,7 +1077,7 @@ class CoreNavigationClient { specifiedType: const FullType(CoreNavigationGetSettingsNavigationResponseApplicationJson), )! as CoreNavigationGetSettingsNavigationResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1125,7 +1088,7 @@ class CoreOcmClient { final CoreClient _rootClient; /// generate a OCMProvider with local data and send it as DataResponse. This replaces the old PHP file ocm-provider/index.php - Future> discovery() async { + Future> discovery() async { const path = '/index.php/ocm-provider'; final queryParameters = {}; final headers = { @@ -1155,7 +1118,7 @@ class CoreOcmClient { body, ); if (response.statusCode == 200) { - return CoreResponse( + return DynamiteResponse( _jsonSerializers.deserialize( await response.jsonBody, specifiedType: const FullType(CoreOcmDiscoveryResponseApplicationJson), @@ -1166,7 +1129,7 @@ class CoreOcmClient { )! as CoreOcmOcmDiscoveryHeaders, ); } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1212,7 +1175,7 @@ class CoreOcsClient { specifiedType: const FullType(CoreOcsGetCapabilitiesResponseApplicationJson), )! as CoreOcsGetCapabilitiesResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1285,7 +1248,7 @@ class CorePreviewClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a preview by file path @@ -1352,7 +1315,7 @@ class CorePreviewClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1408,7 +1371,7 @@ class CoreProfileApiClient { specifiedType: const FullType(CoreProfileApiSetVisibilityResponseApplicationJson), )! as CoreProfileApiSetVisibilityResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1451,7 +1414,7 @@ class CoreReferenceClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1503,7 +1466,7 @@ class CoreReferenceApiClient { specifiedType: const FullType(CoreReferenceApiResolveOneResponseApplicationJson), )! as CoreReferenceApiResolveOneResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Resolve multiple references @@ -1553,7 +1516,7 @@ class CoreReferenceApiClient { specifiedType: const FullType(CoreReferenceApiResolveResponseApplicationJson), )! as CoreReferenceApiResolveResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Extract references from a text @@ -1607,7 +1570,7 @@ class CoreReferenceApiClient { specifiedType: const FullType(CoreReferenceApiExtractResponseApplicationJson), )! as CoreReferenceApiExtractResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the providers @@ -1651,7 +1614,7 @@ class CoreReferenceApiClient { specifiedType: const FullType(CoreReferenceApiGetProvidersInfoResponseApplicationJson), )! as CoreReferenceApiGetProvidersInfoResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Touch a provider @@ -1701,7 +1664,7 @@ class CoreReferenceApiClient { specifiedType: const FullType(CoreReferenceApiTouchProviderResponseApplicationJson), )! as CoreReferenceApiTouchProviderResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1747,7 +1710,7 @@ class CoreTextProcessingApiClient { specifiedType: const FullType(CoreTextProcessingApiTaskTypesResponseApplicationJson), )! as CoreTextProcessingApiTaskTypesResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// This endpoint allows scheduling a language model task @@ -1799,7 +1762,7 @@ class CoreTextProcessingApiClient { specifiedType: const FullType(CoreTextProcessingApiScheduleResponseApplicationJson), )! as CoreTextProcessingApiScheduleResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// This endpoint allows checking the status and results of a task. Tasks are removed 1 week after receiving their last update. @@ -1843,7 +1806,7 @@ class CoreTextProcessingApiClient { specifiedType: const FullType(CoreTextProcessingApiGetTaskResponseApplicationJson), )! as CoreTextProcessingApiGetTaskResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// This endpoint allows to delete a scheduled task for a user @@ -1889,7 +1852,7 @@ class CoreTextProcessingApiClient { specifiedType: const FullType(CoreTextProcessingApiDeleteTaskResponseApplicationJson), )! as CoreTextProcessingApiDeleteTaskResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// This endpoint returns a list of tasks of a user that are related with a specific appId and optionally with an identifier @@ -1939,7 +1902,7 @@ class CoreTextProcessingApiClient { specifiedType: const FullType(CoreTextProcessingApiListTasksByAppResponseApplicationJson), )! as CoreTextProcessingApiListTasksByAppResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1985,7 +1948,7 @@ class CoreTranslationApiClient { specifiedType: const FullType(CoreTranslationApiLanguagesResponseApplicationJson), )! as CoreTranslationApiLanguagesResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Translate a text @@ -2035,7 +1998,7 @@ class CoreTranslationApiClient { specifiedType: const FullType(CoreTranslationApiTranslateResponseApplicationJson), )! as CoreTranslationApiTranslateResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -2089,7 +2052,7 @@ class CoreUnifiedSearchClient { specifiedType: const FullType(CoreUnifiedSearchGetProvidersResponseApplicationJson), )! as CoreUnifiedSearchGetProvidersResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Search @@ -2158,7 +2121,7 @@ class CoreUnifiedSearchClient { specifiedType: const FullType(CoreUnifiedSearchSearchResponseApplicationJson), )! as CoreUnifiedSearchSearchResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -2206,7 +2169,7 @@ class CoreWhatsNewClient { specifiedType: const FullType(CoreWhatsNewGetResponseApplicationJson), )! as CoreWhatsNewGetResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Dismiss the changes @@ -2252,7 +2215,7 @@ class CoreWhatsNewClient { specifiedType: const FullType(CoreWhatsNewDismissResponseApplicationJson), )! as CoreWhatsNewDismissResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -2298,7 +2261,7 @@ class CoreWipeClient { specifiedType: const FullType(CoreWipeCheckWipeResponseApplicationJson), )! as CoreWipeCheckWipeResponseApplicationJson; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Finish the wipe @@ -2338,7 +2301,7 @@ class CoreWipeClient { specifiedType: const FullType(JsonObject), )! as JsonObject; } - throw await CoreApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/dashboard.openapi.dart b/packages/nextcloud/lib/src/api/dashboard.openapi.dart index 21dbfcdf..3709a050 100644 --- a/packages/nextcloud/lib/src/api/dashboard.openapi.dart +++ b/packages/nextcloud/lib/src/api/dashboard.openapi.dart @@ -10,48 +10,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'dashboard.openapi.g.dart'; -class DashboardResponse extends DynamiteResponse { - DashboardResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'DashboardResponse(data: $data, headers: $headers)'; -} - -class DashboardApiException extends DynamiteApiException { - DashboardApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return DashboardApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'DashboardApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class DashboardClient extends DynamiteClient { DashboardClient( super.baseURL, { @@ -118,7 +81,7 @@ class DashboardDashboardApiClient { specifiedType: const FullType(DashboardDashboardApiGetWidgetsResponseApplicationJson), )! as DashboardDashboardApiGetWidgetsResponseApplicationJson; } - throw await DashboardApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the items for the widgets @@ -179,7 +142,7 @@ class DashboardDashboardApiClient { specifiedType: const FullType(DashboardDashboardApiGetWidgetItemsResponseApplicationJson), )! as DashboardDashboardApiGetWidgetItemsResponseApplicationJson; } - throw await DashboardApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the items for the widgets @@ -240,7 +203,7 @@ class DashboardDashboardApiClient { specifiedType: const FullType(DashboardDashboardApiGetWidgetItemsV2ResponseApplicationJson), )! as DashboardDashboardApiGetWidgetItemsV2ResponseApplicationJson; } - throw await DashboardApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/dav.openapi.dart b/packages/nextcloud/lib/src/api/dav.openapi.dart index 7e37ffd4..f9838619 100644 --- a/packages/nextcloud/lib/src/api/dav.openapi.dart +++ b/packages/nextcloud/lib/src/api/dav.openapi.dart @@ -9,48 +9,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'dav.openapi.g.dart'; -class DavResponse extends DynamiteResponse { - DavResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'DavResponse(data: $data, headers: $headers)'; -} - -class DavApiException extends DynamiteApiException { - DavApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return DavApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'DavApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class DavClient extends DynamiteClient { DavClient( super.baseURL, { @@ -125,7 +88,7 @@ class DavDirectClient { specifiedType: const FullType(DavDirectGetUrlResponseApplicationJson), )! as DavDirectGetUrlResponseApplicationJson; } - throw await DavApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/files.openapi.dart b/packages/nextcloud/lib/src/api/files.openapi.dart index af8b02b4..6d506b3e 100644 --- a/packages/nextcloud/lib/src/api/files.openapi.dart +++ b/packages/nextcloud/lib/src/api/files.openapi.dart @@ -12,48 +12,11 @@ import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; import 'package:dynamite_runtime/utils.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'files.openapi.g.dart'; -class FilesResponse extends DynamiteResponse { - FilesResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'FilesResponse(data: $data, headers: $headers)'; -} - -class FilesApiException extends DynamiteApiException { - FilesApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return FilesApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'FilesApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class FilesClient extends DynamiteClient { FilesClient( super.baseURL, { @@ -132,7 +95,7 @@ class FilesApiClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -180,7 +143,7 @@ class FilesDirectEditingClient { specifiedType: const FullType(FilesDirectEditingInfoResponseApplicationJson), )! as FilesDirectEditingInfoResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the templates for direct editing @@ -228,7 +191,7 @@ class FilesDirectEditingClient { specifiedType: const FullType(FilesDirectEditingTemplatesResponseApplicationJson), )! as FilesDirectEditingTemplatesResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Open a file for direct editing @@ -282,7 +245,7 @@ class FilesDirectEditingClient { specifiedType: const FullType(FilesDirectEditingOpenResponseApplicationJson), )! as FilesDirectEditingOpenResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Create a file for direct editing @@ -336,7 +299,7 @@ class FilesDirectEditingClient { specifiedType: const FullType(FilesDirectEditingCreateResponseApplicationJson), )! as FilesDirectEditingCreateResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -388,7 +351,7 @@ class FilesOpenLocalEditorClient { specifiedType: const FullType(FilesOpenLocalEditorCreateResponseApplicationJson), )! as FilesOpenLocalEditorCreateResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Validate a local editor @@ -436,7 +399,7 @@ class FilesOpenLocalEditorClient { specifiedType: const FullType(FilesOpenLocalEditorValidateResponseApplicationJson), )! as FilesOpenLocalEditorValidateResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -484,7 +447,7 @@ class FilesTemplateClient { specifiedType: const FullType(FilesTemplateListResponseApplicationJson), )! as FilesTemplateListResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Create a template @@ -538,7 +501,7 @@ class FilesTemplateClient { specifiedType: const FullType(FilesTemplateCreateResponseApplicationJson), )! as FilesTemplateCreateResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Initialize the template directory @@ -590,7 +553,7 @@ class FilesTemplateClient { specifiedType: const FullType(FilesTemplatePathResponseApplicationJson), )! as FilesTemplatePathResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -644,7 +607,7 @@ class FilesTransferOwnershipClient { specifiedType: const FullType(FilesTransferOwnershipTransferResponseApplicationJson), )! as FilesTransferOwnershipTransferResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Accept an ownership transfer @@ -690,7 +653,7 @@ class FilesTransferOwnershipClient { specifiedType: const FullType(FilesTransferOwnershipAcceptResponseApplicationJson), )! as FilesTransferOwnershipAcceptResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Reject an ownership transfer @@ -736,7 +699,7 @@ class FilesTransferOwnershipClient { specifiedType: const FullType(FilesTransferOwnershipRejectResponseApplicationJson), )! as FilesTransferOwnershipRejectResponseApplicationJson; } - throw await FilesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/files_external.openapi.dart b/packages/nextcloud/lib/src/api/files_external.openapi.dart index f90baaa4..26bc0874 100644 --- a/packages/nextcloud/lib/src/api/files_external.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_external.openapi.dart @@ -11,48 +11,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'files_external.openapi.g.dart'; -class FilesExternalResponse extends DynamiteResponse { - FilesExternalResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'FilesExternalResponse(data: $data, headers: $headers)'; -} - -class FilesExternalApiException extends DynamiteApiException { - FilesExternalApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return FilesExternalApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'FilesExternalApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class FilesExternalClient extends DynamiteClient { FilesExternalClient( super.baseURL, { @@ -119,7 +82,7 @@ class FilesExternalApiClient { specifiedType: const FullType(FilesExternalApiGetUserMountsResponseApplicationJson), )! as FilesExternalApiGetUserMountsResponseApplicationJson; } - throw await FilesExternalApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/files_reminders.openapi.dart b/packages/nextcloud/lib/src/api/files_reminders.openapi.dart index ac6169fc..3e8d897b 100644 --- a/packages/nextcloud/lib/src/api/files_reminders.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_reminders.openapi.dart @@ -11,48 +11,11 @@ import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; import 'package:dynamite_runtime/utils.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'files_reminders.openapi.g.dart'; -class FilesRemindersResponse extends DynamiteResponse { - FilesRemindersResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'FilesRemindersResponse(data: $data, headers: $headers)'; -} - -class FilesRemindersApiException extends DynamiteApiException { - FilesRemindersApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return FilesRemindersApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'FilesRemindersApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class FilesRemindersClient extends DynamiteClient { FilesRemindersClient( super.baseURL, { @@ -126,7 +89,7 @@ class FilesRemindersApiClient { specifiedType: const FullType(FilesRemindersApiGetResponseApplicationJson), )! as FilesRemindersApiGetResponseApplicationJson; } - throw await FilesRemindersApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Set a reminder @@ -181,7 +144,7 @@ class FilesRemindersApiClient { specifiedType: const FullType(FilesRemindersApiSetResponseApplicationJson), )! as FilesRemindersApiSetResponseApplicationJson; } - throw await FilesRemindersApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Remove a reminder @@ -230,7 +193,7 @@ class FilesRemindersApiClient { specifiedType: const FullType(FilesRemindersApiRemoveResponseApplicationJson), )! as FilesRemindersApiRemoveResponseApplicationJson; } - throw await FilesRemindersApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart index cfdfd1c5..600db34c 100644 --- a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart @@ -11,48 +11,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'files_sharing.openapi.g.dart'; -class FilesSharingResponse extends DynamiteResponse { - FilesSharingResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'FilesSharingResponse(data: $data, headers: $headers)'; -} - -class FilesSharingApiException extends DynamiteApiException { - FilesSharingApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return FilesSharingApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'FilesSharingApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class FilesSharingClient extends DynamiteClient { FilesSharingClient( super.baseURL, { @@ -129,7 +92,7 @@ class FilesSharingDeletedShareapiClient { specifiedType: const FullType(FilesSharingDeletedShareapiListResponseApplicationJson), )! as FilesSharingDeletedShareapiListResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Undelete a deleted share @@ -175,7 +138,7 @@ class FilesSharingDeletedShareapiClient { specifiedType: const FullType(FilesSharingDeletedShareapiUndeleteResponseApplicationJson), )! as FilesSharingDeletedShareapiUndeleteResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -222,7 +185,7 @@ class FilesSharingPublicPreviewClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a preview for a shared file @@ -279,7 +242,7 @@ class FilesSharingPublicPreviewClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -327,7 +290,7 @@ class FilesSharingRemoteClient { specifiedType: const FullType(FilesSharingRemoteGetSharesResponseApplicationJson), )! as FilesSharingRemoteGetSharesResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get list of pending remote shares @@ -371,7 +334,7 @@ class FilesSharingRemoteClient { specifiedType: const FullType(FilesSharingRemoteGetOpenSharesResponseApplicationJson), )! as FilesSharingRemoteGetOpenSharesResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Accept a remote share @@ -417,7 +380,7 @@ class FilesSharingRemoteClient { specifiedType: const FullType(FilesSharingRemoteAcceptShareResponseApplicationJson), )! as FilesSharingRemoteAcceptShareResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Decline a remote share @@ -463,7 +426,7 @@ class FilesSharingRemoteClient { specifiedType: const FullType(FilesSharingRemoteDeclineShareResponseApplicationJson), )! as FilesSharingRemoteDeclineShareResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get info of a remote share @@ -509,7 +472,7 @@ class FilesSharingRemoteClient { specifiedType: const FullType(FilesSharingRemoteGetShareResponseApplicationJson), )! as FilesSharingRemoteGetShareResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Unshare a remote share @@ -555,7 +518,7 @@ class FilesSharingRemoteClient { specifiedType: const FullType(FilesSharingRemoteUnshareResponseApplicationJson), )! as FilesSharingRemoteUnshareResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -615,7 +578,7 @@ class FilesSharingShareInfoClient { specifiedType: const FullType(FilesSharingShareInfo), )! as FilesSharingShareInfo; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -685,7 +648,7 @@ class FilesSharingShareapiClient { specifiedType: const FullType(FilesSharingShareapiGetSharesResponseApplicationJson), )! as FilesSharingShareapiGetSharesResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Create a share @@ -773,7 +736,7 @@ class FilesSharingShareapiClient { specifiedType: const FullType(FilesSharingShareapiCreateShareResponseApplicationJson), )! as FilesSharingShareapiCreateShareResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get all shares relative to a file, including parent folders shares rights @@ -819,7 +782,7 @@ class FilesSharingShareapiClient { specifiedType: const FullType(FilesSharingShareapiGetInheritedSharesResponseApplicationJson), )! as FilesSharingShareapiGetInheritedSharesResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get all shares that are still pending @@ -863,7 +826,7 @@ class FilesSharingShareapiClient { specifiedType: const FullType(FilesSharingShareapiPendingSharesResponseApplicationJson), )! as FilesSharingShareapiPendingSharesResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a specific share by id @@ -913,7 +876,7 @@ class FilesSharingShareapiClient { specifiedType: const FullType(FilesSharingShareapiGetShareResponseApplicationJson), )! as FilesSharingShareapiGetShareResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Update a share @@ -995,7 +958,7 @@ class FilesSharingShareapiClient { specifiedType: const FullType(FilesSharingShareapiUpdateShareResponseApplicationJson), )! as FilesSharingShareapiUpdateShareResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete a share @@ -1041,7 +1004,7 @@ class FilesSharingShareapiClient { specifiedType: const FullType(FilesSharingShareapiDeleteShareResponseApplicationJson), )! as FilesSharingShareapiDeleteShareResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Accept a share @@ -1087,7 +1050,7 @@ class FilesSharingShareapiClient { specifiedType: const FullType(FilesSharingShareapiAcceptShareResponseApplicationJson), )! as FilesSharingShareapiAcceptShareResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1098,7 +1061,7 @@ class FilesSharingShareesapiClient { /// Search for sharees Future< - FilesSharingResponse> search({ final String search = '', final String? itemType, @@ -1161,7 +1124,7 @@ class FilesSharingShareesapiClient { body, ); if (response.statusCode == 200) { - return FilesSharingResponse( _jsonSerializers.deserialize( await response.jsonBody, @@ -1173,7 +1136,7 @@ class FilesSharingShareesapiClient { )! as FilesSharingShareesapiShareesapiSearchHeaders, ); } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Find recommended sharees @@ -1226,7 +1189,7 @@ class FilesSharingShareesapiClient { specifiedType: const FullType(FilesSharingShareesapiFindRecommendedResponseApplicationJson), )! as FilesSharingShareesapiFindRecommendedResponseApplicationJson; } - throw await FilesSharingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/files_trashbin.openapi.dart b/packages/nextcloud/lib/src/api/files_trashbin.openapi.dart index ee0e59e0..b81fcdf4 100644 --- a/packages/nextcloud/lib/src/api/files_trashbin.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_trashbin.openapi.dart @@ -9,48 +9,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'files_trashbin.openapi.g.dart'; -class FilesTrashbinResponse extends DynamiteResponse { - FilesTrashbinResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'FilesTrashbinResponse(data: $data, headers: $headers)'; -} - -class FilesTrashbinApiException extends DynamiteApiException { - FilesTrashbinApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return FilesTrashbinApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'FilesTrashbinApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class FilesTrashbinClient extends DynamiteClient { FilesTrashbinClient( super.baseURL, { @@ -130,7 +93,7 @@ class FilesTrashbinPreviewClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await FilesTrashbinApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/files_versions.openapi.dart b/packages/nextcloud/lib/src/api/files_versions.openapi.dart index 9025edcf..76c72f92 100644 --- a/packages/nextcloud/lib/src/api/files_versions.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_versions.openapi.dart @@ -9,48 +9,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'files_versions.openapi.g.dart'; -class FilesVersionsResponse extends DynamiteResponse { - FilesVersionsResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'FilesVersionsResponse(data: $data, headers: $headers)'; -} - -class FilesVersionsApiException extends DynamiteApiException { - FilesVersionsApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return FilesVersionsApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'FilesVersionsApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class FilesVersionsClient extends DynamiteClient { FilesVersionsClient( super.baseURL, { @@ -130,7 +93,7 @@ class FilesVersionsPreviewClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await FilesVersionsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/news.openapi.dart b/packages/nextcloud/lib/src/api/news.openapi.dart index 109b9dc9..f893bde8 100644 --- a/packages/nextcloud/lib/src/api/news.openapi.dart +++ b/packages/nextcloud/lib/src/api/news.openapi.dart @@ -11,48 +11,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'news.openapi.g.dart'; -class NewsResponse extends DynamiteResponse { - NewsResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'NewsResponse(data: $data, headers: $headers)'; -} - -class NewsApiException extends DynamiteApiException { - NewsApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return NewsApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'NewsApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class NewsClient extends DynamiteClient { NewsClient( super.baseURL, { @@ -109,7 +72,7 @@ class NewsClient extends DynamiteClient { specifiedType: const FullType(NewsSupportedAPIVersions), )! as NewsSupportedAPIVersions; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future listFolders() async { @@ -147,7 +110,7 @@ class NewsClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NewsListFolders))! as NewsListFolders; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future createFolder({required final String name}) async { @@ -186,7 +149,7 @@ class NewsClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NewsListFolders))! as NewsListFolders; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future renameFolder({ @@ -226,7 +189,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future deleteFolder({required final int folderId}) async { @@ -262,7 +225,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future markFolderAsRead({ @@ -302,7 +265,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future listFeeds() async { @@ -340,7 +303,7 @@ class NewsClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NewsListFeeds))! as NewsListFeeds; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future addFeed({ @@ -385,7 +348,7 @@ class NewsClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NewsListFeeds))! as NewsListFeeds; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future deleteFeed({required final int feedId}) async { @@ -421,7 +384,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future moveFeed({ @@ -463,7 +426,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future renameFeed({ @@ -503,7 +466,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future markFeedAsRead({ @@ -543,7 +506,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future listArticles({ @@ -606,7 +569,7 @@ class NewsClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NewsListArticles))! as NewsListArticles; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future listUpdatedArticles({ @@ -657,7 +620,7 @@ class NewsClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NewsListArticles))! as NewsListArticles; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future markArticleAsRead({required final int itemId}) async { @@ -693,7 +656,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future markArticleAsUnread({required final int itemId}) async { @@ -729,7 +692,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future starArticle({required final int itemId}) async { @@ -765,7 +728,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future unstarArticle({required final int itemId}) async { @@ -801,7 +764,7 @@ class NewsClient extends DynamiteClient { if (response.statusCode == 200) { return; } - throw await NewsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/notes.openapi.dart b/packages/nextcloud/lib/src/api/notes.openapi.dart index c9a12c2d..086aed41 100644 --- a/packages/nextcloud/lib/src/api/notes.openapi.dart +++ b/packages/nextcloud/lib/src/api/notes.openapi.dart @@ -12,48 +12,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'notes.openapi.g.dart'; -class NotesResponse extends DynamiteResponse { - NotesResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'NotesResponse(data: $data, headers: $headers)'; -} - -class NotesApiException extends DynamiteApiException { - NotesApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return NotesApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'NotesApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class NotesClient extends DynamiteClient { NotesClient( super.baseURL, { @@ -135,7 +98,7 @@ class NotesClient extends DynamiteClient { specifiedType: const FullType(BuiltList, [FullType(NotesNote)]), )! as BuiltList; } - throw await NotesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future createNote({ @@ -194,7 +157,7 @@ class NotesClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NotesNote))! as NotesNote; } - throw await NotesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future getNote({ @@ -243,7 +206,7 @@ class NotesClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NotesNote))! as NotesNote; } - throw await NotesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future updateNote({ @@ -308,7 +271,7 @@ class NotesClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NotesNote))! as NotesNote; } - throw await NotesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future deleteNote({required final int id}) async { @@ -346,7 +309,7 @@ class NotesClient extends DynamiteClient { if (response.statusCode == 200) { return response.body; } - throw await NotesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future getSettings() async { @@ -384,7 +347,7 @@ class NotesClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NotesSettings))! as NotesSettings; } - throw await NotesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } Future updateSettings({required final NotesSettings settings}) async { @@ -425,7 +388,7 @@ class NotesClient extends DynamiteClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(NotesSettings))! as NotesSettings; } - throw await NotesApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/notifications.openapi.dart b/packages/nextcloud/lib/src/api/notifications.openapi.dart index fc24ec02..3ecd9e6d 100644 --- a/packages/nextcloud/lib/src/api/notifications.openapi.dart +++ b/packages/nextcloud/lib/src/api/notifications.openapi.dart @@ -11,48 +11,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'notifications.openapi.g.dart'; -class NotificationsResponse extends DynamiteResponse { - NotificationsResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'NotificationsResponse(data: $data, headers: $headers)'; -} - -class NotificationsApiException extends DynamiteApiException { - NotificationsApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return NotificationsApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'NotificationsApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class NotificationsClient extends DynamiteClient { NotificationsClient( super.baseURL, { @@ -139,7 +102,7 @@ class NotificationsApiClient { specifiedType: const FullType(NotificationsApiGenerateNotificationResponseApplicationJson), )! as NotificationsApiGenerateNotificationResponseApplicationJson; } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -150,7 +113,7 @@ class NotificationsEndpointClient { /// Get all notifications Future< - NotificationsResponse> listNotifications({ final NotificationsEndpointListNotificationsApiVersion apiVersion = NotificationsEndpointListNotificationsApiVersion.v2, @@ -189,7 +152,7 @@ class NotificationsEndpointClient { body, ); if (response.statusCode == 200) { - return NotificationsResponse( _jsonSerializers.deserialize( await response.jsonBody, @@ -201,7 +164,7 @@ class NotificationsEndpointClient { )! as NotificationsEndpointEndpointListNotificationsHeaders, ); } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete all notifications @@ -248,7 +211,7 @@ class NotificationsEndpointClient { specifiedType: const FullType(NotificationsEndpointDeleteAllNotificationsResponseApplicationJson), )! as NotificationsEndpointDeleteAllNotificationsResponseApplicationJson; } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a notification @@ -296,7 +259,7 @@ class NotificationsEndpointClient { specifiedType: const FullType(NotificationsEndpointGetNotificationResponseApplicationJson), )! as NotificationsEndpointGetNotificationResponseApplicationJson; } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete a notification @@ -345,7 +308,7 @@ class NotificationsEndpointClient { specifiedType: const FullType(NotificationsEndpointDeleteNotificationResponseApplicationJson), )! as NotificationsEndpointDeleteNotificationResponseApplicationJson; } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Check if notification IDs exist @@ -394,7 +357,7 @@ class NotificationsEndpointClient { specifiedType: const FullType(NotificationsEndpointConfirmIdsForUserResponseApplicationJson), )! as NotificationsEndpointConfirmIdsForUserResponseApplicationJson; } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -452,7 +415,7 @@ class NotificationsPushClient { specifiedType: const FullType(NotificationsPushRegisterDeviceResponseApplicationJson), )! as NotificationsPushRegisterDeviceResponseApplicationJson; } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Remove a device from push notifications @@ -498,7 +461,7 @@ class NotificationsPushClient { specifiedType: const FullType(NotificationsPushRemoveDeviceResponseApplicationJson), )! as NotificationsPushRemoveDeviceResponseApplicationJson; } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -556,7 +519,7 @@ class NotificationsSettingsClient { specifiedType: const FullType(NotificationsSettingsPersonalResponseApplicationJson), )! as NotificationsSettingsPersonalResponseApplicationJson; } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Update default notification settings for new users @@ -610,7 +573,7 @@ class NotificationsSettingsClient { specifiedType: const FullType(NotificationsSettingsAdminResponseApplicationJson), )! as NotificationsSettingsAdminResponseApplicationJson; } - throw await NotificationsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart index ca925063..6bf28cb4 100644 --- a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart +++ b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart @@ -12,48 +12,11 @@ import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; import 'package:dynamite_runtime/utils.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'provisioning_api.openapi.g.dart'; -class ProvisioningApiResponse extends DynamiteResponse { - ProvisioningApiResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'ProvisioningApiResponse(data: $data, headers: $headers)'; -} - -class ProvisioningApiApiException extends DynamiteApiException { - ProvisioningApiApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return ProvisioningApiApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'ProvisioningApiApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class ProvisioningApiClient extends DynamiteClient { ProvisioningApiClient( super.baseURL, { @@ -130,7 +93,7 @@ class ProvisioningApiAppConfigClient { specifiedType: const FullType(ProvisioningApiAppConfigGetAppsResponseApplicationJson), )! as ProvisioningApiAppConfigGetAppsResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the config keys of an app @@ -178,7 +141,7 @@ class ProvisioningApiAppConfigClient { specifiedType: const FullType(ProvisioningApiAppConfigGetKeysResponseApplicationJson), )! as ProvisioningApiAppConfigGetKeysResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a the config value of an app @@ -232,7 +195,7 @@ class ProvisioningApiAppConfigClient { specifiedType: const FullType(ProvisioningApiAppConfigGetValueResponseApplicationJson), )! as ProvisioningApiAppConfigGetValueResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Update the config value of an app @@ -282,7 +245,7 @@ class ProvisioningApiAppConfigClient { specifiedType: const FullType(ProvisioningApiAppConfigSetValueResponseApplicationJson), )! as ProvisioningApiAppConfigSetValueResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete a config key of an app @@ -332,7 +295,7 @@ class ProvisioningApiAppConfigClient { specifiedType: const FullType(ProvisioningApiAppConfigDeleteKeyResponseApplicationJson), )! as ProvisioningApiAppConfigDeleteKeyResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -388,7 +351,7 @@ class ProvisioningApiAppsClient { specifiedType: const FullType(ProvisioningApiAppsGetAppsResponseApplicationJson), )! as ProvisioningApiAppsGetAppsResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the app info for an app @@ -436,7 +399,7 @@ class ProvisioningApiAppsClient { specifiedType: const FullType(ProvisioningApiAppsGetAppInfoResponseApplicationJson), )! as ProvisioningApiAppsGetAppInfoResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Enable an app @@ -484,7 +447,7 @@ class ProvisioningApiAppsClient { specifiedType: const FullType(ProvisioningApiAppsEnableResponseApplicationJson), )! as ProvisioningApiAppsEnableResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Disable an app @@ -532,7 +495,7 @@ class ProvisioningApiAppsClient { specifiedType: const FullType(ProvisioningApiAppsDisableResponseApplicationJson), )! as ProvisioningApiAppsDisableResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -594,7 +557,7 @@ class ProvisioningApiGroupsClient { specifiedType: const FullType(ProvisioningApiGroupsGetGroupsResponseApplicationJson), )! as ProvisioningApiGroupsGetGroupsResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Create a new group @@ -646,7 +609,7 @@ class ProvisioningApiGroupsClient { specifiedType: const FullType(ProvisioningApiGroupsAddGroupResponseApplicationJson), )! as ProvisioningApiGroupsAddGroupResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a list of groups details @@ -702,7 +665,7 @@ class ProvisioningApiGroupsClient { specifiedType: const FullType(ProvisioningApiGroupsGetGroupsDetailsResponseApplicationJson), )! as ProvisioningApiGroupsGetGroupsDetailsResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a list of users in the specified group @@ -749,7 +712,7 @@ class ProvisioningApiGroupsClient { specifiedType: const FullType(ProvisioningApiGroupsGetGroupUsersResponseApplicationJson), )! as ProvisioningApiGroupsGetGroupUsersResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a list of users details in the specified group @@ -808,7 +771,7 @@ class ProvisioningApiGroupsClient { specifiedType: const FullType(ProvisioningApiGroupsGetGroupUsersDetailsResponseApplicationJson), )! as ProvisioningApiGroupsGetGroupUsersDetailsResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the list of user IDs that are a subadmin of the group @@ -857,7 +820,7 @@ class ProvisioningApiGroupsClient { specifiedType: const FullType(ProvisioningApiGroupsGetSubAdminsOfGroupResponseApplicationJson), )! as ProvisioningApiGroupsGetSubAdminsOfGroupResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a list of users in the specified group @@ -905,7 +868,7 @@ class ProvisioningApiGroupsClient { specifiedType: const FullType(ProvisioningApiGroupsGetGroupResponseApplicationJson), )! as ProvisioningApiGroupsGetGroupResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Update a group @@ -958,7 +921,7 @@ class ProvisioningApiGroupsClient { specifiedType: const FullType(ProvisioningApiGroupsUpdateGroupResponseApplicationJson), )! as ProvisioningApiGroupsUpdateGroupResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete a group @@ -1007,7 +970,7 @@ class ProvisioningApiGroupsClient { specifiedType: const FullType(ProvisioningApiGroupsDeleteGroupResponseApplicationJson), )! as ProvisioningApiGroupsDeleteGroupResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1063,7 +1026,7 @@ class ProvisioningApiPreferencesClient { specifiedType: const FullType(ProvisioningApiPreferencesSetPreferenceResponseApplicationJson), )! as ProvisioningApiPreferencesSetPreferenceResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete a preference for an app @@ -1111,7 +1074,7 @@ class ProvisioningApiPreferencesClient { specifiedType: const FullType(ProvisioningApiPreferencesDeletePreferenceResponseApplicationJson), )! as ProvisioningApiPreferencesDeletePreferenceResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Update multiple preference values of an app @@ -1164,7 +1127,7 @@ class ProvisioningApiPreferencesClient { specifiedType: const FullType(ProvisioningApiPreferencesSetMultiplePreferencesResponseApplicationJson), )! as ProvisioningApiPreferencesSetMultiplePreferencesResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete multiple preferences for an app @@ -1212,7 +1175,7 @@ class ProvisioningApiPreferencesClient { specifiedType: const FullType(ProvisioningApiPreferencesDeleteMultiplePreferenceResponseApplicationJson), )! as ProvisioningApiPreferencesDeleteMultiplePreferenceResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -1274,7 +1237,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersGetUsersResponseApplicationJson), )! as ProvisioningApiUsersGetUsersResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Create a new user @@ -1352,7 +1315,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersAddUserResponseApplicationJson), )! as ProvisioningApiUsersAddUserResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a list of users and their details @@ -1408,7 +1371,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersGetUsersDetailsResponseApplicationJson), )! as ProvisioningApiUsersGetUsersDetailsResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Search users by their phone numbers @@ -1464,7 +1427,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersSearchByPhoneNumbersResponseApplicationJson), )! as ProvisioningApiUsersSearchByPhoneNumbersResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the details of a user @@ -1510,7 +1473,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersGetUserResponseApplicationJson), )! as ProvisioningApiUsersGetUserResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Update a value of the user's details @@ -1560,7 +1523,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersEditUserResponseApplicationJson), )! as ProvisioningApiUsersEditUserResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete a user @@ -1606,7 +1569,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersDeleteUserResponseApplicationJson), )! as ProvisioningApiUsersDeleteUserResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the details of the current user @@ -1650,7 +1613,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersGetCurrentUserResponseApplicationJson), )! as ProvisioningApiUsersGetCurrentUserResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a list of fields that are editable for the current user @@ -1694,7 +1657,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersGetEditableFieldsResponseApplicationJson), )! as ProvisioningApiUsersGetEditableFieldsResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a list of fields that are editable for a user @@ -1740,7 +1703,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersGetEditableFieldsForUserResponseApplicationJson), )! as ProvisioningApiUsersGetEditableFieldsForUserResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Update multiple values of the user's details @@ -1797,7 +1760,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersEditUserMultiValueResponseApplicationJson), )! as ProvisioningApiUsersEditUserMultiValueResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Wipe all devices of a user @@ -1843,7 +1806,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersWipeUserDevicesResponseApplicationJson), )! as ProvisioningApiUsersWipeUserDevicesResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Enable a user @@ -1889,7 +1852,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersEnableUserResponseApplicationJson), )! as ProvisioningApiUsersEnableUserResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Disable a user @@ -1935,7 +1898,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersDisableUserResponseApplicationJson), )! as ProvisioningApiUsersDisableUserResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a list of groups the user belongs to @@ -1981,7 +1944,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersGetUsersGroupsResponseApplicationJson), )! as ProvisioningApiUsersGetUsersGroupsResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Add a user to a group @@ -2031,7 +1994,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersAddToGroupResponseApplicationJson), )! as ProvisioningApiUsersAddToGroupResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Remove a user from a group @@ -2079,7 +2042,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersRemoveFromGroupResponseApplicationJson), )! as ProvisioningApiUsersRemoveFromGroupResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the groups a user is a subadmin of @@ -2127,7 +2090,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersGetUserSubAdminGroupsResponseApplicationJson), )! as ProvisioningApiUsersGetUserSubAdminGroupsResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Make a user a subadmin of a group @@ -2177,7 +2140,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersAddSubAdminResponseApplicationJson), )! as ProvisioningApiUsersAddSubAdminResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Remove a user from the subadmins of a group @@ -2227,7 +2190,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersRemoveSubAdminResponseApplicationJson), )! as ProvisioningApiUsersRemoveSubAdminResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Resend the welcome message @@ -2273,7 +2236,7 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ProvisioningApiUsersResendWelcomeMessageResponseApplicationJson), )! as ProvisioningApiUsersResendWelcomeMessageResponseApplicationJson; } - throw await ProvisioningApiApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/settings.openapi.dart b/packages/nextcloud/lib/src/api/settings.openapi.dart index 59bb4c91..f2123319 100644 --- a/packages/nextcloud/lib/src/api/settings.openapi.dart +++ b/packages/nextcloud/lib/src/api/settings.openapi.dart @@ -9,48 +9,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'settings.openapi.g.dart'; -class SettingsResponse extends DynamiteResponse { - SettingsResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'SettingsResponse(data: $data, headers: $headers)'; -} - -class SettingsApiException extends DynamiteApiException { - SettingsApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return SettingsApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'SettingsApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class SettingsClient extends DynamiteClient { SettingsClient( super.baseURL, { @@ -81,7 +44,7 @@ class SettingsLogSettingsClient { /// download logfile /// /// This endpoint requires admin access - Future> download() async { + Future> download() async { const path = '/index.php/settings/admin/log/download'; final queryParameters = {}; final headers = { @@ -113,7 +76,7 @@ class SettingsLogSettingsClient { body, ); if (response.statusCode == 200) { - return SettingsResponse( + return DynamiteResponse( await response.bodyBytes, _jsonSerializers.deserialize( response.responseHeaders, @@ -121,7 +84,7 @@ class SettingsLogSettingsClient { )! as SettingsLogSettingsLogSettingsDownloadHeaders, ); } - throw await SettingsApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/sharebymail.openapi.dart b/packages/nextcloud/lib/src/api/sharebymail.openapi.dart index 3358a7e5..bc71e019 100644 --- a/packages/nextcloud/lib/src/api/sharebymail.openapi.dart +++ b/packages/nextcloud/lib/src/api/sharebymail.openapi.dart @@ -7,48 +7,11 @@ import 'package:built_value/serializer.dart'; import 'package:built_value/standard_json_plugin.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'sharebymail.openapi.g.dart'; -class SharebymailResponse extends DynamiteResponse { - SharebymailResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'SharebymailResponse(data: $data, headers: $headers)'; -} - -class SharebymailApiException extends DynamiteApiException { - SharebymailApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return SharebymailApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'SharebymailApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class SharebymailClient extends DynamiteClient { SharebymailClient( super.baseURL, { diff --git a/packages/nextcloud/lib/src/api/theming.openapi.dart b/packages/nextcloud/lib/src/api/theming.openapi.dart index 4ed2e605..55b0e313 100644 --- a/packages/nextcloud/lib/src/api/theming.openapi.dart +++ b/packages/nextcloud/lib/src/api/theming.openapi.dart @@ -12,48 +12,11 @@ import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; import 'package:dynamite_runtime/utils.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'theming.openapi.g.dart'; -class ThemingResponse extends DynamiteResponse { - ThemingResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'ThemingResponse(data: $data, headers: $headers)'; -} - -class ThemingApiException extends DynamiteApiException { - ThemingApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return ThemingApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'ThemingApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class ThemingClient extends DynamiteClient { ThemingClient( super.baseURL, { @@ -119,7 +82,7 @@ class ThemingIconClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Return a 512x512 icon for touch devices @@ -156,7 +119,7 @@ class ThemingIconClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get a themed icon @@ -198,7 +161,7 @@ class ThemingIconClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -253,7 +216,7 @@ class ThemingThemingClient { if (response.statusCode == 200) { return response.body; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get an image @@ -296,7 +259,7 @@ class ThemingThemingClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get the manifest for an app @@ -336,7 +299,7 @@ class ThemingThemingClient { specifiedType: const FullType(ThemingThemingGetManifestResponseApplicationJson), )! as ThemingThemingGetManifestResponseApplicationJson; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -381,7 +344,7 @@ class ThemingUserThemeClient { if (response.statusCode == 200) { return response.bodyBytes; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Set the background @@ -433,7 +396,7 @@ class ThemingUserThemeClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(ThemingBackground))! as ThemingBackground; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete the background @@ -473,7 +436,7 @@ class ThemingUserThemeClient { return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(ThemingBackground))! as ThemingBackground; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Enable theme @@ -519,7 +482,7 @@ class ThemingUserThemeClient { specifiedType: const FullType(ThemingUserThemeEnableThemeResponseApplicationJson), )! as ThemingUserThemeEnableThemeResponseApplicationJson; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Disable theme @@ -565,7 +528,7 @@ class ThemingUserThemeClient { specifiedType: const FullType(ThemingUserThemeDisableThemeResponseApplicationJson), )! as ThemingUserThemeDisableThemeResponseApplicationJson; } - throw await ThemingApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/updatenotification.openapi.dart b/packages/nextcloud/lib/src/api/updatenotification.openapi.dart index 07e887e4..10d4f71e 100644 --- a/packages/nextcloud/lib/src/api/updatenotification.openapi.dart +++ b/packages/nextcloud/lib/src/api/updatenotification.openapi.dart @@ -10,48 +10,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'updatenotification.openapi.g.dart'; -class UpdatenotificationResponse extends DynamiteResponse { - UpdatenotificationResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'UpdatenotificationResponse(data: $data, headers: $headers)'; -} - -class UpdatenotificationApiException extends DynamiteApiException { - UpdatenotificationApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return UpdatenotificationApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'UpdatenotificationApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class UpdatenotificationClient extends DynamiteClient { UpdatenotificationClient( super.baseURL, { @@ -126,7 +89,7 @@ class UpdatenotificationApiClient { specifiedType: const FullType(UpdatenotificationApiGetAppListResponseApplicationJson), )! as UpdatenotificationApiGetAppListResponseApplicationJson; } - throw await UpdatenotificationApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/uppush.openapi.dart b/packages/nextcloud/lib/src/api/uppush.openapi.dart index 0fa4a625..6a766bf2 100644 --- a/packages/nextcloud/lib/src/api/uppush.openapi.dart +++ b/packages/nextcloud/lib/src/api/uppush.openapi.dart @@ -10,48 +10,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'uppush.openapi.g.dart'; -class UppushResponse extends DynamiteResponse { - UppushResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'UppushResponse(data: $data, headers: $headers)'; -} - -class UppushApiException extends DynamiteApiException { - UppushApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return UppushApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'UppushApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class UppushClient extends DynamiteClient { UppushClient( super.baseURL, { @@ -109,7 +72,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushCheckResponseApplicationJson), )! as UppushCheckResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Set keepalive interval @@ -153,7 +116,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushSetKeepaliveResponseApplicationJson), )! as UppushSetKeepaliveResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Request to create a new deviceId @@ -195,7 +158,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushCreateDeviceResponseApplicationJson), )! as UppushCreateDeviceResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Request to get push messages @@ -239,7 +202,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushSyncDeviceResponseApplicationJson), )! as UppushSyncDeviceResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete a device @@ -281,7 +244,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushDeleteDeviceResponseApplicationJson), )! as UppushDeleteDeviceResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Create an authorization token for a new 3rd party service @@ -327,7 +290,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushCreateAppResponseApplicationJson), )! as UppushCreateAppResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Delete an authorization token @@ -369,7 +332,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushDeleteAppResponseApplicationJson), )! as UppushDeleteAppResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Unifiedpush discovery Following specifications @@ -411,7 +374,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushUnifiedpushDiscoveryResponseApplicationJson), )! as UppushUnifiedpushDiscoveryResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Receive notifications from 3rd parties @@ -453,7 +416,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushPushResponseApplicationJson), )! as UppushPushResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Matrix Gateway discovery @@ -494,7 +457,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushGatewayMatrixDiscoveryResponseApplicationJson), )! as UppushGatewayMatrixDiscoveryResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Matrix Gateway @@ -535,7 +498,7 @@ class UppushClient extends DynamiteClient { specifiedType: const FullType(UppushGatewayMatrixResponseApplicationJson), )! as UppushGatewayMatrixResponseApplicationJson; } - throw await UppushApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/user_status.openapi.dart b/packages/nextcloud/lib/src/api/user_status.openapi.dart index a39ca5c2..33416074 100644 --- a/packages/nextcloud/lib/src/api/user_status.openapi.dart +++ b/packages/nextcloud/lib/src/api/user_status.openapi.dart @@ -11,48 +11,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'user_status.openapi.g.dart'; -class UserStatusResponse extends DynamiteResponse { - UserStatusResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'UserStatusResponse(data: $data, headers: $headers)'; -} - -class UserStatusApiException extends DynamiteApiException { - UserStatusApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return UserStatusApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'UserStatusApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class UserStatusClient extends DynamiteClient { UserStatusClient( super.baseURL, { @@ -129,7 +92,7 @@ class UserStatusHeartbeatClient { specifiedType: const FullType(UserStatusHeartbeatHeartbeatResponseApplicationJson), )! as UserStatusHeartbeatHeartbeatResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -177,7 +140,7 @@ class UserStatusPredefinedStatusClient { specifiedType: const FullType(UserStatusPredefinedStatusFindAllResponseApplicationJson), )! as UserStatusPredefinedStatusFindAllResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -235,7 +198,7 @@ class UserStatusStatusesClient { specifiedType: const FullType(UserStatusStatusesFindAllResponseApplicationJson), )! as UserStatusStatusesFindAllResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Find the status of a user @@ -281,7 +244,7 @@ class UserStatusStatusesClient { specifiedType: const FullType(UserStatusStatusesFindResponseApplicationJson), )! as UserStatusStatusesFindResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } @@ -329,7 +292,7 @@ class UserStatusUserStatusClient { specifiedType: const FullType(UserStatusUserStatusGetStatusResponseApplicationJson), )! as UserStatusUserStatusGetStatusResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Update the status type of the current user @@ -375,7 +338,7 @@ class UserStatusUserStatusClient { specifiedType: const FullType(UserStatusUserStatusSetStatusResponseApplicationJson), )! as UserStatusUserStatusSetStatusResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Set the message to a predefined message for the current user @@ -425,7 +388,7 @@ class UserStatusUserStatusClient { specifiedType: const FullType(UserStatusUserStatusSetPredefinedMessageResponseApplicationJson), )! as UserStatusUserStatusSetPredefinedMessageResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Set the message to a custom message for the current user @@ -481,7 +444,7 @@ class UserStatusUserStatusClient { specifiedType: const FullType(UserStatusUserStatusSetCustomMessageResponseApplicationJson), )! as UserStatusUserStatusSetCustomMessageResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Clear the message of the current user @@ -525,7 +488,7 @@ class UserStatusUserStatusClient { specifiedType: const FullType(UserStatusUserStatusClearMessageResponseApplicationJson), )! as UserStatusUserStatusClearMessageResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Revert the status to the previous status @@ -571,7 +534,7 @@ class UserStatusUserStatusClient { specifiedType: const FullType(UserStatusUserStatusRevertStatusResponseApplicationJson), )! as UserStatusUserStatusRevertStatusResponseApplicationJson; } - throw await UserStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/lib/src/api/weather_status.openapi.dart b/packages/nextcloud/lib/src/api/weather_status.openapi.dart index 86b0b8ac..5c328256 100644 --- a/packages/nextcloud/lib/src/api/weather_status.openapi.dart +++ b/packages/nextcloud/lib/src/api/weather_status.openapi.dart @@ -10,48 +10,11 @@ import 'package:built_value/standard_json_plugin.dart'; import 'package:collection/collection.dart'; import 'package:dynamite_runtime/content_string.dart'; import 'package:dynamite_runtime/http_client.dart'; -import 'package:universal_io/io.dart'; export 'package:dynamite_runtime/http_client.dart'; part 'weather_status.openapi.g.dart'; -class WeatherStatusResponse extends DynamiteResponse { - WeatherStatusResponse( - super.data, - super.headers, - ); - - @override - String toString() => 'WeatherStatusResponse(data: $data, headers: $headers)'; -} - -class WeatherStatusApiException extends DynamiteApiException { - WeatherStatusApiException( - super.statusCode, - super.headers, - super.body, - ); - - static Future fromResponse(final HttpClientResponse response) async { - String body; - try { - body = await response.body; - } on FormatException { - body = 'binary'; - } - - return WeatherStatusApiException( - response.statusCode, - response.responseHeaders, - body, - ); - } - - @override - String toString() => 'WeatherStatusApiException(statusCode: $statusCode, headers: $headers, body: $body)'; -} - class WeatherStatusClient extends DynamiteClient { WeatherStatusClient( super.baseURL, { @@ -122,7 +85,7 @@ class WeatherStatusWeatherStatusClient { specifiedType: const FullType(WeatherStatusWeatherStatusSetModeResponseApplicationJson), )! as WeatherStatusWeatherStatusSetModeResponseApplicationJson; } - throw await WeatherStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Try to use the address set in user personal settings as weather location @@ -166,7 +129,7 @@ class WeatherStatusWeatherStatusClient { specifiedType: const FullType(WeatherStatusWeatherStatusUsePersonalAddressResponseApplicationJson), )! as WeatherStatusWeatherStatusUsePersonalAddressResponseApplicationJson; } - throw await WeatherStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get stored user location @@ -210,7 +173,7 @@ class WeatherStatusWeatherStatusClient { specifiedType: const FullType(WeatherStatusWeatherStatusGetLocationResponseApplicationJson), )! as WeatherStatusWeatherStatusGetLocationResponseApplicationJson; } - throw await WeatherStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Set address and resolve it to get coordinates or directly set coordinates and get address with reverse geocoding @@ -266,7 +229,7 @@ class WeatherStatusWeatherStatusClient { specifiedType: const FullType(WeatherStatusWeatherStatusSetLocationResponseApplicationJson), )! as WeatherStatusWeatherStatusSetLocationResponseApplicationJson; } - throw await WeatherStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get forecast for current location @@ -310,7 +273,7 @@ class WeatherStatusWeatherStatusClient { specifiedType: const FullType(WeatherStatusWeatherStatusGetForecastResponseApplicationJson), )! as WeatherStatusWeatherStatusGetForecastResponseApplicationJson; } - throw await WeatherStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Get favorites list @@ -354,7 +317,7 @@ class WeatherStatusWeatherStatusClient { specifiedType: const FullType(WeatherStatusWeatherStatusGetFavoritesResponseApplicationJson), )! as WeatherStatusWeatherStatusGetFavoritesResponseApplicationJson; } - throw await WeatherStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } /// Set favorites list @@ -400,7 +363,7 @@ class WeatherStatusWeatherStatusClient { specifiedType: const FullType(WeatherStatusWeatherStatusSetFavoritesResponseApplicationJson), )! as WeatherStatusWeatherStatusSetFavoritesResponseApplicationJson; } - throw await WeatherStatusApiException.fromResponse(response); // coverage:ignore-line + throw await DynamiteApiException.fromResponse(response); // coverage:ignore-line } } diff --git a/packages/nextcloud/test/helper.dart b/packages/nextcloud/test/helper.dart index db2e0dd8..00f4cb75 100644 --- a/packages/nextcloud/test/helper.dart +++ b/packages/nextcloud/test/helper.dart @@ -141,7 +141,7 @@ Future getTestClient( try { await client.core.getStatus(); break; - } on CoreApiException catch (error) { + } on DynamiteApiException catch (error) { i++; await Future.delayed(const Duration(milliseconds: 100)); if (i >= 30) {