From 768f8edaf9058f154a3e425a416c124853444408 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 18 Aug 2023 07:05:41 +0200 Subject: [PATCH 1/2] fix(dynamite): Fix conflicting variables Signed-off-by: jld3103 --- .../dynamite/lib/src/openapi_builder.dart | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/packages/dynamite/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/dynamite/lib/src/openapi_builder.dart index 1d88b1f1..ac35ef5c 100644 --- a/packages/dynamite/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/dynamite/lib/src/openapi_builder.dart @@ -276,7 +276,7 @@ class OpenAPIBuilder implements Builder { ..fields.add( Field( (final b) => b - ..name = 'rootClient' + ..name = '_rootClient' ..type = refer('${classPrefix}Client') ..modifier = FieldModifier.final$, ), @@ -286,7 +286,7 @@ class OpenAPIBuilder implements Builder { (final b) => b.requiredParameters.add( Parameter( (final b) => b - ..name = 'rootClient' + ..name = '_rootClient' ..toThis = true, ), ), @@ -315,7 +315,7 @@ class OpenAPIBuilder implements Builder { ..lambda = true ..type = MethodType.getter ..returns = refer('$classPrefix${_clientName(t)}') - ..body = Code('$classPrefix${_clientName(t)}(${isRootClient ? 'this' : 'rootClient'})'), + ..body = Code('$classPrefix${_clientName(t)}(${isRootClient ? 'this' : '_rootClient'})'), ), ], for (final path in paths.keys) ...[ @@ -364,10 +364,10 @@ class OpenAPIBuilder implements Builder { {}) .join(','); final code = StringBuffer(''' - var path = '$path'; - final queryParameters = {}; - final headers = {${acceptHeader.isNotEmpty ? "'Accept': '$acceptHeader'," : ''}}; - Uint8List? body; + var _path = '$path'; + final _queryParameters = {}; + final _headers = {${acceptHeader.isNotEmpty ? "'Accept': '$acceptHeader'," : ''}}; + Uint8List? _body; '''); final security = operation.security ?? spec.security ?? []; @@ -377,8 +377,8 @@ class OpenAPIBuilder implements Builder { for (final requirement in securityRequirements) { final securityScheme = spec.components!.securitySchemes![requirement.keys.single]!; code.write(''' - if (${isRootClient ? '' : 'rootClient.'}authentications.where((final a) => a.type == '${securityScheme.type}' && a.scheme == '${securityScheme.scheme}').isNotEmpty) { - headers.addAll(${isRootClient ? '' : 'rootClient.'}authentications.singleWhere((final a) => a.type == '${securityScheme.type}' && a.scheme == '${securityScheme.scheme}').headers); + if (${isRootClient ? 'this' : '_rootClient'}.authentications.where((final a) => a.type == '${securityScheme.type}' && a.scheme == '${securityScheme.scheme}').isNotEmpty) { + _headers.addAll(${isRootClient ? 'this' : '_rootClient'}.authentications.singleWhere((final a) => a.type == '${securityScheme.type}' && a.scheme == '${securityScheme.scheme}').headers); } '''); if (securityRequirements.last != requirement) { @@ -475,15 +475,15 @@ class OpenAPIBuilder implements Builder { switch (parameter.in_) { case 'path': code.write( - "path = path.replaceAll('{${parameter.name}}', Uri.encodeQueryComponent($value));", + "_path = _path.replaceAll('{${parameter.name}}', Uri.encodeQueryComponent($value));", ); case 'query': code.write( - "queryParameters['${parameter.name}'] = $value;", + "_queryParameters['${parameter.name}'] = $value;", ); case 'header': code.write( - "headers['${parameter.name}'] = $value;", + "_headers['${parameter.name}'] = $value;", ); default: throw Exception('Can not work with parameter in "${parameter.in_}"'); @@ -503,7 +503,7 @@ class OpenAPIBuilder implements Builder { for (final mimeType in operation.requestBody!.content!.keys) { final mediaType = operation.requestBody!.content![mimeType]!; - code.write("headers['Content-Type'] = '$mimeType';"); + code.write("_headers['Content-Type'] = '$mimeType';"); final dartParameterNullable = _isDartParameterNullable( operation.requestBody!.required, @@ -541,7 +541,7 @@ class OpenAPIBuilder implements Builder { code.write('if ($parameterName != null) {'); } code.write( - 'body = Uint8List.fromList(utf8.encode(${result.encode(parameterName, mimeType: mimeType)}));', + '_body = Uint8List.fromList(utf8.encode(${result.encode(parameterName, mimeType: mimeType)}));', ); if (dartParameterNullable) { code.write('}'); @@ -554,11 +554,11 @@ class OpenAPIBuilder implements Builder { code.write( ''' - final response = await ${isRootClient ? '' : 'rootClient.'}doRequest( + final _response = await ${isRootClient ? 'this' : '_rootClient'}.doRequest( '$httpMethod', - Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), - headers, - body, + Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null).toString(), + _headers, + _body, ); ''', ); @@ -569,7 +569,7 @@ class OpenAPIBuilder implements Builder { } for (final statusCode in operation.responses!.keys) { final response = operation.responses![statusCode]!; - code.write('if (response.statusCode == $statusCode) {'); + code.write('if (_response.statusCode == $statusCode) {'); String? headersType; String? headersValue; @@ -592,7 +592,7 @@ class OpenAPIBuilder implements Builder { isHeader: true, ); headersType = result.name; - headersValue = result.deserialize('response.responseHeaders'); + headersValue = result.deserialize('_response.responseHeaders'); } String? dataType; @@ -620,24 +620,24 @@ class OpenAPIBuilder implements Builder { mimeType == 'application/octet-stream' || mimeType.startsWith('image/')) { dataType = 'Uint8List'; - dataValue = 'response.bodyBytes'; + dataValue = '_response.bodyBytes'; dataNeedsAwait = true; } else if (mimeType.startsWith('text/')) { dataType = 'String'; - dataValue = 'response.body'; + dataValue = '_response.body'; dataNeedsAwait = true; } else if (mimeType == 'application/json') { dataType = result.name; if (result.name == 'dynamic') { dataValue = ''; } else if (result.name == 'String') { - dataValue = 'response.body'; + dataValue = '_response.body'; dataNeedsAwait = true; } else if (result is TypeResultEnum || result is TypeResultBase) { - dataValue = result.deserialize(result.decode('await response.body')); + dataValue = result.deserialize(result.decode('await _response.body')); dataNeedsAwait = false; } else { - dataValue = result.deserialize('await response.jsonBody'); + dataValue = result.deserialize('await _response.jsonBody'); dataNeedsAwait = false; } } else { @@ -665,7 +665,7 @@ class OpenAPIBuilder implements Builder { code.write('}'); } code.write( - 'throw await ${classPrefix}ApiException.fromResponse(response); // coverage:ignore-line\n', + 'throw await ${classPrefix}ApiException.fromResponse(_response); // coverage:ignore-line\n', ); } else { b.returns = refer('Future'); From ea947bd652f7b4a43210c7632a498e1f68f53de9 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 18 Aug 2023 07:05:56 +0200 Subject: [PATCH 2/2] fix(nextcloud): Regenerate Signed-off-by: jld3103 --- .../nextcloud/lib/src/api/core.openapi.dart | 605 ++++++++++-------- .../lib/src/api/files_sharing.openapi.dart | 313 ++++----- .../lib/src/api/provisioning_api.openapi.dart | 579 +++++++++-------- .../lib/src/api/settings.openapi.dart | 17 +- .../lib/src/api/theming.openapi.dart | 155 ++--- .../lib/src/api/user_status.openapi.dart | 146 +++-- 6 files changed, 972 insertions(+), 843 deletions(-) diff --git a/packages/nextcloud/lib/src/api/core.openapi.dart b/packages/nextcloud/lib/src/api/core.openapi.dart index 1ca47606..31be9f13 100644 --- a/packages/nextcloud/lib/src/api/core.openapi.dart +++ b/packages/nextcloud/lib/src/api/core.openapi.dart @@ -115,9 +115,9 @@ class CoreClient extends DynamiteClient { } class CoreAppPasswordClient { - CoreAppPasswordClient(this.rootClient); + CoreAppPasswordClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Create app password Future getAppPassword({ @@ -130,19 +130,20 @@ class CoreAppPasswordClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -168,19 +169,20 @@ class CoreAppPasswordClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -206,19 +208,20 @@ class CoreAppPasswordClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -235,9 +238,9 @@ class CoreAppPasswordClient { } class CoreAutoCompleteClient { - CoreAutoCompleteClient(this.rootClient); + CoreAutoCompleteClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Autocomplete a query Future $get({ @@ -256,13 +259,14 @@ class CoreAutoCompleteClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -284,7 +288,7 @@ class CoreAutoCompleteClient { queryParameters['limit'] = limit.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -302,9 +306,9 @@ class CoreAutoCompleteClient { /// Class AvatarController class CoreAvatarClient { - CoreAvatarClient(this.rootClient); + CoreAvatarClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Get the dark avatar Future> getAvatarDark({ @@ -318,18 +322,19 @@ class CoreAvatarClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); path = path.replaceAll('{size}', Uri.encodeQueryComponent(size.toString())); - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -359,18 +364,19 @@ class CoreAvatarClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); path = path.replaceAll('{size}', Uri.encodeQueryComponent(size.toString())); - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -390,9 +396,9 @@ class CoreAvatarClient { } class CoreClientFlowLoginV2Client { - CoreClientFlowLoginV2Client(this.rootClient); + CoreClientFlowLoginV2Client(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Poll the login flow credentials Future poll({required final String token}) async { @@ -403,17 +409,18 @@ class CoreClientFlowLoginV2Client { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end queryParameters['token'] = token; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -437,16 +444,17 @@ class CoreClientFlowLoginV2Client { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -461,9 +469,9 @@ class CoreClientFlowLoginV2Client { } class CoreCollaborationResourcesClient { - CoreCollaborationResourcesClient(this.rootClient); + CoreCollaborationResourcesClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Search for collections Future searchCollections({ @@ -477,20 +485,21 @@ class CoreCollaborationResourcesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{filter}', Uri.encodeQueryComponent(filter)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -517,20 +526,21 @@ class CoreCollaborationResourcesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{collectionId}', Uri.encodeQueryComponent(collectionId.toString())); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -558,13 +568,14 @@ class CoreCollaborationResourcesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -572,7 +583,7 @@ class CoreCollaborationResourcesClient { queryParameters['collectionName'] = collectionName; path = path.replaceAll('{collectionId}', Uri.encodeQueryComponent(collectionId.toString())); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -601,13 +612,14 @@ class CoreCollaborationResourcesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -616,7 +628,7 @@ class CoreCollaborationResourcesClient { queryParameters['resourceId'] = resourceId; path = path.replaceAll('{collectionId}', Uri.encodeQueryComponent(collectionId.toString())); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -645,13 +657,14 @@ class CoreCollaborationResourcesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -660,7 +673,7 @@ class CoreCollaborationResourcesClient { queryParameters['resourceId'] = resourceId; path = path.replaceAll('{collectionId}', Uri.encodeQueryComponent(collectionId.toString())); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -688,13 +701,14 @@ class CoreCollaborationResourcesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -702,7 +716,7 @@ class CoreCollaborationResourcesClient { path = path.replaceAll('{resourceType}', Uri.encodeQueryComponent(resourceType)); path = path.replaceAll('{resourceId}', Uri.encodeQueryComponent(resourceId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -731,13 +745,14 @@ class CoreCollaborationResourcesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -746,7 +761,7 @@ class CoreCollaborationResourcesClient { path = path.replaceAll('{baseResourceType}', Uri.encodeQueryComponent(baseResourceType)); path = path.replaceAll('{baseResourceId}', Uri.encodeQueryComponent(baseResourceId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -764,9 +779,9 @@ class CoreCollaborationResourcesClient { /// This controller handles guest avatar requests. class CoreGuestAvatarClient { - CoreGuestAvatarClient(this.rootClient); + CoreGuestAvatarClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Returns a dark guest avatar image response Future getAvatarDark({ @@ -780,18 +795,19 @@ class CoreGuestAvatarClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{guestName}', Uri.encodeQueryComponent(guestName)); path = path.replaceAll('{size}', Uri.encodeQueryComponent(size)); - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -816,13 +832,14 @@ class CoreGuestAvatarClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{guestName}', Uri.encodeQueryComponent(guestName)); @@ -832,7 +849,7 @@ class CoreGuestAvatarClient { queryParameters['darkTheme'] = darkTheme.toString(); } } - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -846,9 +863,9 @@ class CoreGuestAvatarClient { } class CoreHoverCardClient { - CoreHoverCardClient(this.rootClient); + CoreHoverCardClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Get the user details for a hovercard Future getUser({ @@ -862,20 +879,21 @@ class CoreHoverCardClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -892,9 +910,9 @@ class CoreHoverCardClient { } class CoreNavigationClient { - CoreNavigationClient(this.rootClient); + CoreNavigationClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Get the apps navigation Future getAppsNavigation({ @@ -908,13 +926,14 @@ class CoreNavigationClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -923,7 +942,7 @@ class CoreNavigationClient { queryParameters['absolute'] = absolute.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -950,13 +969,14 @@ class CoreNavigationClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -965,7 +985,7 @@ class CoreNavigationClient { queryParameters['absolute'] = absolute.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -982,9 +1002,9 @@ class CoreNavigationClient { } class CoreOcsClient { - CoreOcsClient(this.rootClient); + CoreOcsClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Get the capabilities Future getCapabilities({ @@ -997,17 +1017,18 @@ class CoreOcsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1024,9 +1045,9 @@ class CoreOcsClient { } class CorePreviewClient { - CorePreviewClient(this.rootClient); + CorePreviewClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Get a preview by file ID Future getPreviewByFileId({ @@ -1044,13 +1065,14 @@ class CorePreviewClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1073,7 +1095,7 @@ class CorePreviewClient { if (mode != 'fill') { queryParameters['mode'] = mode; } - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1101,13 +1123,14 @@ class CorePreviewClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1130,7 +1153,7 @@ class CorePreviewClient { if (mode != 'fill') { queryParameters['mode'] = mode; } - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1144,9 +1167,9 @@ class CorePreviewClient { } class CoreProfileApiClient { - CoreProfileApiClient(this.rootClient); + CoreProfileApiClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Update the visiblity of a parameter Future setVisibility({ @@ -1162,13 +1185,14 @@ class CoreProfileApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1177,7 +1201,7 @@ class CoreProfileApiClient { queryParameters['visibility'] = visibility; path = path.replaceAll('{targetUserId}', Uri.encodeQueryComponent(targetUserId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1194,9 +1218,9 @@ class CoreProfileApiClient { } class CoreReferenceClient { - CoreReferenceClient(this.rootClient); + CoreReferenceClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Get a preview for a reference Future preview({required final String referenceId}) async { @@ -1207,17 +1231,18 @@ class CoreReferenceClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{referenceId}', Uri.encodeQueryComponent(referenceId)); - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1231,9 +1256,9 @@ class CoreReferenceClient { } class CoreReferenceApiClient { - CoreReferenceApiClient(this.rootClient); + CoreReferenceApiClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Resolve a reference Future resolveOne({ @@ -1247,20 +1272,21 @@ class CoreReferenceApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end queryParameters['reference'] = reference; headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1288,13 +1314,14 @@ class CoreReferenceApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1304,7 +1331,7 @@ class CoreReferenceApiClient { queryParameters['limit'] = limit.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1333,13 +1360,14 @@ class CoreReferenceApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1352,7 +1380,7 @@ class CoreReferenceApiClient { queryParameters['limit'] = limit.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1378,19 +1406,20 @@ class CoreReferenceApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1418,13 +1447,14 @@ class CoreReferenceApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1434,7 +1464,7 @@ class CoreReferenceApiClient { queryParameters['timestamp'] = timestamp.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1451,9 +1481,9 @@ class CoreReferenceApiClient { } class CoreTextProcessingApiClient { - CoreTextProcessingApiClient(this.rootClient); + CoreTextProcessingApiClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// This endpoint returns all available LanguageModel task types Future taskTypes({ @@ -1466,17 +1496,18 @@ class CoreTextProcessingApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1506,13 +1537,14 @@ class CoreTextProcessingApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end queryParameters['input'] = input; @@ -1522,7 +1554,7 @@ class CoreTextProcessingApiClient { queryParameters['identifier'] = identifier; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1549,18 +1581,19 @@ class CoreTextProcessingApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1577,9 +1610,9 @@ class CoreTextProcessingApiClient { } class CoreTranslationApiClient { - CoreTranslationApiClient(this.rootClient); + CoreTranslationApiClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Get the list of supported languages Future languages({final String oCSAPIRequest = 'true'}) async { @@ -1590,17 +1623,18 @@ class CoreTranslationApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1629,13 +1663,14 @@ class CoreTranslationApiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end queryParameters['text'] = text; @@ -1644,7 +1679,7 @@ class CoreTranslationApiClient { queryParameters['fromLanguage'] = fromLanguage; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1661,9 +1696,9 @@ class CoreTranslationApiClient { } class CoreUnifiedSearchClient { - CoreUnifiedSearchClient(this.rootClient); + CoreUnifiedSearchClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Get the providers for unified search Future getProviders({ @@ -1677,13 +1712,14 @@ class CoreUnifiedSearchClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1692,7 +1728,7 @@ class CoreUnifiedSearchClient { queryParameters['from'] = from; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1724,13 +1760,14 @@ class CoreUnifiedSearchClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1755,7 +1792,7 @@ class CoreUnifiedSearchClient { queryParameters['from'] = from; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1772,9 +1809,9 @@ class CoreUnifiedSearchClient { } class CoreWhatsNewClient { - CoreWhatsNewClient(this.rootClient); + CoreWhatsNewClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Get the changes Future $get({final String oCSAPIRequest = 'true'}) async { @@ -1785,19 +1822,20 @@ class CoreWhatsNewClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1824,20 +1862,21 @@ class CoreWhatsNewClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end queryParameters['version'] = version; headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1854,9 +1893,9 @@ class CoreWhatsNewClient { } class CoreWipeClient { - CoreWipeClient(this.rootClient); + CoreWipeClient(this._rootClient); - final CoreClient rootClient; + final CoreClient _rootClient; /// Check if the device should be wiped Future checkWipe({required final String token}) async { @@ -1867,17 +1906,18 @@ class CoreWipeClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end queryParameters['token'] = token; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1901,17 +1941,18 @@ class CoreWipeClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end queryParameters['token'] = token; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, diff --git a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart index 9a267898..03029f14 100644 --- a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart @@ -82,9 +82,9 @@ class FilesSharingClient extends DynamiteClient { } class FilesSharingDeletedShareapiClient { - FilesSharingDeletedShareapiClient(this.rootClient); + FilesSharingDeletedShareapiClient(this._rootClient); - final FilesSharingClient rootClient; + final FilesSharingClient _rootClient; /// Get a list of all deleted shares Future list({final String oCSAPIRequest = 'true'}) async { @@ -95,19 +95,20 @@ class FilesSharingDeletedShareapiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -134,20 +135,21 @@ class FilesSharingDeletedShareapiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{id}', Uri.encodeQueryComponent(id)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -164,9 +166,9 @@ class FilesSharingDeletedShareapiClient { } class FilesSharingPublicPreviewClient { - FilesSharingPublicPreviewClient(this.rootClient); + FilesSharingPublicPreviewClient(this._rootClient); - final FilesSharingClient rootClient; + final FilesSharingClient _rootClient; /// Get a direct link preview for a shared file Future directLink({ @@ -180,18 +182,19 @@ class FilesSharingPublicPreviewClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{token}', Uri.encodeQueryComponent(token)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -219,13 +222,14 @@ class FilesSharingPublicPreviewClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{token}', Uri.encodeQueryComponent(token)); @@ -242,7 +246,7 @@ class FilesSharingPublicPreviewClient { queryParameters['a'] = a.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -256,9 +260,9 @@ class FilesSharingPublicPreviewClient { } class FilesSharingRemoteClient { - FilesSharingRemoteClient(this.rootClient); + FilesSharingRemoteClient(this._rootClient); - final FilesSharingClient rootClient; + final FilesSharingClient _rootClient; /// Get a list of accepted remote shares Future getShares({final String oCSAPIRequest = 'true'}) async { @@ -269,19 +273,20 @@ class FilesSharingRemoteClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -307,19 +312,20 @@ class FilesSharingRemoteClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -346,20 +352,21 @@ class FilesSharingRemoteClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -386,20 +393,21 @@ class FilesSharingRemoteClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -426,20 +434,21 @@ class FilesSharingRemoteClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -466,20 +475,21 @@ class FilesSharingRemoteClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -496,9 +506,9 @@ class FilesSharingRemoteClient { } class FilesSharingShareInfoClient { - FilesSharingShareInfoClient(this.rootClient); + FilesSharingShareInfoClient(this._rootClient); - final FilesSharingClient rootClient; + final FilesSharingClient _rootClient; /// Get the info about a share Future info({ @@ -514,13 +524,14 @@ class FilesSharingShareInfoClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end queryParameters['t'] = t; @@ -533,7 +544,7 @@ class FilesSharingShareInfoClient { if (depth != -1) { queryParameters['depth'] = depth.toString(); } - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -550,9 +561,9 @@ class FilesSharingShareInfoClient { } class FilesSharingShareapiClient { - FilesSharingShareapiClient(this.rootClient); + FilesSharingShareapiClient(this._rootClient); - final FilesSharingClient rootClient; + final FilesSharingClient _rootClient; /// Get shares of the current user Future getShares({ @@ -563,20 +574,21 @@ class FilesSharingShareapiClient { final String includeTags = 'false', final String oCSAPIRequest = 'true', }) async { - const path = '/ocs/v2.php/apps/files_sharing/api/v1/shares'; + const path0 = '/ocs/v2.php/apps/files_sharing/api/v1/shares'; final queryParameters = {}; final headers = { 'Accept': 'application/json', }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -597,9 +609,9 @@ class FilesSharingShareapiClient { queryParameters['include_tags'] = includeTags; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', - Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), + Uri(path: path0, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, body, ); @@ -627,25 +639,28 @@ class FilesSharingShareapiClient { final String? attributes, final String oCSAPIRequest = 'true', }) async { - const path = '/ocs/v2.php/apps/files_sharing/api/v1/shares'; + const path0 = '/ocs/v2.php/apps/files_sharing/api/v1/shares'; final queryParameters = {}; final headers = { 'Accept': 'application/json', }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - queryParameters['path'] = path; + if (path != null) { + queryParameters['path'] = path; + } if (permissions != null) { queryParameters['permissions'] = permissions.toString(); } @@ -677,9 +692,9 @@ class FilesSharingShareapiClient { queryParameters['attributes'] = attributes; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', - Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), + Uri(path: path0, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, body, ); @@ -697,29 +712,30 @@ class FilesSharingShareapiClient { required final String path, final String oCSAPIRequest = 'true', }) async { - const path = '/ocs/v2.php/apps/files_sharing/api/v1/shares/inherited'; + const path0 = '/ocs/v2.php/apps/files_sharing/api/v1/shares/inherited'; final queryParameters = {}; final headers = { 'Accept': 'application/json', }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end queryParameters['path'] = path; headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', - Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), + Uri(path: path0, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, body, ); @@ -743,19 +759,20 @@ class FilesSharingShareapiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -783,13 +800,14 @@ class FilesSharingShareapiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -799,7 +817,7 @@ class FilesSharingShareapiClient { queryParameters['include_tags'] = includeTags.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -835,13 +853,14 @@ class FilesSharingShareapiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -875,7 +894,7 @@ class FilesSharingShareapiClient { queryParameters['attributes'] = attributes; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -902,20 +921,21 @@ class FilesSharingShareapiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{id}', Uri.encodeQueryComponent(id)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -942,20 +962,21 @@ class FilesSharingShareapiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{id}', Uri.encodeQueryComponent(id)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -972,9 +993,9 @@ class FilesSharingShareapiClient { } class FilesSharingShareesapiClient { - FilesSharingShareesapiClient(this.rootClient); + FilesSharingShareesapiClient(this._rootClient); - final FilesSharingClient rootClient; + final FilesSharingClient _rootClient; /// Search for sharees Future< @@ -995,13 +1016,14 @@ class FilesSharingShareesapiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1028,7 +1050,7 @@ class FilesSharingShareesapiClient { queryParameters['lookup'] = lookup.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1063,13 +1085,14 @@ class FilesSharingShareesapiClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1082,7 +1105,7 @@ class FilesSharingShareesapiClient { ); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, diff --git a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart index 77e74e6b..cf0e79d1 100644 --- a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart +++ b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart @@ -81,9 +81,9 @@ class ProvisioningApiClient extends DynamiteClient { } class ProvisioningApiAppConfigClient { - ProvisioningApiAppConfigClient(this.rootClient); + ProvisioningApiAppConfigClient(this._rootClient); - final ProvisioningApiClient rootClient; + final ProvisioningApiClient _rootClient; /// Get a list of apps /// @@ -98,19 +98,20 @@ class ProvisioningApiAppConfigClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -139,20 +140,21 @@ class ProvisioningApiAppConfigClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -183,13 +185,14 @@ class ProvisioningApiAppConfigClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -200,7 +203,7 @@ class ProvisioningApiAppConfigClient { queryParameters['defaultValue'] = defaultValue; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -229,13 +232,14 @@ class ProvisioningApiAppConfigClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -244,7 +248,7 @@ class ProvisioningApiAppConfigClient { path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); path = path.replaceAll('{key}', Uri.encodeQueryComponent(key)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -274,13 +278,14 @@ class ProvisioningApiAppConfigClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -288,7 +293,7 @@ class ProvisioningApiAppConfigClient { path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); path = path.replaceAll('{key}', Uri.encodeQueryComponent(key)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -305,9 +310,9 @@ class ProvisioningApiAppConfigClient { } class ProvisioningApiAppsClient { - ProvisioningApiAppsClient(this.rootClient); + ProvisioningApiAppsClient(this._rootClient); - final ProvisioningApiClient rootClient; + final ProvisioningApiClient _rootClient; /// Get a list of installed apps /// @@ -323,13 +328,14 @@ class ProvisioningApiAppsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -338,7 +344,7 @@ class ProvisioningApiAppsClient { queryParameters['filter'] = filter; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -367,20 +373,21 @@ class ProvisioningApiAppsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -409,20 +416,21 @@ class ProvisioningApiAppsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -451,20 +459,21 @@ class ProvisioningApiAppsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -481,9 +490,9 @@ class ProvisioningApiAppsClient { } class ProvisioningApiGroupsClient { - ProvisioningApiGroupsClient(this.rootClient); + ProvisioningApiGroupsClient(this._rootClient); - final ProvisioningApiClient rootClient; + final ProvisioningApiClient _rootClient; /// Get a list of groups Future getGroups({ @@ -499,13 +508,14 @@ class ProvisioningApiGroupsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -520,7 +530,7 @@ class ProvisioningApiGroupsClient { queryParameters['offset'] = offset.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -550,13 +560,14 @@ class ProvisioningApiGroupsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -566,7 +577,7 @@ class ProvisioningApiGroupsClient { queryParameters['displayname'] = displayname; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -595,13 +606,14 @@ class ProvisioningApiGroupsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -616,7 +628,7 @@ class ProvisioningApiGroupsClient { queryParameters['offset'] = offset.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -643,13 +655,14 @@ class ProvisioningApiGroupsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -661,7 +674,7 @@ class ProvisioningApiGroupsClient { } path = path.replaceAll('{groupId}', Uri.encodeQueryComponent(groupId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -691,13 +704,14 @@ class ProvisioningApiGroupsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -718,7 +732,7 @@ class ProvisioningApiGroupsClient { queryParameters['offset'] = offset.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -747,13 +761,14 @@ class ProvisioningApiGroupsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -765,7 +780,7 @@ class ProvisioningApiGroupsClient { } path = path.replaceAll('{groupId}', Uri.encodeQueryComponent(groupId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -793,13 +808,14 @@ class ProvisioningApiGroupsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -811,7 +827,7 @@ class ProvisioningApiGroupsClient { } path = path.replaceAll('{groupId}', Uri.encodeQueryComponent(groupId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -842,13 +858,14 @@ class ProvisioningApiGroupsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -862,7 +879,7 @@ class ProvisioningApiGroupsClient { } path = path.replaceAll('{groupId}', Uri.encodeQueryComponent(groupId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -891,13 +908,14 @@ class ProvisioningApiGroupsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -909,7 +927,7 @@ class ProvisioningApiGroupsClient { } path = path.replaceAll('{groupId}', Uri.encodeQueryComponent(groupId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -926,9 +944,9 @@ class ProvisioningApiGroupsClient { } class ProvisioningApiPreferencesClient { - ProvisioningApiPreferencesClient(this.rootClient); + ProvisioningApiPreferencesClient(this._rootClient); - final ProvisioningApiClient rootClient; + final ProvisioningApiClient _rootClient; /// Update a preference value of an app Future setPreference({ @@ -944,13 +962,14 @@ class ProvisioningApiPreferencesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -959,7 +978,7 @@ class ProvisioningApiPreferencesClient { path = path.replaceAll('{appId}', Uri.encodeQueryComponent(appId)); path = path.replaceAll('{configKey}', Uri.encodeQueryComponent(configKey)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -987,13 +1006,14 @@ class ProvisioningApiPreferencesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1001,7 +1021,7 @@ class ProvisioningApiPreferencesClient { path = path.replaceAll('{appId}', Uri.encodeQueryComponent(appId)); path = path.replaceAll('{configKey}', Uri.encodeQueryComponent(configKey)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1029,13 +1049,14 @@ class ProvisioningApiPreferencesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1048,7 +1069,7 @@ class ProvisioningApiPreferencesClient { ); path = path.replaceAll('{appId}', Uri.encodeQueryComponent(appId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1076,13 +1097,14 @@ class ProvisioningApiPreferencesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1090,7 +1112,7 @@ class ProvisioningApiPreferencesClient { queryParameters['configKeys[]'] = configKeys.map((final e) => e); path = path.replaceAll('{appId}', Uri.encodeQueryComponent(appId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1107,9 +1129,9 @@ class ProvisioningApiPreferencesClient { } class ProvisioningApiUsersClient { - ProvisioningApiUsersClient(this.rootClient); + ProvisioningApiUsersClient(this._rootClient); - final ProvisioningApiClient rootClient; + final ProvisioningApiClient _rootClient; /// Get a list of users Future getUsers({ @@ -1125,13 +1147,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1146,7 +1169,7 @@ class ProvisioningApiUsersClient { queryParameters['offset'] = offset.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1181,13 +1204,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1218,7 +1242,7 @@ class ProvisioningApiUsersClient { queryParameters['manager'] = manager; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1247,13 +1271,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1268,7 +1293,7 @@ class ProvisioningApiUsersClient { queryParameters['offset'] = offset.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1296,13 +1321,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1318,7 +1344,7 @@ class ProvisioningApiUsersClient { ]), ); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1345,20 +1371,21 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1387,13 +1414,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1402,7 +1430,7 @@ class ProvisioningApiUsersClient { queryParameters['value'] = value; path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1429,20 +1457,21 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1468,19 +1497,20 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1506,19 +1536,20 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1545,20 +1576,21 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1588,13 +1620,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1609,7 +1642,7 @@ class ProvisioningApiUsersClient { } path = path.replaceAll('{collectionName}', Uri.encodeQueryComponent(collectionName)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1636,20 +1669,21 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1676,20 +1710,21 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1716,20 +1751,21 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1756,20 +1792,21 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1797,13 +1834,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1813,7 +1851,7 @@ class ProvisioningApiUsersClient { queryParameters['groupid'] = groupid; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1841,13 +1879,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1855,7 +1894,7 @@ class ProvisioningApiUsersClient { queryParameters['groupid'] = groupid; path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1884,20 +1923,21 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1927,13 +1967,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1941,7 +1982,7 @@ class ProvisioningApiUsersClient { queryParameters['groupid'] = groupid; path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -1971,13 +2012,14 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -1985,7 +2027,7 @@ class ProvisioningApiUsersClient { queryParameters['groupid'] = groupid; path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -2012,20 +2054,21 @@ class ProvisioningApiUsersClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, diff --git a/packages/nextcloud/lib/src/api/settings.openapi.dart b/packages/nextcloud/lib/src/api/settings.openapi.dart index 9f11e543..05315923 100644 --- a/packages/nextcloud/lib/src/api/settings.openapi.dart +++ b/packages/nextcloud/lib/src/api/settings.openapi.dart @@ -75,9 +75,9 @@ class SettingsClient extends DynamiteClient { } class SettingsLogSettingsClient { - SettingsLogSettingsClient(this.rootClient); + SettingsLogSettingsClient(this._rootClient); - final SettingsClient rootClient; + final SettingsClient _rootClient; /// download logfile /// @@ -90,18 +90,19 @@ class SettingsLogSettingsClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, diff --git a/packages/nextcloud/lib/src/api/theming.openapi.dart b/packages/nextcloud/lib/src/api/theming.openapi.dart index 5b91b3ee..aadcdfe8 100644 --- a/packages/nextcloud/lib/src/api/theming.openapi.dart +++ b/packages/nextcloud/lib/src/api/theming.openapi.dart @@ -79,9 +79,9 @@ class ThemingClient extends DynamiteClient { } class ThemingIconClient { - ThemingIconClient(this.rootClient); + ThemingIconClient(this._rootClient); - final ThemingClient rootClient; + final ThemingClient _rootClient; /// Return a 32x32 favicon as png Future getFavicon({final String app = 'core'}) async { @@ -92,17 +92,18 @@ class ThemingIconClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -123,17 +124,18 @@ class ThemingIconClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -157,13 +159,14 @@ class ThemingIconClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); @@ -171,7 +174,7 @@ class ThemingIconClient { throw Exception('Invalid value "$image" for parameter "image" with pattern "${r'^.+$'}"'); // coverage:ignore-line } path = path.replaceAll('{image}', Uri.encodeQueryComponent(image)); - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -187,9 +190,9 @@ class ThemingIconClient { /// Class ThemingController /// handle ajax requests to update the theme class ThemingThemingClient { - ThemingThemingClient(this.rootClient); + ThemingThemingClient(this._rootClient); - final ThemingClient rootClient; + final ThemingClient _rootClient; /// Get the CSS stylesheet for a theme Future getThemeStylesheet({ @@ -204,13 +207,14 @@ class ThemingThemingClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{themeId}', Uri.encodeQueryComponent(themeId)); @@ -220,7 +224,7 @@ class ThemingThemingClient { if (withCustomCss != 0) { queryParameters['withCustomCss'] = withCustomCss.toString(); } - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -244,20 +248,21 @@ class ThemingThemingClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{key}', Uri.encodeQueryComponent(key)); if (useSvg != 1) { queryParameters['useSvg'] = useSvg.toString(); } - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -278,17 +283,18 @@ class ThemingThemingClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } // coverage:ignore-end path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -305,9 +311,9 @@ class ThemingThemingClient { } class ThemingUserThemeClient { - ThemingUserThemeClient(this.rootClient); + ThemingUserThemeClient(this._rootClient); - final ThemingClient rootClient; + final ThemingClient _rootClient; /// Get the background image Future getBackground({final String oCSAPIRequest = 'true'}) async { @@ -318,19 +324,20 @@ class ThemingUserThemeClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -356,13 +363,14 @@ class ThemingUserThemeClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -375,7 +383,7 @@ class ThemingUserThemeClient { queryParameters['color'] = color; } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'post', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -397,19 +405,20 @@ class ThemingUserThemeClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -434,20 +443,21 @@ class ThemingUserThemeClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{themeId}', Uri.encodeQueryComponent(themeId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -474,20 +484,21 @@ class ThemingUserThemeClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{themeId}', Uri.encodeQueryComponent(themeId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, diff --git a/packages/nextcloud/lib/src/api/user_status.openapi.dart b/packages/nextcloud/lib/src/api/user_status.openapi.dart index f4c458e8..d408feab 100644 --- a/packages/nextcloud/lib/src/api/user_status.openapi.dart +++ b/packages/nextcloud/lib/src/api/user_status.openapi.dart @@ -80,9 +80,9 @@ class UserStatusClient extends DynamiteClient { } class UserStatusHeartbeatClient { - UserStatusHeartbeatClient(this.rootClient); + UserStatusHeartbeatClient(this._rootClient); - final UserStatusClient rootClient; + final UserStatusClient _rootClient; /// Keep the status alive Future heartbeat({ @@ -96,20 +96,21 @@ class UserStatusHeartbeatClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end queryParameters['status'] = status; headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -126,9 +127,9 @@ class UserStatusHeartbeatClient { } class UserStatusPredefinedStatusClient { - UserStatusPredefinedStatusClient(this.rootClient); + UserStatusPredefinedStatusClient(this._rootClient); - final UserStatusClient rootClient; + final UserStatusClient _rootClient; /// Get all predefined messages Future findAll({ @@ -141,19 +142,20 @@ class UserStatusPredefinedStatusClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -170,9 +172,9 @@ class UserStatusPredefinedStatusClient { } class UserStatusStatusesClient { - UserStatusStatusesClient(this.rootClient); + UserStatusStatusesClient(this._rootClient); - final UserStatusClient rootClient; + final UserStatusClient _rootClient; /// Find statuses of users Future findAll({ @@ -187,13 +189,14 @@ class UserStatusStatusesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -205,7 +208,7 @@ class UserStatusStatusesClient { queryParameters['offset'] = offset.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -232,20 +235,21 @@ class UserStatusStatusesClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -262,9 +266,9 @@ class UserStatusStatusesClient { } class UserStatusUserStatusClient { - UserStatusUserStatusClient(this.rootClient); + UserStatusUserStatusClient(this._rootClient); - final UserStatusClient rootClient; + final UserStatusClient _rootClient; /// Get the status of the current user Future getStatus({ @@ -277,19 +281,20 @@ class UserStatusUserStatusClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'get', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -316,20 +321,21 @@ class UserStatusUserStatusClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end queryParameters['statusType'] = statusType; headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -357,13 +363,14 @@ class UserStatusUserStatusClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -373,7 +380,7 @@ class UserStatusUserStatusClient { queryParameters['clearAt'] = clearAt.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -402,13 +409,14 @@ class UserStatusUserStatusClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } @@ -423,7 +431,7 @@ class UserStatusUserStatusClient { queryParameters['clearAt'] = clearAt.toString(); } headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -449,19 +457,20 @@ class UserStatusUserStatusClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers, @@ -488,20 +497,21 @@ class UserStatusUserStatusClient { }; Uint8List? body; // coverage:ignore-start - if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { + headers.addAll( + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + ); + } else if (_rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { headers.addAll( - rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, + _rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers, ); - } else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { - headers - .addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); } else { throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end path = path.replaceAll('{messageId}', Uri.encodeQueryComponent(messageId)); headers['OCS-APIRequest'] = oCSAPIRequest; - final response = await rootClient.doRequest( + final response = await _rootClient.doRequest( 'delete', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), headers,