From d3b6cfa44c9f68bb9e8fc599beac4134083f0226 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Sat, 2 Mar 2024 09:42:07 +0100 Subject: [PATCH] feat(dynamite_runtime): use http.Request in generated code Signed-off-by: Nikolas Rimikis --- .../example/lib/petstore.openapi.dart | 219 +- .../dynamite/dynamite/example/pubspec.yaml | 1 + .../dynamite/lib/src/builder/client.dart | 213 +- .../lib/src/builder/resolve_mime_type.dart | 6 +- .../lib/src/models/openapi/operation.dart | 17 +- .../lib/authentication.openapi.dart | 221 +- .../lib/documentation.openapi.dart | 121 +- .../lib/headers.openapi.dart | 129 +- .../lib/parameters.openapi.dart | 401 +- .../lib/request_body.openapi.dart | 117 +- .../lib/responses.openapi.dart | 177 +- .../lib/tags.openapi.dart | 87 +- .../dynamite_end_to_end_test/pubspec.yaml | 2 +- .../lib/src/client/client.dart | 4 +- .../lib/src/blocs/dashboard.dart | 6 +- .../lib/src/widgets/file_preview.dart | 2 +- .../neon_news/lib/src/blocs/articles.dart | 2 +- .../neon/neon_news/lib/src/blocs/news.dart | 4 +- .../neon/neon_notes/lib/src/blocs/notes.dart | 2 +- .../lib/src/blocs/notifications.dart | 2 +- .../neon/neon_talk/lib/src/blocs/talk.dart | 2 +- .../lib/src/widgets/room_avatar.dart | 4 +- .../neon_framework/lib/src/blocs/apps.dart | 2 +- .../lib/src/blocs/capabilities.dart | 2 +- .../lib/src/blocs/unified_search.dart | 2 +- .../lib/src/blocs/user_details.dart | 2 +- .../lib/src/blocs/user_status.dart | 2 +- .../lib/src/blocs/weather_status.dart | 4 +- .../lib/src/utils/request_manager.dart | 7 +- .../neon_framework/lib/src/widgets/image.dart | 2 +- .../lib/src/widgets/user_avatar.dart | 4 +- .../test/user_status_bloc_test.dart | 2 + .../nextcloud/lib/src/api/core.openapi.dart | 4574 +++--- .../lib/src/api/dashboard.openapi.dart | 317 +- .../nextcloud/lib/src/api/dav.openapi.dart | 492 +- .../nextcloud/lib/src/api/files.openapi.dart | 1210 +- .../lib/src/api/files_external.openapi.dart | 93 +- .../lib/src/api/files_reminders.openapi.dart | 323 +- .../lib/src/api/files_sharing.openapi.dart | 2041 ++- .../lib/src/api/files_trashbin.openapi.dart | 130 +- .../lib/src/api/files_versions.openapi.dart | 130 +- .../nextcloud/lib/src/api/news.openapi.dart | 1290 +- .../nextcloud/lib/src/api/notes.openapi.dart | 665 +- .../lib/src/api/notifications.openapi.dart | 1079 +- .../lib/src/api/provisioning_api.openapi.dart | 3531 +++-- .../lib/src/api/settings.openapi.dart | 79 +- .../nextcloud/lib/src/api/spreed.openapi.dart | 12456 ++++++++-------- .../lib/src/api/theming.openapi.dart | 769 +- .../src/api/updatenotification.openapi.dart | 121 +- .../nextcloud/lib/src/api/uppush.openapi.dart | 781 +- .../lib/src/api/user_status.openapi.dart | 877 +- .../lib/src/api/weather_status.openapi.dart | 567 +- .../notes/get_and_update_settings.regexp | 2 +- tool/find-untested-neon-apis.sh | 2 +- 54 files changed, 16191 insertions(+), 17106 deletions(-) diff --git a/packages/dynamite/dynamite/example/lib/petstore.openapi.dart b/packages/dynamite/dynamite/example/lib/petstore.openapi.dart index d27fa370d13..6d4faaf4207 100644 --- a/packages/dynamite/dynamite/example/lib/petstore.openapi.dart +++ b/packages/dynamite/dynamite/example/lib/petstore.openapi.dart @@ -22,16 +22,16 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:convert'; -import 'dart:typed_data'; import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i5; -import 'package:dynamite_runtime/built_value.dart' as _i4; +import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:dynamite_runtime/built_value.dart' as _i5; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i3; +import 'package:uri/uri.dart' as _i4; part 'petstore.openapi.g.dart'; @@ -54,7 +54,7 @@ class $Client extends _i1.DynamiteClient { authentications: client.authentications, ); - /// Builds a serializer to parse the response of `$findPets_Request`. + /// Builds a serializer to parse the response of [$findPets_Request]. @_i2.experimental _i1.DynamiteSerializer, void> $findPets_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(BuiltList, [FullType(Pet)]), @@ -69,7 +69,7 @@ class $Client extends _i1.DynamiteClient { /// Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. /// /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [findPets] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -81,17 +81,25 @@ class $Client extends _i1.DynamiteClient { /// * default: unexpected error /// /// See: - /// * [findPetsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse, void>> findPets({ + /// * [findPets] for a method executing this request and parsing the response. + /// * [$findPets_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $findPets_Request({ BuiltList? tags, int? limit, - }) async { - final _rawResponse = await findPetsRaw( - tags: tags, - limit: limit, - ); + }) { + final _parameters = {}; + final $tags = _$jsonSerializers.serialize(tags, specifiedType: const FullType(BuiltList, [FullType(String)])); + _parameters['tags'] = $tags; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + _parameters['limit'] = $limit; + + final _path = _i4.UriTemplate('/pets{?tags*,limit*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } /// Returns all pets from the system that the user has access to. @@ -100,9 +108,7 @@ class $Client extends _i1.DynamiteClient { /// Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. /// /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -114,33 +120,24 @@ class $Client extends _i1.DynamiteClient { /// * default: unexpected error /// /// See: - /// * [findPets] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse, void>> findPetsRaw({ + /// * [$findPets_Request] for the request send by this method. + /// * [$findPets_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse, void>> findPets({ BuiltList? tags, int? limit, }) async { - final _parameters = {}; - const _headers = {'Accept': 'application/json'}; - - final $tags = _$jsonSerializers.serialize(tags, specifiedType: const FullType(BuiltList, [FullType(String)])); - _parameters['tags'] = $tags; - - final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - _parameters['limit'] = $limit; - - final _path = _i3.UriTemplate('/pets{?tags*,limit*}').expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, + final _request = $findPets_Request( + tags: tags, + limit: limit, ); + final _response = await sendWithCookies(_request); final _serializer = $findPets_Serializer(); - return _i1.ResponseConverter, void>(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter, void>(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$addPet_Request`. + /// Builds a serializer to parse the response of [$addPet_Request]. @_i2.experimental _i1.DynamiteSerializer $addPet_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Pet), @@ -151,7 +148,7 @@ class $Client extends _i1.DynamiteClient { /// Creates a new pet in the store. Duplicates are allowed. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [addPet] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -159,20 +156,22 @@ class $Client extends _i1.DynamiteClient { /// * default: unexpected error /// /// See: - /// * [addPetRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> addPet({required NewPet newPet}) async { - final _rawResponse = await addPetRaw( - newPet: newPet, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [addPet] for a method executing this request and parsing the response. + /// * [$addPet_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $addPet_Request({required NewPet newPet}) { + const _path = '/pets'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; + _request.headers['Content-Type'] = 'application/json'; + _request.body = json.encode(_$jsonSerializers.serialize(newPet, specifiedType: const FullType(NewPet))); + return _request; } /// Creates a new pet in the store. Duplicates are allowed. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -180,27 +179,20 @@ class $Client extends _i1.DynamiteClient { /// * default: unexpected error /// /// See: - /// * [addPet] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> addPetRaw({required NewPet newPet}) async { - final _headers = {'Accept': 'application/json'}; - Uint8List? _body; - - _headers['Content-Type'] = 'application/json'; - _body = utf8.encode(json.encode(_$jsonSerializers.serialize(newPet, specifiedType: const FullType(NewPet)))); - const _path = '/pets'; - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - body: _body, + /// * [$addPet_Request] for the request send by this method. + /// * [$addPet_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> addPet({required NewPet newPet}) async { + final _request = $addPet_Request( + newPet: newPet, ); + final _response = await sendWithCookies(_request); final _serializer = $addPet_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$findPetById_Request`. + /// Builds a serializer to parse the response of [$findPetById_Request]. @_i2.experimental _i1.DynamiteSerializer $findPetById_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Pet), @@ -211,7 +203,7 @@ class $Client extends _i1.DynamiteClient { /// Returns a user based on a single ID, if the user does not have access to the pet. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [findPetById] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -222,20 +214,24 @@ class $Client extends _i1.DynamiteClient { /// * default: unexpected error /// /// See: - /// * [findPetByIdRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> findPetById({required int id}) async { - final _rawResponse = await findPetByIdRaw( - id: id, - ); + /// * [findPetById] for a method executing this request and parsing the response. + /// * [$findPetById_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $findPetById_Request({required int id}) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + final _path = _i4.UriTemplate('/pets/{id}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } /// Returns a user based on a single ID, if the user does not have access to the pet. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -246,27 +242,20 @@ class $Client extends _i1.DynamiteClient { /// * default: unexpected error /// /// See: - /// * [findPetById] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> findPetByIdRaw({required int id}) async { - final _parameters = {}; - const _headers = {'Accept': 'application/json'}; - - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - - final _path = _i3.UriTemplate('/pets/{id}').expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, + /// * [$findPetById_Request] for the request send by this method. + /// * [$findPetById_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> findPetById({required int id}) async { + final _request = $findPetById_Request( + id: id, ); + final _response = await sendWithCookies(_request); final _serializer = $findPetById_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$deletePet_Request`. + /// Builds a serializer to parse the response of [$deletePet_Request]. @_i2.experimental _i1.DynamiteSerializer $deletePet_Serializer() => _i1.DynamiteSerializer( bodyType: null, @@ -277,7 +266,7 @@ class $Client extends _i1.DynamiteClient { /// deletes a single pet based on the ID supplied. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [deletePet] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -288,20 +277,23 @@ class $Client extends _i1.DynamiteClient { /// * default: unexpected error /// /// See: - /// * [deletePetRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deletePet({required int id}) async { - final _rawResponse = await deletePetRaw( - id: id, - ); + /// * [deletePet] for a method executing this request and parsing the response. + /// * [$deletePet_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $deletePet_Request({required int id}) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + final _path = _i4.UriTemplate('/pets/{id}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('delete', _uri); + return _request; } /// deletes a single pet based on the ID supplied. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -312,22 +304,17 @@ class $Client extends _i1.DynamiteClient { /// * default: unexpected error /// /// See: - /// * [deletePet] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> deletePetRaw({required int id}) async { - final _parameters = {}; - - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - - final _path = _i3.UriTemplate('/pets/{id}').expand(_parameters); - final _response = await executeRequest( - 'delete', - _path, + /// * [$deletePet_Request] for the request send by this method. + /// * [$deletePet_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deletePet({required int id}) async { + final _request = $deletePet_Request( + id: id, ); + final _response = await sendWithCookies(_request); final _serializer = $deletePet_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -439,9 +426,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i4.DynamiteDoubleSerializer()) - ..addPlugin(_i5.StandardJsonPlugin()) - ..addPlugin(const _i4.HeaderPlugin()) - ..addPlugin(const _i4.ContentStringPlugin())) + ..add(_i5.DynamiteDoubleSerializer()) + ..addPlugin(_i6.StandardJsonPlugin()) + ..addPlugin(const _i5.HeaderPlugin()) + ..addPlugin(const _i5.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/dynamite/dynamite/example/pubspec.yaml b/packages/dynamite/dynamite/example/pubspec.yaml index 97e085d78f8..5b0db3ec7da 100644 --- a/packages/dynamite/dynamite/example/pubspec.yaml +++ b/packages/dynamite/dynamite/example/pubspec.yaml @@ -10,6 +10,7 @@ dependencies: built_collection: ^5.0.0 built_value: ^8.9.0 dynamite_runtime: ^0.2.0 + http: ^1.2.1 meta: ^1.0.0 uri: ^1.0.0 diff --git a/packages/dynamite/dynamite/lib/src/builder/client.dart b/packages/dynamite/dynamite/lib/src/builder/client.dart index 0c26ef0c651..5457b60dea4 100644 --- a/packages/dynamite/dynamite/lib/src/builder/client.dart +++ b/packages/dynamite/dynamite/lib/src/builder/client.dart @@ -303,7 +303,7 @@ Iterable buildTags( yield Method((b) { b ..name = '\$${name}_Serializer' - ..docs.add('/// Builds a serializer to parse the response of `\$${name}_Request`.') + ..docs.add('/// Builds a serializer to parse the response of [\$${name}_Request].') ..annotations.add(refer('experimental', 'package:meta/meta.dart')); if (operation.deprecated) { @@ -342,6 +342,70 @@ ${allocate(returnType)}( }); }); + yield Method((b) { + b + ..name = '\$${name}_Request' + ..docs.addAll(operation.formattedDescription(name, isRequest: true)) + ..annotations.add(refer('experimental', 'package:meta/meta.dart')); + + if (operation.deprecated) { + b.annotations.add(refer('Deprecated').call([refer("''")])); + } + + final requestType = refer('Request', 'package:http/http.dart'); + + b + ..optionalParameters.addAll(operationParameters) + ..returns = requestType + ..body = Code.scope((allocate) { + final code = StringBuffer(); + + if (pathParameters.isNotEmpty) { + code.writeln('final _parameters = {};'); + } + + for (final parameter in pathParameters.entries) { + code.writeln(buildParameterSerialization(parameter.value, parameter.key, state, allocate)); + } + + buildUrlPath(pathEntry.key, parameters, code, allocate); + + code + ..writeln("final _uri = Uri.parse('\${$client.baseURL}\$_path');") + ..writeln("final _request = ${allocate(requestType)}('$httpMethod', _uri);"); + + final acceptHeader = responses.keys + .map((response) => response.content?.keys) + .whereNotNull() + .expand((element) => element) + .toSet() + .join(','); + + if (acceptHeader.isNotEmpty) { + code.writeln("_request.headers['Accept'] = '$acceptHeader';"); + } + + buildAuthCheck( + state, + operation, + spec, + client, + code, + ); + + for (final parameter in headerParameters.entries) { + code.writeln(buildParameterSerialization(parameter.value, parameter.key, state, allocate)); + } + + if (bodyParameter != null) { + resolveMimeTypeEncode(bodyParameter.mimeType, bodyParameter.result, code); + } + + code.writeln('return _request;'); + return code.toString(); + }); + }); + yield Method((b) { b ..name = name @@ -363,6 +427,11 @@ ${allocate(returnType)}( ..url = 'package:dynamite_runtime/http_client.dart', ); + final responseConverterType = refer( + 'ResponseConverter<${bodyType.name}, ${headersType.name}>', + 'package:dynamite_runtime/http_client.dart', + ); + b ..optionalParameters.addAll(operationParameters) ..returns = TypeReference( @@ -372,133 +441,15 @@ ${allocate(returnType)}( ) ..body = Code.scope( (allocate) => ''' -final _rawResponse = await ${name}Raw( - $rawParameters -); +final _request = \$${name}_Request($rawParameters); +final _response = await $client.sendWithCookies(_request); +final _serializer = \$${name}_Serializer(); +final _rawResponse = await ${allocate(responseConverterType)}(_serializer).convert(_response); return ${allocate(responseType)}.fromRawResponse(_rawResponse); ''', ); }); - - yield Method( - (b) { - b - ..name = '${name}Raw' - ..modifier = MethodModifier.async - ..docs.addAll(operation.formattedDescription(name, isRawRequest: true)) - ..annotations.add(refer('experimental', 'package:meta/meta.dart')); - - if (operation.deprecated) { - b.annotations.add(refer('Deprecated').call([refer("''")])); - } - - b - ..optionalParameters.addAll(operationParameters) - ..returns = TypeReference( - (b) => b - ..symbol = 'Future' - ..types.add( - refer( - 'DynamiteRawResponse<${bodyType.name}, ${headersType.name}>', - 'package:dynamite_runtime/http_client.dart', - ), - ), - ) - ..body = Code.scope((allocate) { - final hasUriParameters = pathParameters.isNotEmpty; - final hasHeaderParameters = headerParameters.isNotEmpty; - final hasAuthentication = needsAuthCheck(pathEntry, operation, spec, client); - final hasContentEncoding = bodyParameter != null; - - final code = StringBuffer(); - final acceptHeader = responses.keys - .map((response) => response.content?.keys) - .whereNotNull() - .expand((element) => element) - .toSet() - .join(','); - - if (hasUriParameters) { - code.writeln('final _parameters = {};'); - } - - Expression? headersExpression; - if (hasHeaderParameters || hasAuthentication || hasContentEncoding) { - headersExpression = declareFinal('_headers'); - } else if (acceptHeader.isNotEmpty) { - headersExpression = declareConst('_headers'); - } - - if (headersExpression != null) { - final headersCode = headersExpression - .assign( - literalMap( - {if (acceptHeader.isNotEmpty) 'Accept': acceptHeader}, - refer('String'), - refer('String'), - ), - ) - .statement - .accept(state.emitter); - - code.writeln(headersCode); - } - - if (hasContentEncoding) { - code.writeln('Uint8List? _body;'); - } - // Separate the declarations from the assignments - code.writeln(); - - if (hasAuthentication) { - buildAuthCheck( - state, - operation, - spec, - client, - code, - ); - } - - for (final parameter in pathParameters.entries) { - code.writeln(buildParameterSerialization(parameter.value, parameter.key, state, allocate)); - } - for (final parameter in headerParameters.entries) { - code.writeln(buildParameterSerialization(parameter.value, parameter.key, state, allocate)); - } - - if (bodyParameter != null) { - resolveMimeTypeEncode(bodyParameter.mimeType, bodyParameter.result, code); - } - - buildUrlPath(pathEntry.key, parameters, code, state.emitter.allocator.allocate); - - final requestExpression = refer(client).property('executeRequest').call([ - literalString(httpMethod), - refer('_path'), - ], { - if (acceptHeader.isNotEmpty || hasHeaderParameters || hasAuthentication || hasContentEncoding) - 'headers': refer('_headers'), - if (operation.requestBody != null) 'body': refer('_body'), - }); - - final responseConverterType = refer( - 'ResponseConverter<${bodyType.name}, ${headersType.name}>', - 'package:dynamite_runtime/http_client.dart', - ); - - code.write(''' -final _response = ${requestExpression.awaited.accept(state.emitter)}; - -final _serializer = \$${name}_Serializer(); -return ${allocate(responseConverterType)}(_serializer).convert(_response); -'''); - - return code.toString(); - }); - }, - ); } } } @@ -652,7 +603,7 @@ String buildParameterSerialization( if (parameter.$in == openapi.ParameterType.header) { final encoderRef = refer('HeaderEncoder', 'package:dynamite_runtime/utils.dart'); final assignment = - "_headers['${parameter.pctEncodedName}'] = ${allocate(encoderRef)}(explode: ${parameter.explode}).convert($serializedName);"; + "_request.headers['${parameter.pctEncodedName}'] = ${allocate(encoderRef)}(explode: ${parameter.explode}).convert($serializedName);"; if ($default == null) { buffer @@ -669,18 +620,6 @@ String buildParameterSerialization( return buffer.toString(); } -bool needsAuthCheck( - MapEntry pathEntry, - openapi.Operation operation, - openapi.OpenAPI spec, - String client, -) { - final security = operation.security ?? spec.security ?? BuiltList(); - final securityRequirements = security.where((requirement) => requirement.isNotEmpty); - - return securityRequirements.isNotEmpty; -} - void buildAuthCheck( State state, openapi.Operation operation, @@ -725,7 +664,7 @@ final authentication = $client.authentications?.firstWhereOrNull( ); if(authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } diff --git a/packages/dynamite/dynamite/lib/src/builder/resolve_mime_type.dart b/packages/dynamite/dynamite/lib/src/builder/resolve_mime_type.dart index ed17ebeb822..4b82815939f 100644 --- a/packages/dynamite/dynamite/lib/src/builder/resolve_mime_type.dart +++ b/packages/dynamite/dynamite/lib/src/builder/resolve_mime_type.dart @@ -44,7 +44,7 @@ void resolveMimeTypeEncode( TypeResult result, StringSink output, ) { - output.writeln("_headers['Content-Type'] = '$mimeType';"); + output.writeln("_request.headers['Content-Type'] = '$mimeType';"); final parameterName = toDartName(result.name); switch (mimeType) { @@ -53,7 +53,7 @@ void resolveMimeTypeEncode( if (result.nullable) { output.writeln('if ($parameterName != null) {'); } - output.writeln('_body = utf8.encode(${result.encode(parameterName, mimeType: mimeType)});'); + output.writeln('_request.body = ${result.encode(parameterName, mimeType: mimeType)};'); if (result.nullable) { output.writeln('}'); } @@ -62,7 +62,7 @@ void resolveMimeTypeEncode( if (result.nullable) { output.writeln('if ($parameterName != null) {'); } - output.writeln('_body = ${result.encode(parameterName, mimeType: mimeType)};'); + output.writeln('_request.bodyBytes = ${result.encode(parameterName, mimeType: mimeType)};'); if (result.nullable) { output.writeln('}'); } diff --git a/packages/dynamite/dynamite/lib/src/models/openapi/operation.dart b/packages/dynamite/dynamite/lib/src/models/openapi/operation.dart index 3257e18abcc..1363f1dd618 100644 --- a/packages/dynamite/dynamite/lib/src/models/openapi/operation.dart +++ b/packages/dynamite/dynamite/lib/src/models/openapi/operation.dart @@ -42,7 +42,7 @@ abstract class Operation implements Built { Iterable formattedDescription( String methodName, { - bool isRawRequest = false, + bool isRequest = false, bool requiresAuth = false, }) sync* { if (summary != null && summary!.isNotEmpty) { @@ -55,11 +55,8 @@ abstract class Operation implements Built { yield docsSeparator; } - if (isRawRequest) { - yield ''' -$docsSeparator This method and the response it returns is experimental. The API might change without a major version bump. -$docsSeparator -$docsSeparator Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers.'''; + if (isRequest) { + yield '$docsSeparator Returns a `DynamiteRequest` backing the [$methodName] operation.'; } else { yield '$docsSeparator Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers.'; } @@ -96,10 +93,12 @@ $docsSeparator Returns a [Future] containing a `DynamiteRawResponse` with the ra } yield '$docsSeparator See:'; - if (isRawRequest) { - yield '$docsSeparator * [$methodName] for an operation that returns a `DynamiteResponse` with a stable API.'; + if (isRequest) { + yield '$docsSeparator * [$methodName] for a method executing this request and parsing the response.'; + yield '$docsSeparator * [\$${methodName}_Serializer] for a converter to parse the `Response` from an executed this request.'; } else { - yield '$docsSeparator * [${methodName}Raw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized.'; + yield '$docsSeparator * [\$${methodName}_Request] for the request send by this method.'; + yield '$docsSeparator * [\$${methodName}_Serializer] for a converter to parse the `Response` from an executed request.'; } } } diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/authentication.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/authentication.openapi.dart index 545c82c5e33..9f07aa59386 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/authentication.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/authentication.openapi.dart @@ -10,10 +10,11 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i4; +import 'package:built_value/standard_json_plugin.dart' as _i5; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i3; +import 'package:dynamite_runtime/built_value.dart' as _i4; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; class $Client extends _i1.DynamiteClient { @@ -36,7 +37,7 @@ class $Client extends _i1.DynamiteClient { authentications: client.authentications, ); - /// Builds a serializer to parse the response of `$noAuthentication_Request`. + /// Builds a serializer to parse the response of [$noAuthentication_Request]. @_i2.experimental _i1.DynamiteSerializer $noAuthentication_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(JsonObject), @@ -45,46 +46,43 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [noAuthentication] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [noAuthenticationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> noAuthentication() async { - final _rawResponse = await noAuthenticationRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [noAuthentication] for a method executing this request and parsing the response. + /// * [$noAuthentication_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $noAuthentication_Request() { + const _path = '/'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [noAuthentication] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> noAuthenticationRaw() async { - const _headers = {'Accept': 'application/json'}; - - const _path = '/'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); + /// * [$noAuthentication_Request] for the request send by this method. + /// * [$noAuthentication_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> noAuthentication() async { + final _request = $noAuthentication_Request(); + final _response = await sendWithCookies(_request); final _serializer = $noAuthentication_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$basicAuthentication_Request`. + /// Builds a serializer to parse the response of [$basicAuthentication_Request]. @_i2.experimental _i1.DynamiteSerializer $basicAuthentication_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(JsonObject), @@ -93,34 +91,21 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [basicAuthentication] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [basicAuthenticationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> basicAuthentication() async { - final _rawResponse = await basicAuthenticationRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Status codes: - /// * 200 - /// - /// See: - /// * [basicAuthentication] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [basicAuthentication] for a method executing this request and parsing the response. + /// * [$basicAuthentication_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> basicAuthenticationRaw() async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $basicAuthentication_Request() { + const _path = '/basic'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -130,7 +115,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -138,26 +123,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - const _path = '/basic'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $basicAuthentication_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$bearerAuthentication_Request`. - @_i2.experimental - _i1.DynamiteSerializer $bearerAuthentication_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(JsonObject), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -165,27 +133,41 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [bearerAuthenticationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> bearerAuthentication() async { - final _rawResponse = await bearerAuthenticationRaw(); + /// * [$basicAuthentication_Request] for the request send by this method. + /// * [$basicAuthentication_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> basicAuthentication() async { + final _request = $basicAuthentication_Request(); + final _response = await sendWithCookies(_request); + final _serializer = $basicAuthentication_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$bearerAuthentication_Request]. + @_i2.experimental + _i1.DynamiteSerializer $bearerAuthentication_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(JsonObject), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [bearerAuthentication] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [bearerAuthentication] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [bearerAuthentication] for a method executing this request and parsing the response. + /// * [$bearerAuthentication_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> bearerAuthenticationRaw() async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $bearerAuthentication_Request() { + const _path = '/bearer'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -195,7 +177,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -203,26 +185,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - const _path = '/bearer'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $bearerAuthentication_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$multipleAuthentications_Request`. - @_i2.experimental - _i1.DynamiteSerializer $multipleAuthentications_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(JsonObject), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -230,27 +195,41 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [multipleAuthenticationsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> multipleAuthentications() async { - final _rawResponse = await multipleAuthenticationsRaw(); + /// * [$bearerAuthentication_Request] for the request send by this method. + /// * [$bearerAuthentication_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> bearerAuthentication() async { + final _request = $bearerAuthentication_Request(); + final _response = await sendWithCookies(_request); + final _serializer = $bearerAuthentication_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$multipleAuthentications_Request]. + @_i2.experimental + _i1.DynamiteSerializer $multipleAuthentications_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(JsonObject), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [multipleAuthentications] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [multipleAuthentications] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [multipleAuthentications] for a method executing this request and parsing the response. + /// * [$multipleAuthentications_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> multipleAuthenticationsRaw() async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $multipleAuthentications_Request() { + const _path = '/multiple'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -260,7 +239,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -268,15 +247,25 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - const _path = '/multiple'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); + return _request; + } + + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200 + /// + /// See: + /// * [$multipleAuthentications_Request] for the request send by this method. + /// * [$multipleAuthentications_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> multipleAuthentications() async { + final _request = $multipleAuthentications_Request(); + final _response = await sendWithCookies(_request); final _serializer = $multipleAuthentications_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -296,9 +285,9 @@ final Serializers _$serializers = Serializers(); @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i3.DynamiteDoubleSerializer()) - ..addPlugin(_i4.StandardJsonPlugin()) - ..addPlugin(const _i3.HeaderPlugin()) - ..addPlugin(const _i3.ContentStringPlugin())) + ..add(_i4.DynamiteDoubleSerializer()) + ..addPlugin(_i5.StandardJsonPlugin()) + ..addPlugin(const _i4.HeaderPlugin()) + ..addPlugin(const _i4.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/documentation.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/documentation.openapi.dart index c31551ed857..db99882c70a 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/documentation.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/documentation.openapi.dart @@ -25,12 +25,13 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:built_value/standard_json_plugin.dart' as _i7; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:dynamite_runtime/utils.dart' as _i5; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i3; +import 'package:uri/uri.dart' as _i4; part 'documentation.openapi.g.dart'; @@ -57,7 +58,7 @@ class $Client extends _i1.DynamiteClient { /// the non root client used for other requests. late final $NonRootClientClient nonRootClient = $NonRootClientClient(this); - /// Builds a serializer to parse the response of `$findValues_Request`. + /// Builds a serializer to parse the response of [$findValues_Request]. @_i2.experimental _i1.DynamiteSerializer $findValues_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Object1), @@ -73,7 +74,7 @@ class $Client extends _i1.DynamiteClient { /// Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. /// /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [findValues] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -84,17 +85,25 @@ class $Client extends _i1.DynamiteClient { /// * default: finds an object /// /// See: - /// * [findValuesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> findValues({ + /// * [findValues] for a method executing this request and parsing the response. + /// * [$findValues_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $findValues_Request({ BuiltList? tags, int? limit, - }) async { - final _rawResponse = await findValuesRaw( - tags: tags, - limit: limit, - ); + }) { + final _parameters = {}; + final $tags = _$jsonSerializers.serialize(tags, specifiedType: const FullType(BuiltList, [FullType(String)])); + _parameters['tags'] = $tags; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + _parameters['limit'] = $limit; + + final _path = _i4.UriTemplate('/{?tags*,limit*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } /// An optional, string summary, intended to apply to all operations in this path. @@ -105,9 +114,7 @@ class $Client extends _i1.DynamiteClient { /// Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. /// /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -118,30 +125,21 @@ class $Client extends _i1.DynamiteClient { /// * default: finds an object /// /// See: - /// * [findValues] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> findValuesRaw({ + /// * [$findValues_Request] for the request send by this method. + /// * [$findValues_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> findValues({ BuiltList? tags, int? limit, }) async { - final _parameters = {}; - const _headers = {'Accept': 'application/json'}; - - final $tags = _$jsonSerializers.serialize(tags, specifiedType: const FullType(BuiltList, [FullType(String)])); - _parameters['tags'] = $tags; - - final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - _parameters['limit'] = $limit; - - final _path = _i3.UriTemplate('/{?tags*,limit*}').expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, + final _request = $findValues_Request( + tags: tags, + limit: limit, ); + final _response = await sendWithCookies(_request); final _serializer = $findValues_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -152,7 +150,7 @@ class $NonRootClientClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$setMode_Request`. + /// Builds a serializer to parse the response of [$setMode_Request]. @_i2.experimental _i1.DynamiteSerializer $setMode_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Object1), @@ -162,45 +160,42 @@ class $NonRootClientClient { /// Do something really cool. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [setMode] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default: finds an object /// /// See: - /// * [setModeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setMode() async { - final _rawResponse = await setModeRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [setMode] for a method executing this request and parsing the response. + /// * [$setMode_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $setMode_Request() { + const _path = '/other-endpoint'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } /// Do something really cool. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default: finds an object /// /// See: - /// * [setMode] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> setModeRaw() async { - const _headers = {'Accept': 'application/json'}; - - const _path = '/other-endpoint'; - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + /// * [$setMode_Request] for the request send by this method. + /// * [$setMode_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setMode() async { + final _request = $setMode_Request(); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $setMode_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -360,13 +355,13 @@ extension $b2c4857c0136baea42828d89c87c757dExtension on _$b2c4857c0136baea42828d List get _names => const [r'$int', 'string']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i4.validateOneOf( + void validateOneOf() => _i5.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i4.validateAnyOf( + void validateAnyOf() => _i5.validateAnyOf( _values, _names, ); @@ -451,9 +446,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin(typesToLeaveAsList: const {_$b2c4857c0136baea42828d89c87c757d})) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin(typesToLeaveAsList: const {_$b2c4857c0136baea42828d89c87c757d})) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/headers.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/headers.openapi.dart index 74db7381427..41dd2430a58 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/headers.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/headers.openapi.dart @@ -12,9 +12,10 @@ import 'dart:typed_data'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i4; -import 'package:dynamite_runtime/built_value.dart' as _i3; +import 'package:built_value/standard_json_plugin.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i4; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; part 'headers.openapi.g.dart'; @@ -38,7 +39,7 @@ class $Client extends _i1.DynamiteClient { authentications: client.authentications, ); - /// Builds a serializer to parse the response of `$$get_Request`. + /// Builds a serializer to parse the response of [$$get_Request]. @_i2.experimental _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( bodyType: null, @@ -47,43 +48,42 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$get] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Returns a header only /// /// See: - /// * [$getRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $get() async { - final _rawResponse = await $getRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [$get] for a method executing this request and parsing the response. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$get_Request() { + const _path = '/'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Returns a header only /// /// See: - /// * [$get] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $getRaw() async { - const _path = '/'; - final _response = await executeRequest( - 'get', - _path, - ); + /// * [$$get_Request] for the request send by this method. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $get() async { + final _request = $$get_Request(); + final _response = await sendWithCookies(_request); final _serializer = $$get_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$withContentOperationId_Request`. + /// Builds a serializer to parse the response of [$withContentOperationId_Request]. @_i2.experimental _i1.DynamiteSerializer $withContentOperationId_Serializer() => _i1.DynamiteSerializer( @@ -93,43 +93,43 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [withContentOperationId] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Returns a header only /// /// See: - /// * [withContentOperationIdRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> withContentOperationId() async { - final _rawResponse = await withContentOperationIdRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [withContentOperationId] for a method executing this request and parsing the response. + /// * [$withContentOperationId_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $withContentOperationId_Request() { + const _path = '/with_content/operation_id'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Returns a header only /// /// See: - /// * [withContentOperationId] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> withContentOperationIdRaw() async { - const _path = '/with_content/operation_id'; - final _response = await executeRequest( - 'get', - _path, - ); + /// * [$withContentOperationId_Request] for the request send by this method. + /// * [$withContentOperationId_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> withContentOperationId() async { + final _request = $withContentOperationId_Request(); + final _response = await sendWithCookies(_request); final _serializer = $withContentOperationId_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$getWithContent_Request`. + /// Builds a serializer to parse the response of [$getWithContent_Request]. @_i2.experimental _i1.DynamiteSerializer $getWithContent_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -138,43 +138,40 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getWithContent] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Returns both a header and a body. /// /// See: - /// * [getWithContentRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getWithContent() async { - final _rawResponse = await getWithContentRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [getWithContent] for a method executing this request and parsing the response. + /// * [$getWithContent_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getWithContent_Request() { + const _path = '/with_content'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/octet-stream'; + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Returns both a header and a body. /// /// See: - /// * [getWithContent] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getWithContentRaw() async { - const _headers = {'Accept': 'application/octet-stream'}; - - const _path = '/with_content'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); + /// * [$getWithContent_Request] for the request send by this method. + /// * [$getWithContent_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getWithContent() async { + final _request = $getWithContent_Request(); + final _response = await sendWithCookies(_request); final _serializer = $getWithContent_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -286,9 +283,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i3.DynamiteDoubleSerializer()) - ..addPlugin(_i4.StandardJsonPlugin()) - ..addPlugin(const _i3.HeaderPlugin()) - ..addPlugin(const _i3.ContentStringPlugin())) + ..add(_i4.DynamiteDoubleSerializer()) + ..addPlugin(_i5.StandardJsonPlugin()) + ..addPlugin(const _i4.HeaderPlugin()) + ..addPlugin(const _i4.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/parameters.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/parameters.openapi.dart index fbf47c2ebbd..f0ef57f9d28 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/parameters.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/parameters.openapi.dart @@ -14,13 +14,14 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:built_value/standard_json_plugin.dart' as _i7; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; import 'package:dynamite_runtime/models.dart'; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i4; +import 'package:uri/uri.dart' as _i5; part 'parameters.openapi.g.dart'; @@ -43,7 +44,7 @@ class $Client extends _i1.DynamiteClient { authentications: client.authentications, ); - /// Builds a serializer to parse the response of `$$get_Request`. + /// Builds a serializer to parse the response of [$$get_Request]. @_i2.experimental _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(JsonObject), @@ -52,69 +53,7 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [contentString] - /// * [contentParameter] - /// * [array] - /// * [arrayString] - /// * [$bool] - /// * [string] - /// * [stringBinary] - /// * [$int] - /// * [$double] - /// * [$num] - /// * [object] - /// * [oneOf] - /// * [anyOf] - /// * [enumPattern] - /// - /// Status codes: - /// * 200 - /// - /// See: - /// * [$getRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $get({ - ContentString>? contentString, - ContentString>? contentParameter, - BuiltList? array, - BuiltList? arrayString, - bool? $bool, - String? string, - Uint8List? stringBinary, - int? $int, - double? $double, - num? $num, - JsonObject? object, - GetOneOf? oneOf, - GetAnyOf? anyOf, - GetEnumPattern? enumPattern, - }) async { - final _rawResponse = await $getRaw( - contentString: contentString, - contentParameter: contentParameter, - array: array, - arrayString: arrayString, - $bool: $bool, - string: string, - stringBinary: stringBinary, - $int: $int, - $double: $double, - $num: $num, - object: object, - oneOf: oneOf, - anyOf: anyOf, - enumPattern: enumPattern, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [$get] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -137,9 +76,10 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [$get] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [$get] for a method executing this request and parsing the response. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> $getRaw({ + _i3.Request $$get_Request({ ContentString>? contentString, ContentString>? contentParameter, BuiltList? array, @@ -154,10 +94,8 @@ class $Client extends _i1.DynamiteClient { GetOneOf? oneOf, GetAnyOf? anyOf, GetEnumPattern? enumPattern, - }) async { - final _parameters = {}; - const _headers = {'Accept': 'application/json'}; - + }) { + final _parameters = {}; final $contentString = _$jsonSerializers.serialize( contentString, specifiedType: const FullType(ContentString, [ @@ -209,35 +147,22 @@ class $Client extends _i1.DynamiteClient { _parameters['anyOf'] = $anyOf; final $enumPattern = _$jsonSerializers.serialize(enumPattern, specifiedType: const FullType(GetEnumPattern)); - _i3.checkPattern( + _i4.checkPattern( $enumPattern as String?, RegExp('[a-z]'), 'enumPattern', ); _parameters['enum_pattern'] = $enumPattern; - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/{?content_string*,content_parameter*,array*,array_string*,bool*,string*,string_binary*,int*,double*,num*,object*,oneOf*,anyOf*,enum_pattern*}', ).expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $$get_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } - /// Builds a serializer to parse the response of `$getHeaders_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getHeaders_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(JsonObject), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -261,8 +186,9 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [getHeadersRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getHeaders({ + /// * [$$get_Request] for the request send by this method. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $get({ ContentString>? contentString, ContentString>? contentParameter, BuiltList? array, @@ -274,11 +200,11 @@ class $Client extends _i1.DynamiteClient { double? $double, num? $num, JsonObject? object, - GetHeadersOneOf? oneOf, - GetHeadersAnyOf? anyOf, - GetHeadersEnumPattern? enumPattern, + GetOneOf? oneOf, + GetAnyOf? anyOf, + GetEnumPattern? enumPattern, }) async { - final _rawResponse = await getHeadersRaw( + final _request = $$get_Request( contentString: contentString, contentParameter: contentParameter, array: array, @@ -294,13 +220,23 @@ class $Client extends _i1.DynamiteClient { anyOf: anyOf, enumPattern: enumPattern, ); + final _response = await sendWithCookies(_request); + final _serializer = $$get_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$getHeaders_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getHeaders_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(JsonObject), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [getHeaders] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -323,9 +259,10 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [getHeaders] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getHeaders] for a method executing this request and parsing the response. + /// * [$getHeaders_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getHeadersRaw({ + _i3.Request $getHeaders_Request({ ContentString>? contentString, ContentString>? contentParameter, BuiltList? array, @@ -340,9 +277,11 @@ class $Client extends _i1.DynamiteClient { GetHeadersOneOf? oneOf, GetHeadersAnyOf? anyOf, GetHeadersEnumPattern? enumPattern, - }) async { - final _headers = {'Accept': 'application/json'}; - + }) { + const _path = '/headers'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; final $contentString = _$jsonSerializers.serialize( contentString, specifiedType: const FullType(ContentString, [ @@ -350,7 +289,7 @@ class $Client extends _i1.DynamiteClient { ]), ); if ($contentString != null) { - _headers['content_string'] = const _i3.HeaderEncoder().convert($contentString); + _request.headers['content_string'] = const _i4.HeaderEncoder().convert($contentString); } final $contentParameter = _$jsonSerializers.serialize( @@ -360,87 +299,143 @@ class $Client extends _i1.DynamiteClient { ]), ); if ($contentParameter != null) { - _headers['content_parameter'] = const _i3.HeaderEncoder().convert($contentParameter); + _request.headers['content_parameter'] = const _i4.HeaderEncoder().convert($contentParameter); } final $array = _$jsonSerializers.serialize(array, specifiedType: const FullType(BuiltList, [FullType(JsonObject)])); if ($array != null) { - _headers['array'] = const _i3.HeaderEncoder().convert($array); + _request.headers['array'] = const _i4.HeaderEncoder().convert($array); } final $arrayString = _$jsonSerializers.serialize(arrayString, specifiedType: const FullType(BuiltList, [FullType(String)])); if ($arrayString != null) { - _headers['array_string'] = const _i3.HeaderEncoder().convert($arrayString); + _request.headers['array_string'] = const _i4.HeaderEncoder().convert($arrayString); } final $$bool = _$jsonSerializers.serialize($bool, specifiedType: const FullType(bool)); if ($$bool != null) { - _headers['bool'] = const _i3.HeaderEncoder().convert($$bool); + _request.headers['bool'] = const _i4.HeaderEncoder().convert($$bool); } final $string = _$jsonSerializers.serialize(string, specifiedType: const FullType(String)); if ($string != null) { - _headers['string'] = const _i3.HeaderEncoder().convert($string); + _request.headers['string'] = const _i4.HeaderEncoder().convert($string); } final $stringBinary = _$jsonSerializers.serialize(stringBinary, specifiedType: const FullType(Uint8List)); if ($stringBinary != null) { - _headers['string_binary'] = const _i3.HeaderEncoder().convert($stringBinary); + _request.headers['string_binary'] = const _i4.HeaderEncoder().convert($stringBinary); } final $$int = _$jsonSerializers.serialize($int, specifiedType: const FullType(int)); if ($$int != null) { - _headers['int'] = const _i3.HeaderEncoder().convert($$int); + _request.headers['int'] = const _i4.HeaderEncoder().convert($$int); } final $$double = _$jsonSerializers.serialize($double, specifiedType: const FullType(double)); if ($$double != null) { - _headers['double'] = const _i3.HeaderEncoder().convert($$double); + _request.headers['double'] = const _i4.HeaderEncoder().convert($$double); } final $$num = _$jsonSerializers.serialize($num, specifiedType: const FullType(num)); if ($$num != null) { - _headers['num'] = const _i3.HeaderEncoder().convert($$num); + _request.headers['num'] = const _i4.HeaderEncoder().convert($$num); } final $object = _$jsonSerializers.serialize(object, specifiedType: const FullType(JsonObject)); if ($object != null) { - _headers['object'] = const _i3.HeaderEncoder().convert($object); + _request.headers['object'] = const _i4.HeaderEncoder().convert($object); } final $oneOf = _$jsonSerializers.serialize(oneOf, specifiedType: const FullType(GetHeadersOneOf)); if ($oneOf != null) { - _headers['oneOf'] = const _i3.HeaderEncoder().convert($oneOf); + _request.headers['oneOf'] = const _i4.HeaderEncoder().convert($oneOf); } final $anyOf = _$jsonSerializers.serialize(anyOf, specifiedType: const FullType(GetHeadersAnyOf)); if ($anyOf != null) { - _headers['anyOf'] = const _i3.HeaderEncoder().convert($anyOf); + _request.headers['anyOf'] = const _i4.HeaderEncoder().convert($anyOf); } final $enumPattern = _$jsonSerializers.serialize(enumPattern, specifiedType: const FullType(GetHeadersEnumPattern)); - _i3.checkPattern( + _i4.checkPattern( $enumPattern as String?, RegExp('[a-z]'), 'enumPattern', ); if ($enumPattern != null) { - _headers['enum_pattern'] = const _i3.HeaderEncoder().convert($enumPattern); + _request.headers['enum_pattern'] = const _i4.HeaderEncoder().convert($enumPattern); } - const _path = '/headers'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, + return _request; + } + + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [contentString] + /// * [contentParameter] + /// * [array] + /// * [arrayString] + /// * [$bool] + /// * [string] + /// * [stringBinary] + /// * [$int] + /// * [$double] + /// * [$num] + /// * [object] + /// * [oneOf] + /// * [anyOf] + /// * [enumPattern] + /// + /// Status codes: + /// * 200 + /// + /// See: + /// * [$getHeaders_Request] for the request send by this method. + /// * [$getHeaders_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getHeaders({ + ContentString>? contentString, + ContentString>? contentParameter, + BuiltList? array, + BuiltList? arrayString, + bool? $bool, + String? string, + Uint8List? stringBinary, + int? $int, + double? $double, + num? $num, + JsonObject? object, + GetHeadersOneOf? oneOf, + GetHeadersAnyOf? anyOf, + GetHeadersEnumPattern? enumPattern, + }) async { + final _request = $getHeaders_Request( + contentString: contentString, + contentParameter: contentParameter, + array: array, + arrayString: arrayString, + $bool: $bool, + string: string, + stringBinary: stringBinary, + $int: $int, + $double: $double, + $num: $num, + object: object, + oneOf: oneOf, + anyOf: anyOf, + enumPattern: enumPattern, ); + final _response = await sendWithCookies(_request); final _serializer = $getHeaders_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$getPathParameter_Request`. + /// Builds a serializer to parse the response of [$getPathParameter_Request]. @_i2.experimental _i1.DynamiteSerializer $getPathParameter_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(JsonObject), @@ -449,52 +444,49 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getPathParameter] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [getPathParameterRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getPathParameter({required String pathParameter}) async { - final _rawResponse = await getPathParameterRaw( - pathParameter: pathParameter, - ); + /// * [getPathParameter] for a method executing this request and parsing the response. + /// * [$getPathParameter_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getPathParameter_Request({required String pathParameter}) { + final _parameters = {}; + final $pathParameter = _$jsonSerializers.serialize(pathParameter, specifiedType: const FullType(String)); + _parameters['path_parameter'] = $pathParameter; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + final _path = _i5.UriTemplate('/{path_parameter}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [getPathParameter] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getPathParameterRaw({required String pathParameter}) async { - final _parameters = {}; - const _headers = {'Accept': 'application/json'}; - - final $pathParameter = _$jsonSerializers.serialize(pathParameter, specifiedType: const FullType(String)); - _parameters['path_parameter'] = $pathParameter; - - final _path = _i4.UriTemplate('/{path_parameter}').expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, + /// * [$getPathParameter_Request] for the request send by this method. + /// * [$getPathParameter_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getPathParameter({required String pathParameter}) async { + final _request = $getPathParameter_Request( + pathParameter: pathParameter, ); + final _response = await sendWithCookies(_request); final _serializer = $getPathParameter_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$getNamingCollisions_Request`. + /// Builds a serializer to parse the response of [$getNamingCollisions_Request]. @_i2.experimental _i1.DynamiteSerializer $getNamingCollisions_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(JsonObject), @@ -503,85 +495,82 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getNamingCollisions] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [getNamingCollisionsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getNamingCollisions({ - required String jsonSerializers, - required String serializers, - required String body, - required String parameters, - required String headers, - }) async { - final _rawResponse = await getNamingCollisionsRaw( - jsonSerializers: jsonSerializers, - serializers: serializers, - body: body, - parameters: parameters, - headers: headers, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Status codes: - /// * 200 - /// - /// See: - /// * [getNamingCollisions] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getNamingCollisions] for a method executing this request and parsing the response. + /// * [$getNamingCollisions_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getNamingCollisionsRaw({ + _i3.Request $getNamingCollisions_Request({ required String jsonSerializers, required String serializers, required String body, required String parameters, required String headers, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + }) { + final _parameters = {}; final $jsonSerializers = _$jsonSerializers.serialize(jsonSerializers, specifiedType: const FullType(String)); _parameters['%24jsonSerializers'] = $jsonSerializers; + final _path = _i5.UriTemplate('/naming_collisions{?%24jsonSerializers*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; final $serializers = _$jsonSerializers.serialize(serializers, specifiedType: const FullType(String)); if ($serializers != null) { - _headers['%24serializers'] = const _i3.HeaderEncoder().convert($serializers); + _request.headers['%24serializers'] = const _i4.HeaderEncoder().convert($serializers); } final $body = _$jsonSerializers.serialize(body, specifiedType: const FullType(String)); if ($body != null) { - _headers['_body'] = const _i3.HeaderEncoder().convert($body); + _request.headers['_body'] = const _i4.HeaderEncoder().convert($body); } final $parameters = _$jsonSerializers.serialize(parameters, specifiedType: const FullType(String)); if ($parameters != null) { - _headers['_parameters'] = const _i3.HeaderEncoder().convert($parameters); + _request.headers['_parameters'] = const _i4.HeaderEncoder().convert($parameters); } final $headers = _$jsonSerializers.serialize(headers, specifiedType: const FullType(String)); if ($headers != null) { - _headers['_headers'] = const _i3.HeaderEncoder().convert($headers); + _request.headers['_headers'] = const _i4.HeaderEncoder().convert($headers); } - final _path = _i4.UriTemplate('/naming_collisions{?%24jsonSerializers*}').expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, + return _request; + } + + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200 + /// + /// See: + /// * [$getNamingCollisions_Request] for the request send by this method. + /// * [$getNamingCollisions_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getNamingCollisions({ + required String jsonSerializers, + required String serializers, + required String body, + required String parameters, + required String headers, + }) async { + final _request = $getNamingCollisions_Request( + jsonSerializers: jsonSerializers, + serializers: serializers, + body: body, + parameters: parameters, + headers: headers, ); + final _response = await sendWithCookies(_request); final _serializer = $getNamingCollisions_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -768,13 +757,13 @@ extension $93403da1a64cb6a7b1597c7a05e9b2beExtension on _$93403da1a64cb6a7b1597c List get _names => const [r'$bool', 'string']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -868,9 +857,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin(typesToLeaveAsList: const {_$93403da1a64cb6a7b1597c7a05e9b2be})) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin(typesToLeaveAsList: const {_$93403da1a64cb6a7b1597c7a05e9b2be})) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart index 8fad839a074..313f40969f0 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart @@ -12,9 +12,10 @@ import 'dart:convert'; import 'dart:typed_data'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i4; -import 'package:dynamite_runtime/built_value.dart' as _i3; +import 'package:built_value/standard_json_plugin.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i4; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; class $Client extends _i1.DynamiteClient { @@ -36,7 +37,7 @@ class $Client extends _i1.DynamiteClient { authentications: client.authentications, ); - /// Builds a serializer to parse the response of `$$get_Request`. + /// Builds a serializer to parse the response of [$$get_Request]. @_i2.experimental _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( bodyType: null, @@ -44,54 +45,48 @@ class $Client extends _i1.DynamiteClient { serializers: _$jsonSerializers, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$get] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$getRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $get({Uint8List? uint8List}) async { - final _rawResponse = await $getRaw( - uint8List: uint8List, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [$get] for a method executing this request and parsing the response. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$get_Request({Uint8List? uint8List}) { + const _path = '/'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Content-Type'] = 'application/octet-stream'; + if (uint8List != null) { + _request.bodyBytes = uint8List; + } + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$get] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $getRaw({Uint8List? uint8List}) async { - final _headers = {}; - Uint8List? _body; - - _headers['Content-Type'] = 'application/octet-stream'; - if (uint8List != null) { - _body = uint8List; - } - const _path = '/'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - body: _body, + /// * [$$get_Request] for the request send by this method. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $get({Uint8List? uint8List}) async { + final _request = $$get_Request( + uint8List: uint8List, ); + final _response = await sendWithCookies(_request); final _serializer = $$get_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$$post_Request`. + /// Builds a serializer to parse the response of [$$post_Request]. @_i2.experimental _i1.DynamiteSerializer $$post_Serializer() => _i1.DynamiteSerializer( bodyType: null, @@ -99,51 +94,45 @@ class $Client extends _i1.DynamiteClient { serializers: _$jsonSerializers, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$post] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$postRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $post({String? string}) async { - final _rawResponse = await $postRaw( - string: string, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [$post] for a method executing this request and parsing the response. + /// * [$$post_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$post_Request({String? string}) { + const _path = '/'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Content-Type'] = 'application/octet-stream'; + if (string != null) { + _request.bodyBytes = utf8.encode(string); + } + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$post] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $postRaw({String? string}) async { - final _headers = {}; - Uint8List? _body; - - _headers['Content-Type'] = 'application/octet-stream'; - if (string != null) { - _body = utf8.encode(string); - } - const _path = '/'; - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - body: _body, + /// * [$$post_Request] for the request send by this method. + /// * [$$post_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $post({String? string}) async { + final _request = $$post_Request( + string: string, ); + final _response = await sendWithCookies(_request); final _serializer = $$post_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -163,9 +152,9 @@ final Serializers _$serializers = Serializers(); @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i3.DynamiteDoubleSerializer()) - ..addPlugin(_i4.StandardJsonPlugin()) - ..addPlugin(const _i3.HeaderPlugin()) - ..addPlugin(const _i3.ContentStringPlugin())) + ..add(_i4.DynamiteDoubleSerializer()) + ..addPlugin(_i5.StandardJsonPlugin()) + ..addPlugin(const _i4.HeaderPlugin()) + ..addPlugin(const _i4.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/responses.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/responses.openapi.dart index c17c98cdbd7..dd55414dfcf 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/responses.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/responses.openapi.dart @@ -9,9 +9,10 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i4; -import 'package:dynamite_runtime/built_value.dart' as _i3; +import 'package:built_value/standard_json_plugin.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i4; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; class $Client extends _i1.DynamiteClient { @@ -33,7 +34,7 @@ class $Client extends _i1.DynamiteClient { authentications: client.authentications, ); - /// Builds a serializer to parse the response of `$$get_Request`. + /// Builds a serializer to parse the response of [$$get_Request]. @_i2.experimental _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(String), @@ -41,46 +42,43 @@ class $Client extends _i1.DynamiteClient { serializers: _$jsonSerializers, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$get] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$getRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $get() async { - final _rawResponse = await $getRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [$get] for a method executing this request and parsing the response. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$get_Request() { + const _path = '/'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$get] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $getRaw() async { - const _headers = {'Accept': 'application/json'}; - - const _path = '/'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); + /// * [$$get_Request] for the request send by this method. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $get() async { + final _request = $$get_Request(); + final _response = await sendWithCookies(_request); final _serializer = $$get_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$$put_Request`. + /// Builds a serializer to parse the response of [$$put_Request]. @_i2.experimental _i1.DynamiteSerializer $$put_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(String), @@ -89,7 +87,7 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$put] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -97,16 +95,18 @@ class $Client extends _i1.DynamiteClient { /// * 201 /// /// See: - /// * [$putRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $put() async { - final _rawResponse = await $putRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [$put] for a method executing this request and parsing the response. + /// * [$$put_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$put_Request() { + const _path = '/'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -114,23 +114,18 @@ class $Client extends _i1.DynamiteClient { /// * 201 /// /// See: - /// * [$put] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $putRaw() async { - const _headers = {'Accept': 'application/json'}; - - const _path = '/'; - final _response = await executeRequest( - 'put', - _path, - headers: _headers, - ); + /// * [$$put_Request] for the request send by this method. + /// * [$$put_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $put() async { + final _request = $$put_Request(); + final _response = await sendWithCookies(_request); final _serializer = $$put_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$$post_Request`. + /// Builds a serializer to parse the response of [$$post_Request]. @_i2.experimental _i1.DynamiteSerializer $$post_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(String), @@ -138,7 +133,7 @@ class $Client extends _i1.DynamiteClient { serializers: _$jsonSerializers, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$post] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -147,16 +142,18 @@ class $Client extends _i1.DynamiteClient { /// * 201 /// /// See: - /// * [$postRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $post() async { - final _rawResponse = await $postRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [$post] for a method executing this request and parsing the response. + /// * [$$post_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$post_Request() { + const _path = '/'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -165,23 +162,18 @@ class $Client extends _i1.DynamiteClient { /// * 201 /// /// See: - /// * [$post] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $postRaw() async { - const _headers = {'Accept': 'application/json'}; - - const _path = '/'; - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); + /// * [$$post_Request] for the request send by this method. + /// * [$$post_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $post() async { + final _request = $$post_Request(); + final _response = await sendWithCookies(_request); final _serializer = $$post_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$$patch_Request`. + /// Builds a serializer to parse the response of [$$patch_Request]. @_i2.experimental _i1.DynamiteSerializer $$patch_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(String), @@ -190,7 +182,7 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200, 201}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$patch] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -198,16 +190,18 @@ class $Client extends _i1.DynamiteClient { /// * 201 /// /// See: - /// * [$patchRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $patch() async { - final _rawResponse = await $patchRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [$patch] for a method executing this request and parsing the response. + /// * [$$patch_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$patch_Request() { + const _path = '/'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('patch', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -215,20 +209,15 @@ class $Client extends _i1.DynamiteClient { /// * 201 /// /// See: - /// * [$patch] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $patchRaw() async { - const _headers = {'Accept': 'application/json'}; - - const _path = '/'; - final _response = await executeRequest( - 'patch', - _path, - headers: _headers, - ); + /// * [$$patch_Request] for the request send by this method. + /// * [$$patch_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $patch() async { + final _request = $$patch_Request(); + final _response = await sendWithCookies(_request); final _serializer = $$patch_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -248,9 +237,9 @@ final Serializers _$serializers = Serializers(); @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i3.DynamiteDoubleSerializer()) - ..addPlugin(_i4.StandardJsonPlugin()) - ..addPlugin(const _i3.HeaderPlugin()) - ..addPlugin(const _i3.ContentStringPlugin())) + ..add(_i4.DynamiteDoubleSerializer()) + ..addPlugin(_i5.StandardJsonPlugin()) + ..addPlugin(const _i4.HeaderPlugin()) + ..addPlugin(const _i4.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/tags.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/tags.openapi.dart index 387173bb5e7..cf46e9f6bbf 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/tags.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/tags.openapi.dart @@ -9,9 +9,10 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i4; -import 'package:dynamite_runtime/built_value.dart' as _i3; +import 'package:built_value/standard_json_plugin.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i4; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; class $Client extends _i1.DynamiteClient { @@ -44,7 +45,7 @@ class $FirstClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$$get_Request`. + /// Builds a serializer to parse the response of [$$get_Request]. @_i2.experimental _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( bodyType: null, @@ -52,40 +53,39 @@ class $FirstClient { serializers: _$jsonSerializers, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$get] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$getRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $get() async { - final _rawResponse = await $getRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [$get] for a method executing this request and parsing the response. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$get_Request() { + const _path = '/'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$get] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $getRaw() async { - const _path = '/'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - ); + /// * [$$get_Request] for the request send by this method. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $get() async { + final _request = $$get_Request(); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $$get_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -95,7 +95,7 @@ class $SecondClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$$get_Request`. + /// Builds a serializer to parse the response of [$$get_Request]. @_i2.experimental _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( bodyType: null, @@ -103,40 +103,39 @@ class $SecondClient { serializers: _$jsonSerializers, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$get] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$getRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $get() async { - final _rawResponse = await $getRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [$get] for a method executing this request and parsing the response. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$get_Request() { + const _path = '/'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * default /// /// See: - /// * [$get] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $getRaw() async { - const _path = '/'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - ); + /// * [$$get_Request] for the request send by this method. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $get() async { + final _request = $$get_Request(); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $$get_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -156,9 +155,9 @@ final Serializers _$serializers = Serializers(); @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i3.DynamiteDoubleSerializer()) - ..addPlugin(_i4.StandardJsonPlugin()) - ..addPlugin(const _i3.HeaderPlugin()) - ..addPlugin(const _i3.ContentStringPlugin())) + ..add(_i4.DynamiteDoubleSerializer()) + ..addPlugin(_i5.StandardJsonPlugin()) + ..addPlugin(const _i4.HeaderPlugin()) + ..addPlugin(const _i4.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/dynamite/dynamite_end_to_end_test/pubspec.yaml b/packages/dynamite/dynamite_end_to_end_test/pubspec.yaml index 197ba341872..dfb60a40193 100644 --- a/packages/dynamite/dynamite_end_to_end_test/pubspec.yaml +++ b/packages/dynamite/dynamite_end_to_end_test/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: built_value: ^8.9.0 collection: ^1.0.0 dynamite_runtime: ^0.2.0 + http: ^1.2.1 meta: ^1.0.0 uri: ^1.0.0 @@ -18,7 +19,6 @@ dev_dependencies: build_runner: ^2.4.8 built_value_generator: ^8.9.1 dynamite: ^0.2.0 - http: ^1.2.1 neon_lints: git: url: https://github.com/nextcloud/neon diff --git a/packages/dynamite/dynamite_runtime/lib/src/client/client.dart b/packages/dynamite/dynamite_runtime/lib/src/client/client.dart index c3f61a0a94f..8a2f9d6b6f6 100644 --- a/packages/dynamite/dynamite_runtime/lib/src/client/client.dart +++ b/packages/dynamite/dynamite_runtime/lib/src/client/client.dart @@ -2,7 +2,9 @@ import 'dart:async'; import 'dart:typed_data'; import 'package:cookie_jar/cookie_jar.dart'; -import 'package:dynamite_runtime/http_client.dart'; +import 'package:dynamite_runtime/src/client/authentication.dart'; +import 'package:dynamite_runtime/src/client/exception.dart'; +import 'package:dynamite_runtime/src/client/response.dart'; import 'package:dynamite_runtime/src/utils/uri.dart'; import 'package:http/http.dart' as http; import 'package:meta/meta.dart'; diff --git a/packages/neon/neon_dashboard/lib/src/blocs/dashboard.dart b/packages/neon/neon_dashboard/lib/src/blocs/dashboard.dart index de947920c30..38ed1185d7e 100644 --- a/packages/neon/neon_dashboard/lib/src/blocs/dashboard.dart +++ b/packages/neon/neon_dashboard/lib/src/blocs/dashboard.dart @@ -54,7 +54,7 @@ class _DashboardBloc extends InteractiveBloc implements DashboardBloc { account: account, cacheKey: 'dashboard-widgets-v1', subject: itemsV1, - rawResponse: account.client.dashboard.dashboardApi.getWidgetItemsRaw( + request: account.client.dashboard.dashboardApi.$getWidgetItems_Request( widgets: v1WidgetIDs.build(), limit: maxItems, ), @@ -66,7 +66,7 @@ class _DashboardBloc extends InteractiveBloc implements DashboardBloc { account: account, cacheKey: 'dashboard-widgets-v2', subject: itemsV2, - rawResponse: account.client.dashboard.dashboardApi.getWidgetItemsV2Raw( + request: account.client.dashboard.dashboardApi.$getWidgetItemsV2_Request( widgets: v2WidgetIDs.build(), limit: maxItems, ), @@ -112,7 +112,7 @@ class _DashboardBloc extends InteractiveBloc implements DashboardBloc { account: account, cacheKey: 'dashboard-widgets', subject: widgets, - rawResponse: account.client.dashboard.dashboardApi.getWidgetsRaw(), + request: account.client.dashboard.dashboardApi.$getWidgets_Request(), serializer: account.client.dashboard.dashboardApi.$getWidgets_Serializer(), // Filter all widgets that don't support v1 nor v2 unwrap: (response) => BuiltList( diff --git a/packages/neon/neon_files/lib/src/widgets/file_preview.dart b/packages/neon/neon_files/lib/src/widgets/file_preview.dart index 983f236687d..f45a8b26924 100644 --- a/packages/neon/neon_files/lib/src/widgets/file_preview.dart +++ b/packages/neon/neon_files/lib/src/widgets/file_preview.dart @@ -100,7 +100,7 @@ class FilePreviewImage extends NeonApiImage { required int width, required int height, }) : super( - getImage: (client) => client.core.preview.getPreviewRaw( + getImage: (client) => client.core.preview.getPreview( file: file.uri.path, x: width, y: height, diff --git a/packages/neon/neon_news/lib/src/blocs/articles.dart b/packages/neon/neon_news/lib/src/blocs/articles.dart index 86482e454c8..5d0154d403b 100644 --- a/packages/neon/neon_news/lib/src/blocs/articles.dart +++ b/packages/neon/neon_news/lib/src/blocs/articles.dart @@ -153,7 +153,7 @@ class _NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBloc { account: account, cacheKey: 'news-articles-${type.index}-$id-$getRead', subject: articles, - rawResponse: account.client.news.listArticlesRaw( + request: account.client.news.$listArticles_Request( type: type.index, id: id ?? 0, getRead: getRead ?? true ? 1 : 0, diff --git a/packages/neon/neon_news/lib/src/blocs/news.dart b/packages/neon/neon_news/lib/src/blocs/news.dart index 21e45d90282..9b6e73234e8 100644 --- a/packages/neon/neon_news/lib/src/blocs/news.dart +++ b/packages/neon/neon_news/lib/src/blocs/news.dart @@ -119,7 +119,7 @@ class _NewsBloc extends InteractiveBloc implements NewsBloc, NewsMainArticlesBlo account: account, cacheKey: 'news-folders', subject: folders, - rawResponse: account.client.news.listFoldersRaw(), + request: account.client.news.$listFolders_Request(), serializer: account.client.news.$listFolders_Serializer(), unwrap: (response) => response.body.folders, ), @@ -127,7 +127,7 @@ class _NewsBloc extends InteractiveBloc implements NewsBloc, NewsMainArticlesBlo account: account, cacheKey: 'news-feeds', subject: feeds, - rawResponse: account.client.news.listFeedsRaw(), + request: account.client.news.$listFeeds_Request(), serializer: account.client.news.$listFeeds_Serializer(), unwrap: (response) { if (response.body.newestItemId != null) { diff --git a/packages/neon/neon_notes/lib/src/blocs/notes.dart b/packages/neon/neon_notes/lib/src/blocs/notes.dart index 401816fa606..f99cfafff53 100644 --- a/packages/neon/neon_notes/lib/src/blocs/notes.dart +++ b/packages/neon/neon_notes/lib/src/blocs/notes.dart @@ -72,7 +72,7 @@ class _NotesBloc extends InteractiveBloc implements NotesBloc { account: account, cacheKey: 'notes-notes', subject: notes, - rawResponse: account.client.notes.getNotesRaw(), + request: account.client.notes.$getNotes_Request(), serializer: account.client.notes.$getNotes_Serializer(), unwrap: (response) => response.body, ); diff --git a/packages/neon/neon_notifications/lib/src/blocs/notifications.dart b/packages/neon/neon_notifications/lib/src/blocs/notifications.dart index 7a8697a1c31..95d07e4b8f6 100644 --- a/packages/neon/neon_notifications/lib/src/blocs/notifications.dart +++ b/packages/neon/neon_notifications/lib/src/blocs/notifications.dart @@ -70,7 +70,7 @@ class _NotificationsBloc extends InteractiveBloc implements NotificationsBlocInt account: account, cacheKey: 'notifications-notifications', subject: notifications, - rawResponse: account.client.notifications.endpoint.listNotificationsRaw(), + request: account.client.notifications.endpoint.$listNotifications_Request(), serializer: account.client.notifications.endpoint.$listNotifications_Serializer(), unwrap: (response) => response.body.ocs.data, ); diff --git a/packages/neon/neon_talk/lib/src/blocs/talk.dart b/packages/neon/neon_talk/lib/src/blocs/talk.dart index 4616129f218..27256d1edbc 100644 --- a/packages/neon/neon_talk/lib/src/blocs/talk.dart +++ b/packages/neon/neon_talk/lib/src/blocs/talk.dart @@ -63,7 +63,7 @@ class _TalkBloc extends InteractiveBloc implements TalkBloc { account: account, cacheKey: 'talk-rooms', subject: rooms, - rawResponse: account.client.spreed.room.getRoomsRaw(), + request: account.client.spreed.room.$getRooms_Request(), serializer: account.client.spreed.room.$getRooms_Serializer(), unwrap: (response) => BuiltList( response.body.ocs.data.rebuild( diff --git a/packages/neon/neon_talk/lib/src/widgets/room_avatar.dart b/packages/neon/neon_talk/lib/src/widgets/room_avatar.dart index 4a35cfd227c..69fbedc3173 100644 --- a/packages/neon/neon_talk/lib/src/widgets/room_avatar.dart +++ b/packages/neon/neon_talk/lib/src/widgets/room_avatar.dart @@ -26,8 +26,8 @@ class TalkRoomAvatar extends StatelessWidget { child: ClipOval( child: NeonApiImage( getImage: (client) async => switch (brightness) { - Brightness.dark => client.spreed.avatar.getAvatarDarkRaw(token: room.token), - Brightness.light => client.spreed.avatar.getAvatarRaw(token: room.token), + Brightness.dark => client.spreed.avatar.getAvatarDark(token: room.token), + Brightness.light => client.spreed.avatar.getAvatar(token: room.token), }, cacheKey: 'talk-room-${room.token}-avatar-$brightness', etag: room.avatarVersion, diff --git a/packages/neon_framework/lib/src/blocs/apps.dart b/packages/neon_framework/lib/src/blocs/apps.dart index 4be127a3f9c..ed28535c757 100644 --- a/packages/neon_framework/lib/src/blocs/apps.dart +++ b/packages/neon_framework/lib/src/blocs/apps.dart @@ -260,7 +260,7 @@ class _AppsBloc extends InteractiveBloc implements AppsBloc { account: account, cacheKey: 'apps-apps', subject: apps, - rawResponse: account.client.core.navigation.getAppsNavigationRaw(), + request: account.client.core.navigation.$getAppsNavigation_Request(), serializer: account.client.core.navigation.$getAppsNavigation_Serializer(), unwrap: (response) => response.body.ocs.data, ); diff --git a/packages/neon_framework/lib/src/blocs/capabilities.dart b/packages/neon_framework/lib/src/blocs/capabilities.dart index 7d330811a23..b0fcefcc12e 100644 --- a/packages/neon_framework/lib/src/blocs/capabilities.dart +++ b/packages/neon_framework/lib/src/blocs/capabilities.dart @@ -47,7 +47,7 @@ class _CapabilitiesBloc extends InteractiveBloc implements CapabilitiesBloc { account: account, cacheKey: 'capabilities', subject: capabilities, - rawResponse: account.client.core.ocs.getCapabilitiesRaw(), + request: account.client.core.ocs.$getCapabilities_Request(), serializer: account.client.core.ocs.$getCapabilities_Serializer(), unwrap: (response) => response.body.ocs.data, ); diff --git a/packages/neon_framework/lib/src/blocs/unified_search.dart b/packages/neon_framework/lib/src/blocs/unified_search.dart index c0bf96379a7..bf5b2f8590b 100644 --- a/packages/neon_framework/lib/src/blocs/unified_search.dart +++ b/packages/neon_framework/lib/src/blocs/unified_search.dart @@ -99,7 +99,7 @@ class _UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBloc { account: account, cacheKey: 'unified-search-providers', subject: providers, - rawResponse: account.client.core.unifiedSearch.getProvidersRaw(), + request: account.client.core.unifiedSearch.$getProviders_Request(), serializer: account.client.core.unifiedSearch.$getProviders_Serializer(), unwrap: (response) => response.body.ocs.data, ); diff --git a/packages/neon_framework/lib/src/blocs/user_details.dart b/packages/neon_framework/lib/src/blocs/user_details.dart index b9c01b4bf1c..20eaea4e91d 100644 --- a/packages/neon_framework/lib/src/blocs/user_details.dart +++ b/packages/neon_framework/lib/src/blocs/user_details.dart @@ -45,7 +45,7 @@ class _UserDetailsBloc extends InteractiveBloc implements UserDetailsBloc { account: account, cacheKey: 'user-details', subject: userDetails, - rawResponse: account.client.provisioningApi.users.getCurrentUserRaw(), + request: account.client.provisioningApi.users.$getCurrentUser_Request(), serializer: account.client.provisioningApi.users.$getCurrentUser_Serializer(), unwrap: (response) => response.body.ocs.data, ); diff --git a/packages/neon_framework/lib/src/blocs/user_status.dart b/packages/neon_framework/lib/src/blocs/user_status.dart index 70443a93891..4c9e942c97f 100644 --- a/packages/neon_framework/lib/src/blocs/user_status.dart +++ b/packages/neon_framework/lib/src/blocs/user_status.dart @@ -101,7 +101,7 @@ class _UserStatusBloc extends InteractiveBloc implements UserStatusBloc { account: account, cacheKey: 'user_status-predefined-statuses', subject: predefinedStatuses, - rawResponse: account.client.userStatus.predefinedStatus.findAllRaw(), + request: account.client.userStatus.predefinedStatus.$findAll_Request(), serializer: account.client.userStatus.predefinedStatus.$findAll_Serializer(), unwrap: (response) => response.body.ocs.data, ), diff --git a/packages/neon_framework/lib/src/blocs/weather_status.dart b/packages/neon_framework/lib/src/blocs/weather_status.dart index 10849589422..e7d86255bbe 100644 --- a/packages/neon_framework/lib/src/blocs/weather_status.dart +++ b/packages/neon_framework/lib/src/blocs/weather_status.dart @@ -91,7 +91,7 @@ class _WeatherStatusBloc extends InteractiveBloc implements WeatherStatusBloc { account: account, cacheKey: 'weather_status-location', subject: location, - rawResponse: account.client.weatherStatus.weatherStatus.getLocationRaw(), + request: account.client.weatherStatus.weatherStatus.$getLocation_Request(), serializer: account.client.weatherStatus.weatherStatus.$getLocation_Serializer(), unwrap: (response) => response.body.ocs.data, ), @@ -104,7 +104,7 @@ class _WeatherStatusBloc extends InteractiveBloc implements WeatherStatusBloc { account: account, cacheKey: 'weather_status-forecast', subject: forecasts, - rawResponse: account.client.weatherStatus.weatherStatus.getForecastRaw(), + request: account.client.weatherStatus.weatherStatus.$getForecast_Request(), serializer: account.client.weatherStatus.weatherStatus.$getForecast_Serializer(), unwrap: (response) => response.body.ocs.data.builtListForecast ?? BuiltList(), ); diff --git a/packages/neon_framework/lib/src/utils/request_manager.dart b/packages/neon_framework/lib/src/utils/request_manager.dart index df68919adb0..ebc34ef83d5 100644 --- a/packages/neon_framework/lib/src/utils/request_manager.dart +++ b/packages/neon_framework/lib/src/utils/request_manager.dart @@ -77,7 +77,7 @@ class RequestManager { required Account account, required String cacheKey, required BehaviorSubject> subject, - required FutureOr> rawResponse, + required http.BaseRequest request, required DynamiteSerializer serializer, required UnwrapCallback> unwrap, bool disableTimeout = false, @@ -86,7 +86,10 @@ class RequestManager { account: account, cacheKey: cacheKey, subject: subject, - request: () async => rawResponse, + request: () async { + final response = await account.client.sendWithCookies(request); + return ResponseConverter(serializer).convert(response); + }, unwrap: (rawResponse) => unwrap(rawResponse), serialize: (data) { const encoder = RawResponseEncoder(); diff --git a/packages/neon_framework/lib/src/widgets/image.dart b/packages/neon_framework/lib/src/widgets/image.dart index 1422f20476a..4ad12ae5685 100644 --- a/packages/neon_framework/lib/src/widgets/image.dart +++ b/packages/neon_framework/lib/src/widgets/image.dart @@ -20,7 +20,7 @@ import 'package:rxdart/rxdart.dart'; typedef ErrorWidgetBuilder = Widget? Function(BuildContext context, Object? error); /// The signature of a function downloading image data from a the nextcloud api through [client]. -typedef ApiImageDownloader = FutureOr> Function(NextcloudClient client); +typedef ApiImageDownloader = FutureOr> Function(NextcloudClient client); /// A widget painting an Image. /// diff --git a/packages/neon_framework/lib/src/widgets/user_avatar.dart b/packages/neon_framework/lib/src/widgets/user_avatar.dart index 1857a91c852..3439b05d0d6 100644 --- a/packages/neon_framework/lib/src/widgets/user_avatar.dart +++ b/packages/neon_framework/lib/src/widgets/user_avatar.dart @@ -86,11 +86,11 @@ class _UserAvatarState extends State { etag: null, expires: null, getImage: (client) async => switch (brightness) { - Brightness.dark => client.core.avatar.getAvatarDarkRaw( + Brightness.dark => client.core.avatar.getAvatarDark( userId: username, size: pixelSize, ), - Brightness.light => client.core.avatar.getAvatarRaw( + Brightness.light => client.core.avatar.getAvatar( userId: username, size: pixelSize, ), diff --git a/packages/neon_framework/test/user_status_bloc_test.dart b/packages/neon_framework/test/user_status_bloc_test.dart index 62da8774ddf..62a96e3b2bc 100644 --- a/packages/neon_framework/test/user_status_bloc_test.dart +++ b/packages/neon_framework/test/user_status_bloc_test.dart @@ -229,6 +229,8 @@ void main() { }); test('Set predefined message', () async { + await Future.delayed(const Duration(milliseconds: 10)); + final clearAt = DateTime.now().add(const Duration(hours: 1)).millisecondsSinceEpoch ~/ 1000; bloc.setPredefinedMessage( id: 'predefined', diff --git a/packages/nextcloud/lib/src/api/core.openapi.dart b/packages/nextcloud/lib/src/api/core.openapi.dart index 824df52f9ac..f3431adc680 100644 --- a/packages/nextcloud/lib/src/api/core.openapi.dart +++ b/packages/nextcloud/lib/src/api/core.openapi.dart @@ -21,14 +21,15 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; import 'package:dynamite_runtime/models.dart'; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i4; +import 'package:uri/uri.dart' as _i5; part 'core.openapi.g.dart'; @@ -95,7 +96,7 @@ class $Client extends _i1.DynamiteClient { late final $WipeClient wipe = $WipeClient(this); - /// Builds a serializer to parse the response of `$getStatus_Request`. + /// Builds a serializer to parse the response of [$getStatus_Request]. @_i2.experimental _i1.DynamiteSerializer $getStatus_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Status), @@ -104,43 +105,40 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getStatus] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Status returned /// /// See: - /// * [getStatusRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getStatus() async { - final _rawResponse = await getStatusRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + /// * [getStatus] for a method executing this request and parsing the response. + /// * [$getStatus_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getStatus_Request() { + const _path = '/status.php'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; + return _request; } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Status returned /// /// See: - /// * [getStatus] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getStatusRaw() async { - const _headers = {'Accept': 'application/json'}; - - const _path = '/status.php'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); + /// * [$getStatus_Request] for the request send by this method. + /// * [$getStatus_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getStatus() async { + final _request = $getStatus_Request(); + final _response = await sendWithCookies(_request); final _serializer = $getStatus_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -150,7 +148,7 @@ class $AppPasswordClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getAppPassword_Request`. + /// Builds a serializer to parse the response of [$getAppPassword_Request]. @_i2.experimental _i1.DynamiteSerializer $getAppPassword_Serializer() => _i1.DynamiteSerializer( @@ -162,33 +160,7 @@ class $AppPasswordClient { /// Create app password. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: App password returned - /// * 403: Creating app password is not allowed - /// - /// See: - /// * [getAppPasswordRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getAppPassword({ - bool? oCSAPIRequest, - }) async { - final _rawResponse = await getAppPasswordRaw( - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Create app password. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getAppPassword] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -199,13 +171,14 @@ class $AppPasswordClient { /// * 403: Creating app password is not allowed /// /// See: - /// * [getAppPassword] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getAppPassword] for a method executing this request and parsing the response. + /// * [$getAppPassword_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getAppPasswordRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getAppPassword_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/core/getapppassword'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -215,7 +188,7 @@ class $AppPasswordClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -225,31 +198,12 @@ class $AppPasswordClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/core/getapppassword'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getAppPassword_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$rotateAppPassword_Request`. - @_i2.experimental - _i1.DynamiteSerializer $rotateAppPassword_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(AppPasswordRotateAppPasswordResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Rotate app password. + /// Create app password. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -259,25 +213,39 @@ class $AppPasswordClient { /// /// Status codes: /// * 200: App password returned - /// * 403: Rotating app password is not allowed + /// * 403: Creating app password is not allowed /// /// See: - /// * [rotateAppPasswordRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> rotateAppPassword({ + /// * [$getAppPassword_Request] for the request send by this method. + /// * [$getAppPassword_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getAppPassword({ bool? oCSAPIRequest, }) async { - final _rawResponse = await rotateAppPasswordRaw( + final _request = $getAppPassword_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getAppPassword_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$rotateAppPassword_Request]. + @_i2.experimental + _i1.DynamiteSerializer $rotateAppPassword_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(AppPasswordRotateAppPasswordResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Rotate app password. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [rotateAppPassword] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -288,13 +256,14 @@ class $AppPasswordClient { /// * 403: Rotating app password is not allowed /// /// See: - /// * [rotateAppPassword] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [rotateAppPassword] for a method executing this request and parsing the response. + /// * [$rotateAppPassword_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> rotateAppPasswordRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $rotateAppPassword_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/core/apppassword/rotate'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -304,7 +273,7 @@ class $AppPasswordClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -314,31 +283,12 @@ class $AppPasswordClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/core/apppassword/rotate'; - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $rotateAppPassword_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteAppPassword_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteAppPassword_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(AppPasswordDeleteAppPasswordResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Delete app password. + /// Rotate app password. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -347,26 +297,40 @@ class $AppPasswordClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: App password deleted successfully - /// * 403: Deleting app password is not allowed + /// * 200: App password returned + /// * 403: Rotating app password is not allowed /// /// See: - /// * [deleteAppPasswordRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteAppPassword({ + /// * [$rotateAppPassword_Request] for the request send by this method. + /// * [$rotateAppPassword_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> rotateAppPassword({ bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteAppPasswordRaw( + final _request = $rotateAppPassword_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $rotateAppPassword_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteAppPassword_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteAppPassword_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(AppPasswordDeleteAppPasswordResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Delete app password. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteAppPassword] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -377,13 +341,14 @@ class $AppPasswordClient { /// * 403: Deleting app password is not allowed /// /// See: - /// * [deleteAppPassword] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteAppPassword] for a method executing this request and parsing the response. + /// * [$deleteAppPassword_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteAppPasswordRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $deleteAppPassword_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/core/apppassword'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -393,7 +358,7 @@ class $AppPasswordClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -403,18 +368,39 @@ class $AppPasswordClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/core/apppassword'; - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, + return _request; + } + + /// Delete app password. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: App password deleted successfully + /// * 403: Deleting app password is not allowed + /// + /// See: + /// * [$deleteAppPassword_Request] for the request send by this method. + /// * [$deleteAppPassword_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteAppPassword({ + bool? oCSAPIRequest, + }) async { + final _request = $deleteAppPassword_Request( + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $deleteAppPassword_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -424,7 +410,7 @@ class $AutoCompleteClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$$get_Request`. + /// Builds a serializer to parse the response of [$$get_Request]. @_i2.experimental _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(AutoCompleteGetResponseApplicationJson), @@ -435,7 +421,7 @@ class $AutoCompleteClient { /// Autocomplete a query. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$get] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -451,8 +437,10 @@ class $AutoCompleteClient { /// * 200: Autocomplete results returned /// /// See: - /// * [$getRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $get({ + /// * [$get] for a method executing this request and parsing the response. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$get_Request({ required String search, String? itemType, String? itemId, @@ -460,25 +448,62 @@ class $AutoCompleteClient { BuiltList? shareTypes, int? limit, bool? oCSAPIRequest, - }) async { - final _rawResponse = await $getRaw( - search: search, - itemType: itemType, - itemId: itemId, - sorter: sorter, - shareTypes: shareTypes, - limit: limit, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); + _parameters['search'] = $search; + + final $itemType = _$jsonSerializers.serialize(itemType, specifiedType: const FullType(String)); + _parameters['itemType'] = $itemType; + + final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(String)); + _parameters['itemId'] = $itemId; + + final $sorter = _$jsonSerializers.serialize(sorter, specifiedType: const FullType(String)); + _parameters['sorter'] = $sorter; + + var $shareTypes = + _$jsonSerializers.serialize(shareTypes, specifiedType: const FullType(BuiltList, [FullType(int)])); + $shareTypes ??= []; + _parameters['shareTypes%5B%5D'] = $shareTypes; + + var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + $limit ??= 10; + _parameters['limit'] = $limit; + + final _path = _i5.UriTemplate( + '/ocs/v2.php/core/autocomplete/get{?search*,itemType*,itemId*,sorter*,shareTypes%5B%5D*,limit*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Autocomplete a query. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -494,9 +519,9 @@ class $AutoCompleteClient { /// * 200: Autocomplete results returned /// /// See: - /// * [$get] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $getRaw({ + /// * [$$get_Request] for the request send by this method. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $get({ required String search, String? itemType, String? itemId, @@ -505,62 +530,21 @@ class $AutoCompleteClient { int? limit, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); - _parameters['search'] = $search; - - final $itemType = _$jsonSerializers.serialize(itemType, specifiedType: const FullType(String)); - _parameters['itemType'] = $itemType; - - final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(String)); - _parameters['itemId'] = $itemId; - - final $sorter = _$jsonSerializers.serialize(sorter, specifiedType: const FullType(String)); - _parameters['sorter'] = $sorter; - - var $shareTypes = - _$jsonSerializers.serialize(shareTypes, specifiedType: const FullType(BuiltList, [FullType(int)])); - $shareTypes ??= []; - _parameters['shareTypes%5B%5D'] = $shareTypes; - - var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - $limit ??= 10; - _parameters['limit'] = $limit; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( - '/ocs/v2.php/core/autocomplete/get{?search*,itemType*,itemId*,sorter*,shareTypes%5B%5D*,limit*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $$get_Request( + search: search, + itemType: itemType, + itemId: itemId, + sorter: sorter, + shareTypes: shareTypes, + limit: limit, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $$get_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -571,7 +555,7 @@ class $AvatarClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getAvatarDark_Request`. + /// Builds a serializer to parse the response of [$getAvatarDark_Request]. @_i2.experimental _i1.DynamiteSerializer $getAvatarDark_Serializer() => _i1.DynamiteSerializer( @@ -583,7 +567,7 @@ class $AvatarClient { /// Get the dark avatar. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getAvatarDark] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -595,44 +579,24 @@ class $AvatarClient { /// * 404: Avatar not found /// /// See: - /// * [getAvatarDarkRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getAvatarDark({ + /// * [getAvatarDark] for a method executing this request and parsing the response. + /// * [$getAvatarDark_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getAvatarDark_Request({ required String userId, required int size, - }) async { - final _rawResponse = await getAvatarDarkRaw( - userId: userId, - size: size, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; - /// Get the dark avatar. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [userId] ID of the user. - /// * [size] Size of the avatar. - /// - /// Status codes: - /// * 200: Avatar returned - /// * 404: Avatar not found - /// - /// See: - /// * [getAvatarDark] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getAvatarDarkRaw({ - required String userId, - required int size, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; + final $size = _$jsonSerializers.serialize(size, specifiedType: const FullType(int)); + _parameters['size'] = $size; + final _path = _i5.UriTemplate('/index.php/avatar/{userId}/{size}/dark').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -642,39 +606,16 @@ class $AvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - - final $size = _$jsonSerializers.serialize(size, specifiedType: const FullType(int)); - _parameters['size'] = $size; - - final _path = _i4.UriTemplate('/index.php/avatar/{userId}/{size}/dark').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getAvatarDark_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getAvatar_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getAvatar_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Uint8List), - headersType: const FullType(AvatarAvatarGetAvatarHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get the avatar. + /// Get the dark avatar. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -688,24 +629,36 @@ class $AvatarClient { /// * 404: Avatar not found /// /// See: - /// * [getAvatarRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getAvatar({ + /// * [$getAvatarDark_Request] for the request send by this method. + /// * [$getAvatarDark_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getAvatarDark({ required String userId, required int size, }) async { - final _rawResponse = await getAvatarRaw( + final _request = $getAvatarDark_Request( userId: userId, size: size, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getAvatarDark_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getAvatar_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getAvatar_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Uint8List), + headersType: const FullType(AvatarAvatarGetAvatarHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the avatar. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getAvatar] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -717,15 +670,24 @@ class $AvatarClient { /// * 404: Avatar not found /// /// See: - /// * [getAvatar] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getAvatar] for a method executing this request and parsing the response. + /// * [$getAvatar_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getAvatarRaw({ + _i3.Request $getAvatar_Request({ required String userId, required int size, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + + final $size = _$jsonSerializers.serialize(size, specifiedType: const FullType(int)); + _parameters['size'] = $size; + final _path = _i5.UriTemplate('/index.php/avatar/{userId}/{size}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -735,27 +697,45 @@ class $AvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - - final $size = _$jsonSerializers.serialize(size, specifiedType: const FullType(int)); - _parameters['size'] = $size; + return _request; + } - final _path = _i4.UriTemplate('/index.php/avatar/{userId}/{size}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + /// Get the avatar. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [userId] ID of the user. + /// * [size] Size of the avatar. + /// + /// Status codes: + /// * 200: Avatar returned + /// * 404: Avatar not found + /// + /// See: + /// * [$getAvatar_Request] for the request send by this method. + /// * [$getAvatar_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getAvatar({ + required String userId, + required int size, + }) async { + final _request = $getAvatar_Request( + userId: userId, + size: size, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getAvatar_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -765,7 +745,7 @@ class $ClientFlowLoginV2Client { final $Client _rootClient; - /// Builds a serializer to parse the response of `$poll_Request`. + /// Builds a serializer to parse the response of [$poll_Request]. @_i2.experimental _i1.DynamiteSerializer $poll_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(LoginFlowV2Credentials), @@ -776,31 +756,7 @@ class $ClientFlowLoginV2Client { /// Poll the login flow credentials. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [token] Token of the flow. - /// - /// Status codes: - /// * 200: Login flow credentials returned - /// * 404: Login flow not found or completed - /// - /// See: - /// * [pollRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> poll({required String token}) async { - final _rawResponse = await pollRaw( - token: token, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Poll the login flow credentials. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [poll] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -811,12 +767,18 @@ class $ClientFlowLoginV2Client { /// * 404: Login flow not found or completed /// /// See: - /// * [poll] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [poll] for a method executing this request and parsing the response. + /// * [$poll_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> pollRaw({required String token}) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $poll_Request({required String token}) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _parameters['token'] = $token; + final _path = _i5.UriTemplate('/index.php/login/v2/poll{?token*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -826,27 +788,42 @@ class $ClientFlowLoginV2Client { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _parameters['token'] = $token; + return _request; + } - final _path = _i4.UriTemplate('/index.php/login/v2/poll{?token*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + /// Poll the login flow credentials. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [token] Token of the flow. + /// + /// Status codes: + /// * 200: Login flow credentials returned + /// * 404: Login flow not found or completed + /// + /// See: + /// * [$poll_Request] for the request send by this method. + /// * [$poll_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> poll({required String token}) async { + final _request = $poll_Request( + token: token, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $poll_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$init_Request`. + /// Builds a serializer to parse the response of [$init_Request]. @_i2.experimental _i1.DynamiteSerializer $init_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(LoginFlowV2), @@ -857,36 +834,21 @@ class $ClientFlowLoginV2Client { /// Init a login flow. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Status codes: - /// * 200: Login flow init returned - /// - /// See: - /// * [initRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> init() async { - final _rawResponse = await initRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Init a login flow. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [init] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Login flow init returned /// /// See: - /// * [init] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [init] for a method executing this request and parsing the response. + /// * [$init_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> initRaw() async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $init_Request() { + const _path = '/index.php/login/v2'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -896,21 +858,33 @@ class $ClientFlowLoginV2Client { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - const _path = '/index.php/login/v2'; - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + return _request; + } + + /// Init a login flow. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: Login flow init returned + /// + /// See: + /// * [$init_Request] for the request send by this method. + /// * [$init_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> init() async { + final _request = $init_Request(); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $init_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -920,7 +894,7 @@ class $CollaborationResourcesClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$searchCollections_Request`. + /// Builds a serializer to parse the response of [$searchCollections_Request]. @_i2.experimental _i1.DynamiteSerializer $searchCollections_Serializer() => _i1.DynamiteSerializer( @@ -932,36 +906,7 @@ class $CollaborationResourcesClient { /// Search for collections. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [filter] Filter collections. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Collections returned - /// * 404: Collection not found - /// - /// See: - /// * [searchCollectionsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> searchCollections({ - required String filter, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await searchCollectionsRaw( - filter: filter, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Search for collections. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [searchCollections] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -973,16 +918,22 @@ class $CollaborationResourcesClient { /// * 404: Collection not found /// /// See: - /// * [searchCollections] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [searchCollections] for a method executing this request and parsing the response. + /// * [$searchCollections_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - searchCollectionsRaw({ + _i3.Request $searchCollections_Request({ required String filter, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $filter = _$jsonSerializers.serialize(filter, specifiedType: const FullType(String)); + _parameters['filter'] = $filter; + final _path = + _i5.UriTemplate('/ocs/v2.php/collaboration/resources/collections/search/{filter}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -992,7 +943,7 @@ class $CollaborationResourcesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1000,69 +951,59 @@ class $CollaborationResourcesClient { } // coverage:ignore-end - final $filter = _$jsonSerializers.serialize(filter, specifiedType: const FullType(String)); - _parameters['filter'] = $filter; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/collaboration/resources/collections/search/{filter}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $searchCollections_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$listCollection_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $listCollection_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(CollaborationResourcesListCollectionResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get a collection. + /// Search for collections. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [collectionId] ID of the collection. + /// * [filter] Filter collections. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Collection returned + /// * 200: Collections returned /// * 404: Collection not found - /// * 500 /// /// See: - /// * [listCollectionRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> listCollection({ - required int collectionId, + /// * [$searchCollections_Request] for the request send by this method. + /// * [$searchCollections_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> searchCollections({ + required String filter, bool? oCSAPIRequest, }) async { - final _rawResponse = await listCollectionRaw( - collectionId: collectionId, + final _request = $searchCollections_Request( + filter: filter, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $searchCollections_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$listCollection_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $listCollection_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(CollaborationResourcesListCollectionResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a collection. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [listCollection] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1075,15 +1016,21 @@ class $CollaborationResourcesClient { /// * 500 /// /// See: - /// * [listCollection] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [listCollection] for a method executing this request and parsing the response. + /// * [$listCollection_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> listCollectionRaw({ + _i3.Request $listCollection_Request({ required int collectionId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $collectionId = _$jsonSerializers.serialize(collectionId, specifiedType: const FullType(int)); + _parameters['collectionId'] = $collectionId; + final _path = _i5.UriTemplate('/ocs/v2.php/collaboration/resources/collections/{collectionId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1093,7 +1040,7 @@ class $CollaborationResourcesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1101,42 +1048,19 @@ class $CollaborationResourcesClient { } // coverage:ignore-end - final $collectionId = _$jsonSerializers.serialize(collectionId, specifiedType: const FullType(int)); - _parameters['collectionId'] = $collectionId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/collaboration/resources/collections/{collectionId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $listCollection_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$renameCollection_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $renameCollection_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(CollaborationResourcesRenameCollectionResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Rename a collection. + /// Get a collection. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [collectionName] New name. /// * [collectionId] ID of the collection. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// @@ -1146,26 +1070,38 @@ class $CollaborationResourcesClient { /// * 500 /// /// See: - /// * [renameCollectionRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> renameCollection({ - required String collectionName, + /// * [$listCollection_Request] for the request send by this method. + /// * [$listCollection_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> listCollection({ required int collectionId, bool? oCSAPIRequest, }) async { - final _rawResponse = await renameCollectionRaw( - collectionName: collectionName, + final _request = $listCollection_Request( collectionId: collectionId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $listCollection_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$renameCollection_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $renameCollection_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(CollaborationResourcesRenameCollectionResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Rename a collection. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [renameCollection] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1179,17 +1115,26 @@ class $CollaborationResourcesClient { /// * 500 /// /// See: - /// * [renameCollection] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [renameCollection] for a method executing this request and parsing the response. + /// * [$renameCollection_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - renameCollectionRaw({ + _i3.Request $renameCollection_Request({ required String collectionName, required int collectionId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $collectionName = _$jsonSerializers.serialize(collectionName, specifiedType: const FullType(String)); + _parameters['collectionName'] = $collectionName; + + final $collectionId = _$jsonSerializers.serialize(collectionId, specifiedType: const FullType(int)); + _parameters['collectionId'] = $collectionId; + final _path = _i5.UriTemplate('/ocs/v2.php/collaboration/resources/collections/{collectionId}{?collectionName*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1199,7 +1144,7 @@ class $CollaborationResourcesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1207,78 +1152,63 @@ class $CollaborationResourcesClient { } // coverage:ignore-end - final $collectionName = _$jsonSerializers.serialize(collectionName, specifiedType: const FullType(String)); - _parameters['collectionName'] = $collectionName; - - final $collectionId = _$jsonSerializers.serialize(collectionId, specifiedType: const FullType(int)); - _parameters['collectionId'] = $collectionId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/collaboration/resources/collections/{collectionId}{?collectionName*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $renameCollection_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$addResource_Request`. - @_i2.experimental - _i1.DynamiteSerializer $addResource_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(CollaborationResourcesAddResourceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Add a resource to a collection. + /// Rename a collection. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [resourceType] Name of the resource. - /// * [resourceId] ID of the resource. + /// * [collectionName] New name. /// * [collectionId] ID of the collection. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: /// * 200: Collection returned - /// * 404: Collection not found or resource inaccessible + /// * 404: Collection not found /// * 500 /// /// See: - /// * [addResourceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> addResource({ - required String resourceType, - required String resourceId, + /// * [$renameCollection_Request] for the request send by this method. + /// * [$renameCollection_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> renameCollection({ + required String collectionName, required int collectionId, bool? oCSAPIRequest, }) async { - final _rawResponse = await addResourceRaw( - resourceType: resourceType, - resourceId: resourceId, + final _request = $renameCollection_Request( + collectionName: collectionName, collectionId: collectionId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $renameCollection_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$addResource_Request]. + @_i2.experimental + _i1.DynamiteSerializer $addResource_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(CollaborationResourcesAddResourceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Add a resource to a collection. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [addResource] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1293,17 +1223,31 @@ class $CollaborationResourcesClient { /// * 500 /// /// See: - /// * [addResource] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [addResource] for a method executing this request and parsing the response. + /// * [$addResource_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> addResourceRaw({ + _i3.Request $addResource_Request({ required String resourceType, required String resourceId, required int collectionId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $resourceType = _$jsonSerializers.serialize(resourceType, specifiedType: const FullType(String)); + _parameters['resourceType'] = $resourceType; + + final $resourceId = _$jsonSerializers.serialize(resourceId, specifiedType: const FullType(String)); + _parameters['resourceId'] = $resourceId; + + final $collectionId = _$jsonSerializers.serialize(collectionId, specifiedType: const FullType(int)); + _parameters['collectionId'] = $collectionId; + final _path = + _i5.UriTemplate('/ocs/v2.php/collaboration/resources/collections/{collectionId}{?resourceType*,resourceId*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1313,7 +1257,7 @@ class $CollaborationResourcesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1321,44 +1265,14 @@ class $CollaborationResourcesClient { } // coverage:ignore-end - final $resourceType = _$jsonSerializers.serialize(resourceType, specifiedType: const FullType(String)); - _parameters['resourceType'] = $resourceType; - - final $resourceId = _$jsonSerializers.serialize(resourceId, specifiedType: const FullType(String)); - _parameters['resourceId'] = $resourceId; - - final $collectionId = _$jsonSerializers.serialize(collectionId, specifiedType: const FullType(int)); - _parameters['collectionId'] = $collectionId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/collaboration/resources/collections/{collectionId}{?resourceType*,resourceId*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $addResource_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$removeResource_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $removeResource_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(CollaborationResourcesRemoveResourceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Remove a resource from a collection. + /// Add a resource to a collection. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -1371,32 +1285,46 @@ class $CollaborationResourcesClient { /// /// Status codes: /// * 200: Collection returned - /// * 404: Collection or resource not found + /// * 404: Collection not found or resource inaccessible /// * 500 /// /// See: - /// * [removeResourceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> removeResource({ + /// * [$addResource_Request] for the request send by this method. + /// * [$addResource_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> addResource({ required String resourceType, required String resourceId, required int collectionId, bool? oCSAPIRequest, }) async { - final _rawResponse = await removeResourceRaw( + final _request = $addResource_Request( resourceType: resourceType, resourceId: resourceId, collectionId: collectionId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $addResource_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$removeResource_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $removeResource_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(CollaborationResourcesRemoveResourceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Remove a resource from a collection. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [removeResource] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1411,17 +1339,31 @@ class $CollaborationResourcesClient { /// * 500 /// /// See: - /// * [removeResource] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [removeResource] for a method executing this request and parsing the response. + /// * [$removeResource_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> removeResourceRaw({ + _i3.Request $removeResource_Request({ required String resourceType, required String resourceId, required int collectionId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $resourceType = _$jsonSerializers.serialize(resourceType, specifiedType: const FullType(String)); + _parameters['resourceType'] = $resourceType; + + final $resourceId = _$jsonSerializers.serialize(resourceId, specifiedType: const FullType(String)); + _parameters['resourceId'] = $resourceId; + + final $collectionId = _$jsonSerializers.serialize(collectionId, specifiedType: const FullType(int)); + _parameters['collectionId'] = $collectionId; + final _path = + _i5.UriTemplate('/ocs/v2.php/collaboration/resources/collections/{collectionId}{?resourceType*,resourceId*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1431,7 +1373,7 @@ class $CollaborationResourcesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1439,79 +1381,66 @@ class $CollaborationResourcesClient { } // coverage:ignore-end - final $resourceType = _$jsonSerializers.serialize(resourceType, specifiedType: const FullType(String)); - _parameters['resourceType'] = $resourceType; - - final $resourceId = _$jsonSerializers.serialize(resourceId, specifiedType: const FullType(String)); - _parameters['resourceId'] = $resourceId; - - final $collectionId = _$jsonSerializers.serialize(collectionId, specifiedType: const FullType(int)); - _parameters['collectionId'] = $collectionId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/collaboration/resources/collections/{collectionId}{?resourceType*,resourceId*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $removeResource_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getCollectionsByResource_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getCollectionsByResource_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(CollaborationResourcesGetCollectionsByResourceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get collections by resource. + /// Remove a resource from a collection. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [resourceType] Type of the resource. + /// * [resourceType] Name of the resource. /// * [resourceId] ID of the resource. + /// * [collectionId] ID of the collection. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Collections returned - /// * 404: Resource not accessible + /// * 200: Collection returned + /// * 404: Collection or resource not found + /// * 500 /// /// See: - /// * [getCollectionsByResourceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - getCollectionsByResource({ + /// * [$removeResource_Request] for the request send by this method. + /// * [$removeResource_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> removeResource({ required String resourceType, required String resourceId, + required int collectionId, bool? oCSAPIRequest, }) async { - final _rawResponse = await getCollectionsByResourceRaw( + final _request = $removeResource_Request( resourceType: resourceType, resourceId: resourceId, + collectionId: collectionId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $removeResource_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getCollectionsByResource_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getCollectionsByResource_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(CollaborationResourcesGetCollectionsByResourceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get collections by resource. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getCollectionsByResource] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1524,17 +1453,26 @@ class $CollaborationResourcesClient { /// * 404: Resource not accessible /// /// See: - /// * [getCollectionsByResource] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getCollectionsByResource] for a method executing this request and parsing the response. + /// * [$getCollectionsByResource_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getCollectionsByResourceRaw({ + _i3.Request $getCollectionsByResource_Request({ required String resourceType, required String resourceId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $resourceType = _$jsonSerializers.serialize(resourceType, specifiedType: const FullType(String)); + _parameters['resourceType'] = $resourceType; + + final $resourceId = _$jsonSerializers.serialize(resourceId, specifiedType: const FullType(String)); + _parameters['resourceId'] = $resourceId; + final _path = + _i5.UriTemplate('/ocs/v2.php/collaboration/resources/{resourceType}/{resourceId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1544,7 +1482,7 @@ class $CollaborationResourcesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1552,81 +1490,64 @@ class $CollaborationResourcesClient { } // coverage:ignore-end - final $resourceType = _$jsonSerializers.serialize(resourceType, specifiedType: const FullType(String)); - _parameters['resourceType'] = $resourceType; - - final $resourceId = _$jsonSerializers.serialize(resourceId, specifiedType: const FullType(String)); - _parameters['resourceId'] = $resourceId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/collaboration/resources/{resourceType}/{resourceId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getCollectionsByResource_Serializer(); - return _i1.ResponseConverter( - _serializer, - ).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$createCollectionOnResource_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $createCollectionOnResource_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(CollaborationResourcesCreateCollectionOnResourceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Create a collection for a resource. + /// Get collections by resource. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [name] Name of the collection. - /// * [baseResourceType] Type of the base resource. - /// * [baseResourceId] ID of the base resource. + /// * [resourceType] Type of the resource. + /// * [resourceId] ID of the resource. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Collection returned - /// * 400: Creating collection is not possible - /// * 404: Resource inaccessible - /// * 500 + /// * 200: Collections returned + /// * 404: Resource not accessible /// /// See: - /// * [createCollectionOnResourceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - createCollectionOnResource({ - required String name, - required String baseResourceType, - required String baseResourceId, + /// * [$getCollectionsByResource_Request] for the request send by this method. + /// * [$getCollectionsByResource_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + getCollectionsByResource({ + required String resourceType, + required String resourceId, bool? oCSAPIRequest, }) async { - final _rawResponse = await createCollectionOnResourceRaw( - name: name, - baseResourceType: baseResourceType, - baseResourceId: baseResourceId, + final _request = $getCollectionsByResource_Request( + resourceType: resourceType, + resourceId: resourceId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getCollectionsByResource_Serializer(); + final _rawResponse = + await _i1.ResponseConverter( + _serializer, + ).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$createCollectionOnResource_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $createCollectionOnResource_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(CollaborationResourcesCreateCollectionOnResourceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Create a collection for a resource. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [createCollectionOnResource] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1642,19 +1563,31 @@ class $CollaborationResourcesClient { /// * 500 /// /// See: - /// * [createCollectionOnResource] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [createCollectionOnResource] for a method executing this request and parsing the response. + /// * [$createCollectionOnResource_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - createCollectionOnResourceRaw({ + _i3.Request $createCollectionOnResource_Request({ required String name, required String baseResourceType, required String baseResourceId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $name = _$jsonSerializers.serialize(name, specifiedType: const FullType(String)); + _parameters['name'] = $name; -// coverage:ignore-start + final $baseResourceType = _$jsonSerializers.serialize(baseResourceType, specifiedType: const FullType(String)); + _parameters['baseResourceType'] = $baseResourceType; + + final $baseResourceId = _$jsonSerializers.serialize(baseResourceId, specifiedType: const FullType(String)); + _parameters['baseResourceId'] = $baseResourceId; + + final _path = _i5.UriTemplate('/ocs/v2.php/collaboration/resources/{baseResourceType}/{baseResourceId}{?name*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, @@ -1663,7 +1596,7 @@ class $CollaborationResourcesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1671,31 +1604,54 @@ class $CollaborationResourcesClient { } // coverage:ignore-end - final $name = _$jsonSerializers.serialize(name, specifiedType: const FullType(String)); - _parameters['name'] = $name; - - final $baseResourceType = _$jsonSerializers.serialize(baseResourceType, specifiedType: const FullType(String)); - _parameters['baseResourceType'] = $baseResourceType; - - final $baseResourceId = _$jsonSerializers.serialize(baseResourceId, specifiedType: const FullType(String)); - _parameters['baseResourceId'] = $baseResourceId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/collaboration/resources/{baseResourceType}/{baseResourceId}{?name*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + return _request; + } + + /// Create a collection for a resource. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [name] Name of the collection. + /// * [baseResourceType] Type of the base resource. + /// * [baseResourceId] ID of the base resource. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Collection returned + /// * 400: Creating collection is not possible + /// * 404: Resource inaccessible + /// * 500 + /// + /// See: + /// * [$createCollectionOnResource_Request] for the request send by this method. + /// * [$createCollectionOnResource_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + createCollectionOnResource({ + required String name, + required String baseResourceType, + required String baseResourceId, + bool? oCSAPIRequest, + }) async { + final _request = $createCollectionOnResource_Request( + name: name, + baseResourceType: baseResourceType, + baseResourceId: baseResourceId, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $createCollectionOnResource_Serializer(); - return _i1.ResponseConverter( + final _rawResponse = + await _i1.ResponseConverter( _serializer, ).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -1706,7 +1662,7 @@ class $GuestAvatarClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getAvatarDark_Request`. + /// Builds a serializer to parse the response of [$getAvatarDark_Request]. @_i2.experimental _i1.DynamiteSerializer $getAvatarDark_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -1717,37 +1673,7 @@ class $GuestAvatarClient { /// Returns a dark guest avatar image response. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [guestName] The guest name, e.g. "Albert". - /// * [size] The desired avatar size, e.g. 64 for 64x64px. - /// - /// Status codes: - /// * 200: Custom avatar returned - /// * 201: Avatar returned - /// * 500 - /// - /// See: - /// * [getAvatarDarkRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getAvatarDark({ - required String guestName, - required String size, - }) async { - final _rawResponse = await getAvatarDarkRaw( - guestName: guestName, - size: size, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Returns a dark guest avatar image response. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getAvatarDark] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1760,15 +1686,24 @@ class $GuestAvatarClient { /// * 500 /// /// See: - /// * [getAvatarDark] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getAvatarDark] for a method executing this request and parsing the response. + /// * [$getAvatarDark_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getAvatarDarkRaw({ + _i3.Request $getAvatarDark_Request({ required String guestName, required String size, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; + }) { + final _parameters = {}; + final $guestName = _$jsonSerializers.serialize(guestName, specifiedType: const FullType(String)); + _parameters['guestName'] = $guestName; + + final $size = _$jsonSerializers.serialize(size, specifiedType: const FullType(String)); + _parameters['size'] = $size; + final _path = _i5.UriTemplate('/index.php/avatar/guest/{guestName}/{size}/dark').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1778,45 +1713,21 @@ class $GuestAvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $guestName = _$jsonSerializers.serialize(guestName, specifiedType: const FullType(String)); - _parameters['guestName'] = $guestName; - - final $size = _$jsonSerializers.serialize(size, specifiedType: const FullType(String)); - _parameters['size'] = $size; - - final _path = _i4.UriTemplate('/index.php/avatar/guest/{guestName}/{size}/dark').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getAvatarDark_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getAvatar_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getAvatar_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Uint8List), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 201}, - ); - - /// Returns a guest avatar image response. + /// Returns a dark guest avatar image response. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [darkTheme] Return dark avatar. Defaults to `0`. /// * [guestName] The guest name, e.g. "Albert". /// * [size] The desired avatar size, e.g. 64 for 64x64px. /// @@ -1826,26 +1737,35 @@ class $GuestAvatarClient { /// * 500 /// /// See: - /// * [getAvatarRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getAvatar({ + /// * [$getAvatarDark_Request] for the request send by this method. + /// * [$getAvatarDark_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getAvatarDark({ required String guestName, required String size, - GuestAvatarGetAvatarDarkTheme? darkTheme, }) async { - final _rawResponse = await getAvatarRaw( + final _request = $getAvatarDark_Request( guestName: guestName, size: size, - darkTheme: darkTheme, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getAvatarDark_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getAvatar_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getAvatar_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Uint8List), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 201}, + ); + /// Returns a guest avatar image response. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getAvatar] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1859,16 +1779,30 @@ class $GuestAvatarClient { /// * 500 /// /// See: - /// * [getAvatar] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getAvatar] for a method executing this request and parsing the response. + /// * [$getAvatar_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getAvatarRaw({ + _i3.Request $getAvatar_Request({ required String guestName, required String size, GuestAvatarGetAvatarDarkTheme? darkTheme, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; + }) { + final _parameters = {}; + final $guestName = _$jsonSerializers.serialize(guestName, specifiedType: const FullType(String)); + _parameters['guestName'] = $guestName; + + final $size = _$jsonSerializers.serialize(size, specifiedType: const FullType(String)); + _parameters['size'] = $size; + + var $darkTheme = + _$jsonSerializers.serialize(darkTheme, specifiedType: const FullType(GuestAvatarGetAvatarDarkTheme)); + $darkTheme ??= 0; + _parameters['darkTheme'] = $darkTheme; + final _path = _i5.UriTemplate('/index.php/avatar/guest/{guestName}/{size}{?darkTheme*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1878,32 +1812,48 @@ class $GuestAvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $guestName = _$jsonSerializers.serialize(guestName, specifiedType: const FullType(String)); - _parameters['guestName'] = $guestName; - - final $size = _$jsonSerializers.serialize(size, specifiedType: const FullType(String)); - _parameters['size'] = $size; - - var $darkTheme = - _$jsonSerializers.serialize(darkTheme, specifiedType: const FullType(GuestAvatarGetAvatarDarkTheme)); - $darkTheme ??= 0; - _parameters['darkTheme'] = $darkTheme; + return _request; + } - final _path = _i4.UriTemplate('/index.php/avatar/guest/{guestName}/{size}{?darkTheme*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + /// Returns a guest avatar image response. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [darkTheme] Return dark avatar. Defaults to `0`. + /// * [guestName] The guest name, e.g. "Albert". + /// * [size] The desired avatar size, e.g. 64 for 64x64px. + /// + /// Status codes: + /// * 200: Custom avatar returned + /// * 201: Avatar returned + /// * 500 + /// + /// See: + /// * [$getAvatar_Request] for the request send by this method. + /// * [$getAvatar_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getAvatar({ + required String guestName, + required String size, + GuestAvatarGetAvatarDarkTheme? darkTheme, + }) async { + final _request = $getAvatar_Request( + guestName: guestName, + size: size, + darkTheme: darkTheme, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getAvatar_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -1913,7 +1863,7 @@ class $HoverCardClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getUser_Request`. + /// Builds a serializer to parse the response of [$getUser_Request]. @_i2.experimental _i1.DynamiteSerializer $getUser_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(HoverCardGetUserResponseApplicationJson), @@ -1924,36 +1874,7 @@ class $HoverCardClient { /// Get the user details for a hovercard. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [userId] ID of the user. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: User details returned - /// * 404: User not found - /// - /// See: - /// * [getUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getUser({ - required String userId, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await getUserRaw( - userId: userId, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get the user details for a hovercard. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1965,15 +1886,21 @@ class $HoverCardClient { /// * 404: User not found /// /// See: - /// * [getUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getUser] for a method executing this request and parsing the response. + /// * [$getUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getUserRaw({ + _i3.Request $getUser_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/hovercard/v1/{userId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1983,7 +1910,7 @@ class $HoverCardClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1991,22 +1918,43 @@ class $HoverCardClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } - final _path = _i4.UriTemplate('/ocs/v2.php/hovercard/v1/{userId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + /// Get the user details for a hovercard. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [userId] ID of the user. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: User details returned + /// * 404: User not found + /// + /// See: + /// * [$getUser_Request] for the request send by this method. + /// * [$getUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getUser({ + required String userId, + bool? oCSAPIRequest, + }) async { + final _request = $getUser_Request( + userId: userId, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getUser_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -2016,7 +1964,7 @@ class $NavigationClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getAppsNavigation_Request`. + /// Builds a serializer to parse the response of [$getAppsNavigation_Request]. @_i2.experimental _i1.DynamiteSerializer $getAppsNavigation_Serializer() => _i1.DynamiteSerializer( @@ -2028,7 +1976,7 @@ class $NavigationClient { /// Get the apps navigation. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getAppsNavigation] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2040,24 +1988,50 @@ class $NavigationClient { /// * 304: No apps navigation changed /// /// See: - /// * [getAppsNavigationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getAppsNavigation({ + /// * [getAppsNavigation] for a method executing this request and parsing the response. + /// * [$getAppsNavigation_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getAppsNavigation_Request({ NavigationGetAppsNavigationAbsolute? absolute, bool? oCSAPIRequest, - }) async { - final _rawResponse = await getAppsNavigationRaw( - absolute: absolute, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + var $absolute = + _$jsonSerializers.serialize(absolute, specifiedType: const FullType(NavigationGetAppsNavigationAbsolute)); + $absolute ??= 0; + _parameters['absolute'] = $absolute; + + final _path = _i5.UriTemplate('/ocs/v2.php/core/navigation/apps{?absolute*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Get the apps navigation. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2069,54 +2043,26 @@ class $NavigationClient { /// * 304: No apps navigation changed /// /// See: - /// * [getAppsNavigation] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getAppsNavigationRaw({ + /// * [$getAppsNavigation_Request] for the request send by this method. + /// * [$getAppsNavigation_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getAppsNavigation({ NavigationGetAppsNavigationAbsolute? absolute, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - var $absolute = - _$jsonSerializers.serialize(absolute, specifiedType: const FullType(NavigationGetAppsNavigationAbsolute)); - $absolute ??= 0; - _parameters['absolute'] = $absolute; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/core/navigation/apps{?absolute*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getAppsNavigation_Request( + absolute: absolute, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getAppsNavigation_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$getSettingsNavigation_Request`. + /// Builds a serializer to parse the response of [$getSettingsNavigation_Request]. @_i2.experimental _i1.DynamiteSerializer $getSettingsNavigation_Serializer() => _i1.DynamiteSerializer( @@ -2128,7 +2074,7 @@ class $NavigationClient { /// Get the settings navigation. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getSettingsNavigation] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2140,45 +2086,23 @@ class $NavigationClient { /// * 304: No apps navigation changed /// /// See: - /// * [getSettingsNavigationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getSettingsNavigation({ - NavigationGetSettingsNavigationAbsolute? absolute, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await getSettingsNavigationRaw( - absolute: absolute, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get the settings navigation. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [absolute] Rewrite URLs to absolute ones. Defaults to `0`. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Apps navigation returned - /// * 304: No apps navigation changed - /// - /// See: - /// * [getSettingsNavigation] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getSettingsNavigation] for a method executing this request and parsing the response. + /// * [$getSettingsNavigation_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getSettingsNavigationRaw({ + _i3.Request $getSettingsNavigation_Request({ NavigationGetSettingsNavigationAbsolute? absolute, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $absolute = + _$jsonSerializers.serialize(absolute, specifiedType: const FullType(NavigationGetSettingsNavigationAbsolute)); + $absolute ??= 0; + _parameters['absolute'] = $absolute; + final _path = _i5.UriTemplate('/ocs/v2.php/core/navigation/settings{?absolute*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2188,7 +2112,7 @@ class $NavigationClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2196,25 +2120,44 @@ class $NavigationClient { } // coverage:ignore-end - var $absolute = - _$jsonSerializers.serialize(absolute, specifiedType: const FullType(NavigationGetSettingsNavigationAbsolute)); - $absolute ??= 0; - _parameters['absolute'] = $absolute; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/core/navigation/settings{?absolute*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + return _request; + } + + /// Get the settings navigation. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [absolute] Rewrite URLs to absolute ones. Defaults to `0`. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Apps navigation returned + /// * 304: No apps navigation changed + /// + /// See: + /// * [$getSettingsNavigation_Request] for the request send by this method. + /// * [$getSettingsNavigation_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getSettingsNavigation({ + NavigationGetSettingsNavigationAbsolute? absolute, + bool? oCSAPIRequest, + }) async { + final _request = $getSettingsNavigation_Request( + absolute: absolute, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getSettingsNavigation_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -2225,7 +2168,7 @@ class $OcmClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$discovery_Request`. + /// Builds a serializer to parse the response of [$discovery_Request]. @_i2.experimental _i1.DynamiteSerializer $discovery_Serializer() => _i1.DynamiteSerializer( @@ -2237,7 +2180,7 @@ class $OcmClient { /// generate a OCMProvider with local data and send it as DataResponse. This replaces the old PHP file ocm-provider/index.php. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [discovery] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -2245,30 +2188,14 @@ class $OcmClient { /// * 500: OCM not supported /// /// See: - /// * [discoveryRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> discovery() async { - final _rawResponse = await discoveryRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// generate a OCMProvider with local data and send it as DataResponse. This replaces the old PHP file ocm-provider/index.php. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Status codes: - /// * 200: OCM Provider details returned - /// * 500: OCM not supported - /// - /// See: - /// * [discovery] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [discovery] for a method executing this request and parsing the response. + /// * [$discovery_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> discoveryRaw() async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $discovery_Request() { + const _path = '/index.php/ocm-provider'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2278,22 +2205,36 @@ class $OcmClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - const _path = '/index.php/ocm-provider'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + return _request; + } + + /// generate a OCMProvider with local data and send it as DataResponse. This replaces the old PHP file ocm-provider/index.php. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: OCM Provider details returned + /// * 500: OCM not supported + /// + /// See: + /// * [$discovery_Request] for the request send by this method. + /// * [$discovery_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> discovery() async { + final _request = $discovery_Request(); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $discovery_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -2303,7 +2244,7 @@ class $OcsClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getCapabilities_Request`. + /// Builds a serializer to parse the response of [$getCapabilities_Request]. @_i2.experimental _i1.DynamiteSerializer $getCapabilities_Serializer() => _i1.DynamiteSerializer( @@ -2315,32 +2256,7 @@ class $OcsClient { /// Get the capabilities. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Capabilities returned - /// - /// See: - /// * [getCapabilitiesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getCapabilities({ - bool? oCSAPIRequest, - }) async { - final _rawResponse = await getCapabilitiesRaw( - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get the capabilities. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getCapabilities] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2350,13 +2266,14 @@ class $OcsClient { /// * 200: Capabilities returned /// /// See: - /// * [getCapabilities] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getCapabilities] for a method executing this request and parsing the response. + /// * [$getCapabilities_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getCapabilitiesRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getCapabilities_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/cloud/capabilities'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2366,7 +2283,7 @@ class $OcsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } @@ -2374,17 +2291,37 @@ class $OcsClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/cloud/capabilities'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + return _request; + } + + /// Get the capabilities. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Capabilities returned + /// + /// See: + /// * [$getCapabilities_Request] for the request send by this method. + /// * [$getCapabilities_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getCapabilities({ + bool? oCSAPIRequest, + }) async { + final _request = $getCapabilities_Request( + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getCapabilities_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -2394,7 +2331,7 @@ class $PreviewClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getPreviewByFileId_Request`. + /// Builds a serializer to parse the response of [$getPreviewByFileId_Request]. @_i2.experimental _i1.DynamiteSerializer $getPreviewByFileId_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -2405,54 +2342,7 @@ class $PreviewClient { /// Get a preview by file ID. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [fileId] ID of the file. Defaults to `-1`. - /// * [x] Width of the preview. Defaults to `32`. - /// * [y] Height of the preview. Defaults to `32`. - /// * [a] Whether to not crop the preview. Defaults to `0`. - /// * [forceIcon] Force returning an icon. Defaults to `1`. - /// * [mode] How to crop the image. Defaults to `fill`. - /// * [mimeFallback] Whether to fallback to the mime icon if no preview is available. Defaults to `0`. - /// - /// Status codes: - /// * 200: Preview returned - /// * 400: Getting preview is not possible - /// * 403: Getting preview is not allowed - /// * 404: Preview not found - /// * 303: Redirect to the mime icon url if mimeFallback is true - /// - /// See: - /// * [getPreviewByFileIdRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getPreviewByFileId({ - int? fileId, - int? x, - int? y, - PreviewGetPreviewByFileIdA? a, - PreviewGetPreviewByFileIdForceIcon? forceIcon, - String? mode, - PreviewGetPreviewByFileIdMimeFallback? mimeFallback, - }) async { - final _rawResponse = await getPreviewByFileIdRaw( - fileId: fileId, - x: x, - y: y, - a: a, - forceIcon: forceIcon, - mode: mode, - mimeFallback: mimeFallback, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get a preview by file ID. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getPreviewByFileId] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2472,9 +2362,10 @@ class $PreviewClient { /// * 303: Redirect to the mime icon url if mimeFallback is true /// /// See: - /// * [getPreviewByFileId] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getPreviewByFileId] for a method executing this request and parsing the response. + /// * [$getPreviewByFileId_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getPreviewByFileIdRaw({ + _i3.Request $getPreviewByFileId_Request({ int? fileId, int? x, int? y, @@ -2482,27 +2373,8 @@ class $PreviewClient { PreviewGetPreviewByFileIdForceIcon? forceIcon, String? mode, PreviewGetPreviewByFileIdMimeFallback? mimeFallback, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; var $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); $fileId ??= -1; _parameters['fileId'] = $fileId; @@ -2533,34 +2405,38 @@ class $PreviewClient { $mimeFallback ??= 0; _parameters['mimeFallback'] = $mimeFallback; - final _path = _i4.UriTemplate('/index.php/core/preview{?fileId*,x*,y*,a*,forceIcon*,mode*,mimeFallback*}') + final _path = _i5.UriTemplate('/index.php/core/preview{?fileId*,x*,y*,a*,forceIcon*,mode*,mimeFallback*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $getPreviewByFileId_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$getPreview_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getPreview_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Uint8List), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Get a preview by file path. +// coverage:ignore-end + return _request; + } + + /// Get a preview by file ID. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [file] Path of the file. Defaults to `''`. + /// * [fileId] ID of the file. Defaults to `-1`. /// * [x] Width of the preview. Defaults to `32`. /// * [y] Height of the preview. Defaults to `32`. /// * [a] Whether to not crop the preview. Defaults to `0`. @@ -2576,18 +2452,19 @@ class $PreviewClient { /// * 303: Redirect to the mime icon url if mimeFallback is true /// /// See: - /// * [getPreviewRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getPreview({ - String? file, + /// * [$getPreviewByFileId_Request] for the request send by this method. + /// * [$getPreviewByFileId_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getPreviewByFileId({ + int? fileId, int? x, int? y, - PreviewGetPreviewA? a, - PreviewGetPreviewForceIcon? forceIcon, + PreviewGetPreviewByFileIdA? a, + PreviewGetPreviewByFileIdForceIcon? forceIcon, String? mode, - PreviewGetPreviewMimeFallback? mimeFallback, + PreviewGetPreviewByFileIdMimeFallback? mimeFallback, }) async { - final _rawResponse = await getPreviewRaw( - file: file, + final _request = $getPreviewByFileId_Request( + fileId: fileId, x: x, y: y, a: a, @@ -2595,15 +2472,25 @@ class $PreviewClient { mode: mode, mimeFallback: mimeFallback, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getPreviewByFileId_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getPreview_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getPreview_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Uint8List), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a preview by file path. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getPreview] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2623,9 +2510,10 @@ class $PreviewClient { /// * 303: Redirect to the mime icon url if mimeFallback is true /// /// See: - /// * [getPreview] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getPreview] for a method executing this request and parsing the response. + /// * [$getPreview_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getPreviewRaw({ + _i3.Request $getPreview_Request({ String? file, int? x, int? y, @@ -2633,27 +2521,8 @@ class $PreviewClient { PreviewGetPreviewForceIcon? forceIcon, String? mode, PreviewGetPreviewMimeFallback? mimeFallback, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; var $file = _$jsonSerializers.serialize(file, specifiedType: const FullType(String)); $file ??= ''; _parameters['file'] = $file; @@ -2683,16 +2552,78 @@ class $PreviewClient { $mimeFallback ??= 0; _parameters['mimeFallback'] = $mimeFallback; - final _path = _i4.UriTemplate('/index.php/core/preview.png{?file*,x*,y*,a*,forceIcon*,mode*,mimeFallback*}') + final _path = _i5.UriTemplate('/index.php/core/preview.png{?file*,x*,y*,a*,forceIcon*,mode*,mimeFallback*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + return _request; + } + + /// Get a preview by file path. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [file] Path of the file. Defaults to `''`. + /// * [x] Width of the preview. Defaults to `32`. + /// * [y] Height of the preview. Defaults to `32`. + /// * [a] Whether to not crop the preview. Defaults to `0`. + /// * [forceIcon] Force returning an icon. Defaults to `1`. + /// * [mode] How to crop the image. Defaults to `fill`. + /// * [mimeFallback] Whether to fallback to the mime icon if no preview is available. Defaults to `0`. + /// + /// Status codes: + /// * 200: Preview returned + /// * 400: Getting preview is not possible + /// * 403: Getting preview is not allowed + /// * 404: Preview not found + /// * 303: Redirect to the mime icon url if mimeFallback is true + /// + /// See: + /// * [$getPreview_Request] for the request send by this method. + /// * [$getPreview_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getPreview({ + String? file, + int? x, + int? y, + PreviewGetPreviewA? a, + PreviewGetPreviewForceIcon? forceIcon, + String? mode, + PreviewGetPreviewMimeFallback? mimeFallback, + }) async { + final _request = $getPreview_Request( + file: file, + x: x, + y: y, + a: a, + forceIcon: forceIcon, + mode: mode, + mimeFallback: mimeFallback, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getPreview_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -2702,7 +2633,7 @@ class $ProfileApiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$setVisibility_Request`. + /// Builds a serializer to parse the response of [$setVisibility_Request]. @_i2.experimental _i1.DynamiteSerializer $setVisibility_Serializer() => _i1.DynamiteSerializer( @@ -2714,7 +2645,7 @@ class $ProfileApiClient { /// Update the visibility of a parameter. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [setVisibility] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2730,28 +2661,56 @@ class $ProfileApiClient { /// * 404: User not found /// /// See: - /// * [setVisibilityRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setVisibility({ + /// * [setVisibility] for a method executing this request and parsing the response. + /// * [$setVisibility_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $setVisibility_Request({ required String paramId, required String visibility, required String targetUserId, bool? oCSAPIRequest, - }) async { - final _rawResponse = await setVisibilityRaw( - paramId: paramId, - visibility: visibility, - targetUserId: targetUserId, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $paramId = _$jsonSerializers.serialize(paramId, specifiedType: const FullType(String)); + _parameters['paramId'] = $paramId; + + final $visibility = _$jsonSerializers.serialize(visibility, specifiedType: const FullType(String)); + _parameters['visibility'] = $visibility; + + final $targetUserId = _$jsonSerializers.serialize(targetUserId, specifiedType: const FullType(String)); + _parameters['targetUserId'] = $targetUserId; + + final _path = _i5.UriTemplate('/ocs/v2.php/profile/{targetUserId}{?paramId*,visibility*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Update the visibility of a parameter. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2767,56 +2726,26 @@ class $ProfileApiClient { /// * 404: User not found /// /// See: - /// * [setVisibility] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> setVisibilityRaw({ + /// * [$setVisibility_Request] for the request send by this method. + /// * [$setVisibility_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setVisibility({ required String paramId, required String visibility, required String targetUserId, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $paramId = _$jsonSerializers.serialize(paramId, specifiedType: const FullType(String)); - _parameters['paramId'] = $paramId; - - final $visibility = _$jsonSerializers.serialize(visibility, specifiedType: const FullType(String)); - _parameters['visibility'] = $visibility; - - final $targetUserId = _$jsonSerializers.serialize(targetUserId, specifiedType: const FullType(String)); - _parameters['targetUserId'] = $targetUserId; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/profile/{targetUserId}{?paramId*,visibility*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, + final _request = $setVisibility_Request( + paramId: paramId, + visibility: visibility, + targetUserId: targetUserId, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $setVisibility_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -2826,7 +2755,7 @@ class $ReferenceClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$preview_Request`. + /// Builds a serializer to parse the response of [$preview_Request]. @_i2.experimental _i1.DynamiteSerializer $preview_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -2835,6 +2764,49 @@ class $ReferenceClient { validStatuses: const {200}, ); + /// Get a preview for a reference. + /// + /// Returns a `DynamiteRequest` backing the [preview] operation. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [referenceId] the reference cache key. + /// + /// Status codes: + /// * 200: Preview returned + /// * 404: Reference not found + /// + /// See: + /// * [preview] for a method executing this request and parsing the response. + /// * [$preview_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $preview_Request({required String referenceId}) { + final _parameters = {}; + final $referenceId = _$jsonSerializers.serialize(referenceId, specifiedType: const FullType(String)); + _parameters['referenceId'] = $referenceId; + + final _path = _i5.UriTemplate('/index.php/core/references/preview/{referenceId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end + return _request; + } + /// Get a preview for a reference. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -2848,36 +2820,64 @@ class $ReferenceClient { /// * 404: Reference not found /// /// See: - /// * [previewRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$preview_Request] for the request send by this method. + /// * [$preview_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> preview({required String referenceId}) async { - final _rawResponse = await previewRaw( + final _request = $preview_Request( referenceId: referenceId, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $preview_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Get a preview for a reference. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $ReferenceApiClient { + /// Creates a new `DynamiteClient` for reference_api requests. + $ReferenceApiClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$resolveOne_Request]. + @_i2.experimental + _i1.DynamiteSerializer $resolveOne_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ReferenceApiResolveOneResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Resolve a reference. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [resolveOne] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [referenceId] the reference cache key. + /// * [reference] Reference to resolve. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Preview returned - /// * 404: Reference not found + /// * 200: Reference returned /// /// See: - /// * [preview] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [resolveOne] for a method executing this request and parsing the response. + /// * [$resolveOne_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> previewRaw({required String referenceId}) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; + _i3.Request $resolveOne_Request({ + required String reference, + bool? oCSAPIRequest, + }) { + final _parameters = {}; + final $reference = _$jsonSerializers.serialize(reference, specifiedType: const FullType(String)); + _parameters['reference'] = $reference; + final _path = _i5.UriTemplate('/ocs/v2.php/references/resolve{?reference*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2887,42 +2887,20 @@ class $ReferenceClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $referenceId = _$jsonSerializers.serialize(referenceId, specifiedType: const FullType(String)); - _parameters['referenceId'] = $referenceId; - - final _path = _i4.UriTemplate('/index.php/core/references/preview/{referenceId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $preview_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $ReferenceApiClient { - /// Creates a new `DynamiteClient` for reference_api requests. - $ReferenceApiClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$resolveOne_Request`. - @_i2.experimental - _i1.DynamiteSerializer $resolveOne_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ReferenceApiResolveOneResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Resolve a reference. /// @@ -2937,43 +2915,69 @@ class $ReferenceApiClient { /// * 200: Reference returned /// /// See: - /// * [resolveOneRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$resolveOne_Request] for the request send by this method. + /// * [$resolveOne_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> resolveOne({ required String reference, bool? oCSAPIRequest, }) async { - final _rawResponse = await resolveOneRaw( + final _request = $resolveOne_Request( reference: reference, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $resolveOne_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Resolve a reference. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$resolve_Request]. + @_i2.experimental + _i1.DynamiteSerializer $resolve_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ReferenceApiResolveResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Resolve multiple references. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [resolve] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [reference] Reference to resolve. + /// * [references] References to resolve. + /// * [limit] Maximum amount of references to resolve. Defaults to `1`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reference returned + /// * 200: References returned /// /// See: - /// * [resolveOne] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [resolve] for a method executing this request and parsing the response. + /// * [$resolve_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> resolveOneRaw({ - required String reference, + _i3.Request $resolve_Request({ + required BuiltList references, + int? limit, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $references = + _$jsonSerializers.serialize(references, specifiedType: const FullType(BuiltList, [FullType(String)])); + _parameters['references%5B%5D'] = $references; + + var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + $limit ??= 1; + _parameters['limit'] = $limit; + final _path = _i5.UriTemplate('/ocs/v2.php/references/resolve{?references%5B%5D*,limit*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2983,7 +2987,7 @@ class $ReferenceApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2991,34 +2995,13 @@ class $ReferenceApiClient { } // coverage:ignore-end - final $reference = _$jsonSerializers.serialize(reference, specifiedType: const FullType(String)); - _parameters['reference'] = $reference; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/references/resolve{?reference*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $resolveOne_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$resolve_Request`. - @_i2.experimental - _i1.DynamiteSerializer $resolve_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ReferenceApiResolveResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Resolve multiple references. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -3033,47 +3016,76 @@ class $ReferenceApiClient { /// * 200: References returned /// /// See: - /// * [resolveRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$resolve_Request] for the request send by this method. + /// * [$resolve_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> resolve({ required BuiltList references, int? limit, bool? oCSAPIRequest, }) async { - final _rawResponse = await resolveRaw( + final _request = $resolve_Request( references: references, limit: limit, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $resolve_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Resolve multiple references. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$extract_Request]. + @_i2.experimental + _i1.DynamiteSerializer $extract_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ReferenceApiExtractResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Extract references from a text. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [extract] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [references] References to resolve. - /// * [limit] Maximum amount of references to resolve. Defaults to `1`. + /// * [text] Text to extract from. + /// * [resolve] Resolve the references. Defaults to `0`. + /// * [limit] Maximum amount of references to extract. Defaults to `1`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: /// * 200: References returned /// /// See: - /// * [resolve] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [extract] for a method executing this request and parsing the response. + /// * [$extract_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> resolveRaw({ - required BuiltList references, + _i3.Request $extract_Request({ + required String text, + ReferenceApiExtractResolve? resolve, int? limit, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $text = _$jsonSerializers.serialize(text, specifiedType: const FullType(String)); + _parameters['text'] = $text; + + var $resolve = _$jsonSerializers.serialize(resolve, specifiedType: const FullType(ReferenceApiExtractResolve)); + $resolve ??= 0; + _parameters['resolve'] = $resolve; + + var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + $limit ??= 1; + _parameters['limit'] = $limit; + final _path = _i5.UriTemplate('/ocs/v2.php/references/extract{?text*,resolve*,limit*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3083,7 +3095,7 @@ class $ReferenceApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3091,39 +3103,13 @@ class $ReferenceApiClient { } // coverage:ignore-end - final $references = - _$jsonSerializers.serialize(references, specifiedType: const FullType(BuiltList, [FullType(String)])); - _parameters['references%5B%5D'] = $references; - - var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - $limit ??= 1; - _parameters['limit'] = $limit; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/references/resolve{?references%5B%5D*,limit*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $resolve_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$extract_Request`. - @_i2.experimental - _i1.DynamiteSerializer $extract_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ReferenceApiExtractResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Extract references from a text. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -3139,51 +3125,58 @@ class $ReferenceApiClient { /// * 200: References returned /// /// See: - /// * [extractRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$extract_Request] for the request send by this method. + /// * [$extract_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> extract({ required String text, ReferenceApiExtractResolve? resolve, int? limit, bool? oCSAPIRequest, }) async { - final _rawResponse = await extractRaw( + final _request = $extract_Request( text: text, resolve: resolve, limit: limit, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $extract_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Extract references from a text. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getProvidersInfo_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getProvidersInfo_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ReferenceApiGetProvidersInfoResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the providers. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getProvidersInfo] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [text] Text to extract from. - /// * [resolve] Resolve the references. Defaults to `0`. - /// * [limit] Maximum amount of references to extract. Defaults to `1`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: References returned + /// * 200: Providers returned /// /// See: - /// * [extract] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getProvidersInfo] for a method executing this request and parsing the response. + /// * [$getProvidersInfo_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> extractRaw({ - required String text, - ReferenceApiExtractResolve? resolve, - int? limit, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getProvidersInfo_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/references/providers'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3193,7 +3186,7 @@ class $ReferenceApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3201,42 +3194,13 @@ class $ReferenceApiClient { } // coverage:ignore-end - final $text = _$jsonSerializers.serialize(text, specifiedType: const FullType(String)); - _parameters['text'] = $text; - - var $resolve = _$jsonSerializers.serialize(resolve, specifiedType: const FullType(ReferenceApiExtractResolve)); - $resolve ??= 0; - _parameters['resolve'] = $resolve; - - var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - $limit ??= 1; - _parameters['limit'] = $limit; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/references/extract{?text*,resolve*,limit*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $extract_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getProvidersInfo_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getProvidersInfo_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ReferenceApiGetProvidersInfoResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get the providers. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -3249,38 +3213,66 @@ class $ReferenceApiClient { /// * 200: Providers returned /// /// See: - /// * [getProvidersInfoRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getProvidersInfo_Request] for the request send by this method. + /// * [$getProvidersInfo_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getProvidersInfo({ bool? oCSAPIRequest, }) async { - final _rawResponse = await getProvidersInfoRaw( + final _request = $getProvidersInfo_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getProvidersInfo_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the providers. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$touchProvider_Request]. + @_i2.experimental + _i1.DynamiteSerializer $touchProvider_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ReferenceApiTouchProviderResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Touch a provider. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [touchProvider] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [timestamp] Timestamp of the last usage. + /// * [providerId] ID of the provider. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Providers returned + /// * 200: Provider touched /// /// See: - /// * [getProvidersInfo] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [touchProvider] for a method executing this request and parsing the response. + /// * [$touchProvider_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getProvidersInfoRaw({ + _i3.Request $touchProvider_Request({ + required String providerId, + int? timestamp, bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $providerId = _$jsonSerializers.serialize(providerId, specifiedType: const FullType(String)); + _parameters['providerId'] = $providerId; + final $timestamp = _$jsonSerializers.serialize(timestamp, specifiedType: const FullType(int)); + _parameters['timestamp'] = $timestamp; + + final _path = _i5.UriTemplate('/ocs/v2.php/references/provider/{providerId}{?timestamp*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3290,7 +3282,7 @@ class $ReferenceApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3300,30 +3292,11 @@ class $ReferenceApiClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/references/providers'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getProvidersInfo_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$touchProvider_Request`. - @_i2.experimental - _i1.DynamiteSerializer $touchProvider_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ReferenceApiTouchProviderResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Touch a provider. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -3338,47 +3311,64 @@ class $ReferenceApiClient { /// * 200: Provider touched /// /// See: - /// * [touchProviderRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$touchProvider_Request] for the request send by this method. + /// * [$touchProvider_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> touchProvider({ required String providerId, int? timestamp, bool? oCSAPIRequest, }) async { - final _rawResponse = await touchProviderRaw( + final _request = $touchProvider_Request( providerId: providerId, timestamp: timestamp, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $touchProvider_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} + +class $TextProcessingApiClient { + /// Creates a new `DynamiteClient` for text_processing_api requests. + $TextProcessingApiClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$taskTypes_Request]. + @_i2.experimental + _i1.DynamiteSerializer $taskTypes_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextProcessingApiTaskTypesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); - /// Touch a provider. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// This endpoint returns all available LanguageModel task types. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [taskTypes] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [timestamp] Timestamp of the last usage. - /// * [providerId] ID of the provider. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Provider touched + /// * 200: Task types returned /// /// See: - /// * [touchProvider] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [taskTypes] for a method executing this request and parsing the response. + /// * [$taskTypes_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> touchProviderRaw({ - required String providerId, - int? timestamp, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + _i3.Request $taskTypes_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/textprocessing/tasktypes'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3388,52 +3378,18 @@ class $ReferenceApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $providerId = _$jsonSerializers.serialize(providerId, specifiedType: const FullType(String)); - _parameters['providerId'] = $providerId; - - final $timestamp = _$jsonSerializers.serialize(timestamp, specifiedType: const FullType(int)); - _parameters['timestamp'] = $timestamp; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/references/provider/{providerId}{?timestamp*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $touchProvider_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $TextProcessingApiClient { - /// Creates a new `DynamiteClient` for text_processing_api requests. - $TextProcessingApiClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$taskTypes_Request`. - @_i2.experimental - _i1.DynamiteSerializer $taskTypes_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextProcessingApiTaskTypesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// This endpoint returns all available LanguageModel task types. /// @@ -3447,38 +3403,81 @@ class $TextProcessingApiClient { /// * 200: Task types returned /// /// See: - /// * [taskTypesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$taskTypes_Request] for the request send by this method. + /// * [$taskTypes_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> taskTypes({ bool? oCSAPIRequest, }) async { - final _rawResponse = await taskTypesRaw( + final _request = $taskTypes_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $taskTypes_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This endpoint returns all available LanguageModel task types. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$schedule_Request]. + @_i2.experimental + _i1.DynamiteSerializer $schedule_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextProcessingApiScheduleResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// This endpoint allows scheduling a language model task. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [schedule] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [input] Input text. + /// * [type] Type of the task. + /// * [appId] ID of the app that will execute the task. + /// * [identifier] An arbitrary identifier for the task. Defaults to `''`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Task types returned + /// * 200: Task scheduled successfully + /// * 500 + /// * 400: Scheduling task is not possible + /// * 412: Scheduling task is not possible /// /// See: - /// * [taskTypes] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [schedule] for a method executing this request and parsing the response. + /// * [$schedule_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> taskTypesRaw({ + _i3.Request $schedule_Request({ + required String input, + required String type, + required String appId, + String? identifier, bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $input = _$jsonSerializers.serialize(input, specifiedType: const FullType(String)); + _parameters['input'] = $input; + + final $type = _$jsonSerializers.serialize(type, specifiedType: const FullType(String)); + _parameters['type'] = $type; + final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); + _parameters['appId'] = $appId; + + var $identifier = _$jsonSerializers.serialize(identifier, specifiedType: const FullType(String)); + $identifier ??= ''; + _parameters['identifier'] = $identifier; + + final _path = + _i5.UriTemplate('/ocs/v2.php/textprocessing/schedule{?input*,type*,appId*,identifier*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3488,7 +3487,7 @@ class $TextProcessingApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } @@ -3496,30 +3495,11 @@ class $TextProcessingApiClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/textprocessing/tasktypes'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $taskTypes_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$schedule_Request`. - @_i2.experimental - _i1.DynamiteSerializer $schedule_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextProcessingApiScheduleResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// This endpoint allows scheduling a language model task. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -3539,7 +3519,8 @@ class $TextProcessingApiClient { /// * 412: Scheduling task is not possible /// /// See: - /// * [scheduleRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$schedule_Request] for the request send by this method. + /// * [$schedule_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> schedule({ required String input, required String type, @@ -3547,50 +3528,62 @@ class $TextProcessingApiClient { String? identifier, bool? oCSAPIRequest, }) async { - final _rawResponse = await scheduleRaw( + final _request = $schedule_Request( input: input, type: type, appId: appId, identifier: identifier, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $schedule_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This endpoint allows scheduling a language model task. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getTask_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getTask_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextProcessingApiGetTaskResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// This endpoint allows checking the status and results of a task. Tasks are removed 1 week after receiving their last update. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getTask] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [input] Input text. - /// * [type] Type of the task. - /// * [appId] ID of the app that will execute the task. - /// * [identifier] An arbitrary identifier for the task. Defaults to `''`. + /// * [id] The id of the task. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Task scheduled successfully + /// * 200: Task returned + /// * 404: Task not found /// * 500 - /// * 400: Scheduling task is not possible - /// * 412: Scheduling task is not possible /// /// See: - /// * [schedule] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getTask] for a method executing this request and parsing the response. + /// * [$getTask_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> scheduleRaw({ - required String input, - required String type, - required String appId, - String? identifier, + _i3.Request $getTask_Request({ + required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/textprocessing/task/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3600,52 +3593,19 @@ class $TextProcessingApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $input = _$jsonSerializers.serialize(input, specifiedType: const FullType(String)); - _parameters['input'] = $input; - - final $type = _$jsonSerializers.serialize(type, specifiedType: const FullType(String)); - _parameters['type'] = $type; - - final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); - _parameters['appId'] = $appId; - - var $identifier = _$jsonSerializers.serialize(identifier, specifiedType: const FullType(String)); - $identifier ??= ''; - _parameters['identifier'] = $identifier; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/textprocessing/schedule{?input*,type*,appId*,identifier*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $schedule_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getTask_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getTask_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextProcessingApiGetTaskResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// This endpoint allows checking the status and results of a task. Tasks are removed 1 week after receiving their last update. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -3661,24 +3621,37 @@ class $TextProcessingApiClient { /// * 500 /// /// See: - /// * [getTaskRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getTask_Request] for the request send by this method. + /// * [$getTask_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getTask({ required int id, bool? oCSAPIRequest, }) async { - final _rawResponse = await getTaskRaw( + final _request = $getTask_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getTask_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This endpoint allows checking the status and results of a task. Tasks are removed 1 week after receiving their last update. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$deleteTask_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteTask_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextProcessingApiDeleteTaskResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// This endpoint allows to delete a scheduled task for a user. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteTask] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3691,15 +3664,21 @@ class $TextProcessingApiClient { /// * 500 /// /// See: - /// * [getTask] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteTask] for a method executing this request and parsing the response. + /// * [$deleteTask_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getTaskRaw({ + _i3.Request $deleteTask_Request({ required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/textprocessing/task/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3709,40 +3688,21 @@ class $TextProcessingApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/textprocessing/task/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getTask_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteTask_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteTask_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextProcessingApiDeleteTaskResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// This endpoint allows to delete a scheduled task for a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -3758,45 +3718,69 @@ class $TextProcessingApiClient { /// * 500 /// /// See: - /// * [deleteTaskRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteTask_Request] for the request send by this method. + /// * [$deleteTask_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteTask({ required int id, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteTaskRaw( + final _request = $deleteTask_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteTask_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This endpoint allows to delete a scheduled task for a user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$listTasksByApp_Request]. + @_i2.experimental + _i1.DynamiteSerializer $listTasksByApp_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextProcessingApiListTasksByAppResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// This endpoint returns a list of tasks of a user that are related with a specific appId and optionally with an identifier. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [listTasksByApp] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [id] The id of the task. + /// * [identifier] An arbitrary identifier for the task. + /// * [appId] ID of the app. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Task returned - /// * 404: Task not found + /// * 200: Task list returned /// * 500 /// /// See: - /// * [deleteTask] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [listTasksByApp] for a method executing this request and parsing the response. + /// * [$listTasksByApp_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteTaskRaw({ - required int id, + _i3.Request $listTasksByApp_Request({ + required String appId, + String? identifier, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); + _parameters['appId'] = $appId; + + final $identifier = _$jsonSerializers.serialize(identifier, specifiedType: const FullType(String)); + _parameters['identifier'] = $identifier; + final _path = _i5.UriTemplate('/ocs/v2.php/textprocessing/tasks/app/{appId}{?identifier*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3806,7 +3790,7 @@ class $TextProcessingApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3814,35 +3798,13 @@ class $TextProcessingApiClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/textprocessing/task/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $deleteTask_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$listTasksByApp_Request`. - @_i2.experimental - _i1.DynamiteSerializer $listTasksByApp_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextProcessingApiListTasksByAppResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// This endpoint returns a list of tasks of a user that are related with a specific appId and optionally with an identifier. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -3858,48 +3820,64 @@ class $TextProcessingApiClient { /// * 500 /// /// See: - /// * [listTasksByAppRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$listTasksByApp_Request] for the request send by this method. + /// * [$listTasksByApp_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> listTasksByApp({ required String appId, String? identifier, bool? oCSAPIRequest, }) async { - final _rawResponse = await listTasksByAppRaw( + final _request = $listTasksByApp_Request( appId: appId, identifier: identifier, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $listTasksByApp_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} + +class $TextToImageApiClient { + /// Creates a new `DynamiteClient` for text_to_image_api requests. + $TextToImageApiClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$isAvailable_Request]. + @_i2.experimental + _i1.DynamiteSerializer $isAvailable_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextToImageApiIsAvailableResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); - /// This endpoint returns a list of tasks of a user that are related with a specific appId and optionally with an identifier. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Check whether this feature is available. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [isAvailable] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [identifier] An arbitrary identifier for the task. - /// * [appId] ID of the app. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Task list returned - /// * 500 + /// * 200: Returns availability status /// /// See: - /// * [listTasksByApp] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [isAvailable] for a method executing this request and parsing the response. + /// * [$isAvailable_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> listTasksByAppRaw({ - required String appId, - String? identifier, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + _i3.Request $isAvailable_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/text2image/is_available'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3909,52 +3887,18 @@ class $TextProcessingApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); - _parameters['appId'] = $appId; - - final $identifier = _$jsonSerializers.serialize(identifier, specifiedType: const FullType(String)); - _parameters['identifier'] = $identifier; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/textprocessing/tasks/app/{appId}{?identifier*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $listTasksByApp_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $TextToImageApiClient { - /// Creates a new `DynamiteClient` for text_to_image_api requests. - $TextToImageApiClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$isAvailable_Request`. - @_i2.experimental - _i1.DynamiteSerializer $isAvailable_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextToImageApiIsAvailableResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Check whether this feature is available. /// @@ -3968,38 +3912,81 @@ class $TextToImageApiClient { /// * 200: Returns availability status /// /// See: - /// * [isAvailableRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$isAvailable_Request] for the request send by this method. + /// * [$isAvailable_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> isAvailable({ bool? oCSAPIRequest, }) async { - final _rawResponse = await isAvailableRaw( + final _request = $isAvailable_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $isAvailable_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Check whether this feature is available. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$schedule_Request]. + @_i2.experimental + _i1.DynamiteSerializer $schedule_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextToImageApiScheduleResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// This endpoint allows scheduling a text to image task. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [schedule] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [input] Input text. + /// * [appId] ID of the app that will execute the task. + /// * [identifier] An arbitrary identifier for the task. Defaults to `''`. + /// * [numberOfImages] The number of images to generate. Defaults to `8`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Returns availability status + /// * 200: Task scheduled successfully + /// * 412: Scheduling task is not possible + /// * 500 /// /// See: - /// * [isAvailable] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [schedule] for a method executing this request and parsing the response. + /// * [$schedule_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> isAvailableRaw({ + _i3.Request $schedule_Request({ + required String input, + required String appId, + String? identifier, + int? numberOfImages, bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $input = _$jsonSerializers.serialize(input, specifiedType: const FullType(String)); + _parameters['input'] = $input; + + final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); + _parameters['appId'] = $appId; + + var $identifier = _$jsonSerializers.serialize(identifier, specifiedType: const FullType(String)); + $identifier ??= ''; + _parameters['identifier'] = $identifier; + var $numberOfImages = _$jsonSerializers.serialize(numberOfImages, specifiedType: const FullType(int)); + $numberOfImages ??= 8; + _parameters['numberOfImages'] = $numberOfImages; + + final _path = _i5.UriTemplate('/ocs/v2.php/text2image/schedule{?input*,appId*,identifier*,numberOfImages*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4009,7 +3996,7 @@ class $TextToImageApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } @@ -4017,30 +4004,11 @@ class $TextToImageApiClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/text2image/is_available'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $isAvailable_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$schedule_Request`. - @_i2.experimental - _i1.DynamiteSerializer $schedule_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextToImageApiScheduleResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// This endpoint allows scheduling a text to image task. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -4059,7 +4027,8 @@ class $TextToImageApiClient { /// * 500 /// /// See: - /// * [scheduleRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$schedule_Request] for the request send by this method. + /// * [$schedule_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> schedule({ required String input, required String appId, @@ -4067,49 +4036,61 @@ class $TextToImageApiClient { int? numberOfImages, bool? oCSAPIRequest, }) async { - final _rawResponse = await scheduleRaw( + final _request = $schedule_Request( input: input, appId: appId, identifier: identifier, numberOfImages: numberOfImages, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $schedule_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This endpoint allows scheduling a text to image task. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getTask_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getTask_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextToImageApiGetTaskResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// This endpoint allows checking the status and results of a task. Tasks are removed 1 week after receiving their last update. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getTask] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [input] Input text. - /// * [appId] ID of the app that will execute the task. - /// * [identifier] An arbitrary identifier for the task. Defaults to `''`. - /// * [numberOfImages] The number of images to generate. Defaults to `8`. + /// * [id] The id of the task. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Task scheduled successfully - /// * 412: Scheduling task is not possible + /// * 200: Task returned + /// * 404: Task not found /// * 500 /// /// See: - /// * [schedule] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getTask] for a method executing this request and parsing the response. + /// * [$getTask_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> scheduleRaw({ - required String input, - required String appId, - String? identifier, - int? numberOfImages, + _i3.Request $getTask_Request({ + required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/text2image/task/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4119,52 +4100,19 @@ class $TextToImageApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $input = _$jsonSerializers.serialize(input, specifiedType: const FullType(String)); - _parameters['input'] = $input; - - final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); - _parameters['appId'] = $appId; - - var $identifier = _$jsonSerializers.serialize(identifier, specifiedType: const FullType(String)); - $identifier ??= ''; - _parameters['identifier'] = $identifier; - - var $numberOfImages = _$jsonSerializers.serialize(numberOfImages, specifiedType: const FullType(int)); - $numberOfImages ??= 8; - _parameters['numberOfImages'] = $numberOfImages; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/text2image/schedule{?input*,appId*,identifier*,numberOfImages*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $schedule_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getTask_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getTask_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextToImageApiGetTaskResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// This endpoint allows checking the status and results of a task. Tasks are removed 1 week after receiving their last update. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -4180,24 +4128,37 @@ class $TextToImageApiClient { /// * 500 /// /// See: - /// * [getTaskRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getTask_Request] for the request send by this method. + /// * [$getTask_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getTask({ required int id, bool? oCSAPIRequest, }) async { - final _rawResponse = await getTaskRaw( + final _request = $getTask_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getTask_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This endpoint allows checking the status and results of a task. Tasks are removed 1 week after receiving their last update. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$deleteTask_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteTask_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextToImageApiDeleteTaskResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// This endpoint allows to delete a scheduled task for a user. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteTask] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4210,15 +4171,21 @@ class $TextToImageApiClient { /// * 500 /// /// See: - /// * [getTask] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteTask] for a method executing this request and parsing the response. + /// * [$deleteTask_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getTaskRaw({ + _i3.Request $deleteTask_Request({ required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/text2image/task/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4228,40 +4195,21 @@ class $TextToImageApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/text2image/task/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getTask_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteTask_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteTask_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextToImageApiDeleteTaskResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// This endpoint allows to delete a scheduled task for a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -4277,45 +4225,68 @@ class $TextToImageApiClient { /// * 500 /// /// See: - /// * [deleteTaskRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteTask_Request] for the request send by this method. + /// * [$deleteTask_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteTask({ required int id, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteTaskRaw( + final _request = $deleteTask_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteTask_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This endpoint allows to delete a scheduled task for a user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getImage_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getImage_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Uint8List), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// This endpoint allows downloading the resulting image of a task. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getImage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [id] The id of the task. + /// * [index] The index of the image to retrieve. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Task returned - /// * 404: Task not found + /// * 200: Image returned + /// * 404: Task or image not found /// * 500 /// /// See: - /// * [deleteTask] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getImage] for a method executing this request and parsing the response. + /// * [$getImage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteTaskRaw({ + _i3.Request $getImage_Request({ required int id, + required int index, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + + final $index = _$jsonSerializers.serialize(index, specifiedType: const FullType(int)); + _parameters['index'] = $index; + final _path = _i5.UriTemplate('/ocs/v2.php/text2image/task/{id}/image/{index}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4325,41 +4296,19 @@ class $TextToImageApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/text2image/task/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $deleteTask_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getImage_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getImage_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Uint8List), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// This endpoint allows downloading the resulting image of a task. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -4376,49 +4325,69 @@ class $TextToImageApiClient { /// * 500 /// /// See: - /// * [getImageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getImage_Request] for the request send by this method. + /// * [$getImage_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getImage({ required int id, required int index, bool? oCSAPIRequest, }) async { - final _rawResponse = await getImageRaw( + final _request = $getImage_Request( id: id, index: index, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getImage_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This endpoint allows downloading the resulting image of a task. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$listTasksByApp_Request]. + @_i2.experimental + _i1.DynamiteSerializer $listTasksByApp_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TextToImageApiListTasksByAppResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// This endpoint returns a list of tasks of a user that are related with a specific appId and optionally with an identifier. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [listTasksByApp] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [id] The id of the task. - /// * [index] The index of the image to retrieve. + /// * [identifier] An arbitrary identifier for the task. + /// * [appId] ID of the app. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Image returned - /// * 404: Task or image not found + /// * 200: Task list returned /// * 500 /// /// See: - /// * [getImage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [listTasksByApp] for a method executing this request and parsing the response. + /// * [$listTasksByApp_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getImageRaw({ - required int id, - required int index, + _i3.Request $listTasksByApp_Request({ + required String appId, + String? identifier, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; + }) { + final _parameters = {}; + final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); + _parameters['appId'] = $appId; + + final $identifier = _$jsonSerializers.serialize(identifier, specifiedType: const FullType(String)); + _parameters['identifier'] = $identifier; + final _path = _i5.UriTemplate('/ocs/v2.php/text2image/tasks/app/{appId}{?identifier*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4428,43 +4397,21 @@ class $TextToImageApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - - final $index = _$jsonSerializers.serialize(index, specifiedType: const FullType(int)); - _parameters['index'] = $index; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/text2image/task/{id}/image/{index}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getImage_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$listTasksByApp_Request`. - @_i2.experimental - _i1.DynamiteSerializer $listTasksByApp_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TextToImageApiListTasksByAppResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// This endpoint returns a list of tasks of a user that are related with a specific appId and optionally with an identifier. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -4480,48 +4427,64 @@ class $TextToImageApiClient { /// * 500 /// /// See: - /// * [listTasksByAppRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$listTasksByApp_Request] for the request send by this method. + /// * [$listTasksByApp_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> listTasksByApp({ required String appId, String? identifier, bool? oCSAPIRequest, }) async { - final _rawResponse = await listTasksByAppRaw( + final _request = $listTasksByApp_Request( appId: appId, identifier: identifier, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $listTasksByApp_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// This endpoint returns a list of tasks of a user that are related with a specific appId and optionally with an identifier. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $TranslationApiClient { + /// Creates a new `DynamiteClient` for translation_api requests. + $TranslationApiClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$languages_Request]. + @_i2.experimental + _i1.DynamiteSerializer $languages_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TranslationApiLanguagesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the list of supported languages. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [languages] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [identifier] An arbitrary identifier for the task. - /// * [appId] ID of the app. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Task list returned - /// * 500 + /// * 200: Supported languages returned /// /// See: - /// * [listTasksByApp] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [languages] for a method executing this request and parsing the response. + /// * [$languages_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> listTasksByAppRaw({ - required String appId, - String? identifier, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + _i3.Request $languages_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/translation/languages'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4531,52 +4494,18 @@ class $TextToImageApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); - _parameters['appId'] = $appId; - - final $identifier = _$jsonSerializers.serialize(identifier, specifiedType: const FullType(String)); - _parameters['identifier'] = $identifier; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/text2image/tasks/app/{appId}{?identifier*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $listTasksByApp_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $TranslationApiClient { - /// Creates a new `DynamiteClient` for translation_api requests. - $TranslationApiClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$languages_Request`. - @_i2.experimental - _i1.DynamiteSerializer $languages_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TranslationApiLanguagesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get the list of supported languages. /// @@ -4590,38 +4519,74 @@ class $TranslationApiClient { /// * 200: Supported languages returned /// /// See: - /// * [languagesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$languages_Request] for the request send by this method. + /// * [$languages_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> languages({ bool? oCSAPIRequest, }) async { - final _rawResponse = await languagesRaw( + final _request = $languages_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $languages_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the list of supported languages. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$translate_Request]. + @_i2.experimental + _i1.DynamiteSerializer $translate_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TranslationApiTranslateResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Translate a text. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [translate] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [text] Text to be translated. + /// * [fromLanguage] Language to translate from. + /// * [toLanguage] Language to translate to. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Supported languages returned + /// * 200: Translated text returned + /// * 400: Language not detected or unable to translate + /// * 412: Translating is not possible + /// * 500 /// /// See: - /// * [languages] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [translate] for a method executing this request and parsing the response. + /// * [$translate_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> languagesRaw({ + _i3.Request $translate_Request({ + required String text, + required String toLanguage, + String? fromLanguage, bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $text = _$jsonSerializers.serialize(text, specifiedType: const FullType(String)); + _parameters['text'] = $text; + + final $toLanguage = _$jsonSerializers.serialize(toLanguage, specifiedType: const FullType(String)); + _parameters['toLanguage'] = $toLanguage; + final $fromLanguage = _$jsonSerializers.serialize(fromLanguage, specifiedType: const FullType(String)); + _parameters['fromLanguage'] = $fromLanguage; + + final _path = + _i5.UriTemplate('/ocs/v2.php/translation/translate{?text*,toLanguage*,fromLanguage*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4631,7 +4596,7 @@ class $TranslationApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } @@ -4639,29 +4604,11 @@ class $TranslationApiClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/translation/languages'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $languages_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$translate_Request`. - @_i2.experimental - _i1.DynamiteSerializer $translate_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TranslationApiTranslateResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Translate a text. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -4680,54 +4627,74 @@ class $TranslationApiClient { /// * 500 /// /// See: - /// * [translateRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$translate_Request] for the request send by this method. + /// * [$translate_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> translate({ required String text, required String toLanguage, String? fromLanguage, bool? oCSAPIRequest, }) async { - final _rawResponse = await translateRaw( + final _request = $translate_Request( text: text, toLanguage: toLanguage, fromLanguage: fromLanguage, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $translate_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Translate a text. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $UnifiedSearchClient { + /// Creates a new `DynamiteClient` for unified_search requests. + $UnifiedSearchClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$getProviders_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getProviders_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UnifiedSearchGetProvidersResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the providers for unified search. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getProviders] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [text] Text to be translated. - /// * [fromLanguage] Language to translate from. - /// * [toLanguage] Language to translate to. + /// * [from] the url the user is currently at. Defaults to `''`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Translated text returned - /// * 400: Language not detected or unable to translate - /// * 412: Translating is not possible - /// * 500 + /// * 200: Providers returned /// /// See: - /// * [translate] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getProviders] for a method executing this request and parsing the response. + /// * [$getProviders_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> translateRaw({ - required String text, - required String toLanguage, - String? fromLanguage, + _i3.Request $getProviders_Request({ + String? from, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $from = _$jsonSerializers.serialize(from, specifiedType: const FullType(String)); + $from ??= ''; + _parameters['from'] = $from; + final _path = _i5.UriTemplate('/ocs/v2.php/search/providers{?from*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4737,53 +4704,20 @@ class $TranslationApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $text = _$jsonSerializers.serialize(text, specifiedType: const FullType(String)); - _parameters['text'] = $text; - - final $toLanguage = _$jsonSerializers.serialize(toLanguage, specifiedType: const FullType(String)); - _parameters['toLanguage'] = $toLanguage; - - final $fromLanguage = _$jsonSerializers.serialize(fromLanguage, specifiedType: const FullType(String)); - _parameters['fromLanguage'] = $fromLanguage; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/translation/translate{?text*,toLanguage*,fromLanguage*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $translate_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $UnifiedSearchClient { - /// Creates a new `DynamiteClient` for unified_search requests. - $UnifiedSearchClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$getProviders_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getProviders_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UnifiedSearchGetProvidersResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get the providers for unified search. /// @@ -4798,43 +4732,95 @@ class $UnifiedSearchClient { /// * 200: Providers returned /// /// See: - /// * [getProvidersRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getProviders_Request] for the request send by this method. + /// * [$getProviders_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getProviders({ String? from, bool? oCSAPIRequest, }) async { - final _rawResponse = await getProvidersRaw( + final _request = $getProviders_Request( from: from, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getProviders_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the providers for unified search. + /// Builds a serializer to parse the response of [$search_Request]. + @_i2.experimental + _i1.DynamiteSerializer $search_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UnifiedSearchSearchResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Launch a search for a specific search provider. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Additional filters are available for each provider. Send a request to /providers endpoint to list providers with their available filters. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [search] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [from] the url the user is currently at. Defaults to `''`. + /// * [term] Term to search. Defaults to `''`. + /// * [sortOrder] Order of entries. + /// * [limit] Maximum amount of entries. + /// * [cursor] Offset for searching. + /// * [from] The current user URL. Defaults to `''`. + /// * [providerId] ID of the provider. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Providers returned + /// * 200: Search entries returned + /// * 400: Searching is not possible /// /// See: - /// * [getProviders] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [search] for a method executing this request and parsing the response. + /// * [$search_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getProvidersRaw({ + _i3.Request $search_Request({ + required String providerId, + String? term, + int? sortOrder, + int? limit, + UnifiedSearchSearchCursor? cursor, String? from, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $providerId = _$jsonSerializers.serialize(providerId, specifiedType: const FullType(String)); + _parameters['providerId'] = $providerId; + + var $term = _$jsonSerializers.serialize(term, specifiedType: const FullType(String)); + $term ??= ''; + _parameters['term'] = $term; + + final $sortOrder = _$jsonSerializers.serialize(sortOrder, specifiedType: const FullType(int)); + _parameters['sortOrder'] = $sortOrder; + + final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + _parameters['limit'] = $limit; + + final $cursor = _$jsonSerializers.serialize(cursor, specifiedType: const FullType(UnifiedSearchSearchCursor)); + _parameters['cursor'] = $cursor; + + var $from = _$jsonSerializers.serialize(from, specifiedType: const FullType(String)); + $from ??= ''; + _parameters['from'] = $from; + final _path = + _i5.UriTemplate('/ocs/v2.php/search/providers/{providerId}/search{?term*,sortOrder*,limit*,cursor*,from*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4844,7 +4830,7 @@ class $UnifiedSearchClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -4852,36 +4838,13 @@ class $UnifiedSearchClient { } // coverage:ignore-end - var $from = _$jsonSerializers.serialize(from, specifiedType: const FullType(String)); - $from ??= ''; - _parameters['from'] = $from; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/search/providers{?from*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getProviders_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$search_Request`. - @_i2.experimental - _i1.DynamiteSerializer $search_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UnifiedSearchSearchResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Launch a search for a specific search provider. /// /// Additional filters are available for each provider. Send a request to /providers endpoint to list providers with their available filters. @@ -4903,7 +4866,8 @@ class $UnifiedSearchClient { /// * 400: Searching is not possible /// /// See: - /// * [searchRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$search_Request] for the request send by this method. + /// * [$search_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> search({ required String providerId, String? term, @@ -4913,7 +4877,7 @@ class $UnifiedSearchClient { String? from, bool? oCSAPIRequest, }) async { - final _rawResponse = await searchRaw( + final _request = $search_Request( providerId: providerId, term: term, sortOrder: sortOrder, @@ -4922,47 +4886,51 @@ class $UnifiedSearchClient { from: from, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $search_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Launch a search for a specific search provider. - /// - /// Additional filters are available for each provider. Send a request to /providers endpoint to list providers with their available filters. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $WhatsNewClient { + /// Creates a new `DynamiteClient` for whats_new requests. + $WhatsNewClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$$get_Request]. + @_i2.experimental + _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(WhatsNewGetResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the changes. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [$get] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [term] Term to search. Defaults to `''`. - /// * [sortOrder] Order of entries. - /// * [limit] Maximum amount of entries. - /// * [cursor] Offset for searching. - /// * [from] The current user URL. Defaults to `''`. - /// * [providerId] ID of the provider. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Search entries returned - /// * 400: Searching is not possible + /// * 200: Changes returned + /// * 204: No changes /// /// See: - /// * [search] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [$get] for a method executing this request and parsing the response. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> searchRaw({ - required String providerId, - String? term, - int? sortOrder, - int? limit, - UnifiedSearchSearchCursor? cursor, - String? from, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + _i3.Request $$get_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/core/whatsnew'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4972,7 +4940,7 @@ class $UnifiedSearchClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -4980,58 +4948,12 @@ class $UnifiedSearchClient { } // coverage:ignore-end - final $providerId = _$jsonSerializers.serialize(providerId, specifiedType: const FullType(String)); - _parameters['providerId'] = $providerId; - - var $term = _$jsonSerializers.serialize(term, specifiedType: const FullType(String)); - $term ??= ''; - _parameters['term'] = $term; - - final $sortOrder = _$jsonSerializers.serialize(sortOrder, specifiedType: const FullType(int)); - _parameters['sortOrder'] = $sortOrder; - - final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - _parameters['limit'] = $limit; - - final $cursor = _$jsonSerializers.serialize(cursor, specifiedType: const FullType(UnifiedSearchSearchCursor)); - _parameters['cursor'] = $cursor; - - var $from = _$jsonSerializers.serialize(from, specifiedType: const FullType(String)); - $from ??= ''; - _parameters['from'] = $from; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/search/providers/{providerId}/search{?term*,sortOrder*,limit*,cursor*,from*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $search_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $WhatsNewClient { - /// Creates a new `DynamiteClient` for whats_new requests. - $WhatsNewClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$$get_Request`. - @_i2.experimental - _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(WhatsNewGetResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get the changes. /// @@ -5046,35 +4968,58 @@ class $WhatsNewClient { /// * 204: No changes /// /// See: - /// * [$getRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$$get_Request] for the request send by this method. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> $get({bool? oCSAPIRequest}) async { - final _rawResponse = await $getRaw( + final _request = $$get_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $$get_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the changes. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$dismiss_Request]. + @_i2.experimental + _i1.DynamiteSerializer $dismiss_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(WhatsNewDismissResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Dismiss the changes. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [dismiss] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [version] Version to dismiss the changes for. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Changes returned - /// * 204: No changes + /// * 200: Changes dismissed + /// * 500 /// /// See: - /// * [$get] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [dismiss] for a method executing this request and parsing the response. + /// * [$dismiss_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> $getRaw({bool? oCSAPIRequest}) async { - final _headers = {'Accept': 'application/json'}; + _i3.Request $dismiss_Request({ + required String version, + bool? oCSAPIRequest, + }) { + final _parameters = {}; + final $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); + _parameters['version'] = $version; + final _path = _i5.UriTemplate('/ocs/v2.php/core/whatsnew{?version*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -5084,7 +5029,7 @@ class $WhatsNewClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -5094,28 +5039,11 @@ class $WhatsNewClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/core/whatsnew'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $$get_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$dismiss_Request`. - @_i2.experimental - _i1.DynamiteSerializer $dismiss_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(WhatsNewDismissResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Dismiss the changes. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -5130,77 +5058,22 @@ class $WhatsNewClient { /// * 500 /// /// See: - /// * [dismissRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$dismiss_Request] for the request send by this method. + /// * [$dismiss_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> dismiss({ required String version, bool? oCSAPIRequest, }) async { - final _rawResponse = await dismissRaw( + final _request = $dismiss_Request( version: version, oCSAPIRequest: oCSAPIRequest, ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Dismiss the changes. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [version] Version to dismiss the changes for. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Changes dismissed - /// * 500 - /// - /// See: - /// * [dismiss] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> dismissRaw({ - required String version, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); - _parameters['version'] = $version; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/core/whatsnew{?version*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $dismiss_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -5210,7 +5083,7 @@ class $WipeClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$checkWipe_Request`. + /// Builds a serializer to parse the response of [$checkWipe_Request]. @_i2.experimental _i1.DynamiteSerializer $checkWipe_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(WipeCheckWipeResponseApplicationJson), @@ -5221,31 +5094,7 @@ class $WipeClient { /// Check if the device should be wiped. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [token] App password. - /// - /// Status codes: - /// * 200: Device should be wiped - /// * 404: Device should not be wiped - /// - /// See: - /// * [checkWipeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> checkWipe({required String token}) async { - final _rawResponse = await checkWipeRaw( - token: token, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Check if the device should be wiped. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [checkWipe] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5256,14 +5105,18 @@ class $WipeClient { /// * 404: Device should not be wiped /// /// See: - /// * [checkWipe] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [checkWipe] for a method executing this request and parsing the response. + /// * [$checkWipe_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> checkWipeRaw({ - required String token, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $checkWipe_Request({required String token}) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _parameters['token'] = $token; + final _path = _i5.UriTemplate('/index.php/core/wipe/check{?token*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -5273,36 +5126,16 @@ class $WipeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _parameters['token'] = $token; - - final _path = _i4.UriTemplate('/index.php/core/wipe/check{?token*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $checkWipe_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$wipeDone_Request`. - @_i2.experimental - _i1.DynamiteSerializer $wipeDone_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(JsonObject), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 404}, - ); - - /// Finish the wipe. + /// Check if the device should be wiped. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -5311,24 +5144,36 @@ class $WipeClient { /// * [token] App password. /// /// Status codes: - /// * 200: Wipe finished successfully + /// * 200: Device should be wiped /// * 404: Device should not be wiped /// /// See: - /// * [wipeDoneRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> wipeDone({required String token}) async { - final _rawResponse = await wipeDoneRaw( + /// * [$checkWipe_Request] for the request send by this method. + /// * [$checkWipe_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> checkWipe({required String token}) async { + final _request = $checkWipe_Request( token: token, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $checkWipe_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$wipeDone_Request]. + @_i2.experimental + _i1.DynamiteSerializer $wipeDone_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(JsonObject), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 404}, + ); + /// Finish the wipe. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [wipeDone] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5339,12 +5184,18 @@ class $WipeClient { /// * 404: Device should not be wiped /// /// See: - /// * [wipeDone] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [wipeDone] for a method executing this request and parsing the response. + /// * [$wipeDone_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> wipeDoneRaw({required String token}) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $wipeDone_Request({required String token}) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _parameters['token'] = $token; + final _path = _i5.UriTemplate('/index.php/core/wipe/success{?token*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -5354,24 +5205,39 @@ class $WipeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _parameters['token'] = $token; + return _request; + } - final _path = _i4.UriTemplate('/index.php/core/wipe/success{?token*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + /// Finish the wipe. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [token] App password. + /// + /// Status codes: + /// * 200: Wipe finished successfully + /// * 404: Device should not be wiped + /// + /// See: + /// * [$wipeDone_Request] for the request send by this method. + /// * [$wipeDone_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> wipeDone({required String token}) async { + final _request = $wipeDone_Request( + token: token, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $wipeDone_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -13431,13 +13297,13 @@ extension $87e48e5649cd72b4d2947aaaea13ccd8Extension on _$87e48e5649cd72b4d2947a List get _names => const ['autocompleteResultStatus0', 'string']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -13510,13 +13376,13 @@ extension $b2c4857c0136baea42828d89c87c757dExtension on _$b2c4857c0136baea42828d List get _names => const [r'$int', 'string']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -13589,13 +13455,13 @@ extension $46564992d3ed3482aa6c1162698aac99Extension on _$46564992d3ed3482aa6c11 List get _names => const ['builtListNever', 'sharebymailCapabilities0']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -13670,13 +13536,13 @@ extension $06c2e47196a84ebc3718dccf9eb4b29dExtension on _$06c2e47196a84ebc3718dc List get _names => const ['builtListNever', 'spreedPublicCapabilities0']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -13798,13 +13664,13 @@ extension $d7df54b8bef6b092d401eed2bcfbb6f0Extension on _$d7df54b8bef6b092d401ee ]; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -14880,9 +14746,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) + ..add(_i6.DynamiteDoubleSerializer()) ..addPlugin( - _i6.StandardJsonPlugin( + _i7.StandardJsonPlugin( typesToLeaveAsList: const { _$87e48e5649cd72b4d2947aaaea13ccd8, _$b2c4857c0136baea42828d89c87c757d, @@ -14892,7 +14758,7 @@ final Serializers _$jsonSerializers = (_$serializers.toBuilder() }, ), ) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/dashboard.openapi.dart b/packages/nextcloud/lib/src/api/dashboard.openapi.dart index 85e05a3983d..edd86764ddd 100644 --- a/packages/nextcloud/lib/src/api/dashboard.openapi.dart +++ b/packages/nextcloud/lib/src/api/dashboard.openapi.dart @@ -18,14 +18,15 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; import 'package:dynamite_runtime/models.dart'; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i4; +import 'package:uri/uri.dart' as _i5; part 'dashboard.openapi.g.dart'; @@ -58,7 +59,7 @@ class $DashboardApiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getWidgets_Request`. + /// Builds a serializer to parse the response of [$getWidgets_Request]. @_i2.experimental _i1.DynamiteSerializer $getWidgets_Serializer() => _i1.DynamiteSerializer( @@ -70,7 +71,7 @@ class $DashboardApiClient { /// Get the widgets. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getWidgets] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -80,38 +81,14 @@ class $DashboardApiClient { /// * 200: Widgets returned /// /// See: - /// * [getWidgetsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getWidgets({ - bool? oCSAPIRequest, - }) async { - final _rawResponse = await getWidgetsRaw( - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get the widgets. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Widgets returned - /// - /// See: - /// * [getWidgets] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getWidgets] for a method executing this request and parsing the response. + /// * [$getWidgets_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getWidgetsRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getWidgets_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/dashboard/api/v1/widgets'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -121,7 +98,7 @@ class $DashboardApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -131,66 +108,52 @@ class $DashboardApiClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/dashboard/api/v1/widgets'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getWidgets_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getWidgetItems_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getWidgetItems_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(DashboardApiGetWidgetItemsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get the items for the widgets. + /// Get the widgets. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [sinceIds] Array indexed by widget Ids, contains date/id from which we want the new items. - /// * [limit] Limit number of result items per widget. Defaults to `7`. - /// * [widgets] Limit results to specific widgets. Defaults to `[]`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Widget items returned + /// * 200: Widgets returned /// /// See: - /// * [getWidgetItemsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getWidgetItems({ - ContentString>? sinceIds, - int? limit, - BuiltList? widgets, + /// * [$getWidgets_Request] for the request send by this method. + /// * [$getWidgets_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getWidgets({ bool? oCSAPIRequest, }) async { - final _rawResponse = await getWidgetItemsRaw( - sinceIds: sinceIds, - limit: limit, - widgets: widgets, + final _request = $getWidgets_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getWidgets_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getWidgetItems_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getWidgetItems_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(DashboardApiGetWidgetItemsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the items for the widgets. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getWidgetItems] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -203,17 +166,37 @@ class $DashboardApiClient { /// * 200: Widget items returned /// /// See: - /// * [getWidgetItems] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getWidgetItems] for a method executing this request and parsing the response. + /// * [$getWidgetItems_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getWidgetItemsRaw({ + _i3.Request $getWidgetItems_Request({ ContentString>? sinceIds, int? limit, BuiltList? widgets, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $sinceIds = _$jsonSerializers.serialize( + sinceIds, + specifiedType: const FullType(ContentString, [ + FullType(BuiltMap, [FullType(String), FullType(String)]), + ]), + ); + _parameters['sinceIds'] = $sinceIds; + + var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + $limit ??= 7; + _parameters['limit'] = $limit; + + var $widgets = _$jsonSerializers.serialize(widgets, specifiedType: const FullType(BuiltList, [FullType(String)])); + $widgets ??= []; + _parameters['widgets%5B%5D'] = $widgets; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/dashboard/api/v1/widget-items{?sinceIds*,limit*,widgets%5B%5D*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -223,7 +206,7 @@ class $DashboardApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -231,53 +214,15 @@ class $DashboardApiClient { } // coverage:ignore-end - final $sinceIds = _$jsonSerializers.serialize( - sinceIds, - specifiedType: const FullType(ContentString, [ - FullType(BuiltMap, [FullType(String), FullType(String)]), - ]), - ); - _parameters['sinceIds'] = $sinceIds; - - var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - $limit ??= 7; - _parameters['limit'] = $limit; - - var $widgets = _$jsonSerializers.serialize(widgets, specifiedType: const FullType(BuiltList, [FullType(String)])); - $widgets ??= []; - _parameters['widgets%5B%5D'] = $widgets; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/dashboard/api/v1/widget-items{?sinceIds*,limit*,widgets%5B%5D*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getWidgetItems_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getWidgetItemsV2_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getWidgetItemsV2_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(DashboardApiGetWidgetItemsV2ResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get the items for the widgets. /// - /// Only available since 27.1. - /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -291,30 +236,44 @@ class $DashboardApiClient { /// * 200: Widget items returned /// /// See: - /// * [getWidgetItemsV2Raw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getWidgetItemsV2({ + /// * [$getWidgetItems_Request] for the request send by this method. + /// * [$getWidgetItems_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getWidgetItems({ ContentString>? sinceIds, int? limit, BuiltList? widgets, bool? oCSAPIRequest, }) async { - final _rawResponse = await getWidgetItemsV2Raw( + final _request = $getWidgetItems_Request( sinceIds: sinceIds, limit: limit, widgets: widgets, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getWidgetItems_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getWidgetItemsV2_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getWidgetItemsV2_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(DashboardApiGetWidgetItemsV2ResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the items for the widgets. /// /// Only available since 27.1. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getWidgetItemsV2] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -327,17 +286,37 @@ class $DashboardApiClient { /// * 200: Widget items returned /// /// See: - /// * [getWidgetItemsV2] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getWidgetItemsV2] for a method executing this request and parsing the response. + /// * [$getWidgetItemsV2_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getWidgetItemsV2Raw({ + _i3.Request $getWidgetItemsV2_Request({ ContentString>? sinceIds, int? limit, BuiltList? widgets, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $sinceIds = _$jsonSerializers.serialize( + sinceIds, + specifiedType: const FullType(ContentString, [ + FullType(BuiltMap, [FullType(String), FullType(String)]), + ]), + ); + _parameters['sinceIds'] = $sinceIds; + + var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + $limit ??= 7; + _parameters['limit'] = $limit; + + var $widgets = _$jsonSerializers.serialize(widgets, specifiedType: const FullType(BuiltList, [FullType(String)])); + $widgets ??= []; + _parameters['widgets%5B%5D'] = $widgets; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/dashboard/api/v2/widget-items{?sinceIds*,limit*,widgets%5B%5D*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -347,7 +326,7 @@ class $DashboardApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -355,37 +334,51 @@ class $DashboardApiClient { } // coverage:ignore-end - final $sinceIds = _$jsonSerializers.serialize( - sinceIds, - specifiedType: const FullType(ContentString, [ - FullType(BuiltMap, [FullType(String), FullType(String)]), - ]), - ); - _parameters['sinceIds'] = $sinceIds; - - var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - $limit ??= 7; - _parameters['limit'] = $limit; - - var $widgets = _$jsonSerializers.serialize(widgets, specifiedType: const FullType(BuiltList, [FullType(String)])); - $widgets ??= []; - _parameters['widgets%5B%5D'] = $widgets; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/dashboard/api/v2/widget-items{?sinceIds*,limit*,widgets%5B%5D*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + return _request; + } + + /// Get the items for the widgets. + /// + /// Only available since 27.1. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [sinceIds] Array indexed by widget Ids, contains date/id from which we want the new items. + /// * [limit] Limit number of result items per widget. Defaults to `7`. + /// * [widgets] Limit results to specific widgets. Defaults to `[]`. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Widget items returned + /// + /// See: + /// * [$getWidgetItemsV2_Request] for the request send by this method. + /// * [$getWidgetItemsV2_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getWidgetItemsV2({ + ContentString>? sinceIds, + int? limit, + BuiltList? widgets, + bool? oCSAPIRequest, + }) async { + final _request = $getWidgetItemsV2_Request( + sinceIds: sinceIds, + limit: limit, + widgets: widgets, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getWidgetItemsV2_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -895,9 +888,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin()) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin()) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/dav.openapi.dart b/packages/nextcloud/lib/src/api/dav.openapi.dart index 5e14bbce89b..313f4776f55 100644 --- a/packages/nextcloud/lib/src/api/dav.openapi.dart +++ b/packages/nextcloud/lib/src/api/dav.openapi.dart @@ -18,11 +18,12 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i5; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; import 'package:uri/uri.dart' as _i4; @@ -59,7 +60,7 @@ class $DirectClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getUrl_Request`. + /// Builds a serializer to parse the response of [$getUrl_Request]. @_i2.experimental _i1.DynamiteSerializer $getUrl_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(DirectGetUrlResponseApplicationJson), @@ -70,7 +71,7 @@ class $DirectClient { /// Get a direct link to a file. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getUrl] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -85,26 +86,52 @@ class $DirectClient { /// * 403: Missing permissions to get direct link /// /// See: - /// * [getUrlRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getUrl({ + /// * [getUrl] for a method executing this request and parsing the response. + /// * [$getUrl_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getUrl_Request({ required int fileId, required int expirationTime, bool? oCSAPIRequest, - }) async { - final _rawResponse = await getUrlRaw( - fileId: fileId, - expirationTime: expirationTime, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); + _parameters['fileId'] = $fileId; + + final $expirationTime = _$jsonSerializers.serialize(expirationTime, specifiedType: const FullType(int)); + _parameters['expirationTime'] = $expirationTime; + + final _path = _i4.UriTemplate('/ocs/v2.php/apps/dav/api/v1/direct{?fileId*,expirationTime*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Get a direct link to a file. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -119,52 +146,24 @@ class $DirectClient { /// * 403: Missing permissions to get direct link /// /// See: - /// * [getUrl] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getUrlRaw({ + /// * [$getUrl_Request] for the request send by this method. + /// * [$getUrl_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getUrl({ required int fileId, required int expirationTime, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); - _parameters['fileId'] = $fileId; - - final $expirationTime = _$jsonSerializers.serialize(expirationTime, specifiedType: const FullType(int)); - _parameters['expirationTime'] = $expirationTime; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/dav/api/v1/direct{?fileId*,expirationTime*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _request = $getUrl_Request( + fileId: fileId, + expirationTime: expirationTime, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getUrl_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -174,7 +173,7 @@ class $OutOfOfficeClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getCurrentOutOfOfficeData_Request`. + /// Builds a serializer to parse the response of [$getCurrentOutOfOfficeData_Request]. @_i2.experimental _i1.DynamiteSerializer $getCurrentOutOfOfficeData_Serializer() => _i1.DynamiteSerializer( @@ -186,7 +185,7 @@ class $OutOfOfficeClient { /// Get the currently configured out-of-office data of a user. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getCurrentOutOfOfficeData] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -198,46 +197,21 @@ class $OutOfOfficeClient { /// * 404: No out-of-office data was found /// /// See: - /// * [getCurrentOutOfOfficeDataRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - getCurrentOutOfOfficeData({ - required String userId, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await getCurrentOutOfOfficeDataRaw( - userId: userId, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get the currently configured out-of-office data of a user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [userId] The user id to get out-of-office data for. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Out-of-office data - /// * 404: No out-of-office data was found - /// - /// See: - /// * [getCurrentOutOfOfficeData] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getCurrentOutOfOfficeData] for a method executing this request and parsing the response. + /// * [$getCurrentOutOfOfficeData_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getCurrentOutOfOfficeDataRaw({ + _i3.Request $getCurrentOutOfOfficeData_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/dav/api/v1/outOfOffice/{userId}/now').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -247,7 +221,7 @@ class $OutOfOfficeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -255,36 +229,14 @@ class $OutOfOfficeClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/dav/api/v1/outOfOffice/{userId}/now').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getCurrentOutOfOfficeData_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getOutOfOffice_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getOutOfOffice_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(OutOfOfficeGetOutOfOfficeResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get the configured out-of-office data of a user. + /// Get the currently configured out-of-office data of a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -298,24 +250,39 @@ class $OutOfOfficeClient { /// * 404: No out-of-office data was found /// /// See: - /// * [getOutOfOfficeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getOutOfOffice({ + /// * [$getCurrentOutOfOfficeData_Request] for the request send by this method. + /// * [$getCurrentOutOfOfficeData_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + getCurrentOutOfOfficeData({ required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await getOutOfOfficeRaw( + final _request = $getCurrentOutOfOfficeData_Request( userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getCurrentOutOfOfficeData_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getOutOfOffice_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getOutOfOffice_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(OutOfOfficeGetOutOfOfficeResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the configured out-of-office data of a user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getOutOfOffice] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -327,15 +294,21 @@ class $OutOfOfficeClient { /// * 404: No out-of-office data was found /// /// See: - /// * [getOutOfOffice] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getOutOfOffice] for a method executing this request and parsing the response. + /// * [$getOutOfOffice_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getOutOfOfficeRaw({ + _i3.Request $getOutOfOffice_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/dav/api/v1/outOfOffice/{userId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -345,7 +318,7 @@ class $OutOfOfficeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -353,80 +326,59 @@ class $OutOfOfficeClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/dav/api/v1/outOfOffice/{userId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getOutOfOffice_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setOutOfOffice_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setOutOfOffice_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(OutOfOfficeSetOutOfOfficeResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Set out-of-office absence. + /// Get the configured out-of-office data of a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [firstDay] First day of the absence in format `YYYY-MM-DD`. - /// * [lastDay] Last day of the absence in format `YYYY-MM-DD`. - /// * [status] Short text that is set as user status during the absence. - /// * [message] Longer multiline message that is shown to others during the absence. - /// * [userId] + /// * [userId] The user id to get out-of-office data for. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Absence data - /// * 400: When the first day is not before the last day - /// * 401: When the user is not logged in + /// * 200: Out-of-office data + /// * 404: No out-of-office data was found /// /// See: - /// * [setOutOfOfficeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setOutOfOffice({ - required String firstDay, - required String lastDay, - required String status, - required String message, + /// * [$getOutOfOffice_Request] for the request send by this method. + /// * [$getOutOfOffice_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getOutOfOffice({ required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await setOutOfOfficeRaw( - firstDay: firstDay, - lastDay: lastDay, - status: status, - message: message, + final _request = $getOutOfOffice_Request( userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getOutOfOffice_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$setOutOfOffice_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setOutOfOffice_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(OutOfOfficeSetOutOfOfficeResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Set out-of-office absence. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setOutOfOffice] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -443,36 +395,18 @@ class $OutOfOfficeClient { /// * 401: When the user is not logged in /// /// See: - /// * [setOutOfOffice] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setOutOfOffice] for a method executing this request and parsing the response. + /// * [$setOutOfOffice_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setOutOfOfficeRaw({ + _i3.Request $setOutOfOffice_Request({ required String firstDay, required String lastDay, required String status, required String message, required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $firstDay = _$jsonSerializers.serialize(firstDay, specifiedType: const FullType(String)); _parameters['firstDay'] = $firstDay; @@ -488,66 +422,95 @@ class $OutOfOfficeClient { final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/dav/api/v1/outOfOffice/{userId}{?firstDay*,lastDay*,status*,message*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $setOutOfOffice_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); - } - - /// Builds a serializer to parse the response of `$clearOutOfOffice_Request`. - @_i2.experimental - _i1.DynamiteSerializer $clearOutOfOffice_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(OutOfOfficeClearOutOfOfficeResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 401}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Clear the out-of-office. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Set out-of-office absence. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [firstDay] First day of the absence in format `YYYY-MM-DD`. + /// * [lastDay] Last day of the absence in format `YYYY-MM-DD`. + /// * [status] Short text that is set as user status during the absence. + /// * [message] Longer multiline message that is shown to others during the absence. /// * [userId] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: When the absence was cleared successfully + /// * 200: Absence data + /// * 400: When the first day is not before the last day /// * 401: When the user is not logged in /// /// See: - /// * [clearOutOfOfficeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> clearOutOfOffice({ + /// * [$setOutOfOffice_Request] for the request send by this method. + /// * [$setOutOfOffice_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setOutOfOffice({ + required String firstDay, + required String lastDay, + required String status, + required String message, required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await clearOutOfOfficeRaw( + final _request = $setOutOfOffice_Request( + firstDay: firstDay, + lastDay: lastDay, + status: status, + message: message, userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setOutOfOffice_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$clearOutOfOffice_Request]. + @_i2.experimental + _i1.DynamiteSerializer $clearOutOfOffice_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(OutOfOfficeClearOutOfOfficeResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 401}, + ); + /// Clear the out-of-office. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [clearOutOfOffice] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -559,15 +522,21 @@ class $OutOfOfficeClient { /// * 401: When the user is not logged in /// /// See: - /// * [clearOutOfOffice] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [clearOutOfOffice] for a method executing this request and parsing the response. + /// * [$clearOutOfOffice_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> clearOutOfOfficeRaw({ + _i3.Request $clearOutOfOffice_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/dav/api/v1/outOfOffice/{userId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -577,7 +546,7 @@ class $OutOfOfficeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -585,23 +554,44 @@ class $OutOfOfficeClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/dav/api/v1/outOfOffice/{userId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, + return _request; + } + + /// Clear the out-of-office. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [userId] + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: When the absence was cleared successfully + /// * 401: When the user is not logged in + /// + /// See: + /// * [$clearOutOfOffice_Request] for the request send by this method. + /// * [$clearOutOfOffice_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> clearOutOfOffice({ + required String userId, + bool? oCSAPIRequest, + }) async { + final _request = $clearOutOfOffice_Request( + userId: userId, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $clearOutOfOffice_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -1321,9 +1311,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin()) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin()) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/files.openapi.dart b/packages/nextcloud/lib/src/api/files.openapi.dart index 21e944fb243..61249408fb8 100644 --- a/packages/nextcloud/lib/src/api/files.openapi.dart +++ b/packages/nextcloud/lib/src/api/files.openapi.dart @@ -21,13 +21,14 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i4; +import 'package:uri/uri.dart' as _i5; part 'files.openapi.g.dart'; @@ -68,7 +69,7 @@ class $ApiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getThumbnail_Request`. + /// Builds a serializer to parse the response of [$getThumbnail_Request]. @_i2.experimental _i1.DynamiteSerializer $getThumbnail_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -79,7 +80,7 @@ class $ApiClient { /// Gets a thumbnail of the specified file. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getThumbnail] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -93,26 +94,56 @@ class $ApiClient { /// * 404: File not found /// /// See: - /// * [getThumbnailRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getThumbnail({ + /// * [getThumbnail] for a method executing this request and parsing the response. + /// * [$getThumbnail_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getThumbnail_Request({ required int x, required int y, required String file, - }) async { - final _rawResponse = await getThumbnailRaw( - x: x, - y: y, - file: file, + }) { + final _parameters = {}; + final $x = _$jsonSerializers.serialize(x, specifiedType: const FullType(int)); + _parameters['x'] = $x; + + final $y = _$jsonSerializers.serialize(y, specifiedType: const FullType(int)); + _parameters['y'] = $y; + + final $file = _$jsonSerializers.serialize(file, specifiedType: const FullType(String)); + _i4.checkPattern( + $file as String?, + RegExp(r'^.+$'), + 'file', ); + _parameters['file'] = $file; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + final _path = _i5.UriTemplate('/index.php/apps/files/api/v1/thumbnail/{x}/{y}/{file}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + return _request; } /// Gets a thumbnail of the specified file. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -126,56 +157,23 @@ class $ApiClient { /// * 404: File not found /// /// See: - /// * [getThumbnail] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getThumbnailRaw({ + /// * [$getThumbnail_Request] for the request send by this method. + /// * [$getThumbnail_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getThumbnail({ required int x, required int y, required String file, }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $x = _$jsonSerializers.serialize(x, specifiedType: const FullType(int)); - _parameters['x'] = $x; - - final $y = _$jsonSerializers.serialize(y, specifiedType: const FullType(int)); - _parameters['y'] = $y; - - final $file = _$jsonSerializers.serialize(file, specifiedType: const FullType(String)); - _i3.checkPattern( - $file as String?, - RegExp(r'^.+$'), - 'file', - ); - _parameters['file'] = $file; - - final _path = _i4.UriTemplate('/index.php/apps/files/api/v1/thumbnail/{x}/{y}/{file}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getThumbnail_Request( + x: x, + y: y, + file: file, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getThumbnail_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -185,7 +183,7 @@ class $DirectEditingClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$info_Request`. + /// Builds a serializer to parse the response of [$info_Request]. @_i2.experimental _i1.DynamiteSerializer $info_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(DirectEditingInfoResponseApplicationJson), @@ -194,6 +192,50 @@ class $DirectEditingClient { validStatuses: const {200}, ); + /// Get the direct editing capabilities. + /// + /// Returns a `DynamiteRequest` backing the [info] operation. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Direct editing capabilities returned + /// + /// See: + /// * [info] for a method executing this request and parsing the response. + /// * [$info_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $info_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/files/api/v1/directEditing'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + /// Get the direct editing capabilities. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -206,34 +248,65 @@ class $DirectEditingClient { /// * 200: Direct editing capabilities returned /// /// See: - /// * [infoRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$info_Request] for the request send by this method. + /// * [$info_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> info({bool? oCSAPIRequest}) async { - final _rawResponse = await infoRaw( + final _request = $info_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $info_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the direct editing capabilities. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$templates_Request]. + @_i2.experimental + _i1.DynamiteSerializer $templates_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(DirectEditingTemplatesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the templates for direct editing. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [templates] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [editorId] ID of the editor. + /// * [creatorId] ID of the creator. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Direct editing capabilities returned + /// * 200: Templates returned + /// * 500 /// /// See: - /// * [info] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [templates] for a method executing this request and parsing the response. + /// * [$templates_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> infoRaw({bool? oCSAPIRequest}) async { - final _headers = {'Accept': 'application/json'}; + _i3.Request $templates_Request({ + required String editorId, + required String creatorId, + bool? oCSAPIRequest, + }) { + final _parameters = {}; + final $editorId = _$jsonSerializers.serialize(editorId, specifiedType: const FullType(String)); + _parameters['editorId'] = $editorId; + + final $creatorId = _$jsonSerializers.serialize(creatorId, specifiedType: const FullType(String)); + _parameters['creatorId'] = $creatorId; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/directEditing/templates/{editorId}/{creatorId}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -243,7 +316,7 @@ class $DirectEditingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -253,29 +326,11 @@ class $DirectEditingClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/files/api/v1/directEditing'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $info_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$templates_Request`. - @_i2.experimental - _i1.DynamiteSerializer $templates_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(DirectEditingTemplatesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get the templates for direct editing. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -291,48 +346,76 @@ class $DirectEditingClient { /// * 500 /// /// See: - /// * [templatesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$templates_Request] for the request send by this method. + /// * [$templates_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> templates({ required String editorId, required String creatorId, bool? oCSAPIRequest, }) async { - final _rawResponse = await templatesRaw( + final _request = $templates_Request( editorId: editorId, creatorId: creatorId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $templates_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the templates for direct editing. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$open_Request]. + @_i2.experimental + _i1.DynamiteSerializer $open_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(DirectEditingOpenResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Open a file for direct editing. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [open] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [path] Path of the file. /// * [editorId] ID of the editor. - /// * [creatorId] ID of the creator. + /// * [fileId] ID of the file. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Templates returned + /// * 200: URL for direct editing returned + /// * 403: Opening file is not allowed /// * 500 /// /// See: - /// * [templates] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [open] for a method executing this request and parsing the response. + /// * [$open_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> templatesRaw({ - required String editorId, - required String creatorId, + _i3.Request $open_Request({ + required String path, + String? editorId, + int? fileId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); + _parameters['path'] = $path; + + final $editorId = _$jsonSerializers.serialize(editorId, specifiedType: const FullType(String)); + _parameters['editorId'] = $editorId; + + final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); + _parameters['fileId'] = $fileId; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/directEditing/open{?path*,editorId*,fileId*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -342,7 +425,7 @@ class $DirectEditingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -350,37 +433,13 @@ class $DirectEditingClient { } // coverage:ignore-end - final $editorId = _$jsonSerializers.serialize(editorId, specifiedType: const FullType(String)); - _parameters['editorId'] = $editorId; - - final $creatorId = _$jsonSerializers.serialize(creatorId, specifiedType: const FullType(String)); - _parameters['creatorId'] = $creatorId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/directEditing/templates/{editorId}/{creatorId}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $templates_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$open_Request`. - @_i2.experimental - _i1.DynamiteSerializer $open_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(DirectEditingOpenResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Open a file for direct editing. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -398,34 +457,48 @@ class $DirectEditingClient { /// * 500 /// /// See: - /// * [openRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$open_Request] for the request send by this method. + /// * [$open_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> open({ required String path, String? editorId, int? fileId, bool? oCSAPIRequest, }) async { - final _rawResponse = await openRaw( + final _request = $open_Request( path: path, editorId: editorId, fileId: fileId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $open_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Open a file for direct editing. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$create_Request]. + @_i2.experimental + _i1.DynamiteSerializer $create_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(DirectEditingCreateResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Create a file for direct editing. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [create] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [path] Path of the file. /// * [editorId] ID of the editor. - /// * [fileId] ID of the file. + /// * [creatorId] ID of the creator. + /// * [templateId] ID of the template. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: @@ -434,17 +507,35 @@ class $DirectEditingClient { /// * 500 /// /// See: - /// * [open] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [create] for a method executing this request and parsing the response. + /// * [$create_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> openRaw({ + _i3.Request $create_Request({ required String path, - String? editorId, - int? fileId, + required String editorId, + required String creatorId, + String? templateId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); + _parameters['path'] = $path; + + final $editorId = _$jsonSerializers.serialize(editorId, specifiedType: const FullType(String)); + _parameters['editorId'] = $editorId; + + final $creatorId = _$jsonSerializers.serialize(creatorId, specifiedType: const FullType(String)); + _parameters['creatorId'] = $creatorId; + + final $templateId = _$jsonSerializers.serialize(templateId, specifiedType: const FullType(String)); + _parameters['templateId'] = $templateId; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/directEditing/create{?path*,editorId*,creatorId*,templateId*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -454,7 +545,7 @@ class $DirectEditingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -462,41 +553,13 @@ class $DirectEditingClient { } // coverage:ignore-end - final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); - _parameters['path'] = $path; - - final $editorId = _$jsonSerializers.serialize(editorId, specifiedType: const FullType(String)); - _parameters['editorId'] = $editorId; - - final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); - _parameters['fileId'] = $fileId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/directEditing/open{?path*,editorId*,fileId*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $open_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$create_Request`. - @_i2.experimental - _i1.DynamiteSerializer $create_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(DirectEditingCreateResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Create a file for direct editing. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -515,7 +578,8 @@ class $DirectEditingClient { /// * 500 /// /// See: - /// * [createRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$create_Request] for the request send by this method. + /// * [$create_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> create({ required String path, required String editorId, @@ -523,49 +587,67 @@ class $DirectEditingClient { String? templateId, bool? oCSAPIRequest, }) async { - final _rawResponse = await createRaw( + final _request = $create_Request( path: path, editorId: editorId, creatorId: creatorId, templateId: templateId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $create_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Create a file for direct editing. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $OpenLocalEditorClient { + /// Creates a new `DynamiteClient` for open_local_editor requests. + $OpenLocalEditorClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$create_Request]. + @_i2.experimental + _i1.DynamiteSerializer $create_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(OpenLocalEditorCreateResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Create a local editor. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [create] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [path] Path of the file. - /// * [editorId] ID of the editor. - /// * [creatorId] ID of the creator. - /// * [templateId] ID of the template. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: URL for direct editing returned - /// * 403: Opening file is not allowed + /// * 200: Local editor returned /// * 500 /// /// See: - /// * [create] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [create] for a method executing this request and parsing the response. + /// * [$create_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createRaw({ + _i3.Request $create_Request({ required String path, - required String editorId, - required String creatorId, - String? templateId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); + _parameters['path'] = $path; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/openlocaleditor{?path*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -575,7 +657,7 @@ class $DirectEditingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -583,51 +665,12 @@ class $DirectEditingClient { } // coverage:ignore-end - final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); - _parameters['path'] = $path; - - final $editorId = _$jsonSerializers.serialize(editorId, specifiedType: const FullType(String)); - _parameters['editorId'] = $editorId; - - final $creatorId = _$jsonSerializers.serialize(creatorId, specifiedType: const FullType(String)); - _parameters['creatorId'] = $creatorId; - - final $templateId = _$jsonSerializers.serialize(templateId, specifiedType: const FullType(String)); - _parameters['templateId'] = $templateId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/directEditing/create{?path*,editorId*,creatorId*,templateId*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $create_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $OpenLocalEditorClient { - /// Creates a new `DynamiteClient` for open_local_editor requests. - $OpenLocalEditorClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$create_Request`. - @_i2.experimental - _i1.DynamiteSerializer $create_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(OpenLocalEditorCreateResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Create a local editor. /// @@ -643,44 +686,68 @@ class $OpenLocalEditorClient { /// * 500 /// /// See: - /// * [createRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$create_Request] for the request send by this method. + /// * [$create_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> create({ required String path, bool? oCSAPIRequest, }) async { - final _rawResponse = await createRaw( + final _request = $create_Request( path: path, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $create_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Create a local editor. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$validate_Request]. + @_i2.experimental + _i1.DynamiteSerializer $validate_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(OpenLocalEditorValidateResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Validate a local editor. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [validate] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [path] Path of the file. + /// * [token] Token of the local editor. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Local editor returned - /// * 500 + /// * 200: Local editor validated successfully + /// * 404: Local editor not found /// /// See: - /// * [create] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [validate] for a method executing this request and parsing the response. + /// * [$validate_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createRaw({ + _i3.Request $validate_Request({ required String path, + required String token, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); + _parameters['path'] = $path; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _parameters['token'] = $token; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/openlocaleditor/{token}{?path*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -690,7 +757,7 @@ class $OpenLocalEditorClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -698,34 +765,13 @@ class $OpenLocalEditorClient { } // coverage:ignore-end - final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); - _parameters['path'] = $path; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/openlocaleditor{?path*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $create_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$validate_Request`. - @_i2.experimental - _i1.DynamiteSerializer $validate_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(OpenLocalEditorValidateResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Validate a local editor. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -741,48 +787,62 @@ class $OpenLocalEditorClient { /// * 404: Local editor not found /// /// See: - /// * [validateRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$validate_Request] for the request send by this method. + /// * [$validate_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> validate({ required String path, required String token, bool? oCSAPIRequest, }) async { - final _rawResponse = await validateRaw( + final _request = $validate_Request( path: path, token: token, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $validate_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Validate a local editor. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $TemplateClient { + /// Creates a new `DynamiteClient` for template requests. + $TemplateClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$list_Request]. + @_i2.experimental + _i1.DynamiteSerializer $list_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(TemplateListResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// List the available templates. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [list] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [path] Path of the file. - /// * [token] Token of the local editor. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Local editor validated successfully - /// * 404: Local editor not found + /// * 200: Available templates returned /// /// See: - /// * [validate] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [list] for a method executing this request and parsing the response. + /// * [$list_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> validateRaw({ - required String path, - required String token, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + _i3.Request $list_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/files/api/v1/templates'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -792,7 +852,7 @@ class $OpenLocalEditorClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -800,42 +860,12 @@ class $OpenLocalEditorClient { } // coverage:ignore-end - final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); - _parameters['path'] = $path; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _parameters['token'] = $token; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/openlocaleditor/{token}{?path*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $validate_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $TemplateClient { - /// Creates a new `DynamiteClient` for template requests. - $TemplateClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$list_Request`. - @_i2.experimental - _i1.DynamiteSerializer $list_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(TemplateListResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// List the available templates. /// @@ -849,34 +879,72 @@ class $TemplateClient { /// * 200: Available templates returned /// /// See: - /// * [listRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$list_Request] for the request send by this method. + /// * [$list_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> list({bool? oCSAPIRequest}) async { - final _rawResponse = await listRaw( + final _request = $list_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $list_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// List the available templates. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$create_Request]. + @_i2.experimental + _i1.DynamiteSerializer $create_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(TemplateCreateResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Create a template. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [create] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [filePath] Path of the file. + /// * [templatePath] Name of the template. Defaults to `''`. + /// * [templateType] Type of the template. Defaults to `user`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Available templates returned + /// * 200: Template created successfully + /// * 403: Creating template is not allowed /// /// See: - /// * [list] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [create] for a method executing this request and parsing the response. + /// * [$create_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> listRaw({bool? oCSAPIRequest}) async { - final _headers = {'Accept': 'application/json'}; + _i3.Request $create_Request({ + required String filePath, + String? templatePath, + String? templateType, + bool? oCSAPIRequest, + }) { + final _parameters = {}; + final $filePath = _$jsonSerializers.serialize(filePath, specifiedType: const FullType(String)); + _parameters['filePath'] = $filePath; + + var $templatePath = _$jsonSerializers.serialize(templatePath, specifiedType: const FullType(String)); + $templatePath ??= ''; + _parameters['templatePath'] = $templatePath; + + var $templateType = _$jsonSerializers.serialize(templateType, specifiedType: const FullType(String)); + $templateType ??= 'user'; + _parameters['templateType'] = $templateType; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/templates/create{?filePath*,templatePath*,templateType*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -886,7 +954,7 @@ class $TemplateClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -896,28 +964,11 @@ class $TemplateClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/apps/files/api/v1/templates'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $list_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$create_Request`. - @_i2.experimental - _i1.DynamiteSerializer $create_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(TemplateCreateResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Create a template. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -934,52 +985,77 @@ class $TemplateClient { /// * 403: Creating template is not allowed /// /// See: - /// * [createRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$create_Request] for the request send by this method. + /// * [$create_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> create({ required String filePath, String? templatePath, String? templateType, bool? oCSAPIRequest, }) async { - final _rawResponse = await createRaw( + final _request = $create_Request( filePath: filePath, templatePath: templatePath, templateType: templateType, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $create_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Create a template. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$path_Request]. + @_i2.experimental + _i1.DynamiteSerializer $path_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(TemplatePathResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Initialize the template directory. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [path] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [filePath] Path of the file. - /// * [templatePath] Name of the template. Defaults to `''`. - /// * [templateType] Type of the template. Defaults to `user`. + /// * [templatePath] Path of the template directory. Defaults to `''`. + /// * [copySystemTemplates] Whether to copy the system templates to the template directory. Defaults to `0`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Template created successfully - /// * 403: Creating template is not allowed + /// * 200: Template directory initialized successfully + /// * 403: Initializing the template directory is not allowed /// /// See: - /// * [create] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [path] for a method executing this request and parsing the response. + /// * [$path_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createRaw({ - required String filePath, + _i3.Request $path_Request({ String? templatePath, - String? templateType, + TemplatePathCopySystemTemplates? copySystemTemplates, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $templatePath = _$jsonSerializers.serialize(templatePath, specifiedType: const FullType(String)); + $templatePath ??= ''; + _parameters['templatePath'] = $templatePath; + + var $copySystemTemplates = _$jsonSerializers.serialize( + copySystemTemplates, + specifiedType: const FullType(TemplatePathCopySystemTemplates), + ); + $copySystemTemplates ??= 0; + _parameters['copySystemTemplates'] = $copySystemTemplates; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/templates/path{?templatePath*,copySystemTemplates*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -989,7 +1065,7 @@ class $TemplateClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -997,43 +1073,13 @@ class $TemplateClient { } // coverage:ignore-end - final $filePath = _$jsonSerializers.serialize(filePath, specifiedType: const FullType(String)); - _parameters['filePath'] = $filePath; - - var $templatePath = _$jsonSerializers.serialize(templatePath, specifiedType: const FullType(String)); - $templatePath ??= ''; - _parameters['templatePath'] = $templatePath; - - var $templateType = _$jsonSerializers.serialize(templateType, specifiedType: const FullType(String)); - $templateType ??= 'user'; - _parameters['templateType'] = $templateType; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/templates/create{?filePath*,templatePath*,templateType*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $create_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$path_Request`. - @_i2.experimental - _i1.DynamiteSerializer $path_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(TemplatePathResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Initialize the template directory. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1049,48 +1095,79 @@ class $TemplateClient { /// * 403: Initializing the template directory is not allowed /// /// See: - /// * [pathRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$path_Request] for the request send by this method. + /// * [$path_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> path({ String? templatePath, TemplatePathCopySystemTemplates? copySystemTemplates, bool? oCSAPIRequest, }) async { - final _rawResponse = await pathRaw( + final _request = $path_Request( templatePath: templatePath, copySystemTemplates: copySystemTemplates, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $path_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Initialize the template directory. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $TransferOwnershipClient { + /// Creates a new `DynamiteClient` for transfer_ownership requests. + $TransferOwnershipClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$transfer_Request]. + @_i2.experimental + _i1.DynamiteSerializer $transfer_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TransferOwnershipTransferResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400, 403}, + ); + + /// Transfer the ownership to another user. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [transfer] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [templatePath] Path of the template directory. Defaults to `''`. - /// * [copySystemTemplates] Whether to copy the system templates to the template directory. Defaults to `0`. + /// * [recipient] Username of the recipient. + /// * [path] Path of the file. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Template directory initialized successfully - /// * 403: Initializing the template directory is not allowed + /// * 200: Ownership transferred successfully + /// * 400: Transferring ownership is not possible + /// * 403: Transferring ownership is not allowed /// /// See: - /// * [path] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [transfer] for a method executing this request and parsing the response. + /// * [$transfer_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> pathRaw({ - String? templatePath, - TemplatePathCopySystemTemplates? copySystemTemplates, + _i3.Request $transfer_Request({ + required String recipient, + required String path, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $recipient = _$jsonSerializers.serialize(recipient, specifiedType: const FullType(String)); + _parameters['recipient'] = $recipient; + final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); + _parameters['path'] = $path; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/transferownership{?recipient*,path*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1100,7 +1177,7 @@ class $TemplateClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1108,49 +1185,12 @@ class $TemplateClient { } // coverage:ignore-end - var $templatePath = _$jsonSerializers.serialize(templatePath, specifiedType: const FullType(String)); - $templatePath ??= ''; - _parameters['templatePath'] = $templatePath; - - var $copySystemTemplates = _$jsonSerializers.serialize( - copySystemTemplates, - specifiedType: const FullType(TemplatePathCopySystemTemplates), - ); - $copySystemTemplates ??= 0; - _parameters['copySystemTemplates'] = $copySystemTemplates; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/templates/path{?templatePath*,copySystemTemplates*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $path_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $TransferOwnershipClient { - /// Creates a new `DynamiteClient` for transfer_ownership requests. - $TransferOwnershipClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$transfer_Request`. - @_i2.experimental - _i1.DynamiteSerializer $transfer_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TransferOwnershipTransferResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400, 403}, - ); /// Transfer the ownership to another user. /// @@ -1168,49 +1208,67 @@ class $TransferOwnershipClient { /// * 403: Transferring ownership is not allowed /// /// See: - /// * [transferRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$transfer_Request] for the request send by this method. + /// * [$transfer_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> transfer({ required String recipient, required String path, bool? oCSAPIRequest, }) async { - final _rawResponse = await transferRaw( + final _request = $transfer_Request( recipient: recipient, path: path, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $transfer_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Transfer the ownership to another user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$accept_Request]. + @_i2.experimental + _i1.DynamiteSerializer $accept_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TransferOwnershipAcceptResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 403, 404}, + ); + + /// Accept an ownership transfer. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [accept] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [recipient] Username of the recipient. - /// * [path] Path of the file. + /// * [id] ID of the ownership transfer. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Ownership transferred successfully - /// * 400: Transferring ownership is not possible - /// * 403: Transferring ownership is not allowed + /// * 200: Ownership transfer accepted successfully + /// * 403: Accepting ownership transfer is not allowed + /// * 404: Ownership transfer not found /// /// See: - /// * [transfer] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [accept] for a method executing this request and parsing the response. + /// * [$accept_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> transferRaw({ - required String recipient, - required String path, + _i3.Request $accept_Request({ + required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/transferownership/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1220,7 +1278,7 @@ class $TransferOwnershipClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1228,39 +1286,13 @@ class $TransferOwnershipClient { } // coverage:ignore-end - final $recipient = _$jsonSerializers.serialize(recipient, specifiedType: const FullType(String)); - _parameters['recipient'] = $recipient; - - final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); - _parameters['path'] = $path; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/transferownership{?recipient*,path*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $transfer_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$accept_Request`. - @_i2.experimental - _i1.DynamiteSerializer $accept_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TransferOwnershipAcceptResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 403, 404}, - ); - /// Accept an ownership transfer. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1276,24 +1308,37 @@ class $TransferOwnershipClient { /// * 404: Ownership transfer not found /// /// See: - /// * [acceptRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$accept_Request] for the request send by this method. + /// * [$accept_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> accept({ required int id, bool? oCSAPIRequest, }) async { - final _rawResponse = await acceptRaw( + final _request = $accept_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $accept_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Accept an ownership transfer. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$reject_Request]. + @_i2.experimental + _i1.DynamiteSerializer $reject_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TransferOwnershipRejectResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 403, 404}, + ); + + /// Reject an ownership transfer. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [reject] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1301,20 +1346,26 @@ class $TransferOwnershipClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Ownership transfer accepted successfully - /// * 403: Accepting ownership transfer is not allowed + /// * 200: Ownership transfer rejected successfully + /// * 403: Rejecting ownership transfer is not allowed /// * 404: Ownership transfer not found /// /// See: - /// * [accept] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [reject] for a method executing this request and parsing the response. + /// * [$reject_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> acceptRaw({ + _i3.Request $reject_Request({ required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files/api/v1/transferownership/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1324,7 +1375,7 @@ class $TransferOwnershipClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1332,34 +1383,13 @@ class $TransferOwnershipClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/transferownership/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $accept_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$reject_Request`. - @_i2.experimental - _i1.DynamiteSerializer $reject_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TransferOwnershipRejectResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 403, 404}, - ); - /// Reject an ownership transfer. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1375,78 +1405,22 @@ class $TransferOwnershipClient { /// * 404: Ownership transfer not found /// /// See: - /// * [rejectRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$reject_Request] for the request send by this method. + /// * [$reject_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> reject({ required int id, bool? oCSAPIRequest, }) async { - final _rawResponse = await rejectRaw( + final _request = $reject_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Reject an ownership transfer. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [id] ID of the ownership transfer. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Ownership transfer rejected successfully - /// * 403: Rejecting ownership transfer is not allowed - /// * 404: Ownership transfer not found - /// - /// See: - /// * [reject] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> rejectRaw({ - required int id, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files/api/v1/transferownership/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $reject_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -3299,9 +3273,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin()) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin()) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/files_external.openapi.dart b/packages/nextcloud/lib/src/api/files_external.openapi.dart index 5a47b03d8c8..739b333056f 100644 --- a/packages/nextcloud/lib/src/api/files_external.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_external.openapi.dart @@ -19,11 +19,12 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i5; +import 'package:built_value/standard_json_plugin.dart' as _i6; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i4; +import 'package:dynamite_runtime/built_value.dart' as _i5; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; part 'files_external.openapi.g.dart'; @@ -57,7 +58,7 @@ class $ApiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getUserMounts_Request`. + /// Builds a serializer to parse the response of [$getUserMounts_Request]. @_i2.experimental _i1.DynamiteSerializer $getUserMounts_Serializer() => _i1.DynamiteSerializer( @@ -69,7 +70,7 @@ class $ApiClient { /// Get the mount points visible for this user. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getUserMounts] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -79,38 +80,14 @@ class $ApiClient { /// * 200: User mounts returned /// /// See: - /// * [getUserMountsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getUserMounts({ - bool? oCSAPIRequest, - }) async { - final _rawResponse = await getUserMountsRaw( - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get the mount points visible for this user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: User mounts returned - /// - /// See: - /// * [getUserMounts] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getUserMounts] for a method executing this request and parsing the response. + /// * [$getUserMounts_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getUserMountsRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getUserMounts_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/files_external/api/v1/mounts'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -120,7 +97,7 @@ class $ApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -130,17 +107,37 @@ class $ApiClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/apps/files_external/api/v1/mounts'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + return _request; + } + + /// Get the mount points visible for this user. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: User mounts returned + /// + /// See: + /// * [$getUserMounts_Request] for the request send by this method. + /// * [$getUserMounts_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getUserMounts({ + bool? oCSAPIRequest, + }) async { + final _request = $getUserMounts_Request( + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getUserMounts_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -558,9 +555,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i4.DynamiteDoubleSerializer()) - ..addPlugin(_i5.StandardJsonPlugin()) - ..addPlugin(const _i4.HeaderPlugin()) - ..addPlugin(const _i4.ContentStringPlugin())) + ..add(_i5.DynamiteDoubleSerializer()) + ..addPlugin(_i6.StandardJsonPlugin()) + ..addPlugin(const _i5.HeaderPlugin()) + ..addPlugin(const _i5.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/files_reminders.openapi.dart b/packages/nextcloud/lib/src/api/files_reminders.openapi.dart index 8e92f28c8ea..7d86fa6b928 100644 --- a/packages/nextcloud/lib/src/api/files_reminders.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_reminders.openapi.dart @@ -18,13 +18,14 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i4; +import 'package:uri/uri.dart' as _i5; part 'files_reminders.openapi.g.dart'; @@ -57,7 +58,7 @@ class $ApiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$$get_Request`. + /// Builds a serializer to parse the response of [$$get_Request]. @_i2.experimental _i1.DynamiteSerializer $$get_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(ApiGetResponseApplicationJson), @@ -68,7 +69,7 @@ class $ApiClient { /// Get a reminder. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [$get] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -81,48 +82,30 @@ class $ApiClient { /// * 401: User not found /// /// See: - /// * [$getRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $get({ + /// * [$get] for a method executing this request and parsing the response. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $$get_Request({ required String version, required int fileId, bool? oCSAPIRequest, - }) async { - final _rawResponse = await $getRaw( - version: version, - fileId: fileId, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); + _i4.checkPattern( + $version as String?, + RegExp(r'^1$'), + 'version', ); + _parameters['version'] = $version; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get a reminder. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [version] - /// * [fileId] ID of the file. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Reminder returned - /// * 401: User not found - /// - /// See: - /// * [$get] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> $getRaw({ - required String version, - required int fileId, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); + _parameters['fileId'] = $fileId; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files_reminders/api/v{version}/{fileId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -132,7 +115,7 @@ class $ApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -140,82 +123,60 @@ class $ApiClient { } // coverage:ignore-end - final $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); - _i3.checkPattern( - $version as String?, - RegExp(r'^1$'), - 'version', - ); - _parameters['version'] = $version; - - final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); - _parameters['fileId'] = $fileId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files_reminders/api/v{version}/{fileId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $$get_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$$set_Request`. - @_i2.experimental - _i1.DynamiteSerializer $$set_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ApiSetResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 201, 400, 401, 404}, - ); - - /// Set a reminder. + /// Get a reminder. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [dueDate] ISO 8601 formatted date time string. /// * [version] /// * [fileId] ID of the file. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reminder updated - /// * 201: Reminder created successfully - /// * 400: Creating reminder is not possible + /// * 200: Reminder returned /// * 401: User not found - /// * 404: File not found /// /// See: - /// * [$setRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> $set({ - required String dueDate, + /// * [$$get_Request] for the request send by this method. + /// * [$$get_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $get({ required String version, required int fileId, bool? oCSAPIRequest, }) async { - final _rawResponse = await $setRaw( - dueDate: dueDate, + final _request = $$get_Request( version: version, fileId: fileId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $$get_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$$set_Request]. + @_i2.experimental + _i1.DynamiteSerializer $$set_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ApiSetResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 201, 400, 401, 404}, + ); + /// Set a reminder. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [$set] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -232,17 +193,35 @@ class $ApiClient { /// * 404: File not found /// /// See: - /// * [$set] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [$set] for a method executing this request and parsing the response. + /// * [$$set_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> $setRaw({ + _i3.Request $$set_Request({ required String dueDate, required String version, required int fileId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $dueDate = _$jsonSerializers.serialize(dueDate, specifiedType: const FullType(String)); + _parameters['dueDate'] = $dueDate; + final $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); + _i4.checkPattern( + $version as String?, + RegExp(r'^1$'), + 'version', + ); + _parameters['version'] = $version; + + final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); + _parameters['fileId'] = $fileId; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/files_reminders/api/v{version}/{fileId}{?dueDate*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -252,7 +231,7 @@ class $ApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -260,81 +239,66 @@ class $ApiClient { } // coverage:ignore-end - final $dueDate = _$jsonSerializers.serialize(dueDate, specifiedType: const FullType(String)); - _parameters['dueDate'] = $dueDate; - - final $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); - _i3.checkPattern( - $version as String?, - RegExp(r'^1$'), - 'version', - ); - _parameters['version'] = $version; - - final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); - _parameters['fileId'] = $fileId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/files_reminders/api/v{version}/{fileId}{?dueDate*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); - - final _serializer = $$set_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$remove_Request`. - @_i2.experimental - _i1.DynamiteSerializer $remove_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ApiRemoveResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 401, 404}, - ); - - /// Remove a reminder. + /// Set a reminder. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [dueDate] ISO 8601 formatted date time string. /// * [version] /// * [fileId] ID of the file. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reminder deleted successfully + /// * 200: Reminder updated + /// * 201: Reminder created successfully + /// * 400: Creating reminder is not possible /// * 401: User not found - /// * 404: Reminder not found + /// * 404: File not found /// /// See: - /// * [removeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> remove({ + /// * [$$set_Request] for the request send by this method. + /// * [$$set_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> $set({ + required String dueDate, required String version, required int fileId, bool? oCSAPIRequest, }) async { - final _rawResponse = await removeRaw( + final _request = $$set_Request( + dueDate: dueDate, version: version, fileId: fileId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $$set_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$remove_Request]. + @_i2.experimental + _i1.DynamiteSerializer $remove_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ApiRemoveResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 401, 404}, + ); + /// Remove a reminder. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [remove] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -348,16 +312,30 @@ class $ApiClient { /// * 404: Reminder not found /// /// See: - /// * [remove] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [remove] for a method executing this request and parsing the response. + /// * [$remove_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> removeRaw({ + _i3.Request $remove_Request({ required String version, required int fileId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); + _i4.checkPattern( + $version as String?, + RegExp(r'^1$'), + 'version', + ); + _parameters['version'] = $version; + + final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); + _parameters['fileId'] = $fileId; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files_reminders/api/v{version}/{fileId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -367,7 +345,7 @@ class $ApiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -375,30 +353,47 @@ class $ApiClient { } // coverage:ignore-end - final $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); - _i3.checkPattern( - $version as String?, - RegExp(r'^1$'), - 'version', - ); - _parameters['version'] = $version; - - final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); - _parameters['fileId'] = $fileId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files_reminders/api/v{version}/{fileId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, + /// Remove a reminder. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [version] + /// * [fileId] ID of the file. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Reminder deleted successfully + /// * 401: User not found + /// * 404: Reminder not found + /// + /// See: + /// * [$remove_Request] for the request send by this method. + /// * [$remove_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> remove({ + required String version, + required int fileId, + bool? oCSAPIRequest, + }) async { + final _request = $remove_Request( + version: version, + fileId: fileId, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $remove_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -739,9 +734,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin()) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin()) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart index fdaf47533ee..45364639d4b 100644 --- a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart @@ -21,13 +21,14 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i4; +import 'package:uri/uri.dart' as _i5; part 'files_sharing.openapi.g.dart'; @@ -70,7 +71,7 @@ class $DeletedShareapiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$index_Request`. + /// Builds a serializer to parse the response of [$index_Request]. @_i2.experimental _i1.DynamiteSerializer $index_Serializer() => _i1.DynamiteSerializer( @@ -82,30 +83,7 @@ class $DeletedShareapiClient { /// Get a list of all deleted shares. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Deleted shares returned - /// - /// See: - /// * [indexRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> index({bool? oCSAPIRequest}) async { - final _rawResponse = await indexRaw( - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get a list of all deleted shares. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [index] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -115,13 +93,14 @@ class $DeletedShareapiClient { /// * 200: Deleted shares returned /// /// See: - /// * [index] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [index] for a method executing this request and parsing the response. + /// * [$index_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> indexRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $index_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/files_sharing/api/v1/deletedshares'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -131,7 +110,7 @@ class $DeletedShareapiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -141,61 +120,50 @@ class $DeletedShareapiClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/apps/files_sharing/api/v1/deletedshares'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $index_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$undelete_Request`. - @_i2.experimental - _i1.DynamiteSerializer $undelete_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(DeletedShareapiUndeleteResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Undelete a deleted share. + /// Get a list of all deleted shares. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [id] ID of the share. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share undeleted successfully - /// * 404: Share not found + /// * 200: Deleted shares returned /// /// See: - /// * [undeleteRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> undelete({ - required String id, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await undeleteRaw( - id: id, + /// * [$index_Request] for the request send by this method. + /// * [$index_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> index({bool? oCSAPIRequest}) async { + final _request = $index_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $index_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$undelete_Request]. + @_i2.experimental + _i1.DynamiteSerializer $undelete_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(DeletedShareapiUndeleteResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Undelete a deleted share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [undelete] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -207,15 +175,21 @@ class $DeletedShareapiClient { /// * 404: Share not found /// /// See: - /// * [undelete] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [undelete] for a method executing this request and parsing the response. + /// * [$undelete_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> undeleteRaw({ + _i3.Request $undelete_Request({ required String id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(String)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/deletedshares/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -225,7 +199,7 @@ class $DeletedShareapiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -233,22 +207,43 @@ class $DeletedShareapiClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(String)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/deletedshares/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + /// Undelete a deleted share. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [id] ID of the share. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Share undeleted successfully + /// * 404: Share not found + /// + /// See: + /// * [$undelete_Request] for the request send by this method. + /// * [$undelete_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> undelete({ + required String id, + bool? oCSAPIRequest, + }) async { + final _request = $undelete_Request( + id: id, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $undelete_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -258,7 +253,7 @@ class $PublicPreviewClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$directLink_Request`. + /// Builds a serializer to parse the response of [$directLink_Request]. @_i2.experimental _i1.DynamiteSerializer $directLink_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -269,33 +264,7 @@ class $PublicPreviewClient { /// Get a direct link preview for a shared file. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [token] Token of the share. - /// - /// Status codes: - /// * 200: Preview returned - /// * 400: Getting preview is not possible - /// * 403: Getting preview is not allowed - /// * 404: Share or preview not found - /// - /// See: - /// * [directLinkRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> directLink({required String token}) async { - final _rawResponse = await directLinkRaw( - token: token, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get a direct link preview for a shared file. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [directLink] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -308,12 +277,18 @@ class $PublicPreviewClient { /// * 404: Share or preview not found /// /// See: - /// * [directLink] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [directLink] for a method executing this request and parsing the response. + /// * [$directLink_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> directLinkRaw({required String token}) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; + _i3.Request $directLink_Request({required String token}) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _parameters['token'] = $token; + final _path = _i5.UriTemplate('/index.php/s/{token}/preview').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -323,45 +298,21 @@ class $PublicPreviewClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _parameters['token'] = $token; - - final _path = _i4.UriTemplate('/index.php/s/{token}/preview').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $directLink_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getPreview_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getPreview_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Uint8List), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get a preview for a shared file. + /// Get a direct link preview for a shared file. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [file] File in the share. Defaults to `''`. - /// * [x] Width of the preview. Defaults to `32`. - /// * [y] Height of the preview. Defaults to `32`. - /// * [a] Whether to not crop the preview. Defaults to `0`. /// * [token] Token of the share. /// /// Status codes: @@ -371,30 +322,31 @@ class $PublicPreviewClient { /// * 404: Share or preview not found /// /// See: - /// * [getPreviewRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getPreview({ - required String token, - String? file, - int? x, - int? y, - PublicPreviewGetPreviewA? a, - }) async { - final _rawResponse = await getPreviewRaw( + /// * [$directLink_Request] for the request send by this method. + /// * [$directLink_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> directLink({required String token}) async { + final _request = $directLink_Request( token: token, - file: file, - x: x, - y: y, - a: a, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $directLink_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getPreview_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getPreview_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Uint8List), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a preview for a shared file. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getPreview] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -411,33 +363,17 @@ class $PublicPreviewClient { /// * 404: Share or preview not found /// /// See: - /// * [getPreview] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getPreview] for a method executing this request and parsing the response. + /// * [$getPreview_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getPreviewRaw({ + _i3.Request $getPreview_Request({ required String token, String? file, int? x, int? y, PublicPreviewGetPreviewA? a, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); _parameters['token'] = $token; @@ -458,15 +394,68 @@ class $PublicPreviewClient { _parameters['a'] = $a; final _path = - _i4.UriTemplate('/index.php/apps/files_sharing/publicpreview/{token}{?file*,x*,y*,a*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + _i5.UriTemplate('/index.php/apps/files_sharing/publicpreview/{token}{?file*,x*,y*,a*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end + return _request; + } + + /// Get a preview for a shared file. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [file] File in the share. Defaults to `''`. + /// * [x] Width of the preview. Defaults to `32`. + /// * [y] Height of the preview. Defaults to `32`. + /// * [a] Whether to not crop the preview. Defaults to `0`. + /// * [token] Token of the share. + /// + /// Status codes: + /// * 200: Preview returned + /// * 400: Getting preview is not possible + /// * 403: Getting preview is not allowed + /// * 404: Share or preview not found + /// + /// See: + /// * [$getPreview_Request] for the request send by this method. + /// * [$getPreview_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getPreview({ + required String token, + String? file, + int? x, + int? y, + PublicPreviewGetPreviewA? a, + }) async { + final _request = $getPreview_Request( + token: token, + file: file, + x: x, + y: y, + a: a, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getPreview_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -476,7 +465,7 @@ class $RemoteClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getShares_Request`. + /// Builds a serializer to parse the response of [$getShares_Request]. @_i2.experimental _i1.DynamiteSerializer $getShares_Serializer() => _i1.DynamiteSerializer( @@ -488,30 +477,7 @@ class $RemoteClient { /// Get a list of accepted remote shares. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Accepted remote shares returned - /// - /// See: - /// * [getSharesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getShares({bool? oCSAPIRequest}) async { - final _rawResponse = await getSharesRaw( - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get a list of accepted remote shares. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getShares] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -521,13 +487,14 @@ class $RemoteClient { /// * 200: Accepted remote shares returned /// /// See: - /// * [getShares] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getShares] for a method executing this request and parsing the response. + /// * [$getShares_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getSharesRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getShares_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/files_sharing/api/v1/remote_shares'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -537,7 +504,7 @@ class $RemoteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -547,30 +514,12 @@ class $RemoteClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/files_sharing/api/v1/remote_shares'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getShares_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getOpenShares_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getOpenShares_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RemoteGetOpenSharesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get list of pending remote shares. + /// Get a list of accepted remote shares. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -579,25 +528,36 @@ class $RemoteClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Pending remote shares returned + /// * 200: Accepted remote shares returned /// /// See: - /// * [getOpenSharesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getOpenShares({ - bool? oCSAPIRequest, - }) async { - final _rawResponse = await getOpenSharesRaw( + /// * [$getShares_Request] for the request send by this method. + /// * [$getShares_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getShares({bool? oCSAPIRequest}) async { + final _request = $getShares_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getShares_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getOpenShares_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getOpenShares_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RemoteGetOpenSharesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get list of pending remote shares. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getOpenShares] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -607,13 +567,14 @@ class $RemoteClient { /// * 200: Pending remote shares returned /// /// See: - /// * [getOpenShares] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getOpenShares] for a method executing this request and parsing the response. + /// * [$getOpenShares_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getOpenSharesRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getOpenShares_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -623,7 +584,7 @@ class $RemoteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -633,61 +594,52 @@ class $RemoteClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getOpenShares_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$acceptShare_Request`. - @_i2.experimental - _i1.DynamiteSerializer $acceptShare_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RemoteAcceptShareResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Accept a remote share. + /// Get list of pending remote shares. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [id] ID of the share. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share accepted successfully - /// * 404: Share not found + /// * 200: Pending remote shares returned /// /// See: - /// * [acceptShareRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> acceptShare({ - required int id, + /// * [$getOpenShares_Request] for the request send by this method. + /// * [$getOpenShares_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getOpenShares({ bool? oCSAPIRequest, }) async { - final _rawResponse = await acceptShareRaw( - id: id, + final _request = $getOpenShares_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getOpenShares_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$acceptShare_Request]. + @_i2.experimental + _i1.DynamiteSerializer $acceptShare_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RemoteAcceptShareResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Accept a remote share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [acceptShare] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -699,15 +651,22 @@ class $RemoteClient { /// * 404: Share not found /// /// See: - /// * [acceptShare] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [acceptShare] for a method executing this request and parsing the response. + /// * [$acceptShare_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> acceptShareRaw({ + _i3.Request $acceptShare_Request({ required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -717,7 +676,7 @@ class $RemoteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -725,36 +684,14 @@ class $RemoteClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $acceptShare_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$declineShare_Request`. - @_i2.experimental - _i1.DynamiteSerializer $declineShare_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RemoteDeclineShareResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Decline a remote share. + /// Accept a remote share. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -764,28 +701,41 @@ class $RemoteClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share declined successfully + /// * 200: Share accepted successfully /// * 404: Share not found /// /// See: - /// * [declineShareRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> declineShare({ + /// * [$acceptShare_Request] for the request send by this method. + /// * [$acceptShare_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> acceptShare({ required int id, bool? oCSAPIRequest, }) async { - final _rawResponse = await declineShareRaw( + final _request = $acceptShare_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $acceptShare_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$declineShare_Request]. + @_i2.experimental + _i1.DynamiteSerializer $declineShare_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RemoteDeclineShareResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Decline a remote share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [declineShare] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -797,15 +747,22 @@ class $RemoteClient { /// * 404: Share not found /// /// See: - /// * [declineShare] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [declineShare] for a method executing this request and parsing the response. + /// * [$declineShare_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> declineShareRaw({ + _i3.Request $declineShare_Request({ required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -815,7 +772,7 @@ class $RemoteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -823,35 +780,14 @@ class $RemoteClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $declineShare_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getShare_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getShare_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RemoteGetShareResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get info of a remote share. + /// Decline a remote share. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -861,28 +797,40 @@ class $RemoteClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share returned + /// * 200: Share declined successfully /// * 404: Share not found /// /// See: - /// * [getShareRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getShare({ + /// * [$declineShare_Request] for the request send by this method. + /// * [$declineShare_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> declineShare({ required int id, bool? oCSAPIRequest, }) async { - final _rawResponse = await getShareRaw( + final _request = $declineShare_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $declineShare_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getShare_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getShare_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RemoteGetShareResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get info of a remote share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getShare] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -894,15 +842,21 @@ class $RemoteClient { /// * 404: Share not found /// /// See: - /// * [getShare] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getShare] for a method executing this request and parsing the response. + /// * [$getShare_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getShareRaw({ + _i3.Request $getShare_Request({ required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -912,7 +866,7 @@ class $RemoteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -920,34 +874,14 @@ class $RemoteClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getShare_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$unshare_Request`. - @_i2.experimental - _i1.DynamiteSerializer $unshare_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RemoteUnshareResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Unshare a remote share. + /// Get info of a remote share. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -957,29 +891,40 @@ class $RemoteClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share unshared successfully + /// * 200: Share returned /// * 404: Share not found - /// * 403: Unsharing is not possible /// /// See: - /// * [unshareRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> unshare({ + /// * [$getShare_Request] for the request send by this method. + /// * [$getShare_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getShare({ required int id, bool? oCSAPIRequest, }) async { - final _rawResponse = await unshareRaw( + final _request = $getShare_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getShare_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$unshare_Request]. + @_i2.experimental + _i1.DynamiteSerializer $unshare_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RemoteUnshareResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Unshare a remote share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [unshare] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -992,15 +937,21 @@ class $RemoteClient { /// * 403: Unsharing is not possible /// /// See: - /// * [unshare] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [unshare] for a method executing this request and parsing the response. + /// * [$unshare_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> unshareRaw({ + _i3.Request $unshare_Request({ required int id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1010,7 +961,7 @@ class $RemoteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1018,22 +969,44 @@ class $RemoteClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, + /// Unshare a remote share. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [id] ID of the share. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Share unshared successfully + /// * 404: Share not found + /// * 403: Unsharing is not possible + /// + /// See: + /// * [$unshare_Request] for the request send by this method. + /// * [$unshare_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> unshare({ + required int id, + bool? oCSAPIRequest, + }) async { + final _request = $unshare_Request( + id: id, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $unshare_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -1043,7 +1016,7 @@ class $ShareInfoClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$info_Request`. + /// Builds a serializer to parse the response of [$info_Request]. @_i2.experimental _i1.DynamiteSerializer $info_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(ShareInfo), @@ -1054,7 +1027,7 @@ class $ShareInfoClient { /// Get the info about a share. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [info] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1069,28 +1042,55 @@ class $ShareInfoClient { /// * 404: Share not found /// /// See: - /// * [infoRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> info({ + /// * [info] for a method executing this request and parsing the response. + /// * [$info_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $info_Request({ required String t, String? password, String? dir, int? depth, - }) async { - final _rawResponse = await infoRaw( - t: t, - password: password, - dir: dir, - depth: depth, + }) { + final _parameters = {}; + final $t = _$jsonSerializers.serialize(t, specifiedType: const FullType(String)); + _parameters['t'] = $t; + + final $password = _$jsonSerializers.serialize(password, specifiedType: const FullType(String)); + _parameters['password'] = $password; + + final $dir = _$jsonSerializers.serialize(dir, specifiedType: const FullType(String)); + _parameters['dir'] = $dir; + + var $depth = _$jsonSerializers.serialize(depth, specifiedType: const FullType(int)); + $depth ??= -1; + _parameters['depth'] = $depth; + + final _path = + _i5.UriTemplate('/index.php/apps/files_sharing/shareinfo{?t*,password*,dir*,depth*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end + return _request; } /// Get the info about a share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1105,55 +1105,25 @@ class $ShareInfoClient { /// * 404: Share not found /// /// See: - /// * [info] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> infoRaw({ + /// * [$info_Request] for the request send by this method. + /// * [$info_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> info({ required String t, String? password, String? dir, int? depth, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end - final $t = _$jsonSerializers.serialize(t, specifiedType: const FullType(String)); - _parameters['t'] = $t; - - final $password = _$jsonSerializers.serialize(password, specifiedType: const FullType(String)); - _parameters['password'] = $password; - - final $dir = _$jsonSerializers.serialize(dir, specifiedType: const FullType(String)); - _parameters['dir'] = $dir; - - var $depth = _$jsonSerializers.serialize(depth, specifiedType: const FullType(int)); - $depth ??= -1; - _parameters['depth'] = $depth; - - final _path = - _i4.UriTemplate('/index.php/apps/files_sharing/shareinfo{?t*,password*,dir*,depth*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _request = $info_Request( + t: t, + password: password, + dir: dir, + depth: depth, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $info_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -1163,7 +1133,7 @@ class $ShareapiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getShares_Request`. + /// Builds a serializer to parse the response of [$getShares_Request]. @_i2.experimental _i1.DynamiteSerializer $getShares_Serializer() => _i1.DynamiteSerializer( @@ -1175,48 +1145,7 @@ class $ShareapiClient { /// Get shares of the current user. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [sharedWithMe] Only get shares with the current user. Defaults to `false`. - /// * [reshares] Only get shares by the current user and reshares. Defaults to `false`. - /// * [subfiles] Only get all shares in a folder. Defaults to `false`. - /// * [path] Get shares for a specific path. Defaults to `''`. - /// * [includeTags] Include tags in the share. Defaults to `false`. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Shares returned - /// * 404: The folder was not found or is inaccessible - /// - /// See: - /// * [getSharesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getShares({ - String? sharedWithMe, - String? reshares, - String? subfiles, - String? path, - String? includeTags, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await getSharesRaw( - sharedWithMe: sharedWithMe, - reshares: reshares, - subfiles: subfiles, - path: path, - includeTags: includeTags, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get shares of the current user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getShares] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1232,36 +1161,18 @@ class $ShareapiClient { /// * 404: The folder was not found or is inaccessible /// /// See: - /// * [getShares] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getShares] for a method executing this request and parsing the response. + /// * [$getShares_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getSharesRaw({ + _i3.Request $getShares_Request({ String? sharedWithMe, String? reshares, String? subfiles, String? path, String? includeTags, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; var $sharedWithMe = _$jsonSerializers.serialize(sharedWithMe, specifiedType: const FullType(String)); $sharedWithMe ??= 'false'; _parameters['shared_with_me'] = $sharedWithMe; @@ -1282,97 +1193,93 @@ class $ShareapiClient { $includeTags ??= 'false'; _parameters['include_tags'] = $includeTags; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/files_sharing/api/v1/shares{?shared_with_me*,reshares*,subfiles*,path*,include_tags*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $getShares_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$createShare_Request`. - @_i2.experimental - _i1.DynamiteSerializer $createShare_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ShareapiCreateShareResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Create a share. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Get shares of the current user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [path] Path of the share. - /// * [permissions] Permissions for the share. - /// * [shareType] Type of the share. Defaults to `-1`. - /// * [shareWith] The entity this should be shared with. - /// * [publicUpload] If public uploading is allowed. Defaults to `false`. - /// * [password] Password for the share. Defaults to `''`. - /// * [sendPasswordByTalk] Send the password for the share over Talk. - /// * [expireDate] Expiry date of the share using user timezone at 00:00. It means date in UTC timezone will be used. Defaults to `''`. - /// * [note] Note for the share. Defaults to `''`. - /// * [label] Label for the share (only used in link and email). Defaults to `''`. - /// * [attributes] Additional attributes for the share. + /// * [sharedWithMe] Only get shares with the current user. Defaults to `false`. + /// * [reshares] Only get shares by the current user and reshares. Defaults to `false`. + /// * [subfiles] Only get all shares in a folder. Defaults to `false`. + /// * [path] Get shares for a specific path. Defaults to `''`. + /// * [includeTags] Include tags in the share. Defaults to `false`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share created - /// * 400: Unknown share type - /// * 403: Creating the share is not allowed - /// * 404: Creating the share failed + /// * 200: Shares returned + /// * 404: The folder was not found or is inaccessible /// /// See: - /// * [createShareRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> createShare({ + /// * [$getShares_Request] for the request send by this method. + /// * [$getShares_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getShares({ + String? sharedWithMe, + String? reshares, + String? subfiles, String? path, - int? permissions, - int? shareType, - String? shareWith, - String? publicUpload, - String? password, - String? sendPasswordByTalk, - String? expireDate, - String? note, - String? label, - String? attributes, + String? includeTags, bool? oCSAPIRequest, }) async { - final _rawResponse = await createShareRaw( + final _request = $getShares_Request( + sharedWithMe: sharedWithMe, + reshares: reshares, + subfiles: subfiles, path: path, - permissions: permissions, - shareType: shareType, - shareWith: shareWith, - publicUpload: publicUpload, - password: password, - sendPasswordByTalk: sendPasswordByTalk, - expireDate: expireDate, - note: note, - label: label, - attributes: attributes, + includeTags: includeTags, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getShares_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$createShare_Request]. + @_i2.experimental + _i1.DynamiteSerializer $createShare_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ShareapiCreateShareResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Create a share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [createShare] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1396,9 +1303,10 @@ class $ShareapiClient { /// * 404: Creating the share failed /// /// See: - /// * [createShare] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [createShare] for a method executing this request and parsing the response. + /// * [$createShare_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createShareRaw({ + _i3.Request $createShare_Request({ String? path, int? permissions, int? shareType, @@ -1411,27 +1319,8 @@ class $ShareapiClient { String? label, String? attributes, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); _parameters['path'] = $path; @@ -1471,66 +1360,113 @@ class $ShareapiClient { final $attributes = _$jsonSerializers.serialize(attributes, specifiedType: const FullType(String)); _parameters['attributes'] = $attributes; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/files_sharing/api/v1/shares{?path*,permissions*,shareType*,shareWith*,publicUpload*,password*,sendPasswordByTalk*,expireDate*,note*,label*,attributes*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $createShare_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$getInheritedShares_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getInheritedShares_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ShareapiGetInheritedSharesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Get all shares relative to a file, including parent folders shares rights. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Create a share. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [path] Path all shares will be relative to. + /// * [path] Path of the share. + /// * [permissions] Permissions for the share. + /// * [shareType] Type of the share. Defaults to `-1`. + /// * [shareWith] The entity this should be shared with. + /// * [publicUpload] If public uploading is allowed. Defaults to `false`. + /// * [password] Password for the share. Defaults to `''`. + /// * [sendPasswordByTalk] Send the password for the share over Talk. + /// * [expireDate] Expiry date of the share using user timezone at 00:00. It means date in UTC timezone will be used. Defaults to `''`. + /// * [note] Note for the share. Defaults to `''`. + /// * [label] Label for the share (only used in link and email). Defaults to `''`. + /// * [attributes] Additional attributes for the share. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Shares returned - /// * 500 - /// * 404: The given path is invalid + /// * 200: Share created + /// * 400: Unknown share type + /// * 403: Creating the share is not allowed + /// * 404: Creating the share failed /// /// See: - /// * [getInheritedSharesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getInheritedShares({ - required String path, + /// * [$createShare_Request] for the request send by this method. + /// * [$createShare_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> createShare({ + String? path, + int? permissions, + int? shareType, + String? shareWith, + String? publicUpload, + String? password, + String? sendPasswordByTalk, + String? expireDate, + String? note, + String? label, + String? attributes, bool? oCSAPIRequest, }) async { - final _rawResponse = await getInheritedSharesRaw( + final _request = $createShare_Request( path: path, + permissions: permissions, + shareType: shareType, + shareWith: shareWith, + publicUpload: publicUpload, + password: password, + sendPasswordByTalk: sendPasswordByTalk, + expireDate: expireDate, + note: note, + label: label, + attributes: attributes, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $createShare_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getInheritedShares_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getInheritedShares_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ShareapiGetInheritedSharesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get all shares relative to a file, including parent folders shares rights. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getInheritedShares] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1543,15 +1479,21 @@ class $ShareapiClient { /// * 404: The given path is invalid /// /// See: - /// * [getInheritedShares] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getInheritedShares] for a method executing this request and parsing the response. + /// * [$getInheritedShares_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getInheritedSharesRaw({ + _i3.Request $getInheritedShares_Request({ required String path, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); + _parameters['path'] = $path; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/shares/inherited{?path*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1561,7 +1503,7 @@ class $ShareapiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1569,63 +1511,60 @@ class $ShareapiClient { } // coverage:ignore-end - final $path = _$jsonSerializers.serialize(path, specifiedType: const FullType(String)); - _parameters['path'] = $path; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/shares/inherited{?path*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getInheritedShares_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$pendingShares_Request`. - @_i2.experimental - _i1.DynamiteSerializer $pendingShares_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ShareapiPendingSharesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get all shares that are still pending. + /// Get all shares relative to a file, including parent folders shares rights. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [path] Path all shares will be relative to. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Pending shares returned + /// * 200: Shares returned + /// * 500 + /// * 404: The given path is invalid /// /// See: - /// * [pendingSharesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> pendingShares({ + /// * [$getInheritedShares_Request] for the request send by this method. + /// * [$getInheritedShares_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getInheritedShares({ + required String path, bool? oCSAPIRequest, }) async { - final _rawResponse = await pendingSharesRaw( + final _request = $getInheritedShares_Request( + path: path, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getInheritedShares_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$pendingShares_Request]. + @_i2.experimental + _i1.DynamiteSerializer $pendingShares_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ShareapiPendingSharesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get all shares that are still pending. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [pendingShares] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1635,13 +1574,14 @@ class $ShareapiClient { /// * 200: Pending shares returned /// /// See: - /// * [pendingShares] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [pendingShares] for a method executing this request and parsing the response. + /// * [$pendingShares_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> pendingSharesRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $pendingShares_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/files_sharing/api/v1/shares/pending'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1651,7 +1591,7 @@ class $ShareapiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1661,64 +1601,52 @@ class $ShareapiClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/files_sharing/api/v1/shares/pending'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $pendingShares_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getShare_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getShare_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ShareapiGetShareResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get a specific share by id. + /// Get all shares that are still pending. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [includeTags] Include tags in the share. Defaults to `0`. - /// * [id] ID of the share. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share returned - /// * 404: Share not found + /// * 200: Pending shares returned /// /// See: - /// * [getShareRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getShare({ - required String id, - ShareapiGetShareIncludeTags? includeTags, + /// * [$pendingShares_Request] for the request send by this method. + /// * [$pendingShares_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> pendingShares({ bool? oCSAPIRequest, }) async { - final _rawResponse = await getShareRaw( - id: id, - includeTags: includeTags, + final _request = $pendingShares_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $pendingShares_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getShare_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getShare_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ShareapiGetShareResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a specific share by id. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getShare] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1731,16 +1659,28 @@ class $ShareapiClient { /// * 404: Share not found /// /// See: - /// * [getShare] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getShare] for a method executing this request and parsing the response. + /// * [$getShare_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getShareRaw({ + _i3.Request $getShare_Request({ required String id, ShareapiGetShareIncludeTags? includeTags, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(String)); + _parameters['id'] = $id; + + var $includeTags = + _$jsonSerializers.serialize(includeTags, specifiedType: const FullType(ShareapiGetShareIncludeTags)); + $includeTags ??= 0; + _parameters['include_tags'] = $includeTags; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/shares/{id}{?include_tags*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1750,7 +1690,7 @@ class $ShareapiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1758,101 +1698,61 @@ class $ShareapiClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(String)); - _parameters['id'] = $id; - - var $includeTags = - _$jsonSerializers.serialize(includeTags, specifiedType: const FullType(ShareapiGetShareIncludeTags)); - $includeTags ??= 0; - _parameters['include_tags'] = $includeTags; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/shares/{id}{?include_tags*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getShare_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$updateShare_Request`. - @_i2.experimental - _i1.DynamiteSerializer $updateShare_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ShareapiUpdateShareResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Update a share. + /// Get a specific share by id. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [permissions] New permissions. - /// * [password] New password. - /// * [sendPasswordByTalk] New condition if the password should be send over Talk. - /// * [publicUpload] New condition if public uploading is allowed. - /// * [expireDate] New expiry date. - /// * [note] New note. - /// * [label] New label. - /// * [hideDownload] New condition if the download should be hidden. - /// * [attributes] New additional attributes. + /// * [includeTags] Include tags in the share. Defaults to `0`. /// * [id] ID of the share. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share updated successfully - /// * 400: Share could not be updated because the requested changes are invalid - /// * 403: Missing permissions to update the share + /// * 200: Share returned /// * 404: Share not found /// /// See: - /// * [updateShareRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> updateShare({ + /// * [$getShare_Request] for the request send by this method. + /// * [$getShare_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getShare({ required String id, - int? permissions, - String? password, - String? sendPasswordByTalk, - String? publicUpload, - String? expireDate, - String? note, - String? label, - String? hideDownload, - String? attributes, + ShareapiGetShareIncludeTags? includeTags, bool? oCSAPIRequest, }) async { - final _rawResponse = await updateShareRaw( + final _request = $getShare_Request( id: id, - permissions: permissions, - password: password, - sendPasswordByTalk: sendPasswordByTalk, - publicUpload: publicUpload, - expireDate: expireDate, - note: note, - label: label, - hideDownload: hideDownload, - attributes: attributes, + includeTags: includeTags, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getShare_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$updateShare_Request]. + @_i2.experimental + _i1.DynamiteSerializer $updateShare_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ShareapiUpdateShareResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Update a share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [updateShare] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1875,9 +1775,10 @@ class $ShareapiClient { /// * 404: Share not found /// /// See: - /// * [updateShare] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [updateShare] for a method executing this request and parsing the response. + /// * [$updateShare_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> updateShareRaw({ + _i3.Request $updateShare_Request({ required String id, int? permissions, String? password, @@ -1889,27 +1790,8 @@ class $ShareapiClient { String? hideDownload, String? attributes, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(String)); _parameters['id'] = $id; @@ -1940,66 +1822,110 @@ class $ShareapiClient { final $attributes = _$jsonSerializers.serialize(attributes, specifiedType: const FullType(String)); _parameters['attributes'] = $attributes; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/files_sharing/api/v1/shares/{id}{?permissions*,password*,sendPasswordByTalk*,publicUpload*,expireDate*,note*,label*,hideDownload*,attributes*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $updateShare_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$deleteShare_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteShare_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ShareapiDeleteShareResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Delete a share. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Update a share. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [permissions] New permissions. + /// * [password] New password. + /// * [sendPasswordByTalk] New condition if the password should be send over Talk. + /// * [publicUpload] New condition if public uploading is allowed. + /// * [expireDate] New expiry date. + /// * [note] New note. + /// * [label] New label. + /// * [hideDownload] New condition if the download should be hidden. + /// * [attributes] New additional attributes. /// * [id] ID of the share. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share deleted successfully + /// * 200: Share updated successfully + /// * 400: Share could not be updated because the requested changes are invalid + /// * 403: Missing permissions to update the share /// * 404: Share not found - /// * 403: Missing permissions to delete the share /// /// See: - /// * [deleteShareRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteShare({ + /// * [$updateShare_Request] for the request send by this method. + /// * [$updateShare_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> updateShare({ required String id, + int? permissions, + String? password, + String? sendPasswordByTalk, + String? publicUpload, + String? expireDate, + String? note, + String? label, + String? hideDownload, + String? attributes, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteShareRaw( + final _request = $updateShare_Request( id: id, + permissions: permissions, + password: password, + sendPasswordByTalk: sendPasswordByTalk, + publicUpload: publicUpload, + expireDate: expireDate, + note: note, + label: label, + hideDownload: hideDownload, + attributes: attributes, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $updateShare_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteShare_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteShare_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ShareapiDeleteShareResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Delete a share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteShare] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2012,15 +1938,21 @@ class $ShareapiClient { /// * 403: Missing permissions to delete the share /// /// See: - /// * [deleteShare] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteShare] for a method executing this request and parsing the response. + /// * [$deleteShare_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteShareRaw({ + _i3.Request $deleteShare_Request({ required String id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(String)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/shares/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2030,7 +1962,7 @@ class $ShareapiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2038,35 +1970,14 @@ class $ShareapiClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(String)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/shares/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $deleteShare_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$acceptShare_Request`. - @_i2.experimental - _i1.DynamiteSerializer $acceptShare_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ShareapiAcceptShareResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Accept a share. + /// Delete a share. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -2076,29 +1987,42 @@ class $ShareapiClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Share accepted successfully + /// * 200: Share deleted successfully /// * 404: Share not found - /// * 400: Share could not be accepted + /// * 403: Missing permissions to delete the share /// /// See: - /// * [acceptShareRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> acceptShare({ + /// * [$deleteShare_Request] for the request send by this method. + /// * [$deleteShare_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteShare({ required String id, bool? oCSAPIRequest, }) async { - final _rawResponse = await acceptShareRaw( + final _request = $deleteShare_Request( id: id, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteShare_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$acceptShare_Request]. + @_i2.experimental + _i1.DynamiteSerializer $acceptShare_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ShareapiAcceptShareResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Accept a share. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [acceptShare] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2111,15 +2035,21 @@ class $ShareapiClient { /// * 400: Share could not be accepted /// /// See: - /// * [acceptShare] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [acceptShare] for a method executing this request and parsing the response. + /// * [$acceptShare_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> acceptShareRaw({ + _i3.Request $acceptShare_Request({ required String id, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(String)); + _parameters['id'] = $id; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/shares/pending/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2129,7 +2059,7 @@ class $ShareapiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2137,22 +2067,44 @@ class $ShareapiClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(String)); - _parameters['id'] = $id; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/shares/pending/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + /// Accept a share. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [id] ID of the share. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Share accepted successfully + /// * 404: Share not found + /// * 400: Share could not be accepted + /// + /// See: + /// * [$acceptShare_Request] for the request send by this method. + /// * [$acceptShare_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> acceptShare({ + required String id, + bool? oCSAPIRequest, + }) async { + final _request = $acceptShare_Request( + id: id, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $acceptShare_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -2162,7 +2114,7 @@ class $ShareesapiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$search_Request`. + /// Builds a serializer to parse the response of [$search_Request]. @_i2.experimental _i1.DynamiteSerializer $search_Serializer() => _i1.DynamiteSerializer( @@ -2174,51 +2126,7 @@ class $ShareesapiClient { /// Search for sharees. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [search] Text to search for. Defaults to `''`. - /// * [itemType] Limit to specific item types. - /// * [page] Page offset for searching. Defaults to `1`. - /// * [perPage] Limit amount of search results per page. Defaults to `200`. - /// * [shareType] Limit to specific share types. - /// * [lookup] If a global lookup should be performed too. Defaults to `0`. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Sharees search result returned - /// * 400: Invalid search parameters - /// - /// See: - /// * [searchRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> search({ - String? search, - String? itemType, - int? page, - int? perPage, - ShareesapiSearchShareType? shareType, - ShareesapiSearchLookup? lookup, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await searchRaw( - search: search, - itemType: itemType, - page: page, - perPage: perPage, - shareType: shareType, - lookup: lookup, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Search for sharees. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [search] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2235,10 +2143,10 @@ class $ShareesapiClient { /// * 400: Invalid search parameters /// /// See: - /// * [search] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [search] for a method executing this request and parsing the response. + /// * [$search_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - searchRaw({ + _i3.Request $search_Request({ String? search, String? itemType, int? page, @@ -2246,27 +2154,8 @@ class $ShareesapiClient { ShareesapiSearchShareType? shareType, ShareesapiSearchLookup? lookup, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); $search ??= ''; _parameters['search'] = $search; @@ -2289,69 +2178,98 @@ class $ShareesapiClient { $lookup ??= 0; _parameters['lookup'] = $lookup; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/files_sharing/api/v1/sharees{?search*,itemType*,page*,perPage*,shareType*,lookup*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $search_Serializer(); - return _i1.ResponseConverter( - _serializer, - ).convert(_response); - } - - /// Builds a serializer to parse the response of `$findRecommended_Request`. - @_i2.experimental - _i1.DynamiteSerializer $findRecommended_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ShareesapiFindRecommendedResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Find recommended sharees. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Search for sharees. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [search] Text to search for. Defaults to `''`. /// * [itemType] Limit to specific item types. + /// * [page] Page offset for searching. Defaults to `1`. + /// * [perPage] Limit amount of search results per page. Defaults to `200`. /// * [shareType] Limit to specific share types. + /// * [lookup] If a global lookup should be performed too. Defaults to `0`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Recommended sharees returned + /// * 200: Sharees search result returned + /// * 400: Invalid search parameters /// /// See: - /// * [findRecommendedRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> findRecommended({ - required String itemType, - ShareesapiFindRecommendedShareType? shareType, + /// * [$search_Request] for the request send by this method. + /// * [$search_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> search({ + String? search, + String? itemType, + int? page, + int? perPage, + ShareesapiSearchShareType? shareType, + ShareesapiSearchLookup? lookup, bool? oCSAPIRequest, }) async { - final _rawResponse = await findRecommendedRaw( + final _request = $search_Request( + search: search, itemType: itemType, + page: page, + perPage: perPage, shareType: shareType, + lookup: lookup, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $search_Serializer(); + final _rawResponse = + await _i1.ResponseConverter( + _serializer, + ).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$findRecommended_Request]. + @_i2.experimental + _i1.DynamiteSerializer $findRecommended_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ShareesapiFindRecommendedResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Find recommended sharees. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [findRecommended] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2363,16 +2281,27 @@ class $ShareesapiClient { /// * 200: Recommended sharees returned /// /// See: - /// * [findRecommended] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [findRecommended] for a method executing this request and parsing the response. + /// * [$findRecommended_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> findRecommendedRaw({ + _i3.Request $findRecommended_Request({ required String itemType, ShareesapiFindRecommendedShareType? shareType, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $itemType = _$jsonSerializers.serialize(itemType, specifiedType: const FullType(String)); + _parameters['itemType'] = $itemType; + + final $shareType = + _$jsonSerializers.serialize(shareType, specifiedType: const FullType(ShareesapiFindRecommendedShareType)); + _parameters['shareType'] = $shareType; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/sharees_recommended{?itemType*,shareType*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2382,7 +2311,7 @@ class $ShareesapiClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2390,28 +2319,46 @@ class $ShareesapiClient { } // coverage:ignore-end - final $itemType = _$jsonSerializers.serialize(itemType, specifiedType: const FullType(String)); - _parameters['itemType'] = $itemType; - - final $shareType = - _$jsonSerializers.serialize(shareType, specifiedType: const FullType(ShareesapiFindRecommendedShareType)); - _parameters['shareType'] = $shareType; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/files_sharing/api/v1/sharees_recommended{?itemType*,shareType*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + return _request; + } + + /// Find recommended sharees. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [itemType] Limit to specific item types. + /// * [shareType] Limit to specific share types. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Recommended sharees returned + /// + /// See: + /// * [$findRecommended_Request] for the request send by this method. + /// * [$findRecommended_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> findRecommended({ + required String itemType, + ShareesapiFindRecommendedShareType? shareType, + bool? oCSAPIRequest, + }) async { + final _request = $findRecommended_Request( + itemType: itemType, + shareType: shareType, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $findRecommended_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -5842,13 +5789,13 @@ extension $07eaa0304017ba8abe7f9f20d6a736f3Extension on _$07eaa0304017ba8abe7f9f List get _names => const ['builtListInt', r'$int']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -6247,9 +6194,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin(typesToLeaveAsList: const {_$07eaa0304017ba8abe7f9f20d6a736f3})) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin(typesToLeaveAsList: const {_$07eaa0304017ba8abe7f9f20d6a736f3})) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/files_trashbin.openapi.dart b/packages/nextcloud/lib/src/api/files_trashbin.openapi.dart index c5512406b70..caa98f8517d 100644 --- a/packages/nextcloud/lib/src/api/files_trashbin.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_trashbin.openapi.dart @@ -20,12 +20,13 @@ import 'dart:typed_data'; import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i5; +import 'package:built_value/standard_json_plugin.dart' as _i6; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i4; +import 'package:dynamite_runtime/built_value.dart' as _i5; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i3; +import 'package:uri/uri.dart' as _i4; part 'files_trashbin.openapi.g.dart'; @@ -58,7 +59,7 @@ class $PreviewClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getPreview_Request`. + /// Builds a serializer to parse the response of [$getPreview_Request]. @_i2.experimental _i1.DynamiteSerializer $getPreview_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -69,7 +70,7 @@ class $PreviewClient { /// Get the preview for a file. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getPreview] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -84,28 +85,59 @@ class $PreviewClient { /// * 404: Preview not found /// /// See: - /// * [getPreviewRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getPreview({ + /// * [getPreview] for a method executing this request and parsing the response. + /// * [$getPreview_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getPreview_Request({ int? fileId, int? x, int? y, PreviewGetPreviewA? a, - }) async { - final _rawResponse = await getPreviewRaw( - fileId: fileId, - x: x, - y: y, - a: a, + }) { + final _parameters = {}; + var $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); + $fileId ??= -1; + _parameters['fileId'] = $fileId; + + var $x = _$jsonSerializers.serialize(x, specifiedType: const FullType(int)); + $x ??= 32; + _parameters['x'] = $x; + + var $y = _$jsonSerializers.serialize(y, specifiedType: const FullType(int)); + $y ??= 32; + _parameters['y'] = $y; + + var $a = _$jsonSerializers.serialize(a, specifiedType: const FullType(PreviewGetPreviewA)); + $a ??= 0; + _parameters['a'] = $a; + + final _path = _i4.UriTemplate('/index.php/apps/files_trashbin/preview{?fileId*,x*,y*,a*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + return _request; } /// Get the preview for a file. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -120,59 +152,25 @@ class $PreviewClient { /// * 404: Preview not found /// /// See: - /// * [getPreview] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getPreviewRaw({ + /// * [$getPreview_Request] for the request send by this method. + /// * [$getPreview_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getPreview({ int? fileId, int? x, int? y, PreviewGetPreviewA? a, }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - var $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); - $fileId ??= -1; - _parameters['fileId'] = $fileId; - - var $x = _$jsonSerializers.serialize(x, specifiedType: const FullType(int)); - $x ??= 32; - _parameters['x'] = $x; - - var $y = _$jsonSerializers.serialize(y, specifiedType: const FullType(int)); - $y ??= 32; - _parameters['y'] = $y; - - var $a = _$jsonSerializers.serialize(a, specifiedType: const FullType(PreviewGetPreviewA)); - $a ??= 0; - _parameters['a'] = $a; - - final _path = _i3.UriTemplate('/index.php/apps/files_trashbin/preview{?fileId*,x*,y*,a*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getPreview_Request( + fileId: fileId, + x: x, + y: y, + a: a, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getPreview_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -325,9 +323,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i4.DynamiteDoubleSerializer()) - ..addPlugin(_i5.StandardJsonPlugin()) - ..addPlugin(const _i4.HeaderPlugin()) - ..addPlugin(const _i4.ContentStringPlugin())) + ..add(_i5.DynamiteDoubleSerializer()) + ..addPlugin(_i6.StandardJsonPlugin()) + ..addPlugin(const _i5.HeaderPlugin()) + ..addPlugin(const _i5.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/files_versions.openapi.dart b/packages/nextcloud/lib/src/api/files_versions.openapi.dart index 709c2e41314..26079c5b4e8 100644 --- a/packages/nextcloud/lib/src/api/files_versions.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_versions.openapi.dart @@ -19,12 +19,13 @@ import 'dart:typed_data'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i5; +import 'package:built_value/standard_json_plugin.dart' as _i6; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i4; +import 'package:dynamite_runtime/built_value.dart' as _i5; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i3; +import 'package:uri/uri.dart' as _i4; part 'files_versions.openapi.g.dart'; @@ -57,7 +58,7 @@ class $PreviewClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getPreview_Request`. + /// Builds a serializer to parse the response of [$getPreview_Request]. @_i2.experimental _i1.DynamiteSerializer $getPreview_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -68,7 +69,7 @@ class $PreviewClient { /// Get the preview for a file version. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getPreview] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -83,28 +84,59 @@ class $PreviewClient { /// * 404: Preview not found /// /// See: - /// * [getPreviewRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getPreview({ + /// * [getPreview] for a method executing this request and parsing the response. + /// * [$getPreview_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getPreview_Request({ String? file, int? x, int? y, String? version, - }) async { - final _rawResponse = await getPreviewRaw( - file: file, - x: x, - y: y, - version: version, + }) { + final _parameters = {}; + var $file = _$jsonSerializers.serialize(file, specifiedType: const FullType(String)); + $file ??= ''; + _parameters['file'] = $file; + + var $x = _$jsonSerializers.serialize(x, specifiedType: const FullType(int)); + $x ??= 44; + _parameters['x'] = $x; + + var $y = _$jsonSerializers.serialize(y, specifiedType: const FullType(int)); + $y ??= 44; + _parameters['y'] = $y; + + var $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); + $version ??= ''; + _parameters['version'] = $version; + + final _path = _i4.UriTemplate('/index.php/apps/files_versions/preview{?file*,x*,y*,version*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + return _request; } /// Get the preview for a file version. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -119,59 +151,25 @@ class $PreviewClient { /// * 404: Preview not found /// /// See: - /// * [getPreview] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getPreviewRaw({ + /// * [$getPreview_Request] for the request send by this method. + /// * [$getPreview_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getPreview({ String? file, int? x, int? y, String? version, }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - var $file = _$jsonSerializers.serialize(file, specifiedType: const FullType(String)); - $file ??= ''; - _parameters['file'] = $file; - - var $x = _$jsonSerializers.serialize(x, specifiedType: const FullType(int)); - $x ??= 44; - _parameters['x'] = $x; - - var $y = _$jsonSerializers.serialize(y, specifiedType: const FullType(int)); - $y ??= 44; - _parameters['y'] = $y; - - var $version = _$jsonSerializers.serialize(version, specifiedType: const FullType(String)); - $version ??= ''; - _parameters['version'] = $version; - - final _path = _i3.UriTemplate('/index.php/apps/files_versions/preview{?file*,x*,y*,version*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getPreview_Request( + file: file, + x: x, + y: y, + version: version, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getPreview_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -264,9 +262,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i4.DynamiteDoubleSerializer()) - ..addPlugin(_i5.StandardJsonPlugin()) - ..addPlugin(const _i4.HeaderPlugin()) - ..addPlugin(const _i4.ContentStringPlugin())) + ..add(_i5.DynamiteDoubleSerializer()) + ..addPlugin(_i6.StandardJsonPlugin()) + ..addPlugin(const _i5.HeaderPlugin()) + ..addPlugin(const _i5.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/news.openapi.dart b/packages/nextcloud/lib/src/api/news.openapi.dart index 318538d9504..9cd0f946361 100644 --- a/packages/nextcloud/lib/src/api/news.openapi.dart +++ b/packages/nextcloud/lib/src/api/news.openapi.dart @@ -20,12 +20,13 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i5; +import 'package:built_value/standard_json_plugin.dart' as _i6; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i4; +import 'package:dynamite_runtime/built_value.dart' as _i5; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i3; +import 'package:uri/uri.dart' as _i4; part 'news.openapi.g.dart'; @@ -49,7 +50,7 @@ class $Client extends _i1.DynamiteClient { authentications: client.authentications, ); - /// Builds a serializer to parse the response of `$getSupportedApiVersions_Request`. + /// Builds a serializer to parse the response of [$getSupportedApiVersions_Request]. @_i2.experimental _i1.DynamiteSerializer $getSupportedApiVersions_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(SupportedAPIVersions), @@ -58,6 +59,41 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); + /// Returns a `DynamiteRequest` backing the [getSupportedApiVersions] operation. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200 + /// + /// See: + /// * [getSupportedApiVersions] for a method executing this request and parsing the response. + /// * [$getSupportedApiVersions_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getSupportedApiVersions_Request() { + const _path = '/index.php/apps/news/api'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for basic_auth'); + } + +// coverage:ignore-end + return _request; + } + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -65,27 +101,41 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [getSupportedApiVersionsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getSupportedApiVersions_Request] for the request send by this method. + /// * [$getSupportedApiVersions_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getSupportedApiVersions() async { - final _rawResponse = await getSupportedApiVersionsRaw(); + final _request = $getSupportedApiVersions_Request(); + final _response = await sendWithCookies(_request); + final _serializer = $getSupportedApiVersions_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$listFolders_Request]. + @_i2.experimental + _i1.DynamiteSerializer $listFolders_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ListFolders), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [listFolders] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [getSupportedApiVersions] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [listFolders] for a method executing this request and parsing the response. + /// * [$listFolders_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getSupportedApiVersionsRaw() async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $listFolders_Request() { + const _path = '/index.php/apps/news/api/v1-3/folders'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -95,7 +145,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -103,26 +153,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - const _path = '/index.php/apps/news/api'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getSupportedApiVersions_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$listFolders_Request`. - @_i2.experimental - _i1.DynamiteSerializer $listFolders_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ListFolders), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -130,27 +163,48 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [listFoldersRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$listFolders_Request] for the request send by this method. + /// * [$listFolders_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> listFolders() async { - final _rawResponse = await listFoldersRaw(); + final _request = $listFolders_Request(); + final _response = await sendWithCookies(_request); + final _serializer = $listFolders_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$createFolder_Request]. + @_i2.experimental + _i1.DynamiteSerializer $createFolder_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ListFolders), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [createFolder] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// + /// Parameters: + /// * [name] + /// /// Status codes: /// * 200 /// /// See: - /// * [listFolders] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [createFolder] for a method executing this request and parsing the response. + /// * [$createFolder_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> listFoldersRaw() async { - final _headers = {'Accept': 'application/json'}; + _i3.Request $createFolder_Request({required String name}) { + final _parameters = {}; + final $name = _$jsonSerializers.serialize(name, specifiedType: const FullType(String)); + _parameters['name'] = $name; + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/folders{?name*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -160,7 +214,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -168,26 +222,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - const _path = '/index.php/apps/news/api/v1-3/folders'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $listFolders_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$createFolder_Request`. - @_i2.experimental - _i1.DynamiteSerializer $createFolder_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ListFolders), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -198,18 +235,29 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [createFolderRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$createFolder_Request] for the request send by this method. + /// * [$createFolder_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> createFolder({required String name}) async { - final _rawResponse = await createFolderRaw( + final _request = $createFolder_Request( name: name, ); + final _response = await sendWithCookies(_request); + final _serializer = $createFolder_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$renameFolder_Request]. + @_i2.experimental + _i1.DynamiteSerializer $renameFolder_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [renameFolder] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -219,12 +267,23 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [createFolder] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [renameFolder] for a method executing this request and parsing the response. + /// * [$renameFolder_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createFolderRaw({required String name}) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $renameFolder_Request({ + required int folderId, + required String name, + }) { + final _parameters = {}; + final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); + _parameters['folderId'] = $folderId; + + final $name = _$jsonSerializers.serialize(name, specifiedType: const FullType(String)); + _parameters['name'] = $name; + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/folders/{folderId}{?name*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('put', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -234,7 +293,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -242,29 +301,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $name = _$jsonSerializers.serialize(name, specifiedType: const FullType(String)); - _parameters['name'] = $name; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/folders{?name*}').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $createFolder_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$renameFolder_Request`. - @_i2.experimental - _i1.DynamiteSerializer $renameFolder_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -275,40 +314,50 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [renameFolderRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$renameFolder_Request] for the request send by this method. + /// * [$renameFolder_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> renameFolder({ required int folderId, required String name, }) async { - final _rawResponse = await renameFolderRaw( + final _request = $renameFolder_Request( folderId: folderId, name: name, ); + final _response = await sendWithCookies(_request); + final _serializer = $renameFolder_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$deleteFolder_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteFolder_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [deleteFolder] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// - /// Parameters: - /// * [name] - /// /// Status codes: /// * 200 /// /// See: - /// * [renameFolder] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteFolder] for a method executing this request and parsing the response. + /// * [$deleteFolder_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> renameFolderRaw({ - required int folderId, - required String name, - }) async { - final _parameters = {}; - final _headers = {}; + _i3.Request $deleteFolder_Request({required int folderId}) { + final _parameters = {}; + final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); + _parameters['folderId'] = $folderId; + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/folders/{folderId}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('delete', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -318,7 +367,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -326,32 +375,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); - _parameters['folderId'] = $folderId; - - final $name = _$jsonSerializers.serialize(name, specifiedType: const FullType(String)); - _parameters['name'] = $name; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/folders/{folderId}{?name*}').expand(_parameters); - final _response = await executeRequest( - 'put', - _path, - headers: _headers, - ); - - final _serializer = $renameFolder_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteFolder_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteFolder_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -359,30 +385,56 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [deleteFolderRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteFolder_Request] for the request send by this method. + /// * [$deleteFolder_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteFolder({required int folderId}) async { - final _rawResponse = await deleteFolderRaw( + final _request = $deleteFolder_Request( folderId: folderId, ); + final _response = await sendWithCookies(_request); + final _serializer = $deleteFolder_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$markFolderAsRead_Request]. + @_i2.experimental + _i1.DynamiteSerializer $markFolderAsRead_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [markFolderAsRead] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// + /// Parameters: + /// * [newestItemId] The newest read item. + /// /// Status codes: /// * 200 /// /// See: - /// * [deleteFolder] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [markFolderAsRead] for a method executing this request and parsing the response. + /// * [$markFolderAsRead_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteFolderRaw({required int folderId}) async { - final _parameters = {}; - final _headers = {}; + _i3.Request $markFolderAsRead_Request({ + required int folderId, + required int newestItemId, + }) { + final _parameters = {}; + final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); + _parameters['folderId'] = $folderId; + final $newestItemId = _$jsonSerializers.serialize(newestItemId, specifiedType: const FullType(int)); + _parameters['newestItemId'] = $newestItemId; + + final _path = + _i4.UriTemplate('/index.php/apps/news/api/v1-3/folders/{folderId}/read{?newestItemId*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -392,7 +444,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -400,29 +452,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); - _parameters['folderId'] = $folderId; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/folders/{folderId}').expand(_parameters); - final _response = await executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $deleteFolder_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$markFolderAsRead_Request`. - @_i2.experimental - _i1.DynamiteSerializer $markFolderAsRead_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -433,40 +465,47 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [markFolderAsReadRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$markFolderAsRead_Request] for the request send by this method. + /// * [$markFolderAsRead_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> markFolderAsRead({ required int folderId, required int newestItemId, }) async { - final _rawResponse = await markFolderAsReadRaw( + final _request = $markFolderAsRead_Request( folderId: folderId, newestItemId: newestItemId, ); + final _response = await sendWithCookies(_request); + final _serializer = $markFolderAsRead_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$listFeeds_Request]. + @_i2.experimental + _i1.DynamiteSerializer $listFeeds_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ListFeeds), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [listFeeds] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// - /// Parameters: - /// * [newestItemId] The newest read item. - /// /// Status codes: /// * 200 /// /// See: - /// * [markFolderAsRead] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [listFeeds] for a method executing this request and parsing the response. + /// * [$listFeeds_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> markFolderAsReadRaw({ - required int folderId, - required int newestItemId, - }) async { - final _parameters = {}; - final _headers = {}; - + _i3.Request $listFeeds_Request() { + const _path = '/index.php/apps/news/api/v1-3/feeds'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -476,7 +515,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -484,33 +523,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); - _parameters['folderId'] = $folderId; - - final $newestItemId = _$jsonSerializers.serialize(newestItemId, specifiedType: const FullType(int)); - _parameters['newestItemId'] = $newestItemId; - - final _path = - _i3.UriTemplate('/index.php/apps/news/api/v1-3/folders/{folderId}/read{?newestItemId*}').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $markFolderAsRead_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$listFeeds_Request`. - @_i2.experimental - _i1.DynamiteSerializer $listFeeds_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ListFeeds), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -518,27 +533,55 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [listFeedsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$listFeeds_Request] for the request send by this method. + /// * [$listFeeds_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> listFeeds() async { - final _rawResponse = await listFeedsRaw(); + final _request = $listFeeds_Request(); + final _response = await sendWithCookies(_request); + final _serializer = $listFeeds_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$addFeed_Request]. + @_i2.experimental + _i1.DynamiteSerializer $addFeed_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ListFeeds), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [addFeed] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// + /// Parameters: + /// * [url] + /// * [folderId] + /// /// Status codes: /// * 200 /// /// See: - /// * [listFeeds] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [addFeed] for a method executing this request and parsing the response. + /// * [$addFeed_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> listFeedsRaw() async { - final _headers = {'Accept': 'application/json'}; + _i3.Request $addFeed_Request({ + required String url, + int? folderId, + }) { + final _parameters = {}; + final $url = _$jsonSerializers.serialize(url, specifiedType: const FullType(String)); + _parameters['url'] = $url; + final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); + _parameters['folderId'] = $folderId; + + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/feeds{?url*,folderId*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -548,7 +591,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -556,26 +599,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - const _path = '/index.php/apps/news/api/v1-3/feeds'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $listFeeds_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$addFeed_Request`. - @_i2.experimental - _i1.DynamiteSerializer $addFeed_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ListFeeds), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -587,41 +613,50 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [addFeedRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$addFeed_Request] for the request send by this method. + /// * [$addFeed_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> addFeed({ required String url, int? folderId, }) async { - final _rawResponse = await addFeedRaw( + final _request = $addFeed_Request( url: url, folderId: folderId, ); + final _response = await sendWithCookies(_request); + final _serializer = $addFeed_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [url] - /// * [folderId] - /// - /// Status codes: + /// Builds a serializer to parse the response of [$deleteFeed_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteFeed_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [deleteFeed] operation. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: /// * 200 /// /// See: - /// * [addFeed] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteFeed] for a method executing this request and parsing the response. + /// * [$deleteFeed_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> addFeedRaw({ - required String url, - int? folderId, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $deleteFeed_Request({required int feedId}) { + final _parameters = {}; + final $feedId = _$jsonSerializers.serialize(feedId, specifiedType: const FullType(int)); + _parameters['feedId'] = $feedId; + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/feeds/{feedId}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('delete', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -631,7 +666,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -639,32 +674,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $url = _$jsonSerializers.serialize(url, specifiedType: const FullType(String)); - _parameters['url'] = $url; - - final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); - _parameters['folderId'] = $folderId; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/feeds{?url*,folderId*}').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $addFeed_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteFeed_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteFeed_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -672,30 +684,55 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [deleteFeedRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteFeed_Request] for the request send by this method. + /// * [$deleteFeed_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteFeed({required int feedId}) async { - final _rawResponse = await deleteFeedRaw( + final _request = $deleteFeed_Request( feedId: feedId, ); + final _response = await sendWithCookies(_request); + final _serializer = $deleteFeed_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$moveFeed_Request]. + @_i2.experimental + _i1.DynamiteSerializer $moveFeed_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [moveFeed] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// + /// Parameters: + /// * [folderId] + /// /// Status codes: /// * 200 /// /// See: - /// * [deleteFeed] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [moveFeed] for a method executing this request and parsing the response. + /// * [$moveFeed_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteFeedRaw({required int feedId}) async { - final _parameters = {}; - final _headers = {}; + _i3.Request $moveFeed_Request({ + required int feedId, + int? folderId, + }) { + final _parameters = {}; + final $feedId = _$jsonSerializers.serialize(feedId, specifiedType: const FullType(int)); + _parameters['feedId'] = $feedId; + + final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); + _parameters['folderId'] = $folderId; + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/feeds/{feedId}/move{?folderId*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -705,7 +742,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -713,29 +750,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $feedId = _$jsonSerializers.serialize(feedId, specifiedType: const FullType(int)); - _parameters['feedId'] = $feedId; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/feeds/{feedId}').expand(_parameters); - final _response = await executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $deleteFeed_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$moveFeed_Request`. - @_i2.experimental - _i1.DynamiteSerializer $moveFeed_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -746,40 +763,60 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [moveFeedRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$moveFeed_Request] for the request send by this method. + /// * [$moveFeed_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> moveFeed({ required int feedId, int? folderId, }) async { - final _rawResponse = await moveFeedRaw( + final _request = $moveFeed_Request( feedId: feedId, folderId: folderId, ); + final _response = await sendWithCookies(_request); + final _serializer = $moveFeed_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$renameFeed_Request]. + @_i2.experimental + _i1.DynamiteSerializer $renameFeed_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [renameFeed] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [folderId] + /// * [feedTitle] /// /// Status codes: /// * 200 /// /// See: - /// * [moveFeed] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [renameFeed] for a method executing this request and parsing the response. + /// * [$renameFeed_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> moveFeedRaw({ + _i3.Request $renameFeed_Request({ required int feedId, - int? folderId, - }) async { - final _parameters = {}; - final _headers = {}; + required String feedTitle, + }) { + final _parameters = {}; + final $feedId = _$jsonSerializers.serialize(feedId, specifiedType: const FullType(int)); + _parameters['feedId'] = $feedId; + + final $feedTitle = _$jsonSerializers.serialize(feedTitle, specifiedType: const FullType(String)); + _parameters['feedTitle'] = $feedTitle; + final _path = + _i4.UriTemplate('/index.php/apps/news/api/v1-3/feeds/{feedId}/rename{?feedTitle*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -789,7 +826,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -797,32 +834,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $feedId = _$jsonSerializers.serialize(feedId, specifiedType: const FullType(int)); - _parameters['feedId'] = $feedId; - - final $folderId = _$jsonSerializers.serialize(folderId, specifiedType: const FullType(int)); - _parameters['folderId'] = $folderId; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/feeds/{feedId}/move{?folderId*}').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $moveFeed_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$renameFeed_Request`. - @_i2.experimental - _i1.DynamiteSerializer $renameFeed_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -833,40 +847,60 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [renameFeedRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$renameFeed_Request] for the request send by this method. + /// * [$renameFeed_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> renameFeed({ required int feedId, required String feedTitle, }) async { - final _rawResponse = await renameFeedRaw( + final _request = $renameFeed_Request( feedId: feedId, feedTitle: feedTitle, ); + final _response = await sendWithCookies(_request); + final _serializer = $renameFeed_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$markFeedAsRead_Request]. + @_i2.experimental + _i1.DynamiteSerializer $markFeedAsRead_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [markFeedAsRead] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [feedTitle] + /// * [newestItemId] /// /// Status codes: /// * 200 /// /// See: - /// * [renameFeed] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [markFeedAsRead] for a method executing this request and parsing the response. + /// * [$markFeedAsRead_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> renameFeedRaw({ + _i3.Request $markFeedAsRead_Request({ required int feedId, - required String feedTitle, - }) async { - final _parameters = {}; - final _headers = {}; + required int newestItemId, + }) { + final _parameters = {}; + final $feedId = _$jsonSerializers.serialize(feedId, specifiedType: const FullType(int)); + _parameters['feedId'] = $feedId; + + final $newestItemId = _$jsonSerializers.serialize(newestItemId, specifiedType: const FullType(int)); + _parameters['newestItemId'] = $newestItemId; + final _path = + _i4.UriTemplate('/index.php/apps/news/api/v1-3/feeds/{feedId}/read{?newestItemId*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -876,7 +910,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -884,33 +918,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $feedId = _$jsonSerializers.serialize(feedId, specifiedType: const FullType(int)); - _parameters['feedId'] = $feedId; - - final $feedTitle = _$jsonSerializers.serialize(feedTitle, specifiedType: const FullType(String)); - _parameters['feedTitle'] = $feedTitle; - - final _path = - _i3.UriTemplate('/index.php/apps/news/api/v1-3/feeds/{feedId}/rename{?feedTitle*}').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $renameFeed_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$markFeedAsRead_Request`. - @_i2.experimental - _i1.DynamiteSerializer $markFeedAsRead_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -921,40 +931,89 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [markFeedAsReadRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$markFeedAsRead_Request] for the request send by this method. + /// * [$markFeedAsRead_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> markFeedAsRead({ required int feedId, required int newestItemId, }) async { - final _rawResponse = await markFeedAsReadRaw( + final _request = $markFeedAsRead_Request( feedId: feedId, newestItemId: newestItemId, ); + final _response = await sendWithCookies(_request); + final _serializer = $markFeedAsRead_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$listArticles_Request]. + @_i2.experimental + _i1.DynamiteSerializer $listArticles_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ListArticles), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [listArticles] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [newestItemId] + /// * [type] Defaults to `3`. + /// * [id] Defaults to `0`. + /// * [getRead] Defaults to `1`. + /// * [batchSize] Defaults to `-1`. + /// * [offset] Defaults to `0`. + /// * [oldestFirst] Defaults to `0`. /// /// Status codes: /// * 200 /// /// See: - /// * [markFeedAsRead] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [listArticles] for a method executing this request and parsing the response. + /// * [$listArticles_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> markFeedAsReadRaw({ - required int feedId, - required int newestItemId, - }) async { - final _parameters = {}; - final _headers = {}; + _i3.Request $listArticles_Request({ + int? type, + int? id, + int? getRead, + int? batchSize, + int? offset, + int? oldestFirst, + }) { + final _parameters = {}; + var $type = _$jsonSerializers.serialize(type, specifiedType: const FullType(int)); + $type ??= 3; + _parameters['type'] = $type; + + var $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + $id ??= 0; + _parameters['id'] = $id; + + var $getRead = _$jsonSerializers.serialize(getRead, specifiedType: const FullType(int)); + $getRead ??= 1; + _parameters['getRead'] = $getRead; + + var $batchSize = _$jsonSerializers.serialize(batchSize, specifiedType: const FullType(int)); + $batchSize ??= -1; + _parameters['batchSize'] = $batchSize; + + var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); + $offset ??= 0; + _parameters['offset'] = $offset; + + var $oldestFirst = _$jsonSerializers.serialize(oldestFirst, specifiedType: const FullType(int)); + $oldestFirst ??= 0; + _parameters['oldestFirst'] = $oldestFirst; + final _path = + _i4.UriTemplate('/index.php/apps/news/api/v1-3/items{?type*,id*,getRead*,batchSize*,offset*,oldestFirst*}') + .expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -964,7 +1023,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -972,33 +1031,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $feedId = _$jsonSerializers.serialize(feedId, specifiedType: const FullType(int)); - _parameters['feedId'] = $feedId; - - final $newestItemId = _$jsonSerializers.serialize(newestItemId, specifiedType: const FullType(int)); - _parameters['newestItemId'] = $newestItemId; - - final _path = - _i3.UriTemplate('/index.php/apps/news/api/v1-3/feeds/{feedId}/read{?newestItemId*}').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $markFeedAsRead_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$listArticles_Request`. - @_i2.experimental - _i1.DynamiteSerializer $listArticles_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ListArticles), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -1014,7 +1049,8 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [listArticlesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$listArticles_Request] for the request send by this method. + /// * [$listArticles_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> listArticles({ int? type, int? id, @@ -1023,7 +1059,7 @@ class $Client extends _i1.DynamiteClient { int? offset, int? oldestFirst, }) async { - final _rawResponse = await listArticlesRaw( + final _request = $listArticles_Request( type: type, id: id, getRead: getRead, @@ -1031,40 +1067,60 @@ class $Client extends _i1.DynamiteClient { offset: offset, oldestFirst: oldestFirst, ); + final _response = await sendWithCookies(_request); + final _serializer = $listArticles_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$listUpdatedArticles_Request]. + @_i2.experimental + _i1.DynamiteSerializer $listUpdatedArticles_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ListArticles), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [listUpdatedArticles] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [type] Defaults to `3`. /// * [id] Defaults to `0`. - /// * [getRead] Defaults to `1`. - /// * [batchSize] Defaults to `-1`. - /// * [offset] Defaults to `0`. - /// * [oldestFirst] Defaults to `0`. + /// * [lastModified] Defaults to `0`. /// /// Status codes: /// * 200 /// /// See: - /// * [listArticles] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [listUpdatedArticles] for a method executing this request and parsing the response. + /// * [$listUpdatedArticles_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> listArticlesRaw({ + _i3.Request $listUpdatedArticles_Request({ int? type, int? id, - int? getRead, - int? batchSize, - int? offset, - int? oldestFirst, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + int? lastModified, + }) { + final _parameters = {}; + var $type = _$jsonSerializers.serialize(type, specifiedType: const FullType(int)); + $type ??= 3; + _parameters['type'] = $type; + + var $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + $id ??= 0; + _parameters['id'] = $id; + var $lastModified = _$jsonSerializers.serialize(lastModified, specifiedType: const FullType(int)); + $lastModified ??= 0; + _parameters['lastModified'] = $lastModified; + + final _path = + _i4.UriTemplate('/index.php/apps/news/api/v1-3/items/updated{?type*,id*,lastModified*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1074,7 +1130,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1082,52 +1138,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - var $type = _$jsonSerializers.serialize(type, specifiedType: const FullType(int)); - $type ??= 3; - _parameters['type'] = $type; - - var $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - $id ??= 0; - _parameters['id'] = $id; - - var $getRead = _$jsonSerializers.serialize(getRead, specifiedType: const FullType(int)); - $getRead ??= 1; - _parameters['getRead'] = $getRead; - - var $batchSize = _$jsonSerializers.serialize(batchSize, specifiedType: const FullType(int)); - $batchSize ??= -1; - _parameters['batchSize'] = $batchSize; - - var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); - $offset ??= 0; - _parameters['offset'] = $offset; - - var $oldestFirst = _$jsonSerializers.serialize(oldestFirst, specifiedType: const FullType(int)); - $oldestFirst ??= 0; - _parameters['oldestFirst'] = $oldestFirst; - - final _path = - _i3.UriTemplate('/index.php/apps/news/api/v1-3/items{?type*,id*,getRead*,batchSize*,offset*,oldestFirst*}') - .expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $listArticles_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$listUpdatedArticles_Request`. - @_i2.experimental - _i1.DynamiteSerializer $listUpdatedArticles_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ListArticles), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -1140,45 +1153,52 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [listUpdatedArticlesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$listUpdatedArticles_Request] for the request send by this method. + /// * [$listUpdatedArticles_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> listUpdatedArticles({ int? type, int? id, int? lastModified, }) async { - final _rawResponse = await listUpdatedArticlesRaw( + final _request = $listUpdatedArticles_Request( type: type, id: id, lastModified: lastModified, ); + final _response = await sendWithCookies(_request); + final _serializer = $listUpdatedArticles_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$markArticleAsRead_Request]. + @_i2.experimental + _i1.DynamiteSerializer $markArticleAsRead_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [markArticleAsRead] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// - /// Parameters: - /// * [type] Defaults to `3`. - /// * [id] Defaults to `0`. - /// * [lastModified] Defaults to `0`. - /// /// Status codes: /// * 200 /// /// See: - /// * [listUpdatedArticles] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [markArticleAsRead] for a method executing this request and parsing the response. + /// * [$markArticleAsRead_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> listUpdatedArticlesRaw({ - int? type, - int? id, - int? lastModified, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $markArticleAsRead_Request({required int itemId}) { + final _parameters = {}; + final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(int)); + _parameters['itemId'] = $itemId; + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/items/{itemId}/read').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1188,7 +1208,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1196,39 +1216,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - var $type = _$jsonSerializers.serialize(type, specifiedType: const FullType(int)); - $type ??= 3; - _parameters['type'] = $type; - - var $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - $id ??= 0; - _parameters['id'] = $id; - - var $lastModified = _$jsonSerializers.serialize(lastModified, specifiedType: const FullType(int)); - $lastModified ??= 0; - _parameters['lastModified'] = $lastModified; - - final _path = - _i3.UriTemplate('/index.php/apps/news/api/v1-3/items/updated{?type*,id*,lastModified*}').expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $listUpdatedArticles_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$markArticleAsRead_Request`. - @_i2.experimental - _i1.DynamiteSerializer $markArticleAsRead_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -1236,30 +1226,46 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [markArticleAsReadRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$markArticleAsRead_Request] for the request send by this method. + /// * [$markArticleAsRead_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> markArticleAsRead({required int itemId}) async { - final _rawResponse = await markArticleAsReadRaw( + final _request = $markArticleAsRead_Request( itemId: itemId, ); + final _response = await sendWithCookies(_request); + final _serializer = $markArticleAsRead_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$markArticleAsUnread_Request]. + @_i2.experimental + _i1.DynamiteSerializer $markArticleAsUnread_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [markArticleAsUnread] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [markArticleAsRead] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [markArticleAsUnread] for a method executing this request and parsing the response. + /// * [$markArticleAsUnread_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> markArticleAsReadRaw({required int itemId}) async { - final _parameters = {}; - final _headers = {}; + _i3.Request $markArticleAsUnread_Request({required int itemId}) { + final _parameters = {}; + final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(int)); + _parameters['itemId'] = $itemId; + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/items/{itemId}/unread').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1269,7 +1275,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1277,29 +1283,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(int)); - _parameters['itemId'] = $itemId; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/items/{itemId}/read').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $markArticleAsRead_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$markArticleAsUnread_Request`. - @_i2.experimental - _i1.DynamiteSerializer $markArticleAsUnread_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -1307,30 +1293,46 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [markArticleAsUnreadRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$markArticleAsUnread_Request] for the request send by this method. + /// * [$markArticleAsUnread_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> markArticleAsUnread({required int itemId}) async { - final _rawResponse = await markArticleAsUnreadRaw( + final _request = $markArticleAsUnread_Request( itemId: itemId, ); + final _response = await sendWithCookies(_request); + final _serializer = $markArticleAsUnread_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$starArticle_Request]. + @_i2.experimental + _i1.DynamiteSerializer $starArticle_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [starArticle] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [markArticleAsUnread] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [starArticle] for a method executing this request and parsing the response. + /// * [$starArticle_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> markArticleAsUnreadRaw({required int itemId}) async { - final _parameters = {}; - final _headers = {}; + _i3.Request $starArticle_Request({required int itemId}) { + final _parameters = {}; + final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(int)); + _parameters['itemId'] = $itemId; + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/items/{itemId}/star').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1340,7 +1342,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1348,29 +1350,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(int)); - _parameters['itemId'] = $itemId; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/items/{itemId}/unread').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $markArticleAsUnread_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$starArticle_Request`. - @_i2.experimental - _i1.DynamiteSerializer $starArticle_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -1378,30 +1360,46 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [starArticleRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$starArticle_Request] for the request send by this method. + /// * [$starArticle_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> starArticle({required int itemId}) async { - final _rawResponse = await starArticleRaw( + final _request = $starArticle_Request( itemId: itemId, ); + final _response = await sendWithCookies(_request); + final _serializer = $starArticle_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$unstarArticle_Request]. + @_i2.experimental + _i1.DynamiteSerializer $unstarArticle_Serializer() => _i1.DynamiteSerializer( + bodyType: null, + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [unstarArticle] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [starArticle] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [unstarArticle] for a method executing this request and parsing the response. + /// * [$unstarArticle_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> starArticleRaw({required int itemId}) async { - final _parameters = {}; - final _headers = {}; + _i3.Request $unstarArticle_Request({required int itemId}) { + final _parameters = {}; + final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(int)); + _parameters['itemId'] = $itemId; + final _path = _i4.UriTemplate('/index.php/apps/news/api/v1-3/items/{itemId}/unstar').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1411,7 +1409,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1419,29 +1417,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(int)); - _parameters['itemId'] = $itemId; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/items/{itemId}/star').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $starArticle_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$unstarArticle_Request`. - @_i2.experimental - _i1.DynamiteSerializer $unstarArticle_Serializer() => _i1.DynamiteSerializer( - bodyType: null, - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -1449,59 +1427,17 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [unstarArticleRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$unstarArticle_Request] for the request send by this method. + /// * [$unstarArticle_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> unstarArticle({required int itemId}) async { - final _rawResponse = await unstarArticleRaw( + final _request = $unstarArticle_Request( itemId: itemId, ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Status codes: - /// * 200 - /// - /// See: - /// * [unstarArticle] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> unstarArticleRaw({required int itemId}) async { - final _parameters = {}; - final _headers = {}; - -// coverage:ignore-start - final authentication = authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for basic_auth'); - } - -// coverage:ignore-end - final $itemId = _$jsonSerializers.serialize(itemId, specifiedType: const FullType(int)); - _parameters['itemId'] = $itemId; - - final _path = _i3.UriTemplate('/index.php/apps/news/api/v1-3/items/{itemId}/unstar').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); + final _response = await sendWithCookies(_request); final _serializer = $unstarArticle_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -1902,9 +1838,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i4.DynamiteDoubleSerializer()) - ..addPlugin(_i5.StandardJsonPlugin()) - ..addPlugin(const _i4.HeaderPlugin()) - ..addPlugin(const _i4.ContentStringPlugin())) + ..add(_i5.DynamiteDoubleSerializer()) + ..addPlugin(_i6.StandardJsonPlugin()) + ..addPlugin(const _i5.HeaderPlugin()) + ..addPlugin(const _i5.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/notes.openapi.dart b/packages/nextcloud/lib/src/api/notes.openapi.dart index c84d9cf2927..74ecb484e80 100644 --- a/packages/nextcloud/lib/src/api/notes.openapi.dart +++ b/packages/nextcloud/lib/src/api/notes.openapi.dart @@ -17,17 +17,17 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:convert'; -import 'dart:typed_data'; import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i5; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; import 'package:uri/uri.dart' as _i4; @@ -53,7 +53,7 @@ class $Client extends _i1.DynamiteClient { authentications: client.authentications, ); - /// Builds a serializer to parse the response of `$getNotes_Request`. + /// Builds a serializer to parse the response of [$getNotes_Request]. @_i2.experimental _i1.DynamiteSerializer, void> $getNotes_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(BuiltList, [FullType(Note)]), @@ -62,7 +62,7 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getNotes] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -77,74 +77,18 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [getNotesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse, void>> getNotes({ - String? category, - String? exclude, - int? pruneBefore, - int? chunkSize, - String? chunkCursor, - String? ifNoneMatch, - }) async { - final _rawResponse = await getNotesRaw( - category: category, - exclude: exclude, - pruneBefore: pruneBefore, - chunkSize: chunkSize, - chunkCursor: chunkCursor, - ifNoneMatch: ifNoneMatch, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [category] - /// * [exclude] Defaults to `''`. - /// * [pruneBefore] Defaults to `0`. - /// * [chunkSize] Defaults to `0`. - /// * [chunkCursor] - /// * [ifNoneMatch] - /// - /// Status codes: - /// * 200 - /// - /// See: - /// * [getNotes] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getNotes] for a method executing this request and parsing the response. + /// * [$getNotes_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse, void>> getNotesRaw({ + _i3.Request $getNotes_Request({ String? category, String? exclude, int? pruneBefore, int? chunkSize, String? chunkCursor, String? ifNoneMatch, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $category = _$jsonSerializers.serialize(category, specifiedType: const FullType(String)); _parameters['category'] = $category; @@ -163,69 +107,87 @@ class $Client extends _i1.DynamiteClient { final $chunkCursor = _$jsonSerializers.serialize(chunkCursor, specifiedType: const FullType(String)); _parameters['chunkCursor'] = $chunkCursor; - final $ifNoneMatch = _$jsonSerializers.serialize(ifNoneMatch, specifiedType: const FullType(String)); - if ($ifNoneMatch != null) { - _headers['If-None-Match'] = const _i3.HeaderEncoder().convert($ifNoneMatch); - } - final _path = _i4.UriTemplate('/index.php/apps/notes/api/v1/notes{?category*,exclude*,pruneBefore*,chunkSize*,chunkCursor*}') .expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $getNotes_Serializer(); - return _i1.ResponseConverter, void>(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$createNote_Request`. - @_i2.experimental - _i1.DynamiteSerializer $createNote_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Note), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for basic_auth'); + } + +// coverage:ignore-end + final $ifNoneMatch = _$jsonSerializers.serialize(ifNoneMatch, specifiedType: const FullType(String)); + if ($ifNoneMatch != null) { + _request.headers['If-None-Match'] = const _i5.HeaderEncoder().convert($ifNoneMatch); + } + + return _request; + } /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [category] Defaults to `''`. - /// * [title] Defaults to `''`. - /// * [content] Defaults to `''`. - /// * [modified] Defaults to `0`. - /// * [favorite] Defaults to `0`. + /// * [category] + /// * [exclude] Defaults to `''`. + /// * [pruneBefore] Defaults to `0`. + /// * [chunkSize] Defaults to `0`. + /// * [chunkCursor] + /// * [ifNoneMatch] /// /// Status codes: /// * 200 /// /// See: - /// * [createNoteRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> createNote({ + /// * [$getNotes_Request] for the request send by this method. + /// * [$getNotes_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse, void>> getNotes({ String? category, - String? title, - String? content, - int? modified, - int? favorite, + String? exclude, + int? pruneBefore, + int? chunkSize, + String? chunkCursor, + String? ifNoneMatch, }) async { - final _rawResponse = await createNoteRaw( + final _request = $getNotes_Request( category: category, - title: title, - content: content, - modified: modified, - favorite: favorite, + exclude: exclude, + pruneBefore: pruneBefore, + chunkSize: chunkSize, + chunkCursor: chunkCursor, + ifNoneMatch: ifNoneMatch, ); + final _response = await sendWithCookies(_request); + final _serializer = $getNotes_Serializer(); + final _rawResponse = await _i1.ResponseConverter, void>(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$createNote_Request]. + @_i2.experimental + _i1.DynamiteSerializer $createNote_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Note), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [createNote] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -239,35 +201,17 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [createNote] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [createNote] for a method executing this request and parsing the response. + /// * [$createNote_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createNoteRaw({ + _i3.Request $createNote_Request({ String? category, String? title, String? content, int? modified, int? favorite, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; var $category = _$jsonSerializers.serialize(category, specifiedType: const FullType(String)); $category ??= ''; _parameters['category'] = $category; @@ -290,54 +234,76 @@ class $Client extends _i1.DynamiteClient { final _path = _i4.UriTemplate('/index.php/apps/notes/api/v1/notes{?category*,title*,content*,modified*,favorite*}') .expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $createNote_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$getNote_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getNote_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Note), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for basic_auth'); + } + +// coverage:ignore-end + return _request; + } /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [exclude] Defaults to `''`. - /// * [ifNoneMatch] + /// * [category] Defaults to `''`. + /// * [title] Defaults to `''`. + /// * [content] Defaults to `''`. + /// * [modified] Defaults to `0`. + /// * [favorite] Defaults to `0`. /// /// Status codes: /// * 200 /// /// See: - /// * [getNoteRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getNote({ - required int id, - String? exclude, - String? ifNoneMatch, + /// * [$createNote_Request] for the request send by this method. + /// * [$createNote_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> createNote({ + String? category, + String? title, + String? content, + int? modified, + int? favorite, }) async { - final _rawResponse = await getNoteRaw( - id: id, - exclude: exclude, - ifNoneMatch: ifNoneMatch, + final _request = $createNote_Request( + category: category, + title: title, + content: content, + modified: modified, + favorite: favorite, ); + final _response = await sendWithCookies(_request); + final _serializer = $createNote_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$getNote_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getNote_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Note), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [getNote] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -348,16 +314,26 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [getNote] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getNote] for a method executing this request and parsing the response. + /// * [$getNote_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getNoteRaw({ + _i3.Request $getNote_Request({ required int id, String? exclude, String? ifNoneMatch, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + var $exclude = _$jsonSerializers.serialize(exclude, specifiedType: const FullType(String)); + $exclude ??= ''; + _parameters['exclude'] = $exclude; + + final _path = _i4.UriTemplate('/index.php/apps/notes/api/v1/notes/{id}{?exclude*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -367,7 +343,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -375,79 +351,54 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - - var $exclude = _$jsonSerializers.serialize(exclude, specifiedType: const FullType(String)); - $exclude ??= ''; - _parameters['exclude'] = $exclude; - final $ifNoneMatch = _$jsonSerializers.serialize(ifNoneMatch, specifiedType: const FullType(String)); if ($ifNoneMatch != null) { - _headers['If-None-Match'] = const _i3.HeaderEncoder().convert($ifNoneMatch); + _request.headers['If-None-Match'] = const _i5.HeaderEncoder().convert($ifNoneMatch); } - final _path = _i4.UriTemplate('/index.php/apps/notes/api/v1/notes/{id}{?exclude*}').expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getNote_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$updateNote_Request`. - @_i2.experimental - _i1.DynamiteSerializer $updateNote_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Note), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [content] - /// * [modified] - /// * [title] - /// * [category] - /// * [favorite] - /// * [ifMatch] + /// * [exclude] Defaults to `''`. + /// * [ifNoneMatch] /// /// Status codes: /// * 200 /// /// See: - /// * [updateNoteRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> updateNote({ + /// * [$getNote_Request] for the request send by this method. + /// * [$getNote_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getNote({ required int id, - String? content, - int? modified, - String? title, - String? category, - int? favorite, - String? ifMatch, + String? exclude, + String? ifNoneMatch, }) async { - final _rawResponse = await updateNoteRaw( + final _request = $getNote_Request( id: id, - content: content, - modified: modified, - title: title, - category: category, - favorite: favorite, - ifMatch: ifMatch, + exclude: exclude, + ifNoneMatch: ifNoneMatch, ); + final _response = await sendWithCookies(_request); + final _serializer = $getNote_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$updateNote_Request]. + @_i2.experimental + _i1.DynamiteSerializer $updateNote_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Note), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [updateNote] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -462,9 +413,10 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [updateNote] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [updateNote] for a method executing this request and parsing the response. + /// * [$updateNote_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> updateNoteRaw({ + _i3.Request $updateNote_Request({ required int id, String? content, int? modified, @@ -472,27 +424,8 @@ class $Client extends _i1.DynamiteClient { String? category, int? favorite, String? ifMatch, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); _parameters['id'] = $id; @@ -511,64 +444,107 @@ class $Client extends _i1.DynamiteClient { final $favorite = _$jsonSerializers.serialize(favorite, specifiedType: const FullType(int)); _parameters['favorite'] = $favorite; - final $ifMatch = _$jsonSerializers.serialize(ifMatch, specifiedType: const FullType(String)); - if ($ifMatch != null) { - _headers['If-Match'] = const _i3.HeaderEncoder().convert($ifMatch); - } - final _path = _i4.UriTemplate('/index.php/apps/notes/api/v1/notes/{id}{?content*,modified*,title*,category*,favorite*}') .expand(_parameters); - final _response = await executeRequest( - 'put', - _path, - headers: _headers, + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $updateNote_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$deleteNote_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteNote_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(String), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for basic_auth'); + } + +// coverage:ignore-end + final $ifMatch = _$jsonSerializers.serialize(ifMatch, specifiedType: const FullType(String)); + if ($ifMatch != null) { + _request.headers['If-Match'] = const _i5.HeaderEncoder().convert($ifMatch); + } + + return _request; + } /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// + /// Parameters: + /// * [content] + /// * [modified] + /// * [title] + /// * [category] + /// * [favorite] + /// * [ifMatch] + /// /// Status codes: /// * 200 /// /// See: - /// * [deleteNoteRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteNote({required int id}) async { - final _rawResponse = await deleteNoteRaw( + /// * [$updateNote_Request] for the request send by this method. + /// * [$updateNote_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> updateNote({ + required int id, + String? content, + int? modified, + String? title, + String? category, + int? favorite, + String? ifMatch, + }) async { + final _request = $updateNote_Request( id: id, + content: content, + modified: modified, + title: title, + category: category, + favorite: favorite, + ifMatch: ifMatch, ); + final _response = await sendWithCookies(_request); + final _serializer = $updateNote_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$deleteNote_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteNote_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(String), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [deleteNote] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [deleteNote] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteNote] for a method executing this request and parsing the response. + /// * [$deleteNote_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteNoteRaw({required int id}) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $deleteNote_Request({required int id}) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + final _path = _i4.UriTemplate('/index.php/apps/notes/api/v1/notes/{id}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -578,7 +554,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -586,21 +562,30 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; + return _request; + } - final _path = _i4.UriTemplate('/index.php/apps/notes/api/v1/notes/{id}').expand(_parameters); - final _response = await executeRequest( - 'delete', - _path, - headers: _headers, + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200 + /// + /// See: + /// * [$deleteNote_Request] for the request send by this method. + /// * [$deleteNote_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteNote({required int id}) async { + final _request = $deleteNote_Request( + id: id, ); + final _response = await sendWithCookies(_request); final _serializer = $deleteNote_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$getSettings_Request`. + /// Builds a serializer to parse the response of [$getSettings_Request]. @_i2.experimental _i1.DynamiteSerializer $getSettings_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Settings), @@ -609,34 +594,21 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getSettings] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [getSettingsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getSettings() async { - final _rawResponse = await getSettingsRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Status codes: - /// * 200 - /// - /// See: - /// * [getSettings] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getSettings] for a method executing this request and parsing the response. + /// * [$getSettings_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getSettingsRaw() async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getSettings_Request() { + const _path = '/index.php/apps/notes/api/v1/settings'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -646,7 +618,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -654,26 +626,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - const _path = '/index.php/apps/notes/api/v1/settings'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getSettings_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$updateSettings_Request`. - @_i2.experimental - _i1.DynamiteSerializer $updateSettings_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Settings), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// @@ -681,30 +636,41 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [updateSettingsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> updateSettings({required Settings settings}) async { - final _rawResponse = await updateSettingsRaw( - settings: settings, - ); + /// * [$getSettings_Request] for the request send by this method. + /// * [$getSettings_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getSettings() async { + final _request = $getSettings_Request(); + final _response = await sendWithCookies(_request); + final _serializer = $getSettings_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$updateSettings_Request]. + @_i2.experimental + _i1.DynamiteSerializer $updateSettings_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Settings), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Returns a `DynamiteRequest` backing the [updateSettings] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [updateSettings] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [updateSettings] for a method executing this request and parsing the response. + /// * [$updateSettings_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> updateSettingsRaw({required Settings settings}) async { - final _headers = {'Accept': 'application/json'}; - Uint8List? _body; - + _i3.Request $updateSettings_Request({required Settings settings}) { + const _path = '/index.php/apps/notes/api/v1/settings'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -714,7 +680,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -722,18 +688,29 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - _headers['Content-Type'] = 'application/json'; - _body = utf8.encode(json.encode(_$jsonSerializers.serialize(settings, specifiedType: const FullType(Settings)))); - const _path = '/index.php/apps/notes/api/v1/settings'; - final _response = await executeRequest( - 'put', - _path, - headers: _headers, - body: _body, + _request.headers['Content-Type'] = 'application/json'; + _request.body = json.encode(_$jsonSerializers.serialize(settings, specifiedType: const FullType(Settings))); + return _request; + } + + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200 + /// + /// See: + /// * [$updateSettings_Request] for the request send by this method. + /// * [$updateSettings_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> updateSettings({required Settings settings}) async { + final _request = $updateSettings_Request( + settings: settings, ); + final _response = await sendWithCookies(_request); final _serializer = $updateSettings_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -1075,9 +1052,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin()) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin()) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/notifications.openapi.dart b/packages/nextcloud/lib/src/api/notifications.openapi.dart index a2cc218cc96..a0007c5abc3 100644 --- a/packages/nextcloud/lib/src/api/notifications.openapi.dart +++ b/packages/nextcloud/lib/src/api/notifications.openapi.dart @@ -19,11 +19,12 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i5; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; import 'package:uri/uri.dart' as _i4; @@ -64,7 +65,7 @@ class $ApiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$generateNotification_Request`. + /// Builds a serializer to parse the response of [$generateNotification_Request]. @_i2.experimental _i1.DynamiteSerializer $generateNotification_Serializer() => _i1.DynamiteSerializer( @@ -78,7 +79,7 @@ class $ApiClient { /// /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [generateNotification] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -95,32 +96,67 @@ class $ApiClient { /// * 500 /// /// See: - /// * [generateNotificationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> generateNotification({ + /// * [generateNotification] for a method executing this request and parsing the response. + /// * [$generateNotification_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $generateNotification_Request({ required String shortMessage, required String userId, String? longMessage, ApiGenerateNotificationApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await generateNotificationRaw( - shortMessage: shortMessage, - userId: userId, - longMessage: longMessage, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $shortMessage = _$jsonSerializers.serialize(shortMessage, specifiedType: const FullType(String)); + _parameters['shortMessage'] = $shortMessage; + + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + + var $longMessage = _$jsonSerializers.serialize(longMessage, specifiedType: const FullType(String)); + $longMessage ??= ''; + _parameters['longMessage'] = $longMessage; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ApiGenerateNotificationApiVersion)); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i4.UriTemplate( + '/ocs/v2.php/apps/notifications/api/{apiVersion}/admin_notifications/{userId}{?shortMessage*,longMessage*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Generate a notification for a user. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -137,65 +173,28 @@ class $ApiClient { /// * 500 /// /// See: - /// * [generateNotification] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> generateNotificationRaw({ + /// * [$generateNotification_Request] for the request send by this method. + /// * [$generateNotification_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> generateNotification({ required String shortMessage, required String userId, String? longMessage, ApiGenerateNotificationApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $shortMessage = _$jsonSerializers.serialize(shortMessage, specifiedType: const FullType(String)); - _parameters['shortMessage'] = $shortMessage; - - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - - var $longMessage = _$jsonSerializers.serialize(longMessage, specifiedType: const FullType(String)); - $longMessage ??= ''; - _parameters['longMessage'] = $longMessage; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ApiGenerateNotificationApiVersion)); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/notifications/api/{apiVersion}/admin_notifications/{userId}{?shortMessage*,longMessage*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _request = $generateNotification_Request( + shortMessage: shortMessage, + userId: userId, + longMessage: longMessage, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $generateNotification_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -205,7 +204,7 @@ class $EndpointClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$listNotifications_Request`. + /// Builds a serializer to parse the response of [$listNotifications_Request]. @_i2.experimental _i1.DynamiteSerializer $listNotifications_Serializer() => _i1.DynamiteSerializer( @@ -217,39 +216,7 @@ class $EndpointClient { /// Get all notifications. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [apiVersion] Version of the API to use. Defaults to `v2`. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Notifications returned - /// * 204: No app uses notifications - /// - /// See: - /// * [listNotificationsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future< - _i1 - .DynamiteResponse> - listNotifications({ - EndpointListNotificationsApiVersion? apiVersion, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await listNotificationsRaw( - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get all notifications. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [listNotifications] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -261,17 +228,23 @@ class $EndpointClient { /// * 204: No app uses notifications /// /// See: - /// * [listNotifications] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [listNotifications] for a method executing this request and parsing the response. + /// * [$listNotifications_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future< - _i1.DynamiteRawResponse> listNotificationsRaw({ + _i3.Request $listNotifications_Request({ EndpointListNotificationsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(EndpointListNotificationsApiVersion)); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -281,7 +254,7 @@ class $EndpointClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -289,70 +262,62 @@ class $EndpointClient { } // coverage:ignore-end - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(EndpointListNotificationsApiVersion)); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $listNotifications_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteAllNotifications_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $deleteAllNotifications_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(EndpointDeleteAllNotificationsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Delete all notifications. + /// Get all notifications. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [apiVersion] Defaults to `v2`. + /// * [apiVersion] Version of the API to use. Defaults to `v2`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: All notifications deleted successfully - /// * 403: Deleting notification for impersonated user is not allowed + /// * 200: Notifications returned + /// * 204: No app uses notifications /// /// See: - /// * [deleteAllNotificationsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteAllNotifications({ - EndpointDeleteAllNotificationsApiVersion? apiVersion, + /// * [$listNotifications_Request] for the request send by this method. + /// * [$listNotifications_Serializer] for a converter to parse the `Response` from an executed request. + Future< + _i1 + .DynamiteResponse> + listNotifications({ + EndpointListNotificationsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteAllNotificationsRaw( + final _request = $listNotifications_Request( apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $listNotifications_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteAllNotifications_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $deleteAllNotifications_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(EndpointDeleteAllNotificationsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Delete all notifications. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteAllNotifications] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -364,16 +329,25 @@ class $EndpointClient { /// * 403: Deleting notification for impersonated user is not allowed /// /// See: - /// * [deleteAllNotifications] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteAllNotifications] for a method executing this request and parsing the response. + /// * [$deleteAllNotifications_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - deleteAllNotificationsRaw({ + _i3.Request $deleteAllNotifications_Request({ EndpointDeleteAllNotificationsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(EndpointDeleteAllNotificationsApiVersion), + ); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -383,7 +357,7 @@ class $EndpointClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -391,74 +365,59 @@ class $EndpointClient { } // coverage:ignore-end - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(EndpointDeleteAllNotificationsApiVersion), - ); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $deleteAllNotifications_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getNotification_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getNotification_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(EndpointGetNotificationResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get a notification. + /// Delete all notifications. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [apiVersion] Version of the API to use. Defaults to `v2`. - /// * [id] ID of the notification. + /// * [apiVersion] Defaults to `v2`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Notification returned - /// * 404: Notification not found + /// * 200: All notifications deleted successfully + /// * 403: Deleting notification for impersonated user is not allowed /// /// See: - /// * [getNotificationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getNotification({ - required int id, - EndpointGetNotificationApiVersion? apiVersion, + /// * [$deleteAllNotifications_Request] for the request send by this method. + /// * [$deleteAllNotifications_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteAllNotifications({ + EndpointDeleteAllNotificationsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getNotificationRaw( - id: id, + final _request = $deleteAllNotifications_Request( apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteAllNotifications_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getNotification_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getNotification_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(EndpointGetNotificationResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a notification. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getNotification] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -471,16 +430,28 @@ class $EndpointClient { /// * 404: Notification not found /// /// See: - /// * [getNotification] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getNotification] for a method executing this request and parsing the response. + /// * [$getNotification_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getNotificationRaw({ + _i3.Request $getNotification_Request({ required int id, EndpointGetNotificationApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(EndpointGetNotificationApiVersion)); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -490,7 +461,7 @@ class $EndpointClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -498,76 +469,61 @@ class $EndpointClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(EndpointGetNotificationApiVersion)); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getNotification_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteNotification_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteNotification_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(EndpointDeleteNotificationResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Delete a notification. + /// Get a notification. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [apiVersion] Defaults to `v2`. + /// * [apiVersion] Version of the API to use. Defaults to `v2`. /// * [id] ID of the notification. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Notification deleted successfully - /// * 403: Deleting notification for impersonated user is not allowed + /// * 200: Notification returned /// * 404: Notification not found /// /// See: - /// * [deleteNotificationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteNotification({ + /// * [$getNotification_Request] for the request send by this method. + /// * [$getNotification_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getNotification({ required int id, - EndpointDeleteNotificationApiVersion? apiVersion, + EndpointGetNotificationApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteNotificationRaw( + final _request = $getNotification_Request( id: id, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getNotification_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteNotification_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteNotification_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(EndpointDeleteNotificationResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Delete a notification. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteNotification] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -581,16 +537,28 @@ class $EndpointClient { /// * 404: Notification not found /// /// See: - /// * [deleteNotification] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteNotification] for a method executing this request and parsing the response. + /// * [$deleteNotification_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteNotificationRaw({ + _i3.Request $deleteNotification_Request({ required int id, EndpointDeleteNotificationApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); + _parameters['id'] = $id; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(EndpointDeleteNotificationApiVersion)); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/{id}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -600,7 +568,7 @@ class $EndpointClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -608,76 +576,63 @@ class $EndpointClient { } // coverage:ignore-end - final $id = _$jsonSerializers.serialize(id, specifiedType: const FullType(int)); - _parameters['id'] = $id; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(EndpointDeleteNotificationApiVersion)); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/{id}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $deleteNotification_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$confirmIdsForUser_Request`. - @_i2.experimental - _i1.DynamiteSerializer $confirmIdsForUser_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(EndpointConfirmIdsForUserResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - - /// Check if notification IDs exist. + /// Delete a notification. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [ids] IDs of the notifications to check. - /// * [apiVersion] Version of the API to use. Defaults to `v2`. + /// * [apiVersion] Defaults to `v2`. + /// * [id] ID of the notification. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Existing notification IDs returned - /// * 400: Too many notification IDs requested + /// * 200: Notification deleted successfully + /// * 403: Deleting notification for impersonated user is not allowed + /// * 404: Notification not found /// /// See: - /// * [confirmIdsForUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> confirmIdsForUser({ - required BuiltList ids, - EndpointConfirmIdsForUserApiVersion? apiVersion, + /// * [$deleteNotification_Request] for the request send by this method. + /// * [$deleteNotification_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteNotification({ + required int id, + EndpointDeleteNotificationApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await confirmIdsForUserRaw( - ids: ids, + final _request = $deleteNotification_Request( + id: id, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteNotification_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$confirmIdsForUser_Request]. + @_i2.experimental + _i1.DynamiteSerializer $confirmIdsForUser_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(EndpointConfirmIdsForUserResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + /// Check if notification IDs exist. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [confirmIdsForUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -690,16 +645,28 @@ class $EndpointClient { /// * 400: Too many notification IDs requested /// /// See: - /// * [confirmIdsForUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [confirmIdsForUser] for a method executing this request and parsing the response. + /// * [$confirmIdsForUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> confirmIdsForUserRaw({ + _i3.Request $confirmIdsForUser_Request({ required BuiltList ids, EndpointConfirmIdsForUserApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $ids = _$jsonSerializers.serialize(ids, specifiedType: const FullType(BuiltList, [FullType(int)])); + _parameters['ids%5B%5D'] = $ids; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(EndpointConfirmIdsForUserApiVersion)); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/exists{?ids%5B%5D*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -709,7 +676,7 @@ class $EndpointClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -717,29 +684,47 @@ class $EndpointClient { } // coverage:ignore-end - final $ids = _$jsonSerializers.serialize(ids, specifiedType: const FullType(BuiltList, [FullType(int)])); - _parameters['ids%5B%5D'] = $ids; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(EndpointConfirmIdsForUserApiVersion)); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/exists{?ids%5B%5D*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + return _request; + } + + /// Check if notification IDs exist. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [ids] IDs of the notifications to check. + /// * [apiVersion] Version of the API to use. Defaults to `v2`. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Existing notification IDs returned + /// * 400: Too many notification IDs requested + /// + /// See: + /// * [$confirmIdsForUser_Request] for the request send by this method. + /// * [$confirmIdsForUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> confirmIdsForUser({ + required BuiltList ids, + EndpointConfirmIdsForUserApiVersion? apiVersion, + bool? oCSAPIRequest, + }) async { + final _request = $confirmIdsForUser_Request( + ids: ids, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $confirmIdsForUser_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -749,7 +734,7 @@ class $PushClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$registerDevice_Request`. + /// Builds a serializer to parse the response of [$registerDevice_Request]. @_i2.experimental _i1.DynamiteSerializer $registerDevice_Serializer() => _i1.DynamiteSerializer( @@ -761,7 +746,7 @@ class $PushClient { /// Register device for push notifications. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [registerDevice] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -778,58 +763,37 @@ class $PushClient { /// * 401: Missing permissions to register device /// /// See: - /// * [registerDeviceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> registerDevice({ + /// * [registerDevice] for a method executing this request and parsing the response. + /// * [$registerDevice_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $registerDevice_Request({ required String pushTokenHash, required String devicePublicKey, required String proxyServer, PushRegisterDeviceApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await registerDeviceRaw( - pushTokenHash: pushTokenHash, - devicePublicKey: devicePublicKey, - proxyServer: proxyServer, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, - ); + }) { + final _parameters = {}; + final $pushTokenHash = _$jsonSerializers.serialize(pushTokenHash, specifiedType: const FullType(String)); + _parameters['pushTokenHash'] = $pushTokenHash; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } + final $devicePublicKey = _$jsonSerializers.serialize(devicePublicKey, specifiedType: const FullType(String)); + _parameters['devicePublicKey'] = $devicePublicKey; - /// Register device for push notifications. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [pushTokenHash] Hash of the push token. - /// * [devicePublicKey] Public key of the device. - /// * [proxyServer] Proxy server to be used. - /// * [apiVersion] Defaults to `v2`. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Device was already registered - /// * 201: Device registered successfully - /// * 400: Registering device is not possible - /// * 401: Missing permissions to register device - /// - /// See: - /// * [registerDevice] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> registerDeviceRaw({ - required String pushTokenHash, - required String devicePublicKey, - required String proxyServer, - PushRegisterDeviceApiVersion? apiVersion, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + final $proxyServer = _$jsonSerializers.serialize(proxyServer, specifiedType: const FullType(String)); + _parameters['proxyServer'] = $proxyServer; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PushRegisterDeviceApiVersion)); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i4.UriTemplate( + '/ocs/v2.php/apps/notifications/api/{apiVersion}/push{?pushTokenHash*,devicePublicKey*,proxyServer*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -839,7 +803,7 @@ class $PushClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -847,81 +811,69 @@ class $PushClient { } // coverage:ignore-end - final $pushTokenHash = _$jsonSerializers.serialize(pushTokenHash, specifiedType: const FullType(String)); - _parameters['pushTokenHash'] = $pushTokenHash; - - final $devicePublicKey = _$jsonSerializers.serialize(devicePublicKey, specifiedType: const FullType(String)); - _parameters['devicePublicKey'] = $devicePublicKey; - - final $proxyServer = _$jsonSerializers.serialize(proxyServer, specifiedType: const FullType(String)); - _parameters['proxyServer'] = $proxyServer; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PushRegisterDeviceApiVersion)); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/notifications/api/{apiVersion}/push{?pushTokenHash*,devicePublicKey*,proxyServer*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $registerDevice_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$removeDevice_Request`. - @_i2.experimental - _i1.DynamiteSerializer $removeDevice_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(PushRemoveDeviceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 202, 401}, - ); - - /// Remove a device from push notifications. + /// Register device for push notifications. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [pushTokenHash] Hash of the push token. + /// * [devicePublicKey] Public key of the device. + /// * [proxyServer] Proxy server to be used. /// * [apiVersion] Defaults to `v2`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: No device registered - /// * 202: Device removed successfully - /// * 401: Missing permissions to remove device - /// * 400: Removing device is not possible + /// * 200: Device was already registered + /// * 201: Device registered successfully + /// * 400: Registering device is not possible + /// * 401: Missing permissions to register device /// /// See: - /// * [removeDeviceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> removeDevice({ - PushRemoveDeviceApiVersion? apiVersion, + /// * [$registerDevice_Request] for the request send by this method. + /// * [$registerDevice_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> registerDevice({ + required String pushTokenHash, + required String devicePublicKey, + required String proxyServer, + PushRegisterDeviceApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await removeDeviceRaw( + final _request = $registerDevice_Request( + pushTokenHash: pushTokenHash, + devicePublicKey: devicePublicKey, + proxyServer: proxyServer, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $registerDevice_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$removeDevice_Request]. + @_i2.experimental + _i1.DynamiteSerializer $removeDevice_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(PushRemoveDeviceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 202, 401}, + ); + /// Remove a device from push notifications. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [removeDevice] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -935,15 +887,23 @@ class $PushClient { /// * 400: Removing device is not possible /// /// See: - /// * [removeDevice] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [removeDevice] for a method executing this request and parsing the response. + /// * [$removeDevice_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> removeDeviceRaw({ + _i3.Request $removeDevice_Request({ PushRemoveDeviceApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PushRemoveDeviceApiVersion)); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/push').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -953,7 +913,7 @@ class $PushClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -961,83 +921,67 @@ class $PushClient { } // coverage:ignore-end - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PushRemoveDeviceApiVersion)); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/notifications/api/{apiVersion}/push').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $removeDevice_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $SettingsClient { - /// Creates a new `DynamiteClient` for settings requests. - $SettingsClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$personal_Request`. - @_i2.experimental - _i1.DynamiteSerializer $personal_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(SettingsPersonalResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Update personal notification settings. + /// Remove a device from push notifications. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [batchSetting] How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4). - /// * [soundNotification] Enable sound for notifications ('yes' or 'no'). - /// * [soundTalk] Enable sound for Talk notifications ('yes' or 'no'). /// * [apiVersion] Defaults to `v2`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Personal settings updated + /// * 200: No device registered + /// * 202: Device removed successfully + /// * 401: Missing permissions to remove device + /// * 400: Removing device is not possible /// /// See: - /// * [personalRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> personal({ - required int batchSetting, - required String soundNotification, - required String soundTalk, - SettingsPersonalApiVersion? apiVersion, + /// * [$removeDevice_Request] for the request send by this method. + /// * [$removeDevice_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> removeDevice({ + PushRemoveDeviceApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await personalRaw( - batchSetting: batchSetting, - soundNotification: soundNotification, - soundTalk: soundTalk, + final _request = $removeDevice_Request( apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $removeDevice_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} + +class $SettingsClient { + /// Creates a new `DynamiteClient` for settings requests. + $SettingsClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$personal_Request]. + @_i2.experimental + _i1.DynamiteSerializer $personal_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(SettingsPersonalResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); /// Update personal notification settings. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [personal] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1051,18 +995,37 @@ class $SettingsClient { /// * 200: Personal settings updated /// /// See: - /// * [personal] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [personal] for a method executing this request and parsing the response. + /// * [$personal_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> personalRaw({ + _i3.Request $personal_Request({ required int batchSetting, required String soundNotification, required String soundTalk, SettingsPersonalApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $batchSetting = _$jsonSerializers.serialize(batchSetting, specifiedType: const FullType(int)); + _parameters['batchSetting'] = $batchSetting; + + final $soundNotification = _$jsonSerializers.serialize(soundNotification, specifiedType: const FullType(String)); + _parameters['soundNotification'] = $soundNotification; + + final $soundTalk = _$jsonSerializers.serialize(soundTalk, specifiedType: const FullType(String)); + _parameters['soundTalk'] = $soundTalk; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SettingsPersonalApiVersion)); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i4.UriTemplate( + '/ocs/v2.php/apps/notifications/api/{apiVersion}/settings{?batchSetting*,soundNotification*,soundTalk*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1072,7 +1035,7 @@ class $SettingsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1080,49 +1043,14 @@ class $SettingsClient { } // coverage:ignore-end - final $batchSetting = _$jsonSerializers.serialize(batchSetting, specifiedType: const FullType(int)); - _parameters['batchSetting'] = $batchSetting; - - final $soundNotification = _$jsonSerializers.serialize(soundNotification, specifiedType: const FullType(String)); - _parameters['soundNotification'] = $soundNotification; - - final $soundTalk = _$jsonSerializers.serialize(soundTalk, specifiedType: const FullType(String)); - _parameters['soundTalk'] = $soundTalk; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SettingsPersonalApiVersion)); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/notifications/api/{apiVersion}/settings{?batchSetting*,soundNotification*,soundTalk*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $personal_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$admin_Request`. - @_i2.experimental - _i1.DynamiteSerializer $admin_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(SettingsAdminResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Update default notification settings for new users. - /// - /// This endpoint requires admin access. + /// Update personal notification settings. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -1135,35 +1063,47 @@ class $SettingsClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Admin settings updated + /// * 200: Personal settings updated /// /// See: - /// * [adminRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> admin({ + /// * [$personal_Request] for the request send by this method. + /// * [$personal_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> personal({ required int batchSetting, required String soundNotification, required String soundTalk, - SettingsAdminApiVersion? apiVersion, + SettingsPersonalApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await adminRaw( + final _request = $personal_Request( batchSetting: batchSetting, soundNotification: soundNotification, soundTalk: soundTalk, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $personal_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$admin_Request]. + @_i2.experimental + _i1.DynamiteSerializer $admin_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(SettingsAdminResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Update default notification settings for new users. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [admin] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1177,18 +1117,36 @@ class $SettingsClient { /// * 200: Admin settings updated /// /// See: - /// * [admin] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [admin] for a method executing this request and parsing the response. + /// * [$admin_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> adminRaw({ + _i3.Request $admin_Request({ required int batchSetting, required String soundNotification, required String soundTalk, SettingsAdminApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $batchSetting = _$jsonSerializers.serialize(batchSetting, specifiedType: const FullType(int)); + _parameters['batchSetting'] = $batchSetting; + + final $soundNotification = _$jsonSerializers.serialize(soundNotification, specifiedType: const FullType(String)); + _parameters['soundNotification'] = $soundNotification; + + final $soundTalk = _$jsonSerializers.serialize(soundTalk, specifiedType: const FullType(String)); + _parameters['soundTalk'] = $soundTalk; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SettingsAdminApiVersion)); + $apiVersion ??= 'v2'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i4.UriTemplate( + '/ocs/v2.php/apps/notifications/api/{apiVersion}/settings/admin{?batchSetting*,soundNotification*,soundTalk*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1198,7 +1156,7 @@ class $SettingsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1206,34 +1164,53 @@ class $SettingsClient { } // coverage:ignore-end - final $batchSetting = _$jsonSerializers.serialize(batchSetting, specifiedType: const FullType(int)); - _parameters['batchSetting'] = $batchSetting; - - final $soundNotification = _$jsonSerializers.serialize(soundNotification, specifiedType: const FullType(String)); - _parameters['soundNotification'] = $soundNotification; - - final $soundTalk = _$jsonSerializers.serialize(soundTalk, specifiedType: const FullType(String)); - _parameters['soundTalk'] = $soundTalk; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SettingsAdminApiVersion)); - $apiVersion ??= 'v2'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/notifications/api/{apiVersion}/settings/admin{?batchSetting*,soundNotification*,soundTalk*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + return _request; + } + + /// Update default notification settings for new users. + /// + /// This endpoint requires admin access. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [batchSetting] How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4). + /// * [soundNotification] Enable sound for notifications ('yes' or 'no'). + /// * [soundTalk] Enable sound for Talk notifications ('yes' or 'no'). + /// * [apiVersion] Defaults to `v2`. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Admin settings updated + /// + /// See: + /// * [$admin_Request] for the request send by this method. + /// * [$admin_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> admin({ + required int batchSetting, + required String soundNotification, + required String soundTalk, + SettingsAdminApiVersion? apiVersion, + bool? oCSAPIRequest, + }) async { + final _request = $admin_Request( + batchSetting: batchSetting, + soundNotification: soundNotification, + soundTalk: soundTalk, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $admin_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -3041,9 +3018,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin()) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin()) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart index e3f90c0de55..544d807b234 100644 --- a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart +++ b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart @@ -19,14 +19,15 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; import 'package:dynamite_runtime/models.dart'; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i4; +import 'package:uri/uri.dart' as _i5; part 'provisioning_api.openapi.g.dart'; @@ -67,7 +68,7 @@ class $AppConfigClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getApps_Request`. + /// Builds a serializer to parse the response of [$getApps_Request]. @_i2.experimental _i1.DynamiteSerializer $getApps_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(AppConfigGetAppsResponseApplicationJson), @@ -76,6 +77,52 @@ class $AppConfigClient { validStatuses: const {200}, ); + /// Get a list of apps. + /// + /// This endpoint requires admin access. + /// + /// Returns a `DynamiteRequest` backing the [getApps] operation. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Apps returned + /// + /// See: + /// * [getApps] for a method executing this request and parsing the response. + /// * [$getApps_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getApps_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/provisioning_api/api/v1/config/apps'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + /// Get a list of apps. /// /// This endpoint requires admin access. @@ -90,38 +137,60 @@ class $AppConfigClient { /// * 200: Apps returned /// /// See: - /// * [getAppsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getApps_Request] for the request send by this method. + /// * [$getApps_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getApps({bool? oCSAPIRequest}) async { - final _rawResponse = await getAppsRaw( + final _request = $getApps_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getApps_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a list of apps. + /// Builds a serializer to parse the response of [$getKeys_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getKeys_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(AppConfigGetKeysResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the config keys of an app. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getKeys] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [app] ID of the app. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Apps returned + /// * 200: Keys returned + /// * 403: App is not allowed /// /// See: - /// * [getApps] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getKeys] for a method executing this request and parsing the response. + /// * [$getKeys_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getAppsRaw({ + _i3.Request $getKeys_Request({ + required String app, bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); + _parameters['app'] = $app; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/apps/{app}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -131,7 +200,7 @@ class $AppConfigClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -141,28 +210,11 @@ class $AppConfigClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/provisioning_api/api/v1/config/apps'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getApps_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getKeys_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getKeys_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(AppConfigGetKeysResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get the config keys of an app. /// /// This endpoint requires admin access. @@ -179,46 +231,74 @@ class $AppConfigClient { /// * 403: App is not allowed /// /// See: - /// * [getKeysRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getKeys_Request] for the request send by this method. + /// * [$getKeys_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getKeys({ required String app, bool? oCSAPIRequest, }) async { - final _rawResponse = await getKeysRaw( + final _request = $getKeys_Request( app: app, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getKeys_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the config keys of an app. - /// - /// This endpoint requires admin access. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setValue_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setValue_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(AppConfigSetValueResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Update the config value of an app. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setValue] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [value] New value for the key. /// * [app] ID of the app. + /// * [key] Key to update. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Keys returned - /// * 403: App is not allowed + /// * 200: Value updated successfully + /// * 403: App or key is not allowed /// /// See: - /// * [getKeys] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setValue] for a method executing this request and parsing the response. + /// * [$setValue_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getKeysRaw({ + _i3.Request $setValue_Request({ + required String value, required String app, + required String key, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $value = _$jsonSerializers.serialize(value, specifiedType: const FullType(String)); + _parameters['value'] = $value; + final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); + _parameters['app'] = $app; + + final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(String)); + _parameters['key'] = $key; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/apps/{app}/{key}{?value*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -228,7 +308,7 @@ class $AppConfigClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -236,34 +316,13 @@ class $AppConfigClient { } // coverage:ignore-end - final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); - _parameters['app'] = $app; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/apps/{app}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getKeys_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setValue_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setValue_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(AppConfigSetValueResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Update the config value of an app. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -280,52 +339,74 @@ class $AppConfigClient { /// * 403: App or key is not allowed /// /// See: - /// * [setValueRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setValue_Request] for the request send by this method. + /// * [$setValue_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setValue({ required String value, required String app, required String key, bool? oCSAPIRequest, }) async { - final _rawResponse = await setValueRaw( + final _request = $setValue_Request( value: value, app: app, key: key, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setValue_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Update the config value of an app. +class $AppsClient { + /// Creates a new `DynamiteClient` for apps requests. + $AppsClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$getApps_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getApps_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(AppsGetAppsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a list of installed apps. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getApps] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [value] New value for the key. - /// * [app] ID of the app. - /// * [key] Key to update. + /// * [filter] Filter for enabled or disabled apps. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Value updated successfully - /// * 403: App or key is not allowed + /// * 200: Installed apps returned /// /// See: - /// * [setValue] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getApps] for a method executing this request and parsing the response. + /// * [$getApps_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setValueRaw({ - required String value, - required String app, - required String key, + _i3.Request $getApps_Request({ + String? filter, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $filter = _$jsonSerializers.serialize(filter, specifiedType: const FullType(String)); + _parameters['filter'] = $filter; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/apps{?filter*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -335,7 +416,7 @@ class $AppConfigClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -343,46 +424,12 @@ class $AppConfigClient { } // coverage:ignore-end - final $value = _$jsonSerializers.serialize(value, specifiedType: const FullType(String)); - _parameters['value'] = $value; - - final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); - _parameters['app'] = $app; - - final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(String)); - _parameters['key'] = $key; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/apps/{app}/{key}{?value*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setValue_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $AppsClient { - /// Creates a new `DynamiteClient` for apps requests. - $AppsClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$getApps_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getApps_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(AppsGetAppsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get a list of installed apps. /// @@ -399,45 +446,64 @@ class $AppsClient { /// * 200: Installed apps returned /// /// See: - /// * [getAppsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getApps_Request] for the request send by this method. + /// * [$getApps_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getApps({ String? filter, bool? oCSAPIRequest, }) async { - final _rawResponse = await getAppsRaw( + final _request = $getApps_Request( filter: filter, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getApps_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a list of installed apps. + /// Builds a serializer to parse the response of [$getAppInfo_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getAppInfo_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(AppsGetAppInfoResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the app info for an app. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getAppInfo] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [filter] Filter for enabled or disabled apps. + /// * [app] ID of the app. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Installed apps returned + /// * 200: App info returned /// /// See: - /// * [getApps] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getAppInfo] for a method executing this request and parsing the response. + /// * [$getAppInfo_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getAppsRaw({ - String? filter, + _i3.Request $getAppInfo_Request({ + required String app, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); + _parameters['app'] = $app; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/apps/{app}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -447,7 +513,7 @@ class $AppsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -455,34 +521,13 @@ class $AppsClient { } // coverage:ignore-end - final $filter = _$jsonSerializers.serialize(filter, specifiedType: const FullType(String)); - _parameters['filter'] = $filter; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/apps{?filter*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getApps_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getAppInfo_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getAppInfo_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(AppsGetAppInfoResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get the app info for an app. /// /// This endpoint requires admin access. @@ -498,26 +543,38 @@ class $AppsClient { /// * 200: App info returned /// /// See: - /// * [getAppInfoRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getAppInfo_Request] for the request send by this method. + /// * [$getAppInfo_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getAppInfo({ required String app, bool? oCSAPIRequest, }) async { - final _rawResponse = await getAppInfoRaw( + final _request = $getAppInfo_Request( app: app, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getAppInfo_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the app info for an app. + /// Builds a serializer to parse the response of [$enable_Request]. + @_i2.experimental + _i1.DynamiteSerializer $enable_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(AppsEnableResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Enable an app. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [enable] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -525,18 +582,24 @@ class $AppsClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: App info returned + /// * 200: App enabled successfully /// /// See: - /// * [getAppInfo] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [enable] for a method executing this request and parsing the response. + /// * [$enable_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getAppInfoRaw({ + _i3.Request $enable_Request({ required String app, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); + _parameters['app'] = $app; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/apps/{app}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -546,7 +609,7 @@ class $AppsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -554,33 +617,13 @@ class $AppsClient { } // coverage:ignore-end - final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); - _parameters['app'] = $app; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/apps/{app}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getAppInfo_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$enable_Request`. - @_i2.experimental - _i1.DynamiteSerializer $enable_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(AppsEnableResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Enable an app. /// /// This endpoint requires admin access. @@ -596,26 +639,38 @@ class $AppsClient { /// * 200: App enabled successfully /// /// See: - /// * [enableRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$enable_Request] for the request send by this method. + /// * [$enable_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> enable({ required String app, bool? oCSAPIRequest, }) async { - final _rawResponse = await enableRaw( + final _request = $enable_Request( app: app, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $enable_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Enable an app. - /// - /// This endpoint requires admin access. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Builds a serializer to parse the response of [$disable_Request]. + @_i2.experimental + _i1.DynamiteSerializer $disable_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(AppsDisableResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Disable an app. + /// + /// This endpoint requires admin access. + /// + /// Returns a `DynamiteRequest` backing the [disable] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -623,18 +678,24 @@ class $AppsClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: App enabled successfully + /// * 200: App disabled successfully /// /// See: - /// * [enable] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [disable] for a method executing this request and parsing the response. + /// * [$disable_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> enableRaw({ + _i3.Request $disable_Request({ required String app, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); + _parameters['app'] = $app; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/apps/{app}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -644,7 +705,7 @@ class $AppsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -652,33 +713,13 @@ class $AppsClient { } // coverage:ignore-end - final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); - _parameters['app'] = $app; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/apps/{app}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $enable_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$disable_Request`. - @_i2.experimental - _i1.DynamiteSerializer $disable_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(AppsDisableResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Disable an app. /// /// This endpoint requires admin access. @@ -694,45 +735,76 @@ class $AppsClient { /// * 200: App disabled successfully /// /// See: - /// * [disableRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$disable_Request] for the request send by this method. + /// * [$disable_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> disable({ required String app, bool? oCSAPIRequest, }) async { - final _rawResponse = await disableRaw( + final _request = $disable_Request( app: app, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $disable_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Disable an app. +class $GroupsClient { + /// Creates a new `DynamiteClient` for groups requests. + $GroupsClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$getSubAdminsOfGroup_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getSubAdminsOfGroup_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(GroupsGetSubAdminsOfGroupResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the list of user IDs that are a subadmin of the group. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getSubAdminsOfGroup] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [app] ID of the app. + /// * [groupId] ID of the group. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: App disabled successfully + /// * 200: Sub admins returned /// /// See: - /// * [disable] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getSubAdminsOfGroup] for a method executing this request and parsing the response. + /// * [$getSubAdminsOfGroup_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> disableRaw({ - required String app, + _i3.Request $getSubAdminsOfGroup_Request({ + required String groupId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $groupId = _$jsonSerializers.serialize(groupId, specifiedType: const FullType(String)); + _i4.checkPattern( + $groupId as String?, + RegExp(r'^.+$'), + 'groupId', + ); + _parameters['groupId'] = $groupId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/groups/{groupId}/subadmins').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -742,7 +814,7 @@ class $AppsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -750,40 +822,12 @@ class $AppsClient { } // coverage:ignore-end - final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); - _parameters['app'] = $app; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/apps/{app}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $disable_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $GroupsClient { - /// Creates a new `DynamiteClient` for groups requests. - $GroupsClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$getSubAdminsOfGroup_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getSubAdminsOfGroup_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(GroupsGetSubAdminsOfGroupResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get the list of user IDs that are a subadmin of the group. /// @@ -800,45 +844,75 @@ class $GroupsClient { /// * 200: Sub admins returned /// /// See: - /// * [getSubAdminsOfGroupRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getSubAdminsOfGroup_Request] for the request send by this method. + /// * [$getSubAdminsOfGroup_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getSubAdminsOfGroup({ required String groupId, bool? oCSAPIRequest, }) async { - final _rawResponse = await getSubAdminsOfGroupRaw( + final _request = $getSubAdminsOfGroup_Request( groupId: groupId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getSubAdminsOfGroup_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the list of user IDs that are a subadmin of the group. - /// - /// This endpoint requires admin access. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getGroups_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getGroups_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(GroupsGetGroupsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a list of groups. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getGroups] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [groupId] ID of the group. + /// * [search] Text to search for. Defaults to `''`. + /// * [limit] Limit the amount of groups returned. + /// * [offset] Offset for searching for groups. Defaults to `0`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Sub admins returned + /// * 200: Groups returned /// /// See: - /// * [getSubAdminsOfGroup] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getGroups] for a method executing this request and parsing the response. + /// * [$getGroups_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getSubAdminsOfGroupRaw({ - required String groupId, + _i3.Request $getGroups_Request({ + String? search, + int? limit, + int? offset, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); + $search ??= ''; + _parameters['search'] = $search; + + final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + _parameters['limit'] = $limit; + + var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); + $offset ??= 0; + _parameters['offset'] = $offset; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/groups{?search*,limit*,offset*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -848,7 +922,7 @@ class $GroupsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -856,40 +930,13 @@ class $GroupsClient { } // coverage:ignore-end - final $groupId = _$jsonSerializers.serialize(groupId, specifiedType: const FullType(String)); - _i3.checkPattern( - $groupId as String?, - RegExp(r'^.+$'), - 'groupId', - ); - _parameters['groupId'] = $groupId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/groups/{groupId}/subadmins').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getSubAdminsOfGroup_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getGroups_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getGroups_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(GroupsGetGroupsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get a list of groups. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -905,51 +952,72 @@ class $GroupsClient { /// * 200: Groups returned /// /// See: - /// * [getGroupsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getGroups_Request] for the request send by this method. + /// * [$getGroups_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getGroups({ String? search, int? limit, int? offset, bool? oCSAPIRequest, }) async { - final _rawResponse = await getGroupsRaw( + final _request = $getGroups_Request( search: search, limit: limit, offset: offset, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getGroups_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a list of groups. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getGroup_Request]. + @_i2.experimental + @Deprecated('') + _i1.DynamiteSerializer $getGroup_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(GroupsGetGroupResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a list of users in the specified group. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getGroup] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [search] Text to search for. Defaults to `''`. - /// * [limit] Limit the amount of groups returned. - /// * [offset] Offset for searching for groups. Defaults to `0`. + /// * [groupId] ID of the group. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Groups returned + /// * 200: Group users returned /// /// See: - /// * [getGroups] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getGroup] for a method executing this request and parsing the response. + /// * [$getGroup_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getGroupsRaw({ - String? search, - int? limit, - int? offset, + @Deprecated('') + _i3.Request $getGroup_Request({ + required String groupId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $groupId = _$jsonSerializers.serialize(groupId, specifiedType: const FullType(String)); + _i4.checkPattern( + $groupId as String?, + RegExp(r'^.+$'), + 'groupId', + ); + _parameters['groupId'] = $groupId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/groups/{groupId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -959,7 +1027,7 @@ class $GroupsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -967,42 +1035,13 @@ class $GroupsClient { } // coverage:ignore-end - var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); - $search ??= ''; - _parameters['search'] = $search; - - final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - _parameters['limit'] = $limit; - - var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); - $offset ??= 0; - _parameters['offset'] = $offset; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/groups{?search*,limit*,offset*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getGroups_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getGroup_Request`. - @_i2.experimental - @Deprecated('') - _i1.DynamiteSerializer $getGroup_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(GroupsGetGroupResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get a list of users in the specified group. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1016,45 +1055,75 @@ class $GroupsClient { /// * 200: Group users returned /// /// See: - /// * [getGroupRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getGroup_Request] for the request send by this method. + /// * [$getGroup_Serializer] for a converter to parse the `Response` from an executed request. @Deprecated('') Future<_i1.DynamiteResponse> getGroup({ required String groupId, bool? oCSAPIRequest, }) async { - final _rawResponse = await getGroupRaw( + final _request = $getGroup_Request( groupId: groupId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getGroup_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a list of users in the specified group. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getGroupsDetails_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getGroupsDetails_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(GroupsGetGroupsDetailsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a list of groups details. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getGroupsDetails] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [groupId] ID of the group. + /// * [search] Text to search for. Defaults to `''`. + /// * [limit] Limit the amount of groups returned. + /// * [offset] Offset for searching for groups. Defaults to `0`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Group users returned + /// * 200: Groups details returned /// /// See: - /// * [getGroup] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getGroupsDetails] for a method executing this request and parsing the response. + /// * [$getGroupsDetails_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - @Deprecated('') - Future<_i1.DynamiteRawResponse> getGroupRaw({ - required String groupId, + _i3.Request $getGroupsDetails_Request({ + String? search, + int? limit, + int? offset, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); + $search ??= ''; + _parameters['search'] = $search; + + final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + _parameters['limit'] = $limit; + var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); + $offset ??= 0; + _parameters['offset'] = $offset; + + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/groups/details{?search*,limit*,offset*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1064,7 +1133,7 @@ class $GroupsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1072,39 +1141,13 @@ class $GroupsClient { } // coverage:ignore-end - final $groupId = _$jsonSerializers.serialize(groupId, specifiedType: const FullType(String)); - _i3.checkPattern( - $groupId as String?, - RegExp(r'^.+$'), - 'groupId', - ); - _parameters['groupId'] = $groupId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/groups/{groupId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getGroup_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getGroupsDetails_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getGroupsDetails_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(GroupsGetGroupsDetailsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get a list of groups details. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1120,51 +1163,73 @@ class $GroupsClient { /// * 200: Groups details returned /// /// See: - /// * [getGroupsDetailsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getGroupsDetails_Request] for the request send by this method. + /// * [$getGroupsDetails_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getGroupsDetails({ String? search, int? limit, int? offset, bool? oCSAPIRequest, }) async { - final _rawResponse = await getGroupsDetailsRaw( + final _request = $getGroupsDetails_Request( search: search, limit: limit, offset: offset, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + final _serializer = $getGroupsDetails_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a list of groups details. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getGroupUsers_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getGroupUsers_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(GroupsGetGroupUsersResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a list of users in the specified group. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getGroupUsers] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [search] Text to search for. Defaults to `''`. - /// * [limit] Limit the amount of groups returned. - /// * [offset] Offset for searching for groups. Defaults to `0`. + /// * [groupId] ID of the group. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Groups details returned + /// * 200: User IDs returned + /// * 404: Group not found + /// * 403: Missing permissions to get users in the group /// /// See: - /// * [getGroupsDetails] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getGroupUsers] for a method executing this request and parsing the response. + /// * [$getGroupUsers_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getGroupsDetailsRaw({ - String? search, - int? limit, - int? offset, + _i3.Request $getGroupUsers_Request({ + required String groupId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $groupId = _$jsonSerializers.serialize(groupId, specifiedType: const FullType(String)); + _i4.checkPattern( + $groupId as String?, + RegExp(r'^.+$'), + 'groupId', + ); + _parameters['groupId'] = $groupId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/groups/{groupId}/users').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1174,7 +1239,7 @@ class $GroupsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1182,42 +1247,13 @@ class $GroupsClient { } // coverage:ignore-end - var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); - $search ??= ''; - _parameters['search'] = $search; - - final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - _parameters['limit'] = $limit; - - var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); - $offset ??= 0; - _parameters['offset'] = $offset; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/groups/details{?search*,limit*,offset*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getGroupsDetails_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getGroupUsers_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getGroupUsers_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(GroupsGetGroupUsersResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get a list of users in the specified group. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1233,45 +1269,85 @@ class $GroupsClient { /// * 403: Missing permissions to get users in the group /// /// See: - /// * [getGroupUsersRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getGroupUsers_Request] for the request send by this method. + /// * [$getGroupUsers_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getGroupUsers({ required String groupId, bool? oCSAPIRequest, }) async { - final _rawResponse = await getGroupUsersRaw( + final _request = $getGroupUsers_Request( groupId: groupId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getGroupUsers_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a list of users in the specified group. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getGroupUsersDetails_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getGroupUsersDetails_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(GroupsGetGroupUsersDetailsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a list of users details in the specified group. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getGroupUsersDetails] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [search] Text to search for. Defaults to `''`. + /// * [limit] Limit the amount of groups returned. + /// * [offset] Offset for searching for groups. Defaults to `0`. /// * [groupId] ID of the group. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User IDs returned - /// * 404: Group not found - /// * 403: Missing permissions to get users in the group + /// * 200: Group users details returned /// /// See: - /// * [getGroupUsers] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getGroupUsersDetails] for a method executing this request and parsing the response. + /// * [$getGroupUsersDetails_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getGroupUsersRaw({ + _i3.Request $getGroupUsersDetails_Request({ required String groupId, + String? search, + int? limit, + int? offset, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $groupId = _$jsonSerializers.serialize(groupId, specifiedType: const FullType(String)); + _i4.checkPattern( + $groupId as String?, + RegExp(r'^.+$'), + 'groupId', + ); + _parameters['groupId'] = $groupId; + + var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); + $search ??= ''; + _parameters['search'] = $search; + + final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + _parameters['limit'] = $limit; + var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); + $offset ??= 0; + _parameters['offset'] = $offset; + + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/groups/{groupId}/users/details{?search*,limit*,offset*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1281,7 +1357,7 @@ class $GroupsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1289,39 +1365,13 @@ class $GroupsClient { } // coverage:ignore-end - final $groupId = _$jsonSerializers.serialize(groupId, specifiedType: const FullType(String)); - _i3.checkPattern( - $groupId as String?, - RegExp(r'^.+$'), - 'groupId', - ); - _parameters['groupId'] = $groupId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/groups/{groupId}/users').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getGroupUsers_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getGroupUsersDetails_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getGroupUsersDetails_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(GroupsGetGroupUsersDetailsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get a list of users details in the specified group. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1338,7 +1388,8 @@ class $GroupsClient { /// * 200: Group users details returned /// /// See: - /// * [getGroupUsersDetailsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getGroupUsersDetails_Request] for the request send by this method. + /// * [$getGroupUsersDetails_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getGroupUsersDetails({ required String groupId, String? search, @@ -1346,47 +1397,80 @@ class $GroupsClient { int? offset, bool? oCSAPIRequest, }) async { - final _rawResponse = await getGroupUsersDetailsRaw( + final _request = $getGroupUsersDetails_Request( groupId: groupId, search: search, limit: limit, offset: offset, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getGroupUsersDetails_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Get a list of users details in the specified group. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $PreferencesClient { + /// Creates a new `DynamiteClient` for preferences requests. + $PreferencesClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$setPreference_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setPreference_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(PreferencesSetPreferenceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Update a preference value of an app. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setPreference] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [search] Text to search for. Defaults to `''`. - /// * [limit] Limit the amount of groups returned. - /// * [offset] Offset for searching for groups. Defaults to `0`. - /// * [groupId] ID of the group. + /// * [configValue] New value. + /// * [appId] ID of the app. + /// * [configKey] Key of the preference. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Group users details returned + /// * 200: Preference updated successfully + /// * 400: Preference invalid /// /// See: - /// * [getGroupUsersDetails] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setPreference] for a method executing this request and parsing the response. + /// * [$setPreference_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getGroupUsersDetailsRaw({ - required String groupId, - String? search, - int? limit, - int? offset, + _i3.Request $setPreference_Request({ + required String configValue, + required String appId, + required String configKey, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $configValue = _$jsonSerializers.serialize(configValue, specifiedType: const FullType(String)); + _parameters['configValue'] = $configValue; + + final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); + _parameters['appId'] = $appId; + final $configKey = _$jsonSerializers.serialize(configKey, specifiedType: const FullType(String)); + _parameters['configKey'] = $configKey; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}/{configKey}{?configValue*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1396,7 +1480,7 @@ class $GroupsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1404,58 +1488,12 @@ class $GroupsClient { } // coverage:ignore-end - final $groupId = _$jsonSerializers.serialize(groupId, specifiedType: const FullType(String)); - _i3.checkPattern( - $groupId as String?, - RegExp(r'^.+$'), - 'groupId', - ); - _parameters['groupId'] = $groupId; - - var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); - $search ??= ''; - _parameters['search'] = $search; - - final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - _parameters['limit'] = $limit; - - var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); - $offset ??= 0; - _parameters['offset'] = $offset; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/groups/{groupId}/users/details{?search*,limit*,offset*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getGroupUsersDetails_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $PreferencesClient { - /// Creates a new `DynamiteClient` for preferences requests. - $PreferencesClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$setPreference_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setPreference_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(PreferencesSetPreferenceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); /// Update a preference value of an app. /// @@ -1473,52 +1511,73 @@ class $PreferencesClient { /// * 400: Preference invalid /// /// See: - /// * [setPreferenceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setPreference_Request] for the request send by this method. + /// * [$setPreference_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setPreference({ required String configValue, required String appId, required String configKey, bool? oCSAPIRequest, }) async { - final _rawResponse = await setPreferenceRaw( + final _request = $setPreference_Request( configValue: configValue, appId: appId, configKey: configKey, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setPreference_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update a preference value of an app. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$deletePreference_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deletePreference_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(PreferencesDeletePreferenceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Delete a preference for an app. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deletePreference] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [configValue] New value. /// * [appId] ID of the app. - /// * [configKey] Key of the preference. + /// * [configKey] Key to delete. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Preference updated successfully + /// * 200: Preference deleted successfully /// * 400: Preference invalid /// /// See: - /// * [setPreference] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deletePreference] for a method executing this request and parsing the response. + /// * [$deletePreference_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setPreferenceRaw({ - required String configValue, + _i3.Request $deletePreference_Request({ required String appId, required String configKey, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); + _parameters['appId'] = $appId; + final $configKey = _$jsonSerializers.serialize(configKey, specifiedType: const FullType(String)); + _parameters['configKey'] = $configKey; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}/{configKey}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1528,7 +1587,7 @@ class $PreferencesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1536,42 +1595,13 @@ class $PreferencesClient { } // coverage:ignore-end - final $configValue = _$jsonSerializers.serialize(configValue, specifiedType: const FullType(String)); - _parameters['configValue'] = $configValue; - - final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); - _parameters['appId'] = $appId; - - final $configKey = _$jsonSerializers.serialize(configKey, specifiedType: const FullType(String)); - _parameters['configKey'] = $configKey; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}/{configKey}{?configValue*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setPreference_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deletePreference_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deletePreference_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(PreferencesDeletePreferenceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Delete a preference for an app. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1587,48 +1617,77 @@ class $PreferencesClient { /// * 400: Preference invalid /// /// See: - /// * [deletePreferenceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deletePreference_Request] for the request send by this method. + /// * [$deletePreference_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deletePreference({ required String appId, required String configKey, bool? oCSAPIRequest, }) async { - final _rawResponse = await deletePreferenceRaw( + final _request = $deletePreference_Request( appId: appId, configKey: configKey, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deletePreference_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Delete a preference for an app. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setMultiplePreferences_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $setMultiplePreferences_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(PreferencesSetMultiplePreferencesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Update multiple preference values of an app. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setMultiplePreferences] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [configs] Key-value pairs of the preferences. /// * [appId] ID of the app. - /// * [configKey] Key to delete. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Preference deleted successfully + /// * 200: Preferences updated successfully /// * 400: Preference invalid /// /// See: - /// * [deletePreference] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setMultiplePreferences] for a method executing this request and parsing the response. + /// * [$setMultiplePreferences_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deletePreferenceRaw({ + _i3.Request $setMultiplePreferences_Request({ + required ContentString> configs, required String appId, - required String configKey, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $configs = _$jsonSerializers.serialize( + configs, + specifiedType: const FullType(ContentString, [ + FullType(BuiltMap, [FullType(String), FullType(String)]), + ]), + ); + _parameters['configs'] = $configs; + + final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); + _parameters['appId'] = $appId; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}{?configs*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1638,7 +1697,7 @@ class $PreferencesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1646,39 +1705,13 @@ class $PreferencesClient { } // coverage:ignore-end - final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); - _parameters['appId'] = $appId; - - final $configKey = _$jsonSerializers.serialize(configKey, specifiedType: const FullType(String)); - _parameters['configKey'] = $configKey; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}/{configKey}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $deletePreference_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setMultiplePreferences_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $setMultiplePreferences_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(PreferencesSetMultiplePreferencesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Update multiple preference values of an app. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1694,49 +1727,73 @@ class $PreferencesClient { /// * 400: Preference invalid /// /// See: - /// * [setMultiplePreferencesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setMultiplePreferences_Request] for the request send by this method. + /// * [$setMultiplePreferences_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setMultiplePreferences({ required ContentString> configs, required String appId, bool? oCSAPIRequest, }) async { - final _rawResponse = await setMultiplePreferencesRaw( + final _request = $setMultiplePreferences_Request( configs: configs, appId: appId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setMultiplePreferences_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update multiple preference values of an app. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$deleteMultiplePreference_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $deleteMultiplePreference_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(PreferencesDeleteMultiplePreferenceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Delete multiple preferences for an app. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteMultiplePreference] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [configs] Key-value pairs of the preferences. + /// * [configKeys] Keys to delete. /// * [appId] ID of the app. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Preferences updated successfully + /// * 200: Preferences deleted successfully /// * 400: Preference invalid /// /// See: - /// * [setMultiplePreferences] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteMultiplePreference] for a method executing this request and parsing the response. + /// * [$deleteMultiplePreference_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - setMultiplePreferencesRaw({ - required ContentString> configs, + _i3.Request $deleteMultiplePreference_Request({ + required BuiltList configKeys, required String appId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $configKeys = + _$jsonSerializers.serialize(configKeys, specifiedType: const FullType(BuiltList, [FullType(String)])); + _parameters['configKeys%5B%5D'] = $configKeys; + + final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); + _parameters['appId'] = $appId; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}{?configKeys%5B%5D*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1746,7 +1803,7 @@ class $PreferencesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1754,44 +1811,13 @@ class $PreferencesClient { } // coverage:ignore-end - final $configs = _$jsonSerializers.serialize( - configs, - specifiedType: const FullType(ContentString, [ - FullType(BuiltMap, [FullType(String), FullType(String)]), - ]), - ); - _parameters['configs'] = $configs; - - final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); - _parameters['appId'] = $appId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}{?configs*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setMultiplePreferences_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteMultiplePreference_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $deleteMultiplePreference_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(PreferencesDeleteMultiplePreferenceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Delete multiple preferences for an app. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -1807,50 +1833,75 @@ class $PreferencesClient { /// * 400: Preference invalid /// /// See: - /// * [deleteMultiplePreferenceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteMultiplePreference_Request] for the request send by this method. + /// * [$deleteMultiplePreference_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteMultiplePreference({ required BuiltList configKeys, required String appId, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteMultiplePreferenceRaw( + final _request = $deleteMultiplePreference_Request( configKeys: configKeys, appId: appId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteMultiplePreference_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Delete multiple preferences for an app. +class $UsersClient { + /// Creates a new `DynamiteClient` for users requests. + $UsersClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$getUserSubAdminGroups_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getUserSubAdminGroups_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersGetUserSubAdminGroupsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the groups a user is a subadmin of. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getUserSubAdminGroups] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [configKeys] Keys to delete. - /// * [appId] ID of the app. + /// * [userId] ID if the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Preferences deleted successfully - /// * 400: Preference invalid + /// * 200: User subadmin groups returned /// /// See: - /// * [deleteMultiplePreference] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getUserSubAdminGroups] for a method executing this request and parsing the response. + /// * [$getUserSubAdminGroups_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - deleteMultiplePreferenceRaw({ - required BuiltList configKeys, - required String appId, + _i3.Request $getUserSubAdminGroups_Request({ + required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/subadmins').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1860,7 +1911,7 @@ class $PreferencesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1868,46 +1919,12 @@ class $PreferencesClient { } // coverage:ignore-end - final $configKeys = - _$jsonSerializers.serialize(configKeys, specifiedType: const FullType(BuiltList, [FullType(String)])); - _parameters['configKeys%5B%5D'] = $configKeys; - - final $appId = _$jsonSerializers.serialize(appId, specifiedType: const FullType(String)); - _parameters['appId'] = $appId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}{?configKeys%5B%5D*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $deleteMultiplePreference_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $UsersClient { - /// Creates a new `DynamiteClient` for users requests. - $UsersClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$getUserSubAdminGroups_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getUserSubAdminGroups_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersGetUserSubAdminGroupsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get the groups a user is a subadmin of. /// @@ -1924,45 +1941,70 @@ class $UsersClient { /// * 200: User subadmin groups returned /// /// See: - /// * [getUserSubAdminGroupsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getUserSubAdminGroups_Request] for the request send by this method. + /// * [$getUserSubAdminGroups_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getUserSubAdminGroups({ required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await getUserSubAdminGroupsRaw( + final _request = $getUserSubAdminGroups_Request( userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getUserSubAdminGroups_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the groups a user is a subadmin of. + /// Builds a serializer to parse the response of [$addSubAdmin_Request]. + @_i2.experimental + _i1.DynamiteSerializer $addSubAdmin_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersAddSubAdminResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Make a user a subadmin of a group. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [addSubAdmin] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [userId] ID if the user. + /// * [groupid] ID of the group. + /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User subadmin groups returned + /// * 200: User added as group subadmin successfully /// /// See: - /// * [getUserSubAdminGroups] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [addSubAdmin] for a method executing this request and parsing the response. + /// * [$addSubAdmin_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getUserSubAdminGroupsRaw({ + _i3.Request $addSubAdmin_Request({ + required String groupid, required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $groupid = _$jsonSerializers.serialize(groupid, specifiedType: const FullType(String)); + _parameters['groupid'] = $groupid; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/subadmins{?groupid*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1972,7 +2014,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1980,35 +2022,13 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/subadmins').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getUserSubAdminGroups_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$addSubAdmin_Request`. - @_i2.experimental - _i1.DynamiteSerializer $addSubAdmin_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersAddSubAdminResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Make a user a subadmin of a group. /// /// This endpoint requires admin access. @@ -2025,28 +2045,41 @@ class $UsersClient { /// * 200: User added as group subadmin successfully /// /// See: - /// * [addSubAdminRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$addSubAdmin_Request] for the request send by this method. + /// * [$addSubAdmin_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> addSubAdmin({ required String groupid, required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await addSubAdminRaw( + final _request = $addSubAdmin_Request( groupid: groupid, userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $addSubAdmin_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Make a user a subadmin of a group. + /// Builds a serializer to parse the response of [$removeSubAdmin_Request]. + @_i2.experimental + _i1.DynamiteSerializer $removeSubAdmin_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersRemoveSubAdminResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Remove a user from the subadmins of a group. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [removeSubAdmin] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2055,19 +2088,28 @@ class $UsersClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User added as group subadmin successfully + /// * 200: User removed as group subadmin successfully /// /// See: - /// * [addSubAdmin] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [removeSubAdmin] for a method executing this request and parsing the response. + /// * [$removeSubAdmin_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> addSubAdminRaw({ + _i3.Request $removeSubAdmin_Request({ required String groupid, required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $groupid = _$jsonSerializers.serialize(groupid, specifiedType: const FullType(String)); + _parameters['groupid'] = $groupid; + + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/subadmins{?groupid*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2077,7 +2119,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2085,37 +2127,13 @@ class $UsersClient { } // coverage:ignore-end - final $groupid = _$jsonSerializers.serialize(groupid, specifiedType: const FullType(String)); - _parameters['groupid'] = $groupid; - - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/subadmins{?groupid*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $addSubAdmin_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$removeSubAdmin_Request`. - @_i2.experimental - _i1.DynamiteSerializer $removeSubAdmin_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersRemoveSubAdminResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Remove a user from the subadmins of a group. /// /// This endpoint requires admin access. @@ -2132,49 +2150,75 @@ class $UsersClient { /// * 200: User removed as group subadmin successfully /// /// See: - /// * [removeSubAdminRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$removeSubAdmin_Request] for the request send by this method. + /// * [$removeSubAdmin_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> removeSubAdmin({ required String groupid, required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await removeSubAdminRaw( + final _request = $removeSubAdmin_Request( groupid: groupid, userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $removeSubAdmin_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Remove a user from the subadmins of a group. - /// - /// This endpoint requires admin access. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getUsers_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getUsers_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(UsersGetUsersResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a list of users. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getUsers] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [groupid] ID of the group. - /// * [userId] ID of the user. + /// * [search] Text to search for. Defaults to `''`. + /// * [limit] Limit the amount of groups returned. + /// * [offset] Offset for searching for groups. Defaults to `0`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User removed as group subadmin successfully + /// * 200: Users returned /// /// See: - /// * [removeSubAdmin] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getUsers] for a method executing this request and parsing the response. + /// * [$getUsers_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> removeSubAdminRaw({ - required String groupid, - required String userId, + _i3.Request $getUsers_Request({ + String? search, + int? limit, + int? offset, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); + $search ??= ''; + _parameters['search'] = $search; + + final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + _parameters['limit'] = $limit; + + var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); + $offset ??= 0; + _parameters['offset'] = $offset; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users{?search*,limit*,offset*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2184,7 +2228,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2192,36 +2236,13 @@ class $UsersClient { } // coverage:ignore-end - final $groupid = _$jsonSerializers.serialize(groupid, specifiedType: const FullType(String)); - _parameters['groupid'] = $groupid; - - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/subadmins{?groupid*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $removeSubAdmin_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getUsers_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getUsers_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(UsersGetUsersResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get a list of users. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -2237,95 +2258,29 @@ class $UsersClient { /// * 200: Users returned /// /// See: - /// * [getUsersRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getUsers_Request] for the request send by this method. + /// * [$getUsers_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getUsers({ String? search, int? limit, int? offset, bool? oCSAPIRequest, }) async { - final _rawResponse = await getUsersRaw( + final _request = $getUsers_Request( search: search, limit: limit, offset: offset, oCSAPIRequest: oCSAPIRequest, ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get a list of users. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [search] Text to search for. Defaults to `''`. - /// * [limit] Limit the amount of groups returned. - /// * [offset] Offset for searching for groups. Defaults to `0`. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Users returned - /// - /// See: - /// * [getUsers] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getUsersRaw({ - String? search, - int? limit, - int? offset, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); - $search ??= ''; - _parameters['search'] = $search; - - final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - _parameters['limit'] = $limit; - - var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); - $offset ??= 0; - _parameters['offset'] = $offset; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users{?search*,limit*,offset*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getUsers_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$addUser_Request`. + /// Builds a serializer to parse the response of [$addUser_Request]. @_i2.experimental _i1.DynamiteSerializer $addUser_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(UsersAddUserResponseApplicationJson), @@ -2336,60 +2291,7 @@ class $UsersClient { /// Create a new user. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [userid] ID of the user. - /// * [password] Password of the user. Defaults to `''`. - /// * [displayName] Display name of the user. Defaults to `''`. - /// * [email] Email of the user. Defaults to `''`. - /// * [groups] Groups of the user. Defaults to `[]`. - /// * [subadmin] Groups where the user is subadmin. Defaults to `[]`. - /// * [quota] Quota of the user. Defaults to `''`. - /// * [language] Language of the user. Defaults to `''`. - /// * [manager] Manager of the user. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: User added successfully - /// * 403: Missing permissions to make user subadmin - /// - /// See: - /// * [addUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> addUser({ - required String userid, - String? password, - String? displayName, - String? email, - BuiltList? groups, - BuiltList? subadmin, - String? quota, - String? language, - String? manager, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await addUserRaw( - userid: userid, - password: password, - displayName: displayName, - email: email, - groups: groups, - subadmin: subadmin, - quota: quota, - language: language, - manager: manager, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Create a new user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [addUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2409,9 +2311,10 @@ class $UsersClient { /// * 403: Missing permissions to make user subadmin /// /// See: - /// * [addUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [addUser] for a method executing this request and parsing the response. + /// * [$addUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> addUserRaw({ + _i3.Request $addUser_Request({ required String userid, String? password, String? displayName, @@ -2422,27 +2325,8 @@ class $UsersClient { String? language, String? manager, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $userid = _$jsonSerializers.serialize(userid, specifiedType: const FullType(String)); _parameters['userid'] = $userid; @@ -2477,70 +2361,105 @@ class $UsersClient { final $manager = _$jsonSerializers.serialize(manager, specifiedType: const FullType(String)); _parameters['manager'] = $manager; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/cloud/users{?userid*,password*,displayName*,email*,groups%5B%5D*,subadmin%5B%5D*,quota*,language*,manager*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $addUser_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$getUsersDetails_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getUsersDetails_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersGetUsersDetailsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Get a list of users and their details. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Create a new user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [search] Text to search for. Defaults to `''`. - /// * [limit] Limit the amount of groups returned. - /// * [offset] Offset for searching for groups. Defaults to `0`. + /// * [userid] ID of the user. + /// * [password] Password of the user. Defaults to `''`. + /// * [displayName] Display name of the user. Defaults to `''`. + /// * [email] Email of the user. Defaults to `''`. + /// * [groups] Groups of the user. Defaults to `[]`. + /// * [subadmin] Groups where the user is subadmin. Defaults to `[]`. + /// * [quota] Quota of the user. Defaults to `''`. + /// * [language] Language of the user. Defaults to `''`. + /// * [manager] Manager of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Users details returned + /// * 200: User added successfully + /// * 403: Missing permissions to make user subadmin /// /// See: - /// * [getUsersDetailsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getUsersDetails({ - String? search, - int? limit, - int? offset, + /// * [$addUser_Request] for the request send by this method. + /// * [$addUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> addUser({ + required String userid, + String? password, + String? displayName, + String? email, + BuiltList? groups, + BuiltList? subadmin, + String? quota, + String? language, + String? manager, bool? oCSAPIRequest, }) async { - final _rawResponse = await getUsersDetailsRaw( - search: search, - limit: limit, - offset: offset, + final _request = $addUser_Request( + userid: userid, + password: password, + displayName: displayName, + email: email, + groups: groups, + subadmin: subadmin, + quota: quota, + language: language, + manager: manager, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $addUser_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getUsersDetails_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getUsersDetails_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersGetUsersDetailsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a list of users and their details. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getUsersDetails] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2553,34 +2472,16 @@ class $UsersClient { /// * 200: Users details returned /// /// See: - /// * [getUsersDetails] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getUsersDetails] for a method executing this request and parsing the response. + /// * [$getUsersDetails_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getUsersDetailsRaw({ + _i3.Request $getUsersDetails_Request({ String? search, int? limit, int? offset, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; var $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); $search ??= ''; _parameters['search'] = $search; @@ -2592,65 +2493,84 @@ class $UsersClient { $offset ??= 0; _parameters['offset'] = $offset; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/details{?search*,limit*,offset*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/details{?search*,limit*,offset*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getUsersDetails_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getDisabledUsersDetails_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getDisabledUsersDetails_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(UsersGetDisabledUsersDetailsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get the list of disabled users and their details. + /// Get a list of users and their details. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [limit] Limit the amount of users returned. - /// * [offset] Offset. Defaults to `0`. + /// * [search] Text to search for. Defaults to `''`. + /// * [limit] Limit the amount of groups returned. + /// * [offset] Offset for searching for groups. Defaults to `0`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Disabled users details returned + /// * 200: Users details returned /// /// See: - /// * [getDisabledUsersDetailsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getDisabledUsersDetails({ + /// * [$getUsersDetails_Request] for the request send by this method. + /// * [$getUsersDetails_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getUsersDetails({ + String? search, int? limit, int? offset, bool? oCSAPIRequest, }) async { - final _rawResponse = await getDisabledUsersDetailsRaw( + final _request = $getUsersDetails_Request( + search: search, limit: limit, offset: offset, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getUsersDetails_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getDisabledUsersDetails_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getDisabledUsersDetails_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(UsersGetDisabledUsersDetailsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the list of disabled users and their details. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getDisabledUsersDetails] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2662,17 +2582,26 @@ class $UsersClient { /// * 200: Disabled users details returned /// /// See: - /// * [getDisabledUsersDetails] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getDisabledUsersDetails] for a method executing this request and parsing the response. + /// * [$getDisabledUsersDetails_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getDisabledUsersDetailsRaw({ + _i3.Request $getDisabledUsersDetails_Request({ int? limit, int? offset, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + _parameters['limit'] = $limit; + + var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); + $offset ??= 0; + _parameters['offset'] = $offset; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/disabled{?limit*,offset*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2682,7 +2611,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2690,74 +2619,61 @@ class $UsersClient { } // coverage:ignore-end - final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - _parameters['limit'] = $limit; - - var $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); - $offset ??= 0; - _parameters['offset'] = $offset; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/disabled{?limit*,offset*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getDisabledUsersDetails_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$searchByPhoneNumbers_Request`. - @_i2.experimental - _i1.DynamiteSerializer $searchByPhoneNumbers_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersSearchByPhoneNumbersResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Search users by their phone numbers. + /// Get the list of disabled users and their details. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [location] Location of the phone number (for country code). - /// * [search] Phone numbers to search for. + /// * [limit] Limit the amount of users returned. + /// * [offset] Offset. Defaults to `0`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Users returned - /// * 400: Invalid location + /// * 200: Disabled users details returned /// /// See: - /// * [searchByPhoneNumbersRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> searchByPhoneNumbers({ - required String location, - required ContentString>> search, + /// * [$getDisabledUsersDetails_Request] for the request send by this method. + /// * [$getDisabledUsersDetails_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getDisabledUsersDetails({ + int? limit, + int? offset, bool? oCSAPIRequest, }) async { - final _rawResponse = await searchByPhoneNumbersRaw( - location: location, - search: search, + final _request = $getDisabledUsersDetails_Request( + limit: limit, + offset: offset, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getDisabledUsersDetails_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$searchByPhoneNumbers_Request]. + @_i2.experimental + _i1.DynamiteSerializer $searchByPhoneNumbers_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersSearchByPhoneNumbersResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Search users by their phone numbers. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [searchByPhoneNumbers] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2770,16 +2686,33 @@ class $UsersClient { /// * 400: Invalid location /// /// See: - /// * [searchByPhoneNumbers] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [searchByPhoneNumbers] for a method executing this request and parsing the response. + /// * [$searchByPhoneNumbers_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> searchByPhoneNumbersRaw({ + _i3.Request $searchByPhoneNumbers_Request({ required String location, required ContentString>> search, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $location = _$jsonSerializers.serialize(location, specifiedType: const FullType(String)); + _parameters['location'] = $location; + + final $search = _$jsonSerializers.serialize( + search, + specifiedType: const FullType(ContentString, [ + FullType(BuiltMap, [ + FullType(String), + FullType(BuiltList, [FullType(String)]), + ]), + ]), + ); + _parameters['search'] = $search; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/search/by-phone{?location*,search*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2789,7 +2722,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2797,76 +2730,61 @@ class $UsersClient { } // coverage:ignore-end - final $location = _$jsonSerializers.serialize(location, specifiedType: const FullType(String)); - _parameters['location'] = $location; - - final $search = _$jsonSerializers.serialize( - search, - specifiedType: const FullType(ContentString, [ - FullType(BuiltMap, [ - FullType(String), - FullType(BuiltList, [FullType(String)]), - ]), - ]), - ); - _parameters['search'] = $search; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/search/by-phone{?location*,search*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $searchByPhoneNumbers_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getUser_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getUser_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(UsersGetUserResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get the details of a user. + /// Search users by their phone numbers. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [userId] ID of the user. + /// * [location] Location of the phone number (for country code). + /// * [search] Phone numbers to search for. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User returned + /// * 200: Users returned + /// * 400: Invalid location /// /// See: - /// * [getUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getUser({ - required String userId, + /// * [$searchByPhoneNumbers_Request] for the request send by this method. + /// * [$searchByPhoneNumbers_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> searchByPhoneNumbers({ + required String location, + required ContentString>> search, bool? oCSAPIRequest, }) async { - final _rawResponse = await getUserRaw( - userId: userId, + final _request = $searchByPhoneNumbers_Request( + location: location, + search: search, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $searchByPhoneNumbers_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getUser_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getUser_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(UsersGetUserResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the details of a user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2877,15 +2795,21 @@ class $UsersClient { /// * 200: User returned /// /// See: - /// * [getUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getUser] for a method executing this request and parsing the response. + /// * [$getUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getUserRaw({ + _i3.Request $getUser_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2895,7 +2819,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2903,70 +2827,56 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getUser_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$editUser_Request`. - @_i2.experimental - _i1.DynamiteSerializer $editUser_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(UsersEditUserResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Update a value of the user's details. + /// Get the details of a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [key] Key that will be updated. - /// * [value] New value for the key. /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User value edited successfully + /// * 200: User returned /// /// See: - /// * [editUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> editUser({ - required String key, - required String value, + /// * [$getUser_Request] for the request send by this method. + /// * [$getUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getUser({ required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await editUserRaw( - key: key, - value: value, + final _request = $getUser_Request( userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getUser_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$editUser_Request]. + @_i2.experimental + _i1.DynamiteSerializer $editUser_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(UsersEditUserResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Update a value of the user's details. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [editUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2979,17 +2889,29 @@ class $UsersClient { /// * 200: User value edited successfully /// /// See: - /// * [editUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [editUser] for a method executing this request and parsing the response. + /// * [$editUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> editUserRaw({ + _i3.Request $editUser_Request({ required String key, required String value, required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(String)); + _parameters['key'] = $key; + + final $value = _$jsonSerializers.serialize(value, specifiedType: const FullType(String)); + _parameters['value'] = $value; + + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}{?key*,value*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2999,7 +2921,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3007,71 +2929,63 @@ class $UsersClient { } // coverage:ignore-end - final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(String)); - _parameters['key'] = $key; - - final $value = _$jsonSerializers.serialize(value, specifiedType: const FullType(String)); - _parameters['value'] = $value; - - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}{?key*,value*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $editUser_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteUser_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteUser_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersDeleteUserResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Delete a user. + /// Update a value of the user's details. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [key] Key that will be updated. + /// * [value] New value for the key. /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User deleted successfully + /// * 200: User value edited successfully /// /// See: - /// * [deleteUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteUser({ + /// * [$editUser_Request] for the request send by this method. + /// * [$editUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> editUser({ + required String key, + required String value, required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteUserRaw( + final _request = $editUser_Request( + key: key, + value: value, userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $editUser_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteUser_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteUser_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersDeleteUserResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Delete a user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3082,15 +2996,21 @@ class $UsersClient { /// * 200: User deleted successfully /// /// See: - /// * [deleteUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteUser] for a method executing this request and parsing the response. + /// * [$deleteUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteUserRaw({ + _i3.Request $deleteUser_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3100,7 +3020,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3108,62 +3028,57 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $deleteUser_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getCurrentUser_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getCurrentUser_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersGetCurrentUserResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get the details of the current user. + /// Delete a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Current user returned + /// * 200: User deleted successfully /// /// See: - /// * [getCurrentUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getCurrentUser({ + /// * [$deleteUser_Request] for the request send by this method. + /// * [$deleteUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteUser({ + required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await getCurrentUserRaw( + final _request = $deleteUser_Request( + userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteUser_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getCurrentUser_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getCurrentUser_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersGetCurrentUserResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the details of the current user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getCurrentUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3173,13 +3088,14 @@ class $UsersClient { /// * 200: Current user returned /// /// See: - /// * [getCurrentUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getCurrentUser] for a method executing this request and parsing the response. + /// * [$getCurrentUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getCurrentUserRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getCurrentUser_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/cloud/user'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3189,7 +3105,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3199,30 +3115,12 @@ class $UsersClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/cloud/user'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getCurrentUser_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getEditableFields_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getEditableFields_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersGetEditableFieldsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get a list of fields that are editable for the current user. + /// Get the details of the current user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -3231,25 +3129,38 @@ class $UsersClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Editable fields returned + /// * 200: Current user returned /// /// See: - /// * [getEditableFieldsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getEditableFields({ + /// * [$getCurrentUser_Request] for the request send by this method. + /// * [$getCurrentUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getCurrentUser({ bool? oCSAPIRequest, }) async { - final _rawResponse = await getEditableFieldsRaw( + final _request = $getCurrentUser_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getCurrentUser_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getEditableFields_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getEditableFields_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersGetEditableFieldsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a list of fields that are editable for the current user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getEditableFields] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3259,13 +3170,14 @@ class $UsersClient { /// * 200: Editable fields returned /// /// See: - /// * [getEditableFields] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getEditableFields] for a method executing this request and parsing the response. + /// * [$getEditableFields_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getEditableFieldsRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getEditableFields_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/cloud/user/fields'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3275,7 +3187,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3285,60 +3197,52 @@ class $UsersClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/cloud/user/fields'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getEditableFields_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getEditableFieldsForUser_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getEditableFieldsForUser_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(UsersGetEditableFieldsForUserResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get a list of fields that are editable for a user. + /// Get a list of fields that are editable for the current user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Editable fields for user returned + /// * 200: Editable fields returned /// /// See: - /// * [getEditableFieldsForUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getEditableFieldsForUser({ - required String userId, + /// * [$getEditableFields_Request] for the request send by this method. + /// * [$getEditableFields_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getEditableFields({ bool? oCSAPIRequest, }) async { - final _rawResponse = await getEditableFieldsForUserRaw( - userId: userId, + final _request = $getEditableFields_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getEditableFields_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getEditableFieldsForUser_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getEditableFieldsForUser_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(UsersGetEditableFieldsForUserResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a list of fields that are editable for a user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getEditableFieldsForUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3349,16 +3253,21 @@ class $UsersClient { /// * 200: Editable fields for user returned /// /// See: - /// * [getEditableFieldsForUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getEditableFieldsForUser] for a method executing this request and parsing the response. + /// * [$getEditableFieldsForUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getEditableFieldsForUserRaw({ + _i3.Request $getEditableFieldsForUser_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/user/fields/{userId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3368,7 +3277,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3376,75 +3285,58 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/user/fields/{userId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getEditableFieldsForUser_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$editUserMultiValue_Request`. - @_i2.experimental - _i1.DynamiteSerializer $editUserMultiValue_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersEditUserMultiValueResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Update multiple values of the user's details. + /// Get a list of fields that are editable for a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [key] Key that will be updated. - /// * [value] New value for the key. /// * [userId] ID of the user. - /// * [collectionName] Collection to update. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User values edited successfully + /// * 200: Editable fields for user returned /// /// See: - /// * [editUserMultiValueRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> editUserMultiValue({ - required String key, - required String value, + /// * [$getEditableFieldsForUser_Request] for the request send by this method. + /// * [$getEditableFieldsForUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getEditableFieldsForUser({ required String userId, - required String collectionName, bool? oCSAPIRequest, }) async { - final _rawResponse = await editUserMultiValueRaw( - key: key, - value: value, + final _request = $getEditableFieldsForUser_Request( userId: userId, - collectionName: collectionName, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getEditableFieldsForUser_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$editUserMultiValue_Request]. + @_i2.experimental + _i1.DynamiteSerializer $editUserMultiValue_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersEditUserMultiValueResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Update multiple values of the user's details. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [editUserMultiValue] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3458,18 +3350,39 @@ class $UsersClient { /// * 200: User values edited successfully /// /// See: - /// * [editUserMultiValue] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [editUserMultiValue] for a method executing this request and parsing the response. + /// * [$editUserMultiValue_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> editUserMultiValueRaw({ + _i3.Request $editUserMultiValue_Request({ required String key, required String value, required String userId, required String collectionName, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(String)); + _parameters['key'] = $key; + + final $value = _$jsonSerializers.serialize(value, specifiedType: const FullType(String)); + _parameters['value'] = $value; + + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + + final $collectionName = _$jsonSerializers.serialize(collectionName, specifiedType: const FullType(String)); + _i4.checkPattern( + $collectionName as String?, + RegExp(r'^(?!enable$|disable$)[a-zA-Z0-9_]*$'), + 'collectionName', + ); + _parameters['collectionName'] = $collectionName; + final _path = + _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/{collectionName}{?key*,value*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3479,7 +3392,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3487,80 +3400,66 @@ class $UsersClient { } // coverage:ignore-end - final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(String)); - _parameters['key'] = $key; - - final $value = _$jsonSerializers.serialize(value, specifiedType: const FullType(String)); - _parameters['value'] = $value; - - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - - final $collectionName = _$jsonSerializers.serialize(collectionName, specifiedType: const FullType(String)); - _i3.checkPattern( - $collectionName as String?, - RegExp(r'^(?!enable$|disable$)[a-zA-Z0-9_]*$'), - 'collectionName', - ); - _parameters['collectionName'] = $collectionName; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/{collectionName}{?key*,value*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); - - final _serializer = $editUserMultiValue_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$wipeUserDevices_Request`. - @_i2.experimental - _i1.DynamiteSerializer $wipeUserDevices_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersWipeUserDevicesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Wipe all devices of a user. + /// Update multiple values of the user's details. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [key] Key that will be updated. + /// * [value] New value for the key. /// * [userId] ID of the user. + /// * [collectionName] Collection to update. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Wiped all user devices successfully + /// * 200: User values edited successfully /// /// See: - /// * [wipeUserDevicesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> wipeUserDevices({ + /// * [$editUserMultiValue_Request] for the request send by this method. + /// * [$editUserMultiValue_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> editUserMultiValue({ + required String key, + required String value, required String userId, + required String collectionName, bool? oCSAPIRequest, }) async { - final _rawResponse = await wipeUserDevicesRaw( + final _request = $editUserMultiValue_Request( + key: key, + value: value, userId: userId, + collectionName: collectionName, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $editUserMultiValue_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$wipeUserDevices_Request]. + @_i2.experimental + _i1.DynamiteSerializer $wipeUserDevices_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersWipeUserDevicesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Wipe all devices of a user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [wipeUserDevices] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3571,15 +3470,21 @@ class $UsersClient { /// * 200: Wiped all user devices successfully /// /// See: - /// * [wipeUserDevices] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [wipeUserDevices] for a method executing this request and parsing the response. + /// * [$wipeUserDevices_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> wipeUserDevicesRaw({ + _i3.Request $wipeUserDevices_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/wipe').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3589,7 +3494,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3597,35 +3502,14 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/wipe').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $wipeUserDevices_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - /// Builds a serializer to parse the response of `$enableUser_Request`. - @_i2.experimental - _i1.DynamiteSerializer $enableUser_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersEnableUserResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); + return _request; + } - /// Enable a user. + /// Wipe all devices of a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -3635,27 +3519,40 @@ class $UsersClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User enabled successfully + /// * 200: Wiped all user devices successfully /// /// See: - /// * [enableUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> enableUser({ + /// * [$wipeUserDevices_Request] for the request send by this method. + /// * [$wipeUserDevices_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> wipeUserDevices({ required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await enableUserRaw( + final _request = $wipeUserDevices_Request( userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $wipeUserDevices_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$enableUser_Request]. + @_i2.experimental + _i1.DynamiteSerializer $enableUser_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersEnableUserResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Enable a user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [enableUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3666,15 +3563,21 @@ class $UsersClient { /// * 200: User enabled successfully /// /// See: - /// * [enableUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [enableUser] for a method executing this request and parsing the response. + /// * [$enableUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> enableUserRaw({ + _i3.Request $enableUser_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/enable').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3684,7 +3587,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3692,35 +3595,14 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/enable').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $enableUser_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$disableUser_Request`. - @_i2.experimental - _i1.DynamiteSerializer $disableUser_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersDisableUserResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Disable a user. + /// Enable a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -3730,27 +3612,40 @@ class $UsersClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User disabled successfully + /// * 200: User enabled successfully /// /// See: - /// * [disableUserRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> disableUser({ + /// * [$enableUser_Request] for the request send by this method. + /// * [$enableUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> enableUser({ required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await disableUserRaw( + final _request = $enableUser_Request( userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $enableUser_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$disableUser_Request]. + @_i2.experimental + _i1.DynamiteSerializer $disableUser_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersDisableUserResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Disable a user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [disableUser] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3761,15 +3656,21 @@ class $UsersClient { /// * 200: User disabled successfully /// /// See: - /// * [disableUser] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [disableUser] for a method executing this request and parsing the response. + /// * [$disableUser_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> disableUserRaw({ + _i3.Request $disableUser_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/disable').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3779,7 +3680,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3787,35 +3688,14 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/disable').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $disableUser_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getUsersGroups_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getUsersGroups_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersGetUsersGroupsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get a list of groups the user belongs to. + /// Disable a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -3825,27 +3705,40 @@ class $UsersClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Users groups returned + /// * 200: User disabled successfully /// /// See: - /// * [getUsersGroupsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getUsersGroups({ + /// * [$disableUser_Request] for the request send by this method. + /// * [$disableUser_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> disableUser({ required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await getUsersGroupsRaw( + final _request = $disableUser_Request( userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $disableUser_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getUsersGroups_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getUsersGroups_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersGetUsersGroupsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a list of groups the user belongs to. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getUsersGroups] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3856,15 +3749,21 @@ class $UsersClient { /// * 200: Users groups returned /// /// See: - /// * [getUsersGroups] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getUsersGroups] for a method executing this request and parsing the response. + /// * [$getUsersGroups_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getUsersGroupsRaw({ + _i3.Request $getUsersGroups_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/groups').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3874,7 +3773,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3882,68 +3781,57 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/groups').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getUsersGroups_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$addToGroup_Request`. - @_i2.experimental - _i1.DynamiteSerializer $addToGroup_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersAddToGroupResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Add a user to a group. + /// Get a list of groups the user belongs to. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [groupid] ID of the group. Defaults to `''`. /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User added to group successfully + /// * 200: Users groups returned /// /// See: - /// * [addToGroupRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> addToGroup({ + /// * [$getUsersGroups_Request] for the request send by this method. + /// * [$getUsersGroups_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getUsersGroups({ required String userId, - String? groupid, bool? oCSAPIRequest, }) async { - final _rawResponse = await addToGroupRaw( + final _request = $getUsersGroups_Request( userId: userId, - groupid: groupid, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getUsersGroups_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$addToGroup_Request]. + @_i2.experimental + _i1.DynamiteSerializer $addToGroup_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersAddToGroupResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Add a user to a group. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [addToGroup] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3955,16 +3843,26 @@ class $UsersClient { /// * 200: User added to group successfully /// /// See: - /// * [addToGroup] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [addToGroup] for a method executing this request and parsing the response. + /// * [$addToGroup_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> addToGroupRaw({ + _i3.Request $addToGroup_Request({ required String userId, String? groupid, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + + var $groupid = _$jsonSerializers.serialize(groupid, specifiedType: const FullType(String)); + $groupid ??= ''; + _parameters['groupid'] = $groupid; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/groups{?groupid*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3974,7 +3872,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3982,72 +3880,60 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - - var $groupid = _$jsonSerializers.serialize(groupid, specifiedType: const FullType(String)); - $groupid ??= ''; - _parameters['groupid'] = $groupid; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/groups{?groupid*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $addToGroup_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$removeFromGroup_Request`. - @_i2.experimental - _i1.DynamiteSerializer $removeFromGroup_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersRemoveFromGroupResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Remove a user from a group. + /// Add a user to a group. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [groupid] ID of the group. + /// * [groupid] ID of the group. Defaults to `''`. /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: User removed from group successfully + /// * 200: User added to group successfully /// /// See: - /// * [removeFromGroupRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> removeFromGroup({ - required String groupid, + /// * [$addToGroup_Request] for the request send by this method. + /// * [$addToGroup_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> addToGroup({ required String userId, + String? groupid, bool? oCSAPIRequest, }) async { - final _rawResponse = await removeFromGroupRaw( - groupid: groupid, + final _request = $addToGroup_Request( userId: userId, + groupid: groupid, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $addToGroup_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$removeFromGroup_Request]. + @_i2.experimental + _i1.DynamiteSerializer $removeFromGroup_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersRemoveFromGroupResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Remove a user from a group. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [removeFromGroup] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4059,16 +3945,25 @@ class $UsersClient { /// * 200: User removed from group successfully /// /// See: - /// * [removeFromGroup] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [removeFromGroup] for a method executing this request and parsing the response. + /// * [$removeFromGroup_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> removeFromGroupRaw({ + _i3.Request $removeFromGroup_Request({ required String groupid, required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $groupid = _$jsonSerializers.serialize(groupid, specifiedType: const FullType(String)); + _parameters['groupid'] = $groupid; + + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/groups{?groupid*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4078,7 +3973,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -4086,68 +3981,60 @@ class $UsersClient { } // coverage:ignore-end - final $groupid = _$jsonSerializers.serialize(groupid, specifiedType: const FullType(String)); - _parameters['groupid'] = $groupid; - - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/groups{?groupid*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $removeFromGroup_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$resendWelcomeMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer $resendWelcomeMessage_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UsersResendWelcomeMessageResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Resend the welcome message. + /// Remove a user from a group. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [userId] ID if the user. + /// * [groupid] ID of the group. + /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Resent welcome message successfully + /// * 200: User removed from group successfully /// /// See: - /// * [resendWelcomeMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> resendWelcomeMessage({ + /// * [$removeFromGroup_Request] for the request send by this method. + /// * [$removeFromGroup_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> removeFromGroup({ + required String groupid, required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await resendWelcomeMessageRaw( + final _request = $removeFromGroup_Request( + groupid: groupid, userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $removeFromGroup_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$resendWelcomeMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer $resendWelcomeMessage_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UsersResendWelcomeMessageResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Resend the welcome message. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [resendWelcomeMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4158,15 +4045,21 @@ class $UsersClient { /// * 200: Resent welcome message successfully /// /// See: - /// * [resendWelcomeMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [resendWelcomeMessage] for a method executing this request and parsing the response. + /// * [$resendWelcomeMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> resendWelcomeMessageRaw({ + _i3.Request $resendWelcomeMessage_Request({ required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i5.UriTemplate('/ocs/v2.php/cloud/users/{userId}/welcome').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4176,7 +4069,7 @@ class $UsersClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -4184,23 +4077,43 @@ class $UsersClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } - final _path = _i4.UriTemplate('/ocs/v2.php/cloud/users/{userId}/welcome').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + /// Resend the welcome message. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [userId] ID if the user. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Resent welcome message successfully + /// + /// See: + /// * [$resendWelcomeMessage_Request] for the request send by this method. + /// * [$resendWelcomeMessage_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> resendWelcomeMessage({ + required String userId, + bool? oCSAPIRequest, + }) async { + final _request = $resendWelcomeMessage_Request( + userId: userId, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $resendWelcomeMessage_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -8243,13 +8156,13 @@ extension $c4bc4131e74e61dae681408e87e2e2bdExtension on _$c4bc4131e74e61dae68140 List get _names => const [r'$bool', r'$int']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -8319,13 +8232,13 @@ extension $b6d67dc2a96424d2f407f8e51557f3deExtension on _$b6d67dc2a96424d2f407f8 List get _names => const [r'$num', 'string']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -8398,13 +8311,13 @@ extension $b20d370ea28764b414e70ac5df151f1bExtension on _$b20d370ea28764b414e70a List get _names => const ['groupsGetGroupUsersDetailsResponseApplicationJsonOcsDataUsers1', 'userDetails']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -8488,13 +8401,13 @@ extension $1e1cd5e43e0a1022a23a294e58225d74Extension on _$1e1cd5e43e0a1022a23a29 List get _names => const ['userDetails', 'usersGetUsersDetailsResponseApplicationJsonOcsDataUsers1']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -8577,13 +8490,13 @@ extension $f9d75e948689049b3f3e23e024d4be73Extension on _$f9d75e948689049b3f3e23 List get _names => const ['userDetails', 'usersGetDisabledUsersDetailsResponseApplicationJsonOcsDataUsers1']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -9215,9 +9128,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) + ..add(_i6.DynamiteDoubleSerializer()) ..addPlugin( - _i6.StandardJsonPlugin( + _i7.StandardJsonPlugin( typesToLeaveAsList: const { _$c4bc4131e74e61dae681408e87e2e2bd, _$b6d67dc2a96424d2f407f8e51557f3de, @@ -9227,7 +9140,7 @@ final Serializers _$jsonSerializers = (_$serializers.toBuilder() }, ), ) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/settings.openapi.dart b/packages/nextcloud/lib/src/api/settings.openapi.dart index 956497acc86..13becefd231 100644 --- a/packages/nextcloud/lib/src/api/settings.openapi.dart +++ b/packages/nextcloud/lib/src/api/settings.openapi.dart @@ -19,10 +19,11 @@ import 'dart:typed_data'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i4; +import 'package:built_value/standard_json_plugin.dart' as _i5; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i3; +import 'package:dynamite_runtime/built_value.dart' as _i4; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; part 'settings.openapi.g.dart'; @@ -56,7 +57,7 @@ class $LogSettingsClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$download_Request`. + /// Builds a serializer to parse the response of [$download_Request]. @_i2.experimental _i1.DynamiteSerializer $download_Serializer() => _i1.DynamiteSerializer( @@ -70,38 +71,21 @@ class $LogSettingsClient { /// /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Status codes: - /// * 200: Logfile returned - /// - /// See: - /// * [downloadRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> download() async { - final _rawResponse = await downloadRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// download logfile. - /// - /// This endpoint requires admin access. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [download] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200: Logfile returned /// /// See: - /// * [download] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [download] for a method executing this request and parsing the response. + /// * [$download_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> downloadRaw() async { - final _headers = {'Accept': 'application/octet-stream'}; - + _i3.Request $download_Request() { + const _path = '/index.php/settings/admin/log/download'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/octet-stream'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -111,7 +95,7 @@ class $LogSettingsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -119,15 +103,30 @@ class $LogSettingsClient { } // coverage:ignore-end - const _path = '/index.php/settings/admin/log/download'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + return _request; + } + + /// download logfile. + /// + /// This endpoint requires admin access. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: Logfile returned + /// + /// See: + /// * [$download_Request] for the request send by this method. + /// * [$download_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> download() async { + final _request = $download_Request(); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $download_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -191,9 +190,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i3.DynamiteDoubleSerializer()) - ..addPlugin(_i4.StandardJsonPlugin()) - ..addPlugin(const _i3.HeaderPlugin()) - ..addPlugin(const _i3.ContentStringPlugin())) + ..add(_i4.DynamiteDoubleSerializer()) + ..addPlugin(_i5.StandardJsonPlugin()) + ..addPlugin(const _i4.HeaderPlugin()) + ..addPlugin(const _i4.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/spreed.openapi.dart b/packages/nextcloud/lib/src/api/spreed.openapi.dart index b67456678bd..a59d04a6b5a 100644 --- a/packages/nextcloud/lib/src/api/spreed.openapi.dart +++ b/packages/nextcloud/lib/src/api/spreed.openapi.dart @@ -21,14 +21,15 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; import 'package:dynamite_runtime/models.dart'; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i4; +import 'package:uri/uri.dart' as _i5; part 'spreed.openapi.g.dart'; @@ -97,7 +98,7 @@ class $AvatarClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getAvatar_Request`. + /// Builds a serializer to parse the response of [$getAvatar_Request]. @_i2.experimental _i1.DynamiteSerializer $getAvatar_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -108,7 +109,7 @@ class $AvatarClient { /// Get the avatar of a room. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getAvatar] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -121,51 +122,37 @@ class $AvatarClient { /// * 200: Room avatar returned /// /// See: - /// * [getAvatarRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getAvatar({ + /// * [getAvatar] for a method executing this request and parsing the response. + /// * [$getAvatar_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getAvatar_Request({ required String token, AvatarGetAvatarDarkTheme? darkTheme, AvatarGetAvatarApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await getAvatarRaw( - token: token, - darkTheme: darkTheme, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', ); + _parameters['token'] = $token; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } + var $darkTheme = _$jsonSerializers.serialize(darkTheme, specifiedType: const FullType(AvatarGetAvatarDarkTheme)); + $darkTheme ??= 0; + _parameters['darkTheme'] = $darkTheme; - /// Get the avatar of a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [darkTheme] Theme used for background. Defaults to `0`. - /// * [apiVersion] Defaults to `v1`. - /// * [token] - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Room avatar returned - /// - /// See: - /// * [getAvatar] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getAvatarRaw({ - required String token, - AvatarGetAvatarDarkTheme? darkTheme, - AvatarGetAvatarApiVersion? apiVersion, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(AvatarGetAvatarApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar{?darkTheme*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -175,89 +162,68 @@ class $AvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $darkTheme = _$jsonSerializers.serialize(darkTheme, specifiedType: const FullType(AvatarGetAvatarDarkTheme)); - $darkTheme ??= 0; - _parameters['darkTheme'] = $darkTheme; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(AvatarGetAvatarApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar{?darkTheme*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getAvatar_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$uploadAvatar_Request`. - @_i2.experimental - _i1.DynamiteSerializer $uploadAvatar_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(AvatarUploadAvatarResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Upload an avatar for a room. + /// Get the avatar of a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [darkTheme] Theme used for background. Defaults to `0`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Avatar uploaded successfully - /// * 400: Avatar invalid + /// * 200: Room avatar returned /// /// See: - /// * [uploadAvatarRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> uploadAvatar({ + /// * [$getAvatar_Request] for the request send by this method. + /// * [$getAvatar_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getAvatar({ required String token, - AvatarUploadAvatarApiVersion? apiVersion, + AvatarGetAvatarDarkTheme? darkTheme, + AvatarGetAvatarApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await uploadAvatarRaw( + final _request = $getAvatar_Request( token: token, + darkTheme: darkTheme, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getAvatar_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$uploadAvatar_Request]. + @_i2.experimental + _i1.DynamiteSerializer $uploadAvatar_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(AvatarUploadAvatarResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Upload an avatar for a room. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [uploadAvatar] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -270,16 +236,32 @@ class $AvatarClient { /// * 400: Avatar invalid /// /// See: - /// * [uploadAvatar] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [uploadAvatar] for a method executing this request and parsing the response. + /// * [$uploadAvatar_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> uploadAvatarRaw({ + _i3.Request $uploadAvatar_Request({ required String token, AvatarUploadAvatarApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(AvatarUploadAvatarApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -289,51 +271,20 @@ class $AvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(AvatarUploadAvatarApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $uploadAvatar_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteAvatar_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteAvatar_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(AvatarDeleteAvatarResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Delete the avatar of a room. + /// Upload an avatar for a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -344,29 +295,43 @@ class $AvatarClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Avatar removed successfully + /// * 200: Avatar uploaded successfully + /// * 400: Avatar invalid /// /// See: - /// * [deleteAvatarRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteAvatar({ + /// * [$uploadAvatar_Request] for the request send by this method. + /// * [$uploadAvatar_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> uploadAvatar({ required String token, - AvatarDeleteAvatarApiVersion? apiVersion, + AvatarUploadAvatarApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteAvatarRaw( + final _request = $uploadAvatar_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $uploadAvatar_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteAvatar_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteAvatar_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(AvatarDeleteAvatarResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Delete the avatar of a room. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteAvatar] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -378,16 +343,32 @@ class $AvatarClient { /// * 200: Avatar removed successfully /// /// See: - /// * [deleteAvatar] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteAvatar] for a method executing this request and parsing the response. + /// * [$deleteAvatar_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteAvatarRaw({ + _i3.Request $deleteAvatar_Request({ required String token, AvatarDeleteAvatarApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(AvatarDeleteAvatarApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -397,91 +378,66 @@ class $AvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(AvatarDeleteAvatarApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $deleteAvatar_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$emojiAvatar_Request`. - @_i2.experimental - _i1.DynamiteSerializer $emojiAvatar_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(AvatarEmojiAvatarResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Set an emoji as avatar. + /// Delete the avatar of a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [emoji] Emoji. - /// * [color] Color of the emoji. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Avatar set successfully - /// * 400: Setting emoji avatar is not possible + /// * 200: Avatar removed successfully /// /// See: - /// * [emojiAvatarRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> emojiAvatar({ - required String emoji, + /// * [$deleteAvatar_Request] for the request send by this method. + /// * [$deleteAvatar_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteAvatar({ required String token, - String? color, - AvatarEmojiAvatarApiVersion? apiVersion, + AvatarDeleteAvatarApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await emojiAvatarRaw( - emoji: emoji, + final _request = $deleteAvatar_Request( token: token, - color: color, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteAvatar_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$emojiAvatar_Request]. + @_i2.experimental + _i1.DynamiteSerializer $emojiAvatar_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(AvatarEmojiAvatarResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Set an emoji as avatar. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [emojiAvatar] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -496,38 +452,22 @@ class $AvatarClient { /// * 400: Setting emoji avatar is not possible /// /// See: - /// * [emojiAvatar] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [emojiAvatar] for a method executing this request and parsing the response. + /// * [$emojiAvatar_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> emojiAvatarRaw({ + _i3.Request $emojiAvatar_Request({ required String emoji, required String token, String? color, AvatarEmojiAvatarApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $emoji = _$jsonSerializers.serialize(emoji, specifiedType: const FullType(String)); _parameters['emoji'] = $emoji; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -542,65 +482,86 @@ class $AvatarClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar/emoji{?emoji*,color*}') + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar/emoji{?emoji*,color*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $emojiAvatar_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$getAvatarDark_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getAvatarDark_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Uint8List), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } - /// Get the dark mode avatar of a room. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Set an emoji as avatar. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [emoji] Emoji. + /// * [color] Color of the emoji. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Room avatar returned + /// * 200: Avatar set successfully + /// * 400: Setting emoji avatar is not possible /// /// See: - /// * [getAvatarDarkRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getAvatarDark({ + /// * [$emojiAvatar_Request] for the request send by this method. + /// * [$emojiAvatar_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> emojiAvatar({ + required String emoji, required String token, - AvatarGetAvatarDarkApiVersion? apiVersion, + String? color, + AvatarEmojiAvatarApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getAvatarDarkRaw( + final _request = $emojiAvatar_Request( + emoji: emoji, token: token, + color: color, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $emojiAvatar_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getAvatarDark_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getAvatarDark_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Uint8List), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the dark mode avatar of a room. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getAvatarDark] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -612,16 +573,33 @@ class $AvatarClient { /// * 200: Room avatar returned /// /// See: - /// * [getAvatarDark] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getAvatarDark] for a method executing this request and parsing the response. + /// * [$getAvatarDark_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getAvatarDarkRaw({ + _i3.Request $getAvatarDark_Request({ required String token, AvatarGetAvatarDarkApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(AvatarGetAvatarDarkApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar/dark').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -631,111 +609,74 @@ class $AvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(AvatarGetAvatarDarkApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/avatar/dark').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getAvatarDark_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $BotClient { - /// Creates a new `DynamiteClient` for bot requests. - $BotClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$sendMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer $sendMessage_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(BotSendMessageResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {201, 400, 401, 413}, - ); - /// Sends a new chat message to the given room. - /// - /// The author and timestamp are automatically set to the current user/guest and time. + /// Get the dark mode avatar of a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [message] The message to send. - /// * [referenceId] For the message to be able to later identify it again. Defaults to `''`. - /// * [replyTo] Parent id which this message is a reply to. Defaults to `0`. - /// * [silent] If sent silent the chat message will not create any notifications. Defaults to `0`. /// * [apiVersion] Defaults to `v1`. - /// * [token] Conversation token. + /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 201: Message sent successfully - /// * 400: When the replyTo is invalid or message is empty - /// * 401: Sending message is not allowed - /// * 413: Message too long + /// * 200: Room avatar returned /// /// See: - /// * [sendMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> sendMessage({ - required String message, + /// * [$getAvatarDark_Request] for the request send by this method. + /// * [$getAvatarDark_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getAvatarDark({ required String token, - String? referenceId, - int? replyTo, - BotSendMessageSilent? silent, - BotSendMessageApiVersion? apiVersion, + AvatarGetAvatarDarkApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await sendMessageRaw( - message: message, + final _request = $getAvatarDark_Request( token: token, - referenceId: referenceId, - replyTo: replyTo, - silent: silent, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getAvatarDark_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} + +class $BotClient { + /// Creates a new `DynamiteClient` for bot requests. + $BotClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$sendMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer $sendMessage_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(BotSendMessageResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {201, 400, 401, 413}, + ); /// Sends a new chat message to the given room. /// /// The author and timestamp are automatically set to the current user/guest and time. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [sendMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -754,9 +695,10 @@ class $BotClient { /// * 413: Message too long /// /// See: - /// * [sendMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [sendMessage] for a method executing this request and parsing the response. + /// * [$sendMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> sendMessageRaw({ + _i3.Request $sendMessage_Request({ required String message, required String token, String? referenceId, @@ -764,30 +706,13 @@ class $BotClient { BotSendMessageSilent? silent, BotSendMessageApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $message = _$jsonSerializers.serialize(message, specifiedType: const FullType(String)); _parameters['message'] = $message; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -810,76 +735,97 @@ class $BotClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}/message{?message*,referenceId*,replyTo*,silent*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $sendMessage_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$react_Request`. - @_i2.experimental - _i1.DynamiteSerializer $react_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BotReactResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 201, 400, 401, 404}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } - /// Adds a reaction to a chat message. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Sends a new chat message to the given room. + /// + /// The author and timestamp are automatically set to the current user/guest and time. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [reaction] Reaction to add. + /// * [message] The message to send. + /// * [referenceId] For the message to be able to later identify it again. Defaults to `''`. + /// * [replyTo] Parent id which this message is a reply to. Defaults to `0`. + /// * [silent] If sent silent the chat message will not create any notifications. Defaults to `0`. /// * [apiVersion] Defaults to `v1`. /// * [token] Conversation token. - /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reaction already exists - /// * 201: Reacted successfully - /// * 400: Reacting is not possible - /// * 401: Reacting is not allowed - /// * 404: Reaction not found + /// * 201: Message sent successfully + /// * 400: When the replyTo is invalid or message is empty + /// * 401: Sending message is not allowed + /// * 413: Message too long /// /// See: - /// * [reactRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> react({ - required String reaction, + /// * [$sendMessage_Request] for the request send by this method. + /// * [$sendMessage_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> sendMessage({ + required String message, required String token, - required int messageId, - BotReactApiVersion? apiVersion, + String? referenceId, + int? replyTo, + BotSendMessageSilent? silent, + BotSendMessageApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await reactRaw( - reaction: reaction, + final _request = $sendMessage_Request( + message: message, token: token, - messageId: messageId, + referenceId: referenceId, + replyTo: replyTo, + silent: silent, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $sendMessage_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$react_Request]. + @_i2.experimental + _i1.DynamiteSerializer $react_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BotReactResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 201, 400, 401, 404}, + ); + /// Adds a reaction to a chat message. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [react] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -897,38 +843,22 @@ class $BotClient { /// * 404: Reaction not found /// /// See: - /// * [react] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [react] for a method executing this request and parsing the response. + /// * [$react_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> reactRaw({ + _i3.Request $react_Request({ required String reaction, required String token, required int messageId, BotReactApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $reaction = _$jsonSerializers.serialize(reaction, specifiedType: const FullType(String)); _parameters['reaction'] = $reaction; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -942,76 +872,91 @@ class $BotClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}/reaction/{messageId}{?reaction*}') + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}/reaction/{messageId}{?reaction*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $react_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$deleteReaction_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteReaction_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(BotDeleteReactionResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400, 404, 401}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } - /// Deletes a reaction from a chat message. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Adds a reaction to a chat message. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [reaction] Reaction to delete. + /// * [reaction] Reaction to add. /// * [apiVersion] Defaults to `v1`. /// * [token] Conversation token. /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reaction deleted successfully + /// * 200: Reaction already exists + /// * 201: Reacted successfully /// * 400: Reacting is not possible - /// * 404: Reaction not found /// * 401: Reacting is not allowed + /// * 404: Reaction not found /// /// See: - /// * [deleteReactionRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteReaction({ + /// * [$react_Request] for the request send by this method. + /// * [$react_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> react({ required String reaction, required String token, required int messageId, - BotDeleteReactionApiVersion? apiVersion, + BotReactApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteReactionRaw( + final _request = $react_Request( reaction: reaction, token: token, messageId: messageId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $react_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteReaction_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteReaction_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(BotDeleteReactionResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400, 404, 401}, + ); + /// Deletes a reaction from a chat message. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteReaction] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1028,38 +973,22 @@ class $BotClient { /// * 401: Reacting is not allowed /// /// See: - /// * [deleteReaction] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteReaction] for a method executing this request and parsing the response. + /// * [$deleteReaction_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteReactionRaw({ + _i3.Request $deleteReaction_Request({ required String reaction, required String token, required int messageId, BotDeleteReactionApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $reaction = _$jsonSerializers.serialize(reaction, specifiedType: const FullType(String)); _parameters['reaction'] = $reaction; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -1074,66 +1003,89 @@ class $BotClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}/reaction/{messageId}{?reaction*}') + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}/reaction/{messageId}{?reaction*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $deleteReaction_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$listBots_Request`. - @_i2.experimental - _i1.DynamiteSerializer $listBots_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BotListBotsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } - /// List bots. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Deletes a reaction from a chat message. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [reaction] Reaction to delete. /// * [apiVersion] Defaults to `v1`. - /// * [token] + /// * [token] Conversation token. + /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Bot list returned + /// * 200: Reaction deleted successfully + /// * 400: Reacting is not possible + /// * 404: Reaction not found + /// * 401: Reacting is not allowed /// /// See: - /// * [listBotsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> listBots({ + /// * [$deleteReaction_Request] for the request send by this method. + /// * [$deleteReaction_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteReaction({ + required String reaction, required String token, - BotListBotsApiVersion? apiVersion, + required int messageId, + BotDeleteReactionApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await listBotsRaw( + final _request = $deleteReaction_Request( + reaction: reaction, token: token, + messageId: messageId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteReaction_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$listBots_Request]. + @_i2.experimental + _i1.DynamiteSerializer $listBots_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BotListBotsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// List bots. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [listBots] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1145,16 +1097,31 @@ class $BotClient { /// * 200: Bot list returned /// /// See: - /// * [listBots] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [listBots] for a method executing this request and parsing the response. + /// * [$listBots_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> listBotsRaw({ + _i3.Request $listBots_Request({ required String token, BotListBotsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BotListBotsApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1164,7 +1131,7 @@ class $BotClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1172,43 +1139,14 @@ class $BotClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BotListBotsApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $listBots_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$enableBot_Request`. - @_i2.experimental - _i1.DynamiteSerializer $enableBot_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BotEnableBotResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 201}, - ); - - /// Enables a bot. + /// List bots. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -1216,37 +1154,44 @@ class $BotClient { /// Parameters: /// * [apiVersion] Defaults to `v1`. /// * [token] - /// * [botId] ID of the bot. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Bot already enabled - /// * 201: Bot enabled successfully - /// * 400: Enabling bot errored + /// * 200: Bot list returned /// /// See: - /// * [enableBotRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> enableBot({ + /// * [$listBots_Request] for the request send by this method. + /// * [$listBots_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> listBots({ required String token, - required int botId, - BotEnableBotApiVersion? apiVersion, + BotListBotsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await enableBotRaw( + final _request = $listBots_Request( token: token, - botId: botId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $listBots_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$enableBot_Request]. + @_i2.experimental + _i1.DynamiteSerializer $enableBot_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BotEnableBotResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 201}, + ); + /// Enables a bot. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [enableBot] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1261,17 +1206,35 @@ class $BotClient { /// * 400: Enabling bot errored /// /// See: - /// * [enableBot] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [enableBot] for a method executing this request and parsing the response. + /// * [$enableBot_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> enableBotRaw({ + _i3.Request $enableBot_Request({ required String token, required int botId, BotEnableBotApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $botId = _$jsonSerializers.serialize(botId, specifiedType: const FullType(int)); + _parameters['botId'] = $botId; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BotEnableBotApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}/{botId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1281,7 +1244,7 @@ class $BotClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1289,46 +1252,14 @@ class $BotClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $botId = _$jsonSerializers.serialize(botId, specifiedType: const FullType(int)); - _parameters['botId'] = $botId; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BotEnableBotApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}/{botId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $enableBot_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$disableBot_Request`. - @_i2.experimental - _i1.DynamiteSerializer $disableBot_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BotDisableBotResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Disables a bot. + /// Enables a bot. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -1340,32 +1271,45 @@ class $BotClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Bot disabled successfully - /// * 400: Disabling bot errored + /// * 200: Bot already enabled + /// * 201: Bot enabled successfully + /// * 400: Enabling bot errored /// /// See: - /// * [disableBotRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> disableBot({ + /// * [$enableBot_Request] for the request send by this method. + /// * [$enableBot_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> enableBot({ required String token, required int botId, - BotDisableBotApiVersion? apiVersion, + BotEnableBotApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await disableBotRaw( + final _request = $enableBot_Request( token: token, botId: botId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $enableBot_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$disableBot_Request]. + @_i2.experimental + _i1.DynamiteSerializer $disableBot_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BotDisableBotResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Disables a bot. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [disableBot] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1379,17 +1323,35 @@ class $BotClient { /// * 400: Disabling bot errored /// /// See: - /// * [disableBot] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [disableBot] for a method executing this request and parsing the response. + /// * [$disableBot_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> disableBotRaw({ + _i3.Request $disableBot_Request({ required String token, required int botId, BotDisableBotApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $botId = _$jsonSerializers.serialize(botId, specifiedType: const FullType(int)); + _parameters['botId'] = $botId; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BotDisableBotApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}/{botId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1399,7 +1361,7 @@ class $BotClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1407,81 +1369,66 @@ class $BotClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $botId = _$jsonSerializers.serialize(botId, specifiedType: const FullType(int)); - _parameters['botId'] = $botId; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BotDisableBotApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/{token}/{botId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $disableBot_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$adminListBots_Request`. - @_i2.experimental - _i1.DynamiteSerializer $adminListBots_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(BotAdminListBotsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// List admin bots. - /// - /// This endpoint requires admin access. + /// Disables a bot. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [apiVersion] Defaults to `v1`. + /// * [token] + /// * [botId] ID of the bot. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Bot list returned + /// * 200: Bot disabled successfully + /// * 400: Disabling bot errored /// /// See: - /// * [adminListBotsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> adminListBots({ - BotAdminListBotsApiVersion? apiVersion, + /// * [$disableBot_Request] for the request send by this method. + /// * [$disableBot_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> disableBot({ + required String token, + required int botId, + BotDisableBotApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await adminListBotsRaw( + final _request = $disableBot_Request( + token: token, + botId: botId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $disableBot_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$adminListBots_Request]. + @_i2.experimental + _i1.DynamiteSerializer $adminListBots_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(BotAdminListBotsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// List admin bots. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [adminListBots] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1492,15 +1439,23 @@ class $BotClient { /// * 200: Bot list returned /// /// See: - /// * [adminListBots] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [adminListBots] for a method executing this request and parsing the response. + /// * [$adminListBots_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> adminListBotsRaw({ + _i3.Request $adminListBots_Request({ BotAdminListBotsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BotAdminListBotsApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/admin').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1510,7 +1465,7 @@ class $BotClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1518,87 +1473,66 @@ class $BotClient { } // coverage:ignore-end - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BotAdminListBotsApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bot/admin').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $adminListBots_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $BreakoutRoomClient { - /// Creates a new `DynamiteClient` for breakout_room requests. - $BreakoutRoomClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$configureBreakoutRooms_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $configureBreakoutRooms_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BreakoutRoomConfigureBreakoutRoomsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Configure the breakout rooms. + /// List admin bots. + /// + /// This endpoint requires admin access. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [mode] Mode of the breakout rooms. - /// * [amount] Number of breakout rooms - Constants {@see BreakoutRoom::MINIMUM_ROOM_AMOUNT} and {@see BreakoutRoom::MAXIMUM_ROOM_AMOUNT}. - /// * [attendeeMap] Mapping of the attendees to breakout rooms. Defaults to `[]`. /// * [apiVersion] Defaults to `v1`. - /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Breakout rooms configured successfully - /// * 400: Configuring breakout rooms errored + /// * 200: Bot list returned /// /// See: - /// * [configureBreakoutRoomsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> configureBreakoutRooms({ - required BreakoutRoomConfigureBreakoutRoomsMode mode, - required int amount, - required String token, - String? attendeeMap, - BreakoutRoomConfigureBreakoutRoomsApiVersion? apiVersion, + /// * [$adminListBots_Request] for the request send by this method. + /// * [$adminListBots_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> adminListBots({ + BotAdminListBotsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await configureBreakoutRoomsRaw( - mode: mode, - amount: amount, - token: token, - attendeeMap: attendeeMap, + final _request = $adminListBots_Request( apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $adminListBots_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} + +class $BreakoutRoomClient { + /// Creates a new `DynamiteClient` for breakout_room requests. + $BreakoutRoomClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$configureBreakoutRooms_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $configureBreakoutRooms_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BreakoutRoomConfigureBreakoutRoomsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); /// Configure the breakout rooms. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [configureBreakoutRooms] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1614,37 +1548,18 @@ class $BreakoutRoomClient { /// * 400: Configuring breakout rooms errored /// /// See: - /// * [configureBreakoutRooms] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [configureBreakoutRooms] for a method executing this request and parsing the response. + /// * [$configureBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - configureBreakoutRoomsRaw({ + _i3.Request $configureBreakoutRooms_Request({ required BreakoutRoomConfigureBreakoutRoomsMode mode, required int amount, required String token, String? attendeeMap, BreakoutRoomConfigureBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $mode = _$jsonSerializers.serialize(mode, specifiedType: const FullType(BreakoutRoomConfigureBreakoutRoomsMode)); _parameters['mode'] = $mode; @@ -1653,7 +1568,7 @@ class $BreakoutRoomClient { _parameters['amount'] = $amount; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -1671,68 +1586,94 @@ class $BreakoutRoomClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}{?mode*,amount*,attendeeMap*}') + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}{?mode*,amount*,attendeeMap*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $configureBreakoutRooms_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); - } + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Builds a serializer to parse the response of `$removeBreakoutRooms_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $removeBreakoutRooms_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BreakoutRoomRemoveBreakoutRoomsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - /// Remove the breakout rooms. + return _request; + } + + /// Configure the breakout rooms. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [mode] Mode of the breakout rooms. + /// * [amount] Number of breakout rooms - Constants {@see BreakoutRoom::MINIMUM_ROOM_AMOUNT} and {@see BreakoutRoom::MAXIMUM_ROOM_AMOUNT}. + /// * [attendeeMap] Mapping of the attendees to breakout rooms. Defaults to `[]`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Breakout rooms removed successfully + /// * 200: Breakout rooms configured successfully + /// * 400: Configuring breakout rooms errored /// /// See: - /// * [removeBreakoutRoomsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> removeBreakoutRooms({ + /// * [$configureBreakoutRooms_Request] for the request send by this method. + /// * [$configureBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> configureBreakoutRooms({ + required BreakoutRoomConfigureBreakoutRoomsMode mode, + required int amount, required String token, - BreakoutRoomRemoveBreakoutRoomsApiVersion? apiVersion, + String? attendeeMap, + BreakoutRoomConfigureBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await removeBreakoutRoomsRaw( + final _request = $configureBreakoutRooms_Request( + mode: mode, + amount: amount, token: token, + attendeeMap: attendeeMap, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $configureBreakoutRooms_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$removeBreakoutRooms_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $removeBreakoutRooms_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BreakoutRoomRemoveBreakoutRoomsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Remove the breakout rooms. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [removeBreakoutRooms] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1744,16 +1685,35 @@ class $BreakoutRoomClient { /// * 200: Breakout rooms removed successfully /// /// See: - /// * [removeBreakoutRooms] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [removeBreakoutRooms] for a method executing this request and parsing the response. + /// * [$removeBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> removeBreakoutRoomsRaw({ + _i3.Request $removeBreakoutRooms_Request({ required String token, BreakoutRoomRemoveBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(BreakoutRoomRemoveBreakoutRoomsApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -1763,7 +1723,7 @@ class $BreakoutRoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -1771,87 +1731,61 @@ class $BreakoutRoomClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(BreakoutRoomRemoveBreakoutRoomsApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $removeBreakoutRooms_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$broadcastChatMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $broadcastChatMessage_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BreakoutRoomBroadcastChatMessageResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {201}, - ); - - /// Broadcast a chat message to all breakout rooms. + /// Remove the breakout rooms. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [message] Message to broadcast. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 201: Chat message broadcasted successfully - /// * 400: Broadcasting chat message is not possible - /// * 413: Chat message too long + /// * 200: Breakout rooms removed successfully /// /// See: - /// * [broadcastChatMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> broadcastChatMessage({ - required String message, + /// * [$removeBreakoutRooms_Request] for the request send by this method. + /// * [$removeBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> removeBreakoutRooms({ required String token, - BreakoutRoomBroadcastChatMessageApiVersion? apiVersion, + BreakoutRoomRemoveBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await broadcastChatMessageRaw( - message: message, + final _request = $removeBreakoutRooms_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $removeBreakoutRooms_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$broadcastChatMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $broadcastChatMessage_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BreakoutRoomBroadcastChatMessageResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {201}, + ); + /// Broadcast a chat message to all breakout rooms. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [broadcastChatMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1866,40 +1800,21 @@ class $BreakoutRoomClient { /// * 413: Chat message too long /// /// See: - /// * [broadcastChatMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [broadcastChatMessage] for a method executing this request and parsing the response. + /// * [$broadcastChatMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - broadcastChatMessageRaw({ + _i3.Request $broadcastChatMessage_Request({ required String message, required String token, BreakoutRoomBroadcastChatMessageApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $message = _$jsonSerializers.serialize(message, specifiedType: const FullType(String)); - _parameters['message'] = $message; + }) { + final _parameters = {}; + final $message = _$jsonSerializers.serialize(message, specifiedType: const FullType(String)); + _parameters['message'] = $message; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -1913,72 +1828,89 @@ class $BreakoutRoomClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/broadcast{?message*}') + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/broadcast{?message*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $broadcastChatMessage_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); - } - - /// Builds a serializer to parse the response of `$applyAttendeeMap_Request`. - @_i2.experimental - _i1.DynamiteSerializer $applyAttendeeMap_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(BreakoutRoomApplyAttendeeMapResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Apply an attendee map to the breakout rooms. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Broadcast a chat message to all breakout rooms. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [attendeeMap] JSON encoded mapping of the attendees to breakout rooms `array`. + /// * [message] Message to broadcast. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Attendee map applied successfully - /// * 400: Applying attendee map is not possible + /// * 201: Chat message broadcasted successfully + /// * 400: Broadcasting chat message is not possible + /// * 413: Chat message too long /// /// See: - /// * [applyAttendeeMapRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> applyAttendeeMap({ - required String attendeeMap, + /// * [$broadcastChatMessage_Request] for the request send by this method. + /// * [$broadcastChatMessage_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> broadcastChatMessage({ + required String message, required String token, - BreakoutRoomApplyAttendeeMapApiVersion? apiVersion, + BreakoutRoomBroadcastChatMessageApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await applyAttendeeMapRaw( - attendeeMap: attendeeMap, + final _request = $broadcastChatMessage_Request( + message: message, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $broadcastChatMessage_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$applyAttendeeMap_Request]. + @_i2.experimental + _i1.DynamiteSerializer $applyAttendeeMap_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(BreakoutRoomApplyAttendeeMapResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Apply an attendee map to the breakout rooms. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [applyAttendeeMap] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -1992,17 +1924,38 @@ class $BreakoutRoomClient { /// * 400: Applying attendee map is not possible /// /// See: - /// * [applyAttendeeMap] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [applyAttendeeMap] for a method executing this request and parsing the response. + /// * [$applyAttendeeMap_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> applyAttendeeMapRaw({ + _i3.Request $applyAttendeeMap_Request({ required String attendeeMap, required String token, BreakoutRoomApplyAttendeeMapApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $attendeeMap = _$jsonSerializers.serialize(attendeeMap, specifiedType: const FullType(String)); + _parameters['attendeeMap'] = $attendeeMap; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BreakoutRoomApplyAttendeeMapApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/attendees{?attendeeMap*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2012,7 +1965,7 @@ class $BreakoutRoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2020,85 +1973,65 @@ class $BreakoutRoomClient { } // coverage:ignore-end - final $attendeeMap = _$jsonSerializers.serialize(attendeeMap, specifiedType: const FullType(String)); - _parameters['attendeeMap'] = $attendeeMap; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BreakoutRoomApplyAttendeeMapApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/attendees{?attendeeMap*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $applyAttendeeMap_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$requestAssistance_Request`. - @_i2.experimental - _i1.DynamiteSerializer $requestAssistance_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(BreakoutRoomRequestAssistanceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Request assistance. + /// Apply an attendee map to the breakout rooms. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [attendeeMap] JSON encoded mapping of the attendees to breakout rooms `array`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Assistance requested successfully - /// * 400: Requesting assistance is not possible + /// * 200: Attendee map applied successfully + /// * 400: Applying attendee map is not possible /// /// See: - /// * [requestAssistanceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> requestAssistance({ + /// * [$applyAttendeeMap_Request] for the request send by this method. + /// * [$applyAttendeeMap_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> applyAttendeeMap({ + required String attendeeMap, required String token, - BreakoutRoomRequestAssistanceApiVersion? apiVersion, + BreakoutRoomApplyAttendeeMapApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await requestAssistanceRaw( + final _request = $applyAttendeeMap_Request( + attendeeMap: attendeeMap, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $applyAttendeeMap_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$requestAssistance_Request]. + @_i2.experimental + _i1.DynamiteSerializer $requestAssistance_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(BreakoutRoomRequestAssistanceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Request assistance. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [requestAssistance] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2111,16 +2044,33 @@ class $BreakoutRoomClient { /// * 400: Requesting assistance is not possible /// /// See: - /// * [requestAssistance] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [requestAssistance] for a method executing this request and parsing the response. + /// * [$requestAssistance_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> requestAssistanceRaw({ + _i3.Request $requestAssistance_Request({ required String token, BreakoutRoomRequestAssistanceApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BreakoutRoomRequestAssistanceApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/request-assistance') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2130,7 +2080,7 @@ class $BreakoutRoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2138,47 +2088,14 @@ class $BreakoutRoomClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BreakoutRoomRequestAssistanceApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/request-assistance') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $requestAssistance_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$resetRequestForAssistance_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $resetRequestForAssistance_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BreakoutRoomResetRequestForAssistanceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Reset the request for assistance. + /// Request assistance. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -2189,31 +2106,44 @@ class $BreakoutRoomClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Request for assistance reset successfully - /// * 400: Resetting the request for assistance is not possible + /// * 200: Assistance requested successfully + /// * 400: Requesting assistance is not possible /// /// See: - /// * [resetRequestForAssistanceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - resetRequestForAssistance({ + /// * [$requestAssistance_Request] for the request send by this method. + /// * [$requestAssistance_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> requestAssistance({ required String token, - BreakoutRoomResetRequestForAssistanceApiVersion? apiVersion, + BreakoutRoomRequestAssistanceApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await resetRequestForAssistanceRaw( + final _request = $requestAssistance_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $requestAssistance_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$resetRequestForAssistance_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $resetRequestForAssistance_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BreakoutRoomResetRequestForAssistanceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Reset the request for assistance. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [resetRequestForAssistance] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2226,17 +2156,35 @@ class $BreakoutRoomClient { /// * 400: Resetting the request for assistance is not possible /// /// See: - /// * [resetRequestForAssistance] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [resetRequestForAssistance] for a method executing this request and parsing the response. + /// * [$resetRequestForAssistance_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - resetRequestForAssistanceRaw({ + _i3.Request $resetRequestForAssistance_Request({ required String token, BreakoutRoomResetRequestForAssistanceApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(BreakoutRoomResetRequestForAssistanceApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/request-assistance') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2246,7 +2194,7 @@ class $BreakoutRoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2254,49 +2202,14 @@ class $BreakoutRoomClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(BreakoutRoomResetRequestForAssistanceApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/request-assistance') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $resetRequestForAssistance_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$startBreakoutRooms_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $startBreakoutRooms_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BreakoutRoomStartBreakoutRoomsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Start the breakout rooms. + /// Reset the request for assistance. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -2307,30 +2220,45 @@ class $BreakoutRoomClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Breakout rooms started successfully - /// * 400: Starting breakout rooms is not possible + /// * 200: Request for assistance reset successfully + /// * 400: Resetting the request for assistance is not possible /// /// See: - /// * [startBreakoutRoomsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> startBreakoutRooms({ + /// * [$resetRequestForAssistance_Request] for the request send by this method. + /// * [$resetRequestForAssistance_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + resetRequestForAssistance({ required String token, - BreakoutRoomStartBreakoutRoomsApiVersion? apiVersion, + BreakoutRoomResetRequestForAssistanceApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await startBreakoutRoomsRaw( + final _request = $resetRequestForAssistance_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $resetRequestForAssistance_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$startBreakoutRooms_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $startBreakoutRooms_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BreakoutRoomStartBreakoutRoomsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Start the breakout rooms. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [startBreakoutRooms] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2343,16 +2271,35 @@ class $BreakoutRoomClient { /// * 400: Starting breakout rooms is not possible /// /// See: - /// * [startBreakoutRooms] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [startBreakoutRooms] for a method executing this request and parsing the response. + /// * [$startBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> startBreakoutRoomsRaw({ + _i3.Request $startBreakoutRooms_Request({ required String token, BreakoutRoomStartBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(BreakoutRoomStartBreakoutRoomsApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/rooms').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2362,7 +2309,7 @@ class $BreakoutRoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2370,49 +2317,14 @@ class $BreakoutRoomClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(BreakoutRoomStartBreakoutRoomsApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/rooms').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $startBreakoutRooms_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$stopBreakoutRooms_Request`. - @_i2.experimental - _i1.DynamiteSerializer $stopBreakoutRooms_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(BreakoutRoomStopBreakoutRoomsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Stop the breakout rooms. + /// Start the breakout rooms. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -2423,30 +2335,44 @@ class $BreakoutRoomClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Breakout rooms stopped successfully - /// * 400: Stopping breakout rooms is not possible + /// * 200: Breakout rooms started successfully + /// * 400: Starting breakout rooms is not possible /// /// See: - /// * [stopBreakoutRoomsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> stopBreakoutRooms({ + /// * [$startBreakoutRooms_Request] for the request send by this method. + /// * [$startBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> startBreakoutRooms({ required String token, - BreakoutRoomStopBreakoutRoomsApiVersion? apiVersion, + BreakoutRoomStartBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await stopBreakoutRoomsRaw( + final _request = $startBreakoutRooms_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $startBreakoutRooms_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$stopBreakoutRooms_Request]. + @_i2.experimental + _i1.DynamiteSerializer $stopBreakoutRooms_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(BreakoutRoomStopBreakoutRoomsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Stop the breakout rooms. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [stopBreakoutRooms] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2459,16 +2385,33 @@ class $BreakoutRoomClient { /// * 400: Stopping breakout rooms is not possible /// /// See: - /// * [stopBreakoutRooms] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [stopBreakoutRooms] for a method executing this request and parsing the response. + /// * [$stopBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> stopBreakoutRoomsRaw({ + _i3.Request $stopBreakoutRooms_Request({ required String token, BreakoutRoomStopBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BreakoutRoomStopBreakoutRoomsApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/rooms').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2478,7 +2421,7 @@ class $BreakoutRoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -2486,84 +2429,62 @@ class $BreakoutRoomClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(BreakoutRoomStopBreakoutRoomsApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/rooms').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $stopBreakoutRooms_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$switchBreakoutRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $switchBreakoutRoom_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(BreakoutRoomSwitchBreakoutRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Switch to another breakout room. + /// Stop the breakout rooms. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [target] Target breakout room. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Switched to breakout room successfully - /// * 400: Switching to breakout room is not possible + /// * 200: Breakout rooms stopped successfully + /// * 400: Stopping breakout rooms is not possible /// /// See: - /// * [switchBreakoutRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> switchBreakoutRoom({ - required String target, + /// * [$stopBreakoutRooms_Request] for the request send by this method. + /// * [$stopBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> stopBreakoutRooms({ required String token, - BreakoutRoomSwitchBreakoutRoomApiVersion? apiVersion, + BreakoutRoomStopBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await switchBreakoutRoomRaw( - target: target, + final _request = $stopBreakoutRooms_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $stopBreakoutRooms_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$switchBreakoutRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $switchBreakoutRoom_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(BreakoutRoomSwitchBreakoutRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Switch to another breakout room. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [switchBreakoutRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2577,39 +2498,21 @@ class $BreakoutRoomClient { /// * 400: Switching to breakout room is not possible /// /// See: - /// * [switchBreakoutRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [switchBreakoutRoom] for a method executing this request and parsing the response. + /// * [$switchBreakoutRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> switchBreakoutRoomRaw({ + _i3.Request $switchBreakoutRoom_Request({ required String target, required String token, BreakoutRoomSwitchBreakoutRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $target = _$jsonSerializers.serialize(target, specifiedType: const FullType(String)); _parameters['target'] = $target; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -2623,74 +2526,94 @@ class $BreakoutRoomClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/switch{?target*}') + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/breakout-rooms/{token}/switch{?target*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $switchBreakoutRoom_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); - } -} - -class $CallClient { - /// Creates a new `DynamiteClient` for call requests. - $CallClient(this._rootClient); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - final $Client _rootClient; +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - /// Builds a serializer to parse the response of `$getPeersForCall_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getPeersForCall_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(CallGetPeersForCallResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); + return _request; + } - /// Get the peers for a call. + /// Switch to another breakout room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [apiVersion] Defaults to `v4`. + /// * [target] Target breakout room. + /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: List of peers in the call returned + /// * 200: Switched to breakout room successfully + /// * 400: Switching to breakout room is not possible /// /// See: - /// * [getPeersForCallRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getPeersForCall({ + /// * [$switchBreakoutRoom_Request] for the request send by this method. + /// * [$switchBreakoutRoom_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> switchBreakoutRoom({ + required String target, required String token, - CallGetPeersForCallApiVersion? apiVersion, + BreakoutRoomSwitchBreakoutRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getPeersForCallRaw( + final _request = $switchBreakoutRoom_Request( + target: target, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $switchBreakoutRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} + +class $CallClient { + /// Creates a new `DynamiteClient` for call requests. + $CallClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$getPeersForCall_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getPeersForCall_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(CallGetPeersForCallResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); /// Get the peers for a call. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getPeersForCall] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2702,16 +2625,32 @@ class $CallClient { /// * 200: List of peers in the call returned /// /// See: - /// * [getPeersForCall] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getPeersForCall] for a method executing this request and parsing the response. + /// * [$getPeersForCall_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getPeersForCallRaw({ + _i3.Request $getPeersForCall_Request({ required String token, CallGetPeersForCallApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(CallGetPeersForCallApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -2721,89 +2660,66 @@ class $CallClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(CallGetPeersForCallApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + return _request; + } - final _serializer = $getPeersForCall_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$updateCallFlags_Request`. - @_i2.experimental - _i1.DynamiteSerializer $updateCallFlags_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(CallUpdateCallFlagsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400, 404}, - ); - - /// Update the in-call flags. + /// Get the peers for a call. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [flags] New flags. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: In-call flags updated successfully - /// * 400: Updating in-call flags is not possible - /// * 404: Call session not found + /// * 200: List of peers in the call returned /// /// See: - /// * [updateCallFlagsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> updateCallFlags({ - required int flags, + /// * [$getPeersForCall_Request] for the request send by this method. + /// * [$getPeersForCall_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getPeersForCall({ required String token, - CallUpdateCallFlagsApiVersion? apiVersion, + CallGetPeersForCallApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await updateCallFlagsRaw( - flags: flags, + final _request = $getPeersForCall_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getPeersForCall_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$updateCallFlags_Request]. + @_i2.experimental + _i1.DynamiteSerializer $updateCallFlags_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(CallUpdateCallFlagsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400, 404}, + ); + /// Update the in-call flags. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [updateCallFlags] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2818,37 +2734,21 @@ class $CallClient { /// * 404: Call session not found /// /// See: - /// * [updateCallFlags] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [updateCallFlags] for a method executing this request and parsing the response. + /// * [$updateCallFlags_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> updateCallFlagsRaw({ + _i3.Request $updateCallFlags_Request({ required int flags, required String token, CallUpdateCallFlagsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $flags = _$jsonSerializers.serialize(flags, specifiedType: const FullType(int)); _parameters['flags'] = $flags; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -2860,78 +2760,83 @@ class $CallClient { $apiVersion ??= 'v4'; _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}{?flags*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}{?flags*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $updateCallFlags_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$joinCall_Request`. - @_i2.experimental - _i1.DynamiteSerializer $joinCall_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(CallJoinCallResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 404}, - ); - - /// Join a call. + /// Update the in-call flags. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [flags] In-Call flags. - /// * [forcePermissions] In-call permissions. - /// * [silent] Join the call silently. Defaults to `0`. - /// * [recordingConsent] When the user ticked a checkbox and agreed with being recorded (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES} or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL} and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} ). Defaults to `0`. + /// * [flags] New flags. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Call joined successfully - /// * 404: Call not found - /// * 400: No recording consent was given + /// * 200: In-call flags updated successfully + /// * 400: Updating in-call flags is not possible + /// * 404: Call session not found /// /// See: - /// * [joinCallRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> joinCall({ + /// * [$updateCallFlags_Request] for the request send by this method. + /// * [$updateCallFlags_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> updateCallFlags({ + required int flags, required String token, - CallJoinCallFlags? flags, - CallJoinCallForcePermissions? forcePermissions, - CallJoinCallSilent? silent, - CallJoinCallRecordingConsent? recordingConsent, - CallJoinCallApiVersion? apiVersion, + CallUpdateCallFlagsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await joinCallRaw( - token: token, + final _request = $updateCallFlags_Request( flags: flags, - forcePermissions: forcePermissions, - silent: silent, - recordingConsent: recordingConsent, + token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $updateCallFlags_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$joinCall_Request]. + @_i2.experimental + _i1.DynamiteSerializer $joinCall_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(CallJoinCallResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 404}, + ); + /// Join a call. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [joinCall] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -2949,9 +2854,10 @@ class $CallClient { /// * 400: No recording consent was given /// /// See: - /// * [joinCall] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [joinCall] for a method executing this request and parsing the response. + /// * [$joinCall_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> joinCallRaw({ + _i3.Request $joinCall_Request({ required String token, CallJoinCallFlags? flags, CallJoinCallForcePermissions? forcePermissions, @@ -2959,27 +2865,10 @@ class $CallClient { CallJoinCallRecordingConsent? recordingConsent, CallJoinCallApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -3006,70 +2895,94 @@ class $CallClient { $apiVersion ??= 'v4'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}{?flags*,forcePermissions*,silent*,recordingConsent*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $joinCall_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$leaveCall_Request`. - @_i2.experimental - _i1.DynamiteSerializer $leaveCall_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(CallLeaveCallResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 404}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } - /// Leave a call. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Join a call. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [all] whether to also terminate the call for all participants. Defaults to `0`. + /// * [flags] In-Call flags. + /// * [forcePermissions] In-call permissions. + /// * [silent] Join the call silently. Defaults to `0`. + /// * [recordingConsent] When the user ticked a checkbox and agreed with being recorded (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES} or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL} and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} ). Defaults to `0`. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Call left successfully - /// * 404: Call session not found + /// * 200: Call joined successfully + /// * 404: Call not found + /// * 400: No recording consent was given /// /// See: - /// * [leaveCallRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> leaveCall({ + /// * [$joinCall_Request] for the request send by this method. + /// * [$joinCall_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> joinCall({ required String token, - CallLeaveCallAll? all, - CallLeaveCallApiVersion? apiVersion, + CallJoinCallFlags? flags, + CallJoinCallForcePermissions? forcePermissions, + CallJoinCallSilent? silent, + CallJoinCallRecordingConsent? recordingConsent, + CallJoinCallApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await leaveCallRaw( + final _request = $joinCall_Request( token: token, - all: all, + flags: flags, + forcePermissions: forcePermissions, + silent: silent, + recordingConsent: recordingConsent, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $joinCall_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$leaveCall_Request]. + @_i2.experimental + _i1.DynamiteSerializer $leaveCall_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(CallLeaveCallResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 404}, + ); + /// Leave a call. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [leaveCall] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3083,34 +2996,18 @@ class $CallClient { /// * 404: Call session not found /// /// See: - /// * [leaveCall] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [leaveCall] for a method executing this request and parsing the response. + /// * [$leaveCall_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> leaveCallRaw({ + _i3.Request $leaveCall_Request({ required String token, CallLeaveCallAll? all, CallLeaveCallApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -3125,70 +3022,83 @@ class $CallClient { $apiVersion ??= 'v4'; _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}{?all*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}{?all*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $leaveCall_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$ringAttendee_Request`. - @_i2.experimental - _i1.DynamiteSerializer $ringAttendee_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(CallRingAttendeeResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400, 404}, - ); - - /// Ring an attendee. + /// Leave a call. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [all] whether to also terminate the call for all participants. Defaults to `0`. /// * [apiVersion] Defaults to `v4`. /// * [token] - /// * [attendeeId] ID of the attendee to ring. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Attendee rang successfully - /// * 400: Ringing attendee is not possible - /// * 404: Attendee could not be found + /// * 200: Call left successfully + /// * 404: Call session not found /// /// See: - /// * [ringAttendeeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> ringAttendee({ + /// * [$leaveCall_Request] for the request send by this method. + /// * [$leaveCall_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> leaveCall({ required String token, - required int attendeeId, - CallRingAttendeeApiVersion? apiVersion, + CallLeaveCallAll? all, + CallLeaveCallApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await ringAttendeeRaw( + final _request = $leaveCall_Request( token: token, - attendeeId: attendeeId, + all: all, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $leaveCall_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$ringAttendee_Request]. + @_i2.experimental + _i1.DynamiteSerializer $ringAttendee_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(CallRingAttendeeResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400, 404}, + ); + /// Ring an attendee. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [ringAttendee] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3203,34 +3113,18 @@ class $CallClient { /// * 404: Attendee could not be found /// /// See: - /// * [ringAttendee] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [ringAttendee] for a method executing this request and parsing the response. + /// * [$ringAttendee_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> ringAttendeeRaw({ + _i3.Request $ringAttendee_Request({ required String token, required int attendeeId, CallRingAttendeeApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -3245,33 +3139,34 @@ class $CallClient { $apiVersion ??= 'v4'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}/ring/{attendeeId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}/ring/{attendeeId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $ringAttendee_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$sipDialOut_Request`. - @_i2.experimental - _i1.DynamiteSerializer $sipDialOut_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(CallSipDialOutResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {201, 400, 404, 501}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } - /// Call a SIP dial-out attendee. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Ring an attendee. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -3279,38 +3174,50 @@ class $CallClient { /// Parameters: /// * [apiVersion] Defaults to `v4`. /// * [token] - /// * [attendeeId] ID of the attendee to call. + /// * [attendeeId] ID of the attendee to ring. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 201: Dial-out initiated successfully - /// * 400: SIP dial-out not possible - /// * 404: Participant could not be found or is a wrong type - /// * 501: SIP dial-out is not configured on the server + /// * 200: Attendee rang successfully + /// * 400: Ringing attendee is not possible + /// * 404: Attendee could not be found /// /// See: - /// * [sipDialOutRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> sipDialOut({ + /// * [$ringAttendee_Request] for the request send by this method. + /// * [$ringAttendee_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> ringAttendee({ required String token, required int attendeeId, - CallSipDialOutApiVersion? apiVersion, + CallRingAttendeeApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await sipDialOutRaw( + final _request = $ringAttendee_Request( token: token, attendeeId: attendeeId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $ringAttendee_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$sipDialOut_Request]. + @_i2.experimental + _i1.DynamiteSerializer $sipDialOut_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(CallSipDialOutResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {201, 400, 404, 501}, + ); + /// Call a SIP dial-out attendee. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [sipDialOut] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3326,17 +3233,36 @@ class $CallClient { /// * 501: SIP dial-out is not configured on the server /// /// See: - /// * [sipDialOut] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [sipDialOut] for a method executing this request and parsing the response. + /// * [$sipDialOut_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> sipDialOutRaw({ + _i3.Request $sipDialOut_Request({ required String token, required int attendeeId, CallSipDialOutApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); + _parameters['attendeeId'] = $attendeeId; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(CallSipDialOutApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}/dialout/{attendeeId}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3346,41 +3272,57 @@ class $CallClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); - _parameters['attendeeId'] = $attendeeId; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(CallSipDialOutApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/call/{token}/dialout/{attendeeId}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + return _request; + } + + /// Call a SIP dial-out attendee. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [apiVersion] Defaults to `v4`. + /// * [token] + /// * [attendeeId] ID of the attendee to call. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 201: Dial-out initiated successfully + /// * 400: SIP dial-out not possible + /// * 404: Participant could not be found or is a wrong type + /// * 501: SIP dial-out is not configured on the server + /// + /// See: + /// * [$sipDialOut_Request] for the request send by this method. + /// * [$sipDialOut_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> sipDialOut({ + required String token, + required int attendeeId, + CallSipDialOutApiVersion? apiVersion, + bool? oCSAPIRequest, + }) async { + final _request = $sipDialOut_Request( + token: token, + attendeeId: attendeeId, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $sipDialOut_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -3390,7 +3332,7 @@ class $CertificateClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getCertificateExpiration_Request`. + /// Builds a serializer to parse the response of [$getCertificateExpiration_Request]. @_i2.experimental _i1.DynamiteSerializer $getCertificateExpiration_Serializer() => _i1.DynamiteSerializer( @@ -3404,7 +3346,7 @@ class $CertificateClient { /// /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getCertificateExpiration] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3417,29 +3359,59 @@ class $CertificateClient { /// * 400: Getting certificate expiration is not possible /// /// See: - /// * [getCertificateExpirationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - getCertificateExpiration({ + /// * [getCertificateExpiration] for a method executing this request and parsing the response. + /// * [$getCertificateExpiration_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getCertificateExpiration_Request({ required String host, CertificateGetCertificateExpirationApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await getCertificateExpirationRaw( - host: host, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $host = _$jsonSerializers.serialize(host, specifiedType: const FullType(String)); + _parameters['host'] = $host; + + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(CertificateGetCertificateExpirationApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/certificate/expiration{?host*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Get the certificate expiration for a host. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3452,59 +3424,26 @@ class $CertificateClient { /// * 400: Getting certificate expiration is not possible /// /// See: - /// * [getCertificateExpiration] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> - getCertificateExpirationRaw({ + /// * [$getCertificateExpiration_Request] for the request send by this method. + /// * [$getCertificateExpiration_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + getCertificateExpiration({ required String host, CertificateGetCertificateExpirationApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $host = _$jsonSerializers.serialize(host, specifiedType: const FullType(String)); - _parameters['host'] = $host; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(CertificateGetCertificateExpirationApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/certificate/expiration{?host*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getCertificateExpiration_Request( + host: host, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getCertificateExpiration_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -3514,7 +3453,7 @@ class $ChatClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$receiveMessages_Request`. + /// Builds a serializer to parse the response of [$receiveMessages_Request]. @_i2.experimental _i1.DynamiteSerializer $receiveMessages_Serializer() => _i1.DynamiteSerializer( @@ -3530,7 +3469,7 @@ class $ChatClient { /// - Looking into the future ($lookIntoFuture=1): If there are currently no messages the response will not be sent immediately. Instead, HTTP connection will be kept open waiting for new messages to arrive and, when they do, then the response will be sent. The connection will not be kept open indefinitely, though; the number of seconds to wait for new messages to arrive can be set using the timeout parameter; the default timeout is 30 seconds, maximum timeout is 60 seconds. If the timeout ends a successful but empty response will be sent. If messages have been returned (status=200) the new $lastKnownMessageId for the follow up query is available as `X-Chat-Last-Given` header. /// The limit specifies the maximum number of messages that will be returned, although the actual number of returned messages could be lower if some messages are not visible to the participant. Note that if none of the messages are visible to the participant the returned number of messages will be 0, yet the status will still be 200. Also note that `X-Chat-Last-Given` may reference a message not visible and thus not returned, but it should be used nevertheless as the $lastKnownMessageId for the follow-up query. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [receiveMessages] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3552,9 +3491,10 @@ class $ChatClient { /// * 304: No messages /// /// See: - /// * [receiveMessagesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - receiveMessages({ + /// * [receiveMessages] for a method executing this request and parsing the response. + /// * [$receiveMessages_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $receiveMessages_Request({ required ChatReceiveMessagesLookIntoFuture lookIntoFuture, required String token, int? limit, @@ -3567,105 +3507,23 @@ class $ChatClient { ChatReceiveMessagesMarkNotificationsAsRead? markNotificationsAsRead, ChatReceiveMessagesApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await receiveMessagesRaw( - lookIntoFuture: lookIntoFuture, - token: token, - limit: limit, - lastKnownMessageId: lastKnownMessageId, - lastCommonReadId: lastCommonReadId, - timeout: timeout, - setReadMarker: setReadMarker, - includeLastKnown: includeLastKnown, - noStatusUpdate: noStatusUpdate, - markNotificationsAsRead: markNotificationsAsRead, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $lookIntoFuture = + _$jsonSerializers.serialize(lookIntoFuture, specifiedType: const FullType(ChatReceiveMessagesLookIntoFuture)); + _parameters['lookIntoFuture'] = $lookIntoFuture; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', ); + _parameters['token'] = $token; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Receives chat messages from the given room. - /// - /// - Receiving the history ($lookIntoFuture=0): The next $limit messages after $lastKnownMessageId will be returned. The new $lastKnownMessageId for the follow up query is available as `X-Chat-Last-Given` header. - /// - Looking into the future ($lookIntoFuture=1): If there are currently no messages the response will not be sent immediately. Instead, HTTP connection will be kept open waiting for new messages to arrive and, when they do, then the response will be sent. The connection will not be kept open indefinitely, though; the number of seconds to wait for new messages to arrive can be set using the timeout parameter; the default timeout is 30 seconds, maximum timeout is 60 seconds. If the timeout ends a successful but empty response will be sent. If messages have been returned (status=200) the new $lastKnownMessageId for the follow up query is available as `X-Chat-Last-Given` header. - /// The limit specifies the maximum number of messages that will be returned, although the actual number of returned messages could be lower if some messages are not visible to the participant. Note that if none of the messages are visible to the participant the returned number of messages will be 0, yet the status will still be 200. Also note that `X-Chat-Last-Given` may reference a message not visible and thus not returned, but it should be used nevertheless as the $lastKnownMessageId for the follow-up query. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [lookIntoFuture] Polling for new messages (1) or getting the history of the chat (0). - /// * [limit] Number of chat messages to receive (100 by default, 200 at most). Defaults to `100`. - /// * [lastKnownMessageId] The last known message (serves as offset). Defaults to `0`. - /// * [lastCommonReadId] The last known common read message (so the response is 200 instead of 304 when it changes even when there are no messages). Defaults to `0`. - /// * [timeout] Number of seconds to wait for new messages (30 by default, 30 at most). Defaults to `30`. - /// * [setReadMarker] Automatically set the last read marker when 1, if your client does this itself via chat/{token}/read set to 0. Defaults to `1`. - /// * [includeLastKnown] Include the $lastKnownMessageId in the messages when 1 (default 0). Defaults to `0`. - /// * [noStatusUpdate] When the user status should not be automatically set to online set to 1 (default 0). Defaults to `0`. - /// * [markNotificationsAsRead] Set to 0 when notifications should not be marked as read (default 1). Defaults to `1`. - /// * [apiVersion] Defaults to `v1`. - /// * [token] - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Messages returned - /// * 304: No messages - /// - /// See: - /// * [receiveMessages] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> - receiveMessagesRaw({ - required ChatReceiveMessagesLookIntoFuture lookIntoFuture, - required String token, - int? limit, - int? lastKnownMessageId, - int? lastCommonReadId, - int? timeout, - ChatReceiveMessagesSetReadMarker? setReadMarker, - ChatReceiveMessagesIncludeLastKnown? includeLastKnown, - ChatReceiveMessagesNoStatusUpdate? noStatusUpdate, - ChatReceiveMessagesMarkNotificationsAsRead? markNotificationsAsRead, - ChatReceiveMessagesApiVersion? apiVersion, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end - final $lookIntoFuture = - _$jsonSerializers.serialize(lookIntoFuture, specifiedType: const FullType(ChatReceiveMessagesLookIntoFuture)); - _parameters['lookIntoFuture'] = $lookIntoFuture; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - $limit ??= 100; - _parameters['limit'] = $limit; + var $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + $limit ??= 100; + _parameters['limit'] = $limit; var $lastKnownMessageId = _$jsonSerializers.serialize(lastKnownMessageId, specifiedType: const FullType(int)); $lastKnownMessageId ??= 0; @@ -3708,91 +3566,118 @@ class $ChatClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}{?lookIntoFuture*,limit*,lastKnownMessageId*,lastCommonReadId*,timeout*,setReadMarker*,includeLastKnown*,noStatusUpdate*,markNotificationsAsRead*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $receiveMessages_Serializer(); - return _i1.ResponseConverter( - _serializer, - ).convert(_response); - } + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } - /// Builds a serializer to parse the response of `$sendMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $sendMessage_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ChatSendMessageResponseApplicationJson), - headersType: const FullType(ChatChatSendMessageHeaders), - serializers: _$jsonSerializers, - validStatuses: const {201}, - ); +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - /// Sends a new chat message to the given room. + return _request; + } + + /// Receives chat messages from the given room. /// - /// The author and timestamp are automatically set to the current user/guest and time. + /// - Receiving the history ($lookIntoFuture=0): The next $limit messages after $lastKnownMessageId will be returned. The new $lastKnownMessageId for the follow up query is available as `X-Chat-Last-Given` header. + /// - Looking into the future ($lookIntoFuture=1): If there are currently no messages the response will not be sent immediately. Instead, HTTP connection will be kept open waiting for new messages to arrive and, when they do, then the response will be sent. The connection will not be kept open indefinitely, though; the number of seconds to wait for new messages to arrive can be set using the timeout parameter; the default timeout is 30 seconds, maximum timeout is 60 seconds. If the timeout ends a successful but empty response will be sent. If messages have been returned (status=200) the new $lastKnownMessageId for the follow up query is available as `X-Chat-Last-Given` header. + /// The limit specifies the maximum number of messages that will be returned, although the actual number of returned messages could be lower if some messages are not visible to the participant. Note that if none of the messages are visible to the participant the returned number of messages will be 0, yet the status will still be 200. Also note that `X-Chat-Last-Given` may reference a message not visible and thus not returned, but it should be used nevertheless as the $lastKnownMessageId for the follow-up query. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [message] the message to send. - /// * [actorDisplayName] for guests. Defaults to `''`. - /// * [referenceId] for the message to be able to later identify it again. Defaults to `''`. - /// * [replyTo] Parent id which this message is a reply to. Defaults to `0`. - /// * [silent] If sent silent the chat message will not create any notifications. Defaults to `0`. + /// * [lookIntoFuture] Polling for new messages (1) or getting the history of the chat (0). + /// * [limit] Number of chat messages to receive (100 by default, 200 at most). Defaults to `100`. + /// * [lastKnownMessageId] The last known message (serves as offset). Defaults to `0`. + /// * [lastCommonReadId] The last known common read message (so the response is 200 instead of 304 when it changes even when there are no messages). Defaults to `0`. + /// * [timeout] Number of seconds to wait for new messages (30 by default, 30 at most). Defaults to `30`. + /// * [setReadMarker] Automatically set the last read marker when 1, if your client does this itself via chat/{token}/read set to 0. Defaults to `1`. + /// * [includeLastKnown] Include the $lastKnownMessageId in the messages when 1 (default 0). Defaults to `0`. + /// * [noStatusUpdate] When the user status should not be automatically set to online set to 1 (default 0). Defaults to `0`. + /// * [markNotificationsAsRead] Set to 0 when notifications should not be marked as read (default 1). Defaults to `1`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 201: Message sent successfully - /// * 400: Sending message is not possible - /// * 404: Actor not found - /// * 413: Message too long + /// * 200: Messages returned + /// * 304: No messages /// /// See: - /// * [sendMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> sendMessage({ - required String message, + /// * [$receiveMessages_Request] for the request send by this method. + /// * [$receiveMessages_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + receiveMessages({ + required ChatReceiveMessagesLookIntoFuture lookIntoFuture, required String token, - String? actorDisplayName, - String? referenceId, - int? replyTo, - ChatSendMessageSilent? silent, - ChatSendMessageApiVersion? apiVersion, + int? limit, + int? lastKnownMessageId, + int? lastCommonReadId, + int? timeout, + ChatReceiveMessagesSetReadMarker? setReadMarker, + ChatReceiveMessagesIncludeLastKnown? includeLastKnown, + ChatReceiveMessagesNoStatusUpdate? noStatusUpdate, + ChatReceiveMessagesMarkNotificationsAsRead? markNotificationsAsRead, + ChatReceiveMessagesApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await sendMessageRaw( - message: message, + final _request = $receiveMessages_Request( + lookIntoFuture: lookIntoFuture, token: token, - actorDisplayName: actorDisplayName, - referenceId: referenceId, - replyTo: replyTo, - silent: silent, + limit: limit, + lastKnownMessageId: lastKnownMessageId, + lastCommonReadId: lastCommonReadId, + timeout: timeout, + setReadMarker: setReadMarker, + includeLastKnown: includeLastKnown, + noStatusUpdate: noStatusUpdate, + markNotificationsAsRead: markNotificationsAsRead, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $receiveMessages_Serializer(); + final _rawResponse = + await _i1.ResponseConverter( + _serializer, + ).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$sendMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $sendMessage_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ChatSendMessageResponseApplicationJson), + headersType: const FullType(ChatChatSendMessageHeaders), + serializers: _$jsonSerializers, + validStatuses: const {201}, + ); + /// Sends a new chat message to the given room. /// /// The author and timestamp are automatically set to the current user/guest and time. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [sendMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3812,9 +3697,10 @@ class $ChatClient { /// * 413: Message too long /// /// See: - /// * [sendMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [sendMessage] for a method executing this request and parsing the response. + /// * [$sendMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> sendMessageRaw({ + _i3.Request $sendMessage_Request({ required String message, required String token, String? actorDisplayName, @@ -3823,30 +3709,13 @@ class $ChatClient { ChatSendMessageSilent? silent, ChatSendMessageApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $message = _$jsonSerializers.serialize(message, specifiedType: const FullType(String)); _parameters['message'] = $message; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -3873,70 +3742,102 @@ class $ChatClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}{?message*,actorDisplayName*,referenceId*,replyTo*,silent*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $sendMessage_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); - } + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } - /// Builds a serializer to parse the response of `$clearHistory_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $clearHistory_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ChatClearHistoryResponseApplicationJson), - headersType: const FullType(ChatChatClearHistoryHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200, 202}, - ); +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - /// Clear the chat history. + return _request; + } + + /// Sends a new chat message to the given room. + /// + /// The author and timestamp are automatically set to the current user/guest and time. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [message] the message to send. + /// * [actorDisplayName] for guests. Defaults to `''`. + /// * [referenceId] for the message to be able to later identify it again. Defaults to `''`. + /// * [replyTo] Parent id which this message is a reply to. Defaults to `0`. + /// * [silent] If sent silent the chat message will not create any notifications. Defaults to `0`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: History cleared successfully - /// * 202: History cleared successfully, but Matterbridge is configured, so the information can be replicated elsewhere - /// * 403: Missing permissions to clear history + /// * 201: Message sent successfully + /// * 400: Sending message is not possible + /// * 404: Actor not found + /// * 413: Message too long /// /// See: - /// * [clearHistoryRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> clearHistory({ + /// * [$sendMessage_Request] for the request send by this method. + /// * [$sendMessage_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> sendMessage({ + required String message, required String token, - ChatClearHistoryApiVersion? apiVersion, + String? actorDisplayName, + String? referenceId, + int? replyTo, + ChatSendMessageSilent? silent, + ChatSendMessageApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await clearHistoryRaw( + final _request = $sendMessage_Request( + message: message, token: token, + actorDisplayName: actorDisplayName, + referenceId: referenceId, + replyTo: replyTo, + silent: silent, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $sendMessage_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$clearHistory_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $clearHistory_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ChatClearHistoryResponseApplicationJson), + headersType: const FullType(ChatChatClearHistoryHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200, 202}, + ); + /// Clear the chat history. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [clearHistory] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -3950,17 +3851,32 @@ class $ChatClient { /// * 403: Missing permissions to clear history /// /// See: - /// * [clearHistory] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [clearHistory] for a method executing this request and parsing the response. + /// * [$clearHistory_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - clearHistoryRaw({ + _i3.Request $clearHistory_Request({ required String token, ChatClearHistoryApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatClearHistoryApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -3970,7 +3886,7 @@ class $ChatClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -3978,46 +3894,14 @@ class $ChatClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatClearHistoryApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $clearHistory_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $deleteMessage_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ChatDeleteMessageResponseApplicationJson), - headersType: const FullType(ChatChatDeleteMessageHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200, 202}, - ); - - /// Delete a chat message. + /// Clear the chat history. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -4025,40 +3909,48 @@ class $ChatClient { /// Parameters: /// * [apiVersion] Defaults to `v1`. /// * [token] - /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Message deleted successfully - /// * 202: Message deleted successfully, but Matterbridge is configured, so the information can be replicated elsewhere - /// * 400: Deleting message is not possible - /// * 403: Missing permissions to delete message - /// * 404: Message not found - /// * 405: Deleting message is not allowed + /// * 200: History cleared successfully + /// * 202: History cleared successfully, but Matterbridge is configured, so the information can be replicated elsewhere + /// * 403: Missing permissions to clear history /// /// See: - /// * [deleteMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteMessage({ + /// * [$clearHistory_Request] for the request send by this method. + /// * [$clearHistory_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> clearHistory({ required String token, - required int messageId, - ChatDeleteMessageApiVersion? apiVersion, + ChatClearHistoryApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteMessageRaw( + final _request = $clearHistory_Request( token: token, - messageId: messageId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $clearHistory_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $deleteMessage_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ChatDeleteMessageResponseApplicationJson), + headersType: const FullType(ChatChatDeleteMessageHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200, 202}, + ); + /// Delete a chat message. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4076,18 +3968,37 @@ class $ChatClient { /// * 405: Deleting message is not allowed /// /// See: - /// * [deleteMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteMessage] for a method executing this request and parsing the response. + /// * [$deleteMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - deleteMessageRaw({ + _i3.Request $deleteMessage_Request({ required String token, required int messageId, ChatDeleteMessageApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); + _parameters['messageId'] = $messageId; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatDeleteMessageApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4097,7 +4008,7 @@ class $ChatClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -4105,91 +4016,69 @@ class $ChatClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); - _parameters['messageId'] = $messageId; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatDeleteMessageApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $deleteMessage_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getMessageContext_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getMessageContext_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ChatGetMessageContextResponseApplicationJson), - headersType: const FullType(ChatChatGetMessageContextHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200, 304}, - ); - - /// Get the context of a message. + /// Delete a chat message. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [limit] Number of chat messages to receive in both directions (50 by default, 100 at most, might return 201 messages). Defaults to `50`. /// * [apiVersion] Defaults to `v1`. /// * [token] - /// * [messageId] The focused message which should be in the "middle" of the returned context. + /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Message context returned - /// * 304: No messages + /// * 200: Message deleted successfully + /// * 202: Message deleted successfully, but Matterbridge is configured, so the information can be replicated elsewhere + /// * 400: Deleting message is not possible + /// * 403: Missing permissions to delete message + /// * 404: Message not found + /// * 405: Deleting message is not allowed /// /// See: - /// * [getMessageContextRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - getMessageContext({ + /// * [$deleteMessage_Request] for the request send by this method. + /// * [$deleteMessage_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteMessage({ required String token, required int messageId, - int? limit, - ChatGetMessageContextApiVersion? apiVersion, + ChatDeleteMessageApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getMessageContextRaw( + final _request = $deleteMessage_Request( token: token, messageId: messageId, - limit: limit, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteMessage_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getMessageContext_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getMessageContext_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ChatGetMessageContextResponseApplicationJson), + headersType: const FullType(ChatChatGetMessageContextHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200, 304}, + ); + /// Get the context of a message. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getMessageContext] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4204,36 +4093,19 @@ class $ChatClient { /// * 304: No messages /// /// See: - /// * [getMessageContext] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getMessageContext] for a method executing this request and parsing the response. + /// * [$getMessageContext_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getMessageContextRaw({ + _i3.Request $getMessageContext_Request({ required String token, required int messageId, int? limit, ChatGetMessageContextApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -4252,72 +4124,90 @@ class $ChatClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}/context{?limit*}') + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}/context{?limit*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $getMessageContext_Serializer(); - return _i1.ResponseConverter( - _serializer, - ).convert(_response); - } - - /// Builds a serializer to parse the response of `$getReminder_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getReminder_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ChatGetReminderResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } - /// Get the reminder for a chat message. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Get the context of a message. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [limit] Number of chat messages to receive in both directions (50 by default, 100 at most, might return 201 messages). Defaults to `50`. /// * [apiVersion] Defaults to `v1`. /// * [token] - /// * [messageId] ID of the message. + /// * [messageId] The focused message which should be in the "middle" of the returned context. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reminder returned - /// * 404: Message not found + /// * 200: Message context returned + /// * 304: No messages /// /// See: - /// * [getReminderRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getReminder({ + /// * [$getMessageContext_Request] for the request send by this method. + /// * [$getMessageContext_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + getMessageContext({ required String token, required int messageId, - ChatGetReminderApiVersion? apiVersion, + int? limit, + ChatGetMessageContextApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getReminderRaw( + final _request = $getMessageContext_Request( token: token, messageId: messageId, + limit: limit, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getMessageContext_Serializer(); + final _rawResponse = + await _i1.ResponseConverter( + _serializer, + ).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getReminder_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getReminder_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ChatGetReminderResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the reminder for a chat message. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getReminder] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4331,17 +4221,36 @@ class $ChatClient { /// * 404: Message not found /// /// See: - /// * [getReminder] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getReminder] for a method executing this request and parsing the response. + /// * [$getReminder_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getReminderRaw({ + _i3.Request $getReminder_Request({ required String token, required int messageId, ChatGetReminderApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); + _parameters['messageId'] = $messageId; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatGetReminderApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}/reminder') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4351,7 +4260,7 @@ class $ChatClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -4359,88 +4268,64 @@ class $ChatClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); - _parameters['messageId'] = $messageId; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatGetReminderApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}/reminder') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + return _request; + } - final _serializer = $getReminder_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$setReminder_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setReminder_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ChatSetReminderResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {201}, - ); - - /// Set a reminder for a chat message. + /// Get the reminder for a chat message. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [timestamp] Timestamp of the reminder. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 201: Reminder created successfully + /// * 200: Reminder returned /// * 404: Message not found /// /// See: - /// * [setReminderRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setReminder({ - required int timestamp, + /// * [$getReminder_Request] for the request send by this method. + /// * [$getReminder_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getReminder({ required String token, required int messageId, - ChatSetReminderApiVersion? apiVersion, + ChatGetReminderApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setReminderRaw( - timestamp: timestamp, + final _request = $getReminder_Request( token: token, messageId: messageId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getReminder_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$setReminder_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setReminder_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ChatSetReminderResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {201}, + ); + /// Set a reminder for a chat message. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setReminder] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4455,40 +4340,22 @@ class $ChatClient { /// * 404: Message not found /// /// See: - /// * [setReminder] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setReminder] for a method executing this request and parsing the response. + /// * [$setReminder_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setReminderRaw({ + _i3.Request $setReminder_Request({ required int timestamp, required String token, required int messageId, ChatSetReminderApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $timestamp = _$jsonSerializers.serialize(timestamp, specifiedType: const FullType(int)); _parameters['timestamp'] = $timestamp; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -4502,71 +4369,90 @@ class $ChatClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}/reminder{?timestamp*}') + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}/reminder{?timestamp*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $setReminder_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$deleteReminder_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteReminder_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ChatDeleteReminderResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 404}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - /// Delete a chat reminder. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Set a reminder for a chat message. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [timestamp] Timestamp of the reminder. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reminder deleted successfully + /// * 201: Reminder created successfully /// * 404: Message not found /// /// See: - /// * [deleteReminderRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteReminder({ + /// * [$setReminder_Request] for the request send by this method. + /// * [$setReminder_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setReminder({ + required int timestamp, required String token, required int messageId, - ChatDeleteReminderApiVersion? apiVersion, + ChatSetReminderApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteReminderRaw( + final _request = $setReminder_Request( + timestamp: timestamp, token: token, messageId: messageId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setReminder_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteReminder_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteReminder_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ChatDeleteReminderResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 404}, + ); + /// Delete a chat reminder. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteReminder] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4580,17 +4466,37 @@ class $ChatClient { /// * 404: Message not found /// /// See: - /// * [deleteReminder] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteReminder] for a method executing this request and parsing the response. + /// * [$deleteReminder_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteReminderRaw({ + _i3.Request $deleteReminder_Request({ required String token, required int messageId, ChatDeleteReminderApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); + _parameters['messageId'] = $messageId; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatDeleteReminderApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}/reminder') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4600,7 +4506,7 @@ class $ChatClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -4608,85 +4514,64 @@ class $ChatClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); - _parameters['messageId'] = $messageId; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatDeleteReminderApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}/reminder') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $deleteReminder_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setReadMarker_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $setReadMarker_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ChatSetReadMarkerResponseApplicationJson), - headersType: const FullType(ChatChatSetReadMarkerHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Set the read marker to a specific message. + /// Delete a chat reminder. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [lastReadMessage] ID if the last read message. /// * [apiVersion] Defaults to `v1`. /// * [token] + /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Read marker set successfully + /// * 200: Reminder deleted successfully + /// * 404: Message not found /// /// See: - /// * [setReadMarkerRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setReadMarker({ - required int lastReadMessage, + /// * [$deleteReminder_Request] for the request send by this method. + /// * [$deleteReminder_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteReminder({ required String token, - ChatSetReadMarkerApiVersion? apiVersion, + required int messageId, + ChatDeleteReminderApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setReadMarkerRaw( - lastReadMessage: lastReadMessage, + final _request = $deleteReminder_Request( token: token, + messageId: messageId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteReminder_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$setReadMarker_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $setReadMarker_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ChatSetReadMarkerResponseApplicationJson), + headersType: const FullType(ChatChatSetReadMarkerHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Set the read marker to a specific message. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setReadMarker] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4699,18 +4584,37 @@ class $ChatClient { /// * 200: Read marker set successfully /// /// See: - /// * [setReadMarker] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setReadMarker] for a method executing this request and parsing the response. + /// * [$setReadMarker_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - setReadMarkerRaw({ + _i3.Request $setReadMarker_Request({ required int lastReadMessage, required String token, ChatSetReadMarkerApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $lastReadMessage = _$jsonSerializers.serialize(lastReadMessage, specifiedType: const FullType(int)); + _parameters['lastReadMessage'] = $lastReadMessage; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatSetReadMarkerApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/read{?lastReadMessage*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4720,7 +4624,7 @@ class $ChatClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -4728,55 +4632,20 @@ class $ChatClient { } // coverage:ignore-end - final $lastReadMessage = _$jsonSerializers.serialize(lastReadMessage, specifiedType: const FullType(int)); - _parameters['lastReadMessage'] = $lastReadMessage; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatSetReadMarkerApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/read{?lastReadMessage*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $setReadMarker_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$markUnread_Request`. - @_i2.experimental - _i1.DynamiteSerializer $markUnread_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ChatMarkUnreadResponseApplicationJson), - headersType: const FullType(ChatChatMarkUnreadHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Mark a chat as unread. + /// Set the read marker to a specific message. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [lastReadMessage] ID if the last read message. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. @@ -4785,26 +4654,42 @@ class $ChatClient { /// * 200: Read marker set successfully /// /// See: - /// * [markUnreadRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> markUnread({ + /// * [$setReadMarker_Request] for the request send by this method. + /// * [$setReadMarker_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setReadMarker({ + required int lastReadMessage, required String token, - ChatMarkUnreadApiVersion? apiVersion, + ChatSetReadMarkerApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await markUnreadRaw( + final _request = $setReadMarker_Request( + lastReadMessage: lastReadMessage, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setReadMarker_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$markUnread_Request]. + @_i2.experimental + _i1.DynamiteSerializer $markUnread_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ChatMarkUnreadResponseApplicationJson), + headersType: const FullType(ChatChatMarkUnreadHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Mark a chat as unread. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [markUnread] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4816,16 +4701,31 @@ class $ChatClient { /// * 200: Read marker set successfully /// /// See: - /// * [markUnread] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [markUnread] for a method executing this request and parsing the response. + /// * [$markUnread_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> markUnreadRaw({ + _i3.Request $markUnread_Request({ required String token, ChatMarkUnreadApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatMarkUnreadApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/read').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -4835,7 +4735,7 @@ class $ChatClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -4843,86 +4743,60 @@ class $ChatClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ChatMarkUnreadApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/read').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $markUnread_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$mentions_Request`. - @_i2.experimental - _i1.DynamiteSerializer $mentions_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ChatMentionsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Search for mentions. + /// Mark a chat as unread. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [search] Text to search for. - /// * [limit] Maximum number of results. Defaults to `20`. - /// * [includeStatus] Include the user statuses. Defaults to `0`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: List of mention suggestions returned + /// * 200: Read marker set successfully /// /// See: - /// * [mentionsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> mentions({ - required String search, + /// * [$markUnread_Request] for the request send by this method. + /// * [$markUnread_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> markUnread({ required String token, - int? limit, - ChatMentionsIncludeStatus? includeStatus, - ChatMentionsApiVersion? apiVersion, + ChatMarkUnreadApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await mentionsRaw( - search: search, + final _request = $markUnread_Request( token: token, - limit: limit, - includeStatus: includeStatus, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $markUnread_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$mentions_Request]. + @_i2.experimental + _i1.DynamiteSerializer $mentions_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ChatMentionsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Search for mentions. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [mentions] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -4937,39 +4811,23 @@ class $ChatClient { /// * 200: List of mention suggestions returned /// /// See: - /// * [mentions] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [mentions] for a method executing this request and parsing the response. + /// * [$mentions_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> mentionsRaw({ + _i3.Request $mentions_Request({ required String search, required String token, int? limit, ChatMentionsIncludeStatus? includeStatus, ChatMentionsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $search = _$jsonSerializers.serialize(search, specifiedType: const FullType(String)); _parameters['search'] = $search; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -4989,77 +4847,90 @@ class $ChatClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/mentions{?search*,limit*,includeStatus*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $mentions_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } - /// Builds a serializer to parse the response of `$getObjectsSharedInRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getObjectsSharedInRoom_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ChatGetObjectsSharedInRoomResponseApplicationJson), - headersType: const FullType(ChatChatGetObjectsSharedInRoomHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - /// Get objects that are shared in the room. + return _request; + } + + /// Search for mentions. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [objectType] Type of the objects. - /// * [lastKnownMessageId] ID of the last known message. Defaults to `0`. - /// * [limit] Maximum number of objects. Defaults to `100`. + /// * [search] Text to search for. + /// * [limit] Maximum number of results. Defaults to `20`. + /// * [includeStatus] Include the user statuses. Defaults to `0`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: List of shared objects messages returned + /// * 200: List of mention suggestions returned /// /// See: - /// * [getObjectsSharedInRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - getObjectsSharedInRoom({ - required String objectType, + /// * [$mentions_Request] for the request send by this method. + /// * [$mentions_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> mentions({ + required String search, required String token, - int? lastKnownMessageId, int? limit, - ChatGetObjectsSharedInRoomApiVersion? apiVersion, + ChatMentionsIncludeStatus? includeStatus, + ChatMentionsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getObjectsSharedInRoomRaw( - objectType: objectType, + final _request = $mentions_Request( + search: search, token: token, - lastKnownMessageId: lastKnownMessageId, limit: limit, + includeStatus: includeStatus, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $mentions_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getObjectsSharedInRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getObjectsSharedInRoom_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ChatGetObjectsSharedInRoomResponseApplicationJson), + headersType: const FullType(ChatChatGetObjectsSharedInRoomHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get objects that are shared in the room. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getObjectsSharedInRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5074,41 +4945,23 @@ class $ChatClient { /// * 200: List of shared objects messages returned /// /// See: - /// * [getObjectsSharedInRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getObjectsSharedInRoom] for a method executing this request and parsing the response. + /// * [$getObjectsSharedInRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future< - _i1.DynamiteRawResponse> getObjectsSharedInRoomRaw({ + _i3.Request $getObjectsSharedInRoom_Request({ required String objectType, required String token, int? lastKnownMessageId, int? limit, ChatGetObjectsSharedInRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $objectType = _$jsonSerializers.serialize(objectType, specifiedType: const FullType(String)); _parameters['objectType'] = $objectType; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -5128,92 +4981,94 @@ class $ChatClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/share{?objectType*,lastKnownMessageId*,limit*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $getObjectsSharedInRoom_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); - } + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } - /// Builds a serializer to parse the response of `$shareObjectToChat_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $shareObjectToChat_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ChatShareObjectToChatResponseApplicationJson), - headersType: const FullType(ChatChatShareObjectToChatHeaders), - serializers: _$jsonSerializers, - validStatuses: const {201}, - ); +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - /// Sends a rich-object to the given room. - /// - /// The author and timestamp are automatically set to the current user/guest and time. + return _request; + } + + /// Get objects that are shared in the room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [objectType] Type of the object. - /// * [objectId] ID of the object. - /// * [metaData] Additional metadata. Defaults to `''`. - /// * [actorDisplayName] Guest name. Defaults to `''`. - /// * [referenceId] Reference ID. Defaults to `''`. + /// * [objectType] Type of the objects. + /// * [lastKnownMessageId] ID of the last known message. Defaults to `0`. + /// * [limit] Maximum number of objects. Defaults to `100`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 201: Object shared successfully - /// * 400: Sharing object is not possible - /// * 404: Actor not found - /// * 413: Message too long + /// * 200: List of shared objects messages returned /// /// See: - /// * [shareObjectToChatRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - shareObjectToChat({ + /// * [$getObjectsSharedInRoom_Request] for the request send by this method. + /// * [$getObjectsSharedInRoom_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + getObjectsSharedInRoom({ required String objectType, - required String objectId, required String token, - String? metaData, - String? actorDisplayName, - String? referenceId, - ChatShareObjectToChatApiVersion? apiVersion, + int? lastKnownMessageId, + int? limit, + ChatGetObjectsSharedInRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await shareObjectToChatRaw( + final _request = $getObjectsSharedInRoom_Request( objectType: objectType, - objectId: objectId, token: token, - metaData: metaData, - actorDisplayName: actorDisplayName, - referenceId: referenceId, + lastKnownMessageId: lastKnownMessageId, + limit: limit, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getObjectsSharedInRoom_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$shareObjectToChat_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $shareObjectToChat_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ChatShareObjectToChatResponseApplicationJson), + headersType: const FullType(ChatChatShareObjectToChatHeaders), + serializers: _$jsonSerializers, + validStatuses: const {201}, + ); + /// Sends a rich-object to the given room. /// /// The author and timestamp are automatically set to the current user/guest and time. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [shareObjectToChat] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5233,10 +5088,10 @@ class $ChatClient { /// * 413: Message too long /// /// See: - /// * [shareObjectToChat] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [shareObjectToChat] for a method executing this request and parsing the response. + /// * [$shareObjectToChat_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - shareObjectToChatRaw({ + _i3.Request $shareObjectToChat_Request({ required String objectType, required String objectId, required String token, @@ -5245,25 +5100,8 @@ class $ChatClient { String? referenceId, ChatShareObjectToChatApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $objectType = _$jsonSerializers.serialize(objectType, specifiedType: const FullType(String)); _parameters['objectType'] = $objectType; @@ -5271,7 +5109,7 @@ class $ChatClient { _parameters['objectId'] = $objectId; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -5295,73 +5133,104 @@ class $ChatClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/share{?objectType*,objectId*,metaData*,actorDisplayName*,referenceId*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $shareObjectToChat_Serializer(); - return _i1.ResponseConverter( - _serializer, - ).convert(_response); - } - - /// Builds a serializer to parse the response of `$getObjectsSharedInRoomOverview_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getObjectsSharedInRoomOverview_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ChatGetObjectsSharedInRoomOverviewResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } - /// Get objects that are shared in the room overview. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Sends a rich-object to the given room. + /// + /// The author and timestamp are automatically set to the current user/guest and time. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [limit] Maximum number of objects. Defaults to `7`. + /// * [objectType] Type of the object. + /// * [objectId] ID of the object. + /// * [metaData] Additional metadata. Defaults to `''`. + /// * [actorDisplayName] Guest name. Defaults to `''`. + /// * [referenceId] Reference ID. Defaults to `''`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: List of shared objects messages of each type returned + /// * 201: Object shared successfully + /// * 400: Sharing object is not possible + /// * 404: Actor not found + /// * 413: Message too long /// /// See: - /// * [getObjectsSharedInRoomOverviewRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> - getObjectsSharedInRoomOverview({ + /// * [$shareObjectToChat_Request] for the request send by this method. + /// * [$shareObjectToChat_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + shareObjectToChat({ + required String objectType, + required String objectId, required String token, - int? limit, - ChatGetObjectsSharedInRoomOverviewApiVersion? apiVersion, + String? metaData, + String? actorDisplayName, + String? referenceId, + ChatShareObjectToChatApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getObjectsSharedInRoomOverviewRaw( + final _request = $shareObjectToChat_Request( + objectType: objectType, + objectId: objectId, token: token, - limit: limit, + metaData: metaData, + actorDisplayName: actorDisplayName, + referenceId: referenceId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $shareObjectToChat_Serializer(); + final _rawResponse = + await _i1.ResponseConverter( + _serializer, + ).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getObjectsSharedInRoomOverview_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getObjectsSharedInRoomOverview_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ChatGetObjectsSharedInRoomOverviewResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get objects that are shared in the room overview. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getObjectsSharedInRoomOverview] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5374,35 +5243,18 @@ class $ChatClient { /// * 200: List of shared objects messages of each type returned /// /// See: - /// * [getObjectsSharedInRoomOverview] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getObjectsSharedInRoomOverview] for a method executing this request and parsing the response. + /// * [$getObjectsSharedInRoomOverview_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getObjectsSharedInRoomOverviewRaw({ + _i3.Request $getObjectsSharedInRoomOverview_Request({ required String token, int? limit, ChatGetObjectsSharedInRoomOverviewApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -5420,21 +5272,70 @@ class $ChatClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/share/overview{?limit*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/share/overview{?limit*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + return _request; + } + + /// Get objects that are shared in the room overview. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [limit] Maximum number of objects. Defaults to `7`. + /// * [apiVersion] Defaults to `v1`. + /// * [token] + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: List of shared objects messages of each type returned + /// + /// See: + /// * [$getObjectsSharedInRoomOverview_Request] for the request send by this method. + /// * [$getObjectsSharedInRoomOverview_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> + getObjectsSharedInRoomOverview({ + required String token, + int? limit, + ChatGetObjectsSharedInRoomOverviewApiVersion? apiVersion, + bool? oCSAPIRequest, + }) async { + final _request = $getObjectsSharedInRoomOverview_Request( + token: token, + limit: limit, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getObjectsSharedInRoomOverview_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -5444,7 +5345,7 @@ class $FilesIntegrationClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getRoomByFileId_Request`. + /// Builds a serializer to parse the response of [$getRoomByFileId_Request]. @_i2.experimental _i1.DynamiteSerializer $getRoomByFileId_Serializer() => _i1.DynamiteSerializer( @@ -5460,7 +5361,7 @@ class $FilesIntegrationClient { /// If there is no room associated to the given file id a new room is created; the new room is a public room associated with a "file" object with the given file id. Unlike normal rooms in which the owner is the user that created the room these are special rooms without owner (although self joined users with direct access to the file become persistent participants automatically when they join until they explicitly leave or no longer have access to the file). /// In any case, to create or even get the token of the room, the file must be shared and the user must be the owner of a public share of the file (like a link share, for example) or have direct access to that file; an error is returned otherwise. A user has direct access to a file if she has access to it (or to an ancestor) through a user, group, circle or room share (but not through a link share, for example), or if she is the owner of such a file. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getRoomByFileId] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5474,19 +5375,56 @@ class $FilesIntegrationClient { /// * 404: Share not found /// /// See: - /// * [getRoomByFileIdRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getRoomByFileId({ + /// * [getRoomByFileId] for a method executing this request and parsing the response. + /// * [$getRoomByFileId_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getRoomByFileId_Request({ required String fileId, FilesIntegrationGetRoomByFileIdApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await getRoomByFileIdRaw( - fileId: fileId, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(String)); + _i4.checkPattern( + $fileId as String?, + RegExp(r'^.+$'), + 'fileId', ); + _parameters['fileId'] = $fileId; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(FilesIntegrationGetRoomByFileIdApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/file/{fileId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Get the token of the room associated to the given file id. @@ -5495,9 +5433,7 @@ class $FilesIntegrationClient { /// If there is no room associated to the given file id a new room is created; the new room is a public room associated with a "file" object with the given file id. Unlike normal rooms in which the owner is the user that created the room these are special rooms without owner (although self joined users with direct access to the file become persistent participants automatically when they join until they explicitly leave or no longer have access to the file). /// In any case, to create or even get the token of the room, the file must be shared and the user must be the owner of a public share of the file (like a link share, for example) or have direct access to that file; an error is returned otherwise. A user has direct access to a file if she has access to it (or to an ancestor) through a user, group, circle or room share (but not through a link share, for example), or if she is the owner of such a file. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5511,65 +5447,28 @@ class $FilesIntegrationClient { /// * 404: Share not found /// /// See: - /// * [getRoomByFileId] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getRoomByFileIdRaw({ + /// * [$getRoomByFileId_Request] for the request send by this method. + /// * [$getRoomByFileId_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getRoomByFileId({ required String fileId, FilesIntegrationGetRoomByFileIdApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(String)); - _i3.checkPattern( - $fileId as String?, - RegExp(r'^.+$'), - 'fileId', - ); - _parameters['fileId'] = $fileId; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(FilesIntegrationGetRoomByFileIdApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/file/{fileId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getRoomByFileId_Request( + fileId: fileId, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getRoomByFileId_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$getRoomByShareToken_Request`. + /// Builds a serializer to parse the response of [$getRoomByShareToken_Request]. @_i2.experimental _i1.DynamiteSerializer $getRoomByShareToken_Serializer() => _i1.DynamiteSerializer( @@ -5586,7 +5485,7 @@ class $FilesIntegrationClient { /// In any case, to create or even get the token of the room, the file must be publicly shared (like a link share, for example); an error is returned otherwise. /// Besides the token of the room this also returns the current user ID and display name, if any; this is needed by the Talk sidebar to know the actual current user, as the public share page uses the incognito mode and thus logged-in users as seen as guests. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getRoomByShareToken] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5600,19 +5499,55 @@ class $FilesIntegrationClient { /// * 404: Share not found /// /// See: - /// * [getRoomByShareTokenRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getRoomByShareToken({ + /// * [getRoomByShareToken] for a method executing this request and parsing the response. + /// * [$getRoomByShareToken_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getRoomByShareToken_Request({ required String shareToken, FilesIntegrationGetRoomByShareTokenApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await getRoomByShareTokenRaw( - shareToken: shareToken, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $shareToken = _$jsonSerializers.serialize(shareToken, specifiedType: const FullType(String)); + _i4.checkPattern( + $shareToken as String?, + RegExp(r'^.+$'), + 'shareToken', ); + _parameters['shareToken'] = $shareToken; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(FilesIntegrationGetRoomByShareTokenApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/publicshare/{shareToken}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Returns the token of the room associated to the file of the given share token. @@ -5622,9 +5557,7 @@ class $FilesIntegrationClient { /// In any case, to create or even get the token of the room, the file must be publicly shared (like a link share, for example); an error is returned otherwise. /// Besides the token of the room this also returns the current user ID and display name, if any; this is needed by the Talk sidebar to know the actual current user, as the public share page uses the incognito mode and thus logged-in users as seen as guests. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5638,62 +5571,25 @@ class $FilesIntegrationClient { /// * 404: Share not found /// /// See: - /// * [getRoomByShareToken] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> - getRoomByShareTokenRaw({ + /// * [$getRoomByShareToken_Request] for the request send by this method. + /// * [$getRoomByShareToken_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getRoomByShareToken({ required String shareToken, FilesIntegrationGetRoomByShareTokenApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end - final $shareToken = _$jsonSerializers.serialize(shareToken, specifiedType: const FullType(String)); - _i3.checkPattern( - $shareToken as String?, - RegExp(r'^.+$'), - 'shareToken', - ); - _parameters['shareToken'] = $shareToken; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(FilesIntegrationGetRoomByShareTokenApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/publicshare/{shareToken}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getRoomByShareToken_Request( + shareToken: shareToken, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getRoomByShareToken_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -5703,7 +5599,7 @@ class $GuestClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$setDisplayName_Request`. + /// Builds a serializer to parse the response of [$setDisplayName_Request]. @_i2.experimental _i1.DynamiteSerializer $setDisplayName_Serializer() => _i1.DynamiteSerializer( @@ -5715,7 +5611,7 @@ class $GuestClient { /// Set the display name as a guest. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [setDisplayName] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5730,28 +5626,62 @@ class $GuestClient { /// * 404: Not a participant /// /// See: - /// * [setDisplayNameRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setDisplayName({ + /// * [setDisplayName] for a method executing this request and parsing the response. + /// * [$setDisplayName_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $setDisplayName_Request({ required String displayName, required String token, GuestSetDisplayNameApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await setDisplayNameRaw( - displayName: displayName, - token: token, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $displayName = _$jsonSerializers.serialize(displayName, specifiedType: const FullType(String)); + _parameters['displayName'] = $displayName; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', ); + _parameters['token'] = $token; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(GuestSetDisplayNameApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/guest/{token}/name{?displayName*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Set the display name as a guest. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5766,62 +5696,26 @@ class $GuestClient { /// * 404: Not a participant /// /// See: - /// * [setDisplayName] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> setDisplayNameRaw({ + /// * [$setDisplayName_Request] for the request send by this method. + /// * [$setDisplayName_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setDisplayName({ required String displayName, required String token, GuestSetDisplayNameApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end - final $displayName = _$jsonSerializers.serialize(displayName, specifiedType: const FullType(String)); - _parameters['displayName'] = $displayName; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(GuestSetDisplayNameApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/guest/{token}/name{?displayName*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _request = $setDisplayName_Request( + displayName: displayName, + token: token, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $setDisplayName_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -5831,7 +5725,7 @@ class $HostedSignalingServerClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$requestTrial_Request`. + /// Builds a serializer to parse the response of [$requestTrial_Request]. @_i2.experimental _i1.DynamiteSerializer $requestTrial_Serializer() => _i1.DynamiteSerializer( @@ -5845,7 +5739,7 @@ class $HostedSignalingServerClient { /// /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [requestTrial] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5863,8 +5757,10 @@ class $HostedSignalingServerClient { /// * 500 /// /// See: - /// * [requestTrialRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> requestTrial({ + /// * [requestTrial] for a method executing this request and parsing the response. + /// * [$requestTrial_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $requestTrial_Request({ required String url, required String name, required String email, @@ -5872,27 +5768,65 @@ class $HostedSignalingServerClient { required String country, HostedSignalingServerRequestTrialApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await requestTrialRaw( - url: url, - name: name, - email: email, - language: language, - country: country, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $url = _$jsonSerializers.serialize(url, specifiedType: const FullType(String)); + _parameters['url'] = $url; + + final $name = _$jsonSerializers.serialize(name, specifiedType: const FullType(String)); + _parameters['name'] = $name; + + final $email = _$jsonSerializers.serialize(email, specifiedType: const FullType(String)); + _parameters['email'] = $email; + + final $language = _$jsonSerializers.serialize(language, specifiedType: const FullType(String)); + _parameters['language'] = $language; + + final $country = _$jsonSerializers.serialize(country, specifiedType: const FullType(String)); + _parameters['country'] = $country; + + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(HostedSignalingServerRequestTrialApiVersion), ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + final _path = _i5.UriTemplate( + '/ocs/v2.php/apps/spreed/api/{apiVersion}/hostedsignalingserver/requesttrial{?url*,name*,email*,language*,country*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Request a trial account. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -5910,9 +5844,9 @@ class $HostedSignalingServerClient { /// * 500 /// /// See: - /// * [requestTrial] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> requestTrialRaw({ + /// * [$requestTrial_Request] for the request send by this method. + /// * [$requestTrial_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> requestTrial({ required String url, required String name, required String email, @@ -5921,9 +5855,71 @@ class $HostedSignalingServerClient { HostedSignalingServerRequestTrialApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + final _request = $requestTrial_Request( + url: url, + name: name, + email: email, + language: language, + country: country, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, + ); + final _response = await _rootClient.sendWithCookies(_request); + + final _serializer = $requestTrial_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + } + /// Builds a serializer to parse the response of [$deleteAccount_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteAccount_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(HostedSignalingServerDeleteAccountResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {204}, + ); + + /// Delete the account. + /// + /// This endpoint requires admin access. + /// + /// Returns a `DynamiteRequest` backing the [deleteAccount] operation. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [apiVersion] Defaults to `v1`. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 204: Account deleted successfully + /// * 400: Deleting account is not possible + /// * 500 + /// + /// See: + /// * [deleteAccount] for a method executing this request and parsing the response. + /// * [$deleteAccount_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $deleteAccount_Request({ + HostedSignalingServerDeleteAccountApiVersion? apiVersion, + bool? oCSAPIRequest, + }) { + final _parameters = {}; + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(HostedSignalingServerDeleteAccountApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/hostedsignalingserver/delete').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -5933,7 +5929,7 @@ class $HostedSignalingServerClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -5941,56 +5937,13 @@ class $HostedSignalingServerClient { } // coverage:ignore-end - final $url = _$jsonSerializers.serialize(url, specifiedType: const FullType(String)); - _parameters['url'] = $url; - - final $name = _$jsonSerializers.serialize(name, specifiedType: const FullType(String)); - _parameters['name'] = $name; - - final $email = _$jsonSerializers.serialize(email, specifiedType: const FullType(String)); - _parameters['email'] = $email; - - final $language = _$jsonSerializers.serialize(language, specifiedType: const FullType(String)); - _parameters['language'] = $language; - - final $country = _$jsonSerializers.serialize(country, specifiedType: const FullType(String)); - _parameters['country'] = $country; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(HostedSignalingServerRequestTrialApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/spreed/api/{apiVersion}/hostedsignalingserver/requesttrial{?url*,name*,email*,language*,country*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $requestTrial_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteAccount_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteAccount_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(HostedSignalingServerDeleteAccountResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {204}, - ); - /// Delete the account. /// /// This endpoint requires admin access. @@ -6008,47 +5961,82 @@ class $HostedSignalingServerClient { /// * 500 /// /// See: - /// * [deleteAccountRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteAccount_Request] for the request send by this method. + /// * [$deleteAccount_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteAccount({ HostedSignalingServerDeleteAccountApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteAccountRaw( + final _request = $deleteAccount_Request( apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + + final _serializer = $deleteAccount_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + } +} + +class $MatterbridgeClient { + /// Creates a new `DynamiteClient` for matterbridge requests. + $MatterbridgeClient(this._rootClient); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } + final $Client _rootClient; - /// Delete the account. - /// - /// This endpoint requires admin access. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getBridgeOfRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getBridgeOfRoom_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(MatterbridgeGetBridgeOfRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get bridge information of one room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getBridgeOfRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [apiVersion] Defaults to `v1`. + /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 204: Account deleted successfully - /// * 400: Deleting account is not possible - /// * 500 + /// * 200: Return list of configured bridges /// /// See: - /// * [deleteAccount] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getBridgeOfRoom] for a method executing this request and parsing the response. + /// * [$getBridgeOfRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteAccountRaw({ - HostedSignalingServerDeleteAccountApiVersion? apiVersion, + _i3.Request $getBridgeOfRoom_Request({ + required String token, + MatterbridgeGetBridgeOfRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(MatterbridgeGetBridgeOfRoomApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -6058,7 +6046,7 @@ class $HostedSignalingServerClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -6066,46 +6054,12 @@ class $HostedSignalingServerClient { } // coverage:ignore-end - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(HostedSignalingServerDeleteAccountApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/hostedsignalingserver/delete').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $deleteAccount_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $MatterbridgeClient { - /// Creates a new `DynamiteClient` for matterbridge requests. - $MatterbridgeClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$getBridgeOfRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getBridgeOfRoom_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(MatterbridgeGetBridgeOfRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get bridge information of one room. /// @@ -6121,47 +6075,97 @@ class $MatterbridgeClient { /// * 200: Return list of configured bridges /// /// See: - /// * [getBridgeOfRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getBridgeOfRoom_Request] for the request send by this method. + /// * [$getBridgeOfRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getBridgeOfRoom({ required String token, MatterbridgeGetBridgeOfRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getBridgeOfRoomRaw( + final _request = $getBridgeOfRoom_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getBridgeOfRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get bridge information of one room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$editBridgeOfRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $editBridgeOfRoom_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(MatterbridgeEditBridgeOfRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Edit bridge information of one room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [editBridgeOfRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [enabled] If the bridge should be enabled. + /// * [parts] New parts. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Return list of configured bridges + /// * 200: Bridge edited successfully + /// * 406: Editing bridge is not possible /// /// See: - /// * [getBridgeOfRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [editBridgeOfRoom] for a method executing this request and parsing the response. + /// * [$editBridgeOfRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getBridgeOfRoomRaw({ + _i3.Request $editBridgeOfRoom_Request({ + required MatterbridgeEditBridgeOfRoomEnabled enabled, required String token, - MatterbridgeGetBridgeOfRoomApiVersion? apiVersion, + ContentString>>? parts, + MatterbridgeEditBridgeOfRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $enabled = + _$jsonSerializers.serialize(enabled, specifiedType: const FullType(MatterbridgeEditBridgeOfRoomEnabled)); + _parameters['enabled'] = $enabled; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $parts = _$jsonSerializers.serialize( + parts, + specifiedType: const FullType(ContentString, [ + FullType(BuiltList, [ + FullType(BuiltMap, [FullType(String), FullType(JsonObject)]), + ]), + ]), + ); + _parameters['parts'] = $parts; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(MatterbridgeEditBridgeOfRoomApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/{token}{?enabled*,parts*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -6171,7 +6175,7 @@ class $MatterbridgeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -6179,45 +6183,13 @@ class $MatterbridgeClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(MatterbridgeGetBridgeOfRoomApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getBridgeOfRoom_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$editBridgeOfRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $editBridgeOfRoom_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(MatterbridgeEditBridgeOfRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Edit bridge information of one room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -6235,7 +6207,8 @@ class $MatterbridgeClient { /// * 406: Editing bridge is not possible /// /// See: - /// * [editBridgeOfRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$editBridgeOfRoom_Request] for the request send by this method. + /// * [$editBridgeOfRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> editBridgeOfRoom({ required MatterbridgeEditBridgeOfRoomEnabled enabled, required String token, @@ -6243,48 +6216,75 @@ class $MatterbridgeClient { MatterbridgeEditBridgeOfRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await editBridgeOfRoomRaw( + final _request = $editBridgeOfRoom_Request( enabled: enabled, token: token, parts: parts, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $editBridgeOfRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Edit bridge information of one room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$deleteBridgeOfRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $deleteBridgeOfRoom_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(MatterbridgeDeleteBridgeOfRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Delete bridge of one room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteBridgeOfRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [enabled] If the bridge should be enabled. - /// * [parts] New parts. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Bridge edited successfully - /// * 406: Editing bridge is not possible + /// * 200: Bridge deleted successfully + /// * 406: Deleting bridge is not possible /// /// See: - /// * [editBridgeOfRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteBridgeOfRoom] for a method executing this request and parsing the response. + /// * [$deleteBridgeOfRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> editBridgeOfRoomRaw({ - required MatterbridgeEditBridgeOfRoomEnabled enabled, + _i3.Request $deleteBridgeOfRoom_Request({ required String token, - ContentString>>? parts, - MatterbridgeEditBridgeOfRoomApiVersion? apiVersion, + MatterbridgeDeleteBridgeOfRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(MatterbridgeDeleteBridgeOfRoomApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -6294,7 +6294,7 @@ class $MatterbridgeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -6302,60 +6302,13 @@ class $MatterbridgeClient { } // coverage:ignore-end - final $enabled = - _$jsonSerializers.serialize(enabled, specifiedType: const FullType(MatterbridgeEditBridgeOfRoomEnabled)); - _parameters['enabled'] = $enabled; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $parts = _$jsonSerializers.serialize( - parts, - specifiedType: const FullType(ContentString, [ - FullType(BuiltList, [ - FullType(BuiltMap, [FullType(String), FullType(JsonObject)]), - ]), - ]), - ); - _parameters['parts'] = $parts; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(MatterbridgeEditBridgeOfRoomApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/{token}{?enabled*,parts*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $editBridgeOfRoom_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteBridgeOfRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $deleteBridgeOfRoom_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(MatterbridgeDeleteBridgeOfRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Delete bridge of one room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -6371,26 +6324,40 @@ class $MatterbridgeClient { /// * 406: Deleting bridge is not possible /// /// See: - /// * [deleteBridgeOfRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteBridgeOfRoom_Request] for the request send by this method. + /// * [$deleteBridgeOfRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteBridgeOfRoom({ required String token, MatterbridgeDeleteBridgeOfRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteBridgeOfRoomRaw( + final _request = $deleteBridgeOfRoom_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteBridgeOfRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Delete bridge of one room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getBridgeProcessState_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getBridgeProcessState_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(MatterbridgeGetBridgeProcessStateResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get bridge process information. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getBridgeProcessState] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -6399,20 +6366,38 @@ class $MatterbridgeClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Bridge deleted successfully - /// * 406: Deleting bridge is not possible + /// * 200: Return list of running processes /// /// See: - /// * [deleteBridgeOfRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getBridgeProcessState] for a method executing this request and parsing the response. + /// * [$getBridgeProcessState_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteBridgeOfRoomRaw({ + _i3.Request $getBridgeProcessState_Request({ required String token, - MatterbridgeDeleteBridgeOfRoomApiVersion? apiVersion, + MatterbridgeGetBridgeProcessStateApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(MatterbridgeGetBridgeProcessStateApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/{token}/process').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -6422,7 +6407,7 @@ class $MatterbridgeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -6430,47 +6415,13 @@ class $MatterbridgeClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(MatterbridgeDeleteBridgeOfRoomApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $deleteBridgeOfRoom_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getBridgeProcessState_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getBridgeProcessState_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(MatterbridgeGetBridgeProcessStateResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get bridge process information. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -6485,48 +6436,79 @@ class $MatterbridgeClient { /// * 200: Return list of running processes /// /// See: - /// * [getBridgeProcessStateRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getBridgeProcessState_Request] for the request send by this method. + /// * [$getBridgeProcessState_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getBridgeProcessState({ required String token, MatterbridgeGetBridgeProcessStateApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getBridgeProcessStateRaw( + final _request = $getBridgeProcessState_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getBridgeProcessState_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Get bridge process information. +class $MatterbridgeSettingsClient { + /// Creates a new `DynamiteClient` for matterbridge_settings requests. + $MatterbridgeSettingsClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$stopAllBridges_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $stopAllBridges_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(MatterbridgeSettingsStopAllBridgesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Stop all bridges. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [stopAllBridges] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [apiVersion] Defaults to `v1`. - /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Return list of running processes + /// * 200: All bridges stopped successfully + /// * 406: Stopping all bridges is not possible /// /// See: - /// * [getBridgeProcessState] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [stopAllBridges] for a method executing this request and parsing the response. + /// * [$stopAllBridges_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getBridgeProcessStateRaw({ - required String token, - MatterbridgeGetBridgeProcessStateApiVersion? apiVersion, + _i3.Request $stopAllBridges_Request({ + MatterbridgeSettingsStopAllBridgesApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(MatterbridgeSettingsStopAllBridgesApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -6536,7 +6518,7 @@ class $MatterbridgeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -6544,54 +6526,12 @@ class $MatterbridgeClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(MatterbridgeGetBridgeProcessStateApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/{token}/process').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getBridgeProcessState_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $MatterbridgeSettingsClient { - /// Creates a new `DynamiteClient` for matterbridge_settings requests. - $MatterbridgeSettingsClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$stopAllBridges_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $stopAllBridges_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(MatterbridgeSettingsStopAllBridgesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Stop all bridges. /// @@ -6609,26 +6549,40 @@ class $MatterbridgeSettingsClient { /// * 406: Stopping all bridges is not possible /// /// See: - /// * [stopAllBridgesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$stopAllBridges_Request] for the request send by this method. + /// * [$stopAllBridges_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> stopAllBridges({ MatterbridgeSettingsStopAllBridgesApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await stopAllBridgesRaw( + final _request = $stopAllBridges_Request( apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $stopAllBridges_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Stop all bridges. + /// Builds a serializer to parse the response of [$getMatterbridgeVersion_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getMatterbridgeVersion_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(MatterbridgeSettingsGetMatterbridgeVersionResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get Matterbridge version. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getMatterbridgeVersion] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -6636,19 +6590,29 @@ class $MatterbridgeSettingsClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: All bridges stopped successfully - /// * 406: Stopping all bridges is not possible + /// * 200: Bridge version returned + /// * 400: Getting bridge version is not possible /// /// See: - /// * [stopAllBridges] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getMatterbridgeVersion] for a method executing this request and parsing the response. + /// * [$getMatterbridgeVersion_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> stopAllBridgesRaw({ - MatterbridgeSettingsStopAllBridgesApiVersion? apiVersion, + _i3.Request $getMatterbridgeVersion_Request({ + MatterbridgeSettingsGetMatterbridgeVersionApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(MatterbridgeSettingsGetMatterbridgeVersionApiVersion), + ); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/version').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -6658,7 +6622,7 @@ class $MatterbridgeSettingsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -6666,39 +6630,13 @@ class $MatterbridgeSettingsClient { } // coverage:ignore-end - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(MatterbridgeSettingsStopAllBridgesApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $stopAllBridges_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getMatterbridgeVersion_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getMatterbridgeVersion_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(MatterbridgeSettingsGetMatterbridgeVersionResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get Matterbridge version. /// /// This endpoint requires admin access. @@ -6715,48 +6653,107 @@ class $MatterbridgeSettingsClient { /// * 400: Getting bridge version is not possible /// /// See: - /// * [getMatterbridgeVersionRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getMatterbridgeVersion_Request] for the request send by this method. + /// * [$getMatterbridgeVersion_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getMatterbridgeVersion({ MatterbridgeSettingsGetMatterbridgeVersionApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getMatterbridgeVersionRaw( + final _request = $getMatterbridgeVersion_Request( apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getMatterbridgeVersion_Serializer(); + final _rawResponse = + await _i1.ResponseConverter( + _serializer, + ).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Get Matterbridge version. - /// - /// This endpoint requires admin access. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $PollClient { + /// Creates a new `DynamiteClient` for poll requests. + $PollClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$createPoll_Request]. + @_i2.experimental + _i1.DynamiteSerializer $createPoll_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(PollCreatePollResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {201}, + ); + + /// Create a poll. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [createPoll] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [question] Question of the poll. + /// * [options] Options of the poll. + /// * [resultMode] Mode how the results will be shown. + /// * [maxVotes] Number of maximum votes per voter. /// * [apiVersion] Defaults to `v1`. + /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Bridge version returned - /// * 400: Getting bridge version is not possible + /// * 201: Poll created successfully + /// * 400: Creating poll is not possible /// /// See: - /// * [getMatterbridgeVersion] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [createPoll] for a method executing this request and parsing the response. + /// * [$createPoll_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getMatterbridgeVersionRaw({ - MatterbridgeSettingsGetMatterbridgeVersionApiVersion? apiVersion, + _i3.Request $createPoll_Request({ + required String question, + required BuiltList options, + required PollCreatePollResultMode resultMode, + required int maxVotes, + required String token, + PollCreatePollApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $question = _$jsonSerializers.serialize(question, specifiedType: const FullType(String)); + _parameters['question'] = $question; + + final $options = _$jsonSerializers.serialize(options, specifiedType: const FullType(BuiltList, [FullType(String)])); + _parameters['options%5B%5D'] = $options; + + final $resultMode = + _$jsonSerializers.serialize(resultMode, specifiedType: const FullType(PollCreatePollResultMode)); + _parameters['resultMode'] = $resultMode; + + final $maxVotes = _$jsonSerializers.serialize(maxVotes, specifiedType: const FullType(int)); + _parameters['maxVotes'] = $maxVotes; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PollCreatePollApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate( + '/ocs/v2.php/apps/spreed/api/{apiVersion}/poll/{token}{?question*,options%5B%5D*,resultMode*,maxVotes*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -6766,53 +6763,18 @@ class $MatterbridgeSettingsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(MatterbridgeSettingsGetMatterbridgeVersionApiVersion), - ); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/bridge/version').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getMatterbridgeVersion_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $PollClient { - /// Creates a new `DynamiteClient` for poll requests. - $PollClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$createPoll_Request`. - @_i2.experimental - _i1.DynamiteSerializer $createPoll_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(PollCreatePollResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {201}, - ); /// Create a poll. /// @@ -6833,7 +6795,8 @@ class $PollClient { /// * 400: Creating poll is not possible /// /// See: - /// * [createPollRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$createPoll_Request] for the request send by this method. + /// * [$createPoll_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> createPoll({ required String question, required BuiltList options, @@ -6843,7 +6806,7 @@ class $PollClient { PollCreatePollApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await createPollRaw( + final _request = $createPoll_Request( question: question, options: options, resultMode: resultMode, @@ -6852,45 +6815,68 @@ class $PollClient { apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $createPoll_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Create a poll. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$showPoll_Request]. + @_i2.experimental + _i1.DynamiteSerializer $showPoll_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(PollShowPollResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a poll. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [showPoll] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// - /// Parameters: - /// * [question] Question of the poll. - /// * [options] Options of the poll. - /// * [resultMode] Mode how the results will be shown. - /// * [maxVotes] Number of maximum votes per voter. + /// Parameters: /// * [apiVersion] Defaults to `v1`. /// * [token] + /// * [pollId] ID of the poll. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 201: Poll created successfully - /// * 400: Creating poll is not possible + /// * 200: Poll returned + /// * 404: Poll not found /// /// See: - /// * [createPoll] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [showPoll] for a method executing this request and parsing the response. + /// * [$showPoll_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createPollRaw({ - required String question, - required BuiltList options, - required PollCreatePollResultMode resultMode, - required int maxVotes, + _i3.Request $showPoll_Request({ required String token, - PollCreatePollApiVersion? apiVersion, + required int pollId, + PollShowPollApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $pollId = _$jsonSerializers.serialize(pollId, specifiedType: const FullType(int)); + _parameters['pollId'] = $pollId; + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PollShowPollApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/poll/{token}/{pollId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -6900,63 +6886,19 @@ class $PollClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $question = _$jsonSerializers.serialize(question, specifiedType: const FullType(String)); - _parameters['question'] = $question; - - final $options = _$jsonSerializers.serialize(options, specifiedType: const FullType(BuiltList, [FullType(String)])); - _parameters['options%5B%5D'] = $options; - - final $resultMode = - _$jsonSerializers.serialize(resultMode, specifiedType: const FullType(PollCreatePollResultMode)); - _parameters['resultMode'] = $resultMode; - - final $maxVotes = _$jsonSerializers.serialize(maxVotes, specifiedType: const FullType(int)); - _parameters['maxVotes'] = $maxVotes; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PollCreatePollApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/spreed/api/{apiVersion}/poll/{token}{?question*,options%5B%5D*,resultMode*,maxVotes*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $createPoll_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$showPoll_Request`. - @_i2.experimental - _i1.DynamiteSerializer $showPoll_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(PollShowPollResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get a poll. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -6973,52 +6915,90 @@ class $PollClient { /// * 404: Poll not found /// /// See: - /// * [showPollRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$showPoll_Request] for the request send by this method. + /// * [$showPoll_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> showPoll({ required String token, required int pollId, PollShowPollApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await showPollRaw( + final _request = $showPoll_Request( token: token, pollId: pollId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $showPoll_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a poll. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$votePoll_Request]. + @_i2.experimental + _i1.DynamiteSerializer $votePoll_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(PollVotePollResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Vote on a poll. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [votePoll] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [optionIds] IDs of the selected options. Defaults to `[]`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [pollId] ID of the poll. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Poll returned + /// * 200: Voted successfully + /// * 400: Voting is not possible /// * 404: Poll not found /// /// See: - /// * [showPoll] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [votePoll] for a method executing this request and parsing the response. + /// * [$votePoll_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> showPollRaw({ + _i3.Request $votePoll_Request({ required String token, required int pollId, - PollShowPollApiVersion? apiVersion, + BuiltList? optionIds, + PollVotePollApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $pollId = _$jsonSerializers.serialize(pollId, specifiedType: const FullType(int)); + _parameters['pollId'] = $pollId; + + var $optionIds = _$jsonSerializers.serialize(optionIds, specifiedType: const FullType(BuiltList, [FullType(int)])); + $optionIds ??= []; + _parameters['optionIds%5B%5D'] = $optionIds; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PollVotePollApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/poll/{token}/{pollId}{?optionIds%5B%5D*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -7028,51 +7008,19 @@ class $PollClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $pollId = _$jsonSerializers.serialize(pollId, specifiedType: const FullType(int)); - _parameters['pollId'] = $pollId; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PollShowPollApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/poll/{token}/{pollId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $showPoll_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$votePoll_Request`. - @_i2.experimental - _i1.DynamiteSerializer $votePoll_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(PollVotePollResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Vote on a poll. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -7091,7 +7039,8 @@ class $PollClient { /// * 404: Poll not found /// /// See: - /// * [votePollRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$votePoll_Request] for the request send by this method. + /// * [$votePoll_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> votePoll({ required String token, required int pollId, @@ -7099,49 +7048,78 @@ class $PollClient { PollVotePollApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await votePollRaw( + final _request = $votePoll_Request( token: token, pollId: pollId, optionIds: optionIds, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $votePoll_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Vote on a poll. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$closePoll_Request]. + @_i2.experimental + _i1.DynamiteSerializer $closePoll_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(PollClosePollResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Close a poll. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [closePoll] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [optionIds] IDs of the selected options. Defaults to `[]`. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [pollId] ID of the poll. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Voted successfully - /// * 400: Voting is not possible + /// * 200: Poll closed successfully + /// * 400: Poll already closed + /// * 403: Missing permissions to close poll /// * 404: Poll not found + /// * 500 /// /// See: - /// * [votePoll] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [closePoll] for a method executing this request and parsing the response. + /// * [$closePoll_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> votePollRaw({ + _i3.Request $closePoll_Request({ required String token, required int pollId, - BuiltList? optionIds, - PollVotePollApiVersion? apiVersion, + PollClosePollApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $pollId = _$jsonSerializers.serialize(pollId, specifiedType: const FullType(int)); + _parameters['pollId'] = $pollId; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PollClosePollApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/poll/{token}/{pollId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -7151,56 +7129,19 @@ class $PollClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $pollId = _$jsonSerializers.serialize(pollId, specifiedType: const FullType(int)); - _parameters['pollId'] = $pollId; - - var $optionIds = _$jsonSerializers.serialize(optionIds, specifiedType: const FullType(BuiltList, [FullType(int)])); - $optionIds ??= []; - _parameters['optionIds%5B%5D'] = $optionIds; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PollVotePollApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/poll/{token}/{pollId}{?optionIds%5B%5D*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $votePoll_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$closePoll_Request`. - @_i2.experimental - _i1.DynamiteSerializer $closePoll_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(PollClosePollResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Close a poll. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -7220,55 +7161,85 @@ class $PollClient { /// * 500 /// /// See: - /// * [closePollRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$closePoll_Request] for the request send by this method. + /// * [$closePoll_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> closePoll({ required String token, required int pollId, PollClosePollApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await closePollRaw( + final _request = $closePoll_Request( token: token, pollId: pollId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $closePoll_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Close a poll. +class $PublicShareAuthClient { + /// Creates a new `DynamiteClient` for public_share_auth requests. + $PublicShareAuthClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$createRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $createRoom_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(PublicShareAuthCreateRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {201}, + ); + + /// Creates a new room for video verification (requesting the password of a share). /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// The new room is a public room associated with a "share:password" object with the ID of the share token. Unlike normal rooms in which the owner is the user that created the room these are special rooms always created by a guest or user on behalf of a registered user, the sharer, who will be the owner of the room. + /// The share must have "send password by Talk" enabled; an error is returned otherwise. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [createRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [shareToken] Token of the file share. /// * [apiVersion] Defaults to `v1`. - /// * [token] - /// * [pollId] ID of the poll. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Poll closed successfully - /// * 400: Poll already closed - /// * 403: Missing permissions to close poll - /// * 404: Poll not found - /// * 500 + /// * 201: Room created successfully + /// * 404: Share not found /// /// See: - /// * [closePoll] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [createRoom] for a method executing this request and parsing the response. + /// * [$createRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> closePollRaw({ - required String token, - required int pollId, - PollClosePollApiVersion? apiVersion, + _i3.Request $createRoom_Request({ + required String shareToken, + PublicShareAuthCreateRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $shareToken = _$jsonSerializers.serialize(shareToken, specifiedType: const FullType(String)); + _parameters['shareToken'] = $shareToken; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PublicShareAuthCreateRoomApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/publicshareauth{?shareToken*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -7278,58 +7249,18 @@ class $PollClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $pollId = _$jsonSerializers.serialize(pollId, specifiedType: const FullType(int)); - _parameters['pollId'] = $pollId; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PollClosePollApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/poll/{token}/{pollId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $closePoll_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $PublicShareAuthClient { - /// Creates a new `DynamiteClient` for public_share_auth requests. - $PublicShareAuthClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$createRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $createRoom_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(PublicShareAuthCreateRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {201}, - ); /// Creates a new room for video verification (requesting the password of a share). /// @@ -7349,51 +7280,96 @@ class $PublicShareAuthClient { /// * 404: Share not found /// /// See: - /// * [createRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$createRoom_Request] for the request send by this method. + /// * [$createRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> createRoom({ required String shareToken, PublicShareAuthCreateRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await createRoomRaw( + final _request = $createRoom_Request( shareToken: shareToken, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $createRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Creates a new room for video verification (requesting the password of a share). - /// - /// The new room is a public room associated with a "share:password" object with the ID of the share token. Unlike normal rooms in which the owner is the user that created the room these are special rooms always created by a guest or user on behalf of a registered user, the sharer, who will be the owner of the room. - /// The share must have "send password by Talk" enabled; an error is returned otherwise. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $ReactionClient { + /// Creates a new `DynamiteClient` for reaction requests. + $ReactionClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$getReactions_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getReactions_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(ReactionGetReactionsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a list of reactions for a message. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getReactions] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [shareToken] Token of the file share. + /// * [reaction] Emoji to filter. /// * [apiVersion] Defaults to `v1`. + /// * [token] + /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 201: Room created successfully - /// * 404: Share not found + /// * 200: Reactions returned + /// * 404: Message or reaction not found /// /// See: - /// * [createRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getReactions] for a method executing this request and parsing the response. + /// * [$getReactions_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createRoomRaw({ - required String shareToken, - PublicShareAuthCreateRoomApiVersion? apiVersion, + _i3.Request $getReactions_Request({ + required String token, + required int messageId, + String? reaction, + ReactionGetReactionsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); + _parameters['messageId'] = $messageId; + + final $reaction = _$jsonSerializers.serialize(reaction, specifiedType: const FullType(String)); + _parameters['reaction'] = $reaction; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ReactionGetReactionsApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/reaction/{token}/{messageId}{?reaction*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -7403,53 +7379,18 @@ class $PublicShareAuthClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $shareToken = _$jsonSerializers.serialize(shareToken, specifiedType: const FullType(String)); - _parameters['shareToken'] = $shareToken; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(PublicShareAuthCreateRoomApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/publicshareauth{?shareToken*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $createRoom_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $ReactionClient { - /// Creates a new `DynamiteClient` for reaction requests. - $ReactionClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$getReactions_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getReactions_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(ReactionGetReactionsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get a list of reactions for a message. /// @@ -7468,7 +7409,8 @@ class $ReactionClient { /// * 404: Message or reaction not found /// /// See: - /// * [getReactionsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getReactions_Request] for the request send by this method. + /// * [$getReactions_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getReactions({ required String token, required int messageId, @@ -7476,48 +7418,83 @@ class $ReactionClient { ReactionGetReactionsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getReactionsRaw( + final _request = $getReactions_Request( token: token, messageId: messageId, reaction: reaction, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getReactions_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a list of reactions for a message. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$react_Request]. + @_i2.experimental + _i1.DynamiteSerializer $react_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ReactionReactResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 201}, + ); + + /// Add a reaction to a message. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [react] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [reaction] Emoji to filter. + /// * [reaction] Emoji to add. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reactions returned - /// * 404: Message or reaction not found + /// * 200: Reaction already existed + /// * 201: Reaction added successfully + /// * 400: Adding reaction is not possible + /// * 404: Message not found /// /// See: - /// * [getReactions] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [react] for a method executing this request and parsing the response. + /// * [$react_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getReactionsRaw({ + _i3.Request $react_Request({ + required String reaction, required String token, required int messageId, - String? reaction, - ReactionGetReactionsApiVersion? apiVersion, + ReactionReactApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $reaction = _$jsonSerializers.serialize(reaction, specifiedType: const FullType(String)); + _parameters['reaction'] = $reaction; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); + _parameters['messageId'] = $messageId; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ReactionReactApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/reaction/{token}/{messageId}{?reaction*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -7527,56 +7504,19 @@ class $ReactionClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); - _parameters['messageId'] = $messageId; - - final $reaction = _$jsonSerializers.serialize(reaction, specifiedType: const FullType(String)); - _parameters['reaction'] = $reaction; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ReactionGetReactionsApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/reaction/{token}/{messageId}{?reaction*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getReactions_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$react_Request`. - @_i2.experimental - _i1.DynamiteSerializer $react_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ReactionReactResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 201}, - ); - /// Add a reaction to a message. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -7596,7 +7536,8 @@ class $ReactionClient { /// * 404: Message not found /// /// See: - /// * [reactRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$react_Request] for the request send by this method. + /// * [$react_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> react({ required String reaction, required String token, @@ -7604,70 +7545,64 @@ class $ReactionClient { ReactionReactApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await reactRaw( + final _request = $react_Request( reaction: reaction, token: token, messageId: messageId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $react_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Add a reaction to a message. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$$delete_Request]. + @_i2.experimental + _i1.DynamiteSerializer $$delete_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(ReactionDeleteResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Delete a reaction from a message. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [$delete] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [reaction] Emoji to add. + /// * [reaction] Emoji to remove. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reaction already existed - /// * 201: Reaction added successfully - /// * 400: Adding reaction is not possible + /// * 200: Reaction deleted successfully + /// * 400: Deleting reaction is not possible /// * 404: Message not found /// /// See: - /// * [react] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [$delete] for a method executing this request and parsing the response. + /// * [$$delete_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> reactRaw({ + _i3.Request $$delete_Request({ required String reaction, required String token, required int messageId, - ReactionReactApiVersion? apiVersion, + ReactionDeleteApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $reaction = _$jsonSerializers.serialize(reaction, specifiedType: const FullType(String)); _parameters['reaction'] = $reaction; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -7677,34 +7612,36 @@ class $ReactionClient { final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); _parameters['messageId'] = $messageId; - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ReactionReactApiVersion)); + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ReactionDeleteApiVersion)); $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/reaction/{token}/{messageId}{?reaction*}') + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/reaction/{token}/{messageId}{?reaction*}') .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $react_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$$delete_Request`. - @_i2.experimental - _i1.DynamiteSerializer $$delete_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(ReactionDeleteResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } /// Delete a reaction from a message. /// @@ -7724,7 +7661,8 @@ class $ReactionClient { /// * 404: Message not found /// /// See: - /// * [$deleteRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$$delete_Request] for the request send by this method. + /// * [$$delete_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> $delete({ required String reaction, required String token, @@ -7732,49 +7670,83 @@ class $ReactionClient { ReactionDeleteApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await $deleteRaw( + final _request = $$delete_Request( reaction: reaction, token: token, messageId: messageId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $$delete_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} + +class $RecordingClient { + /// Creates a new `DynamiteClient` for recording requests. + $RecordingClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$start_Request]. + @_i2.experimental + _i1.DynamiteSerializer $start_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RecordingStartResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); - /// Delete a reaction from a message. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Start the recording. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [start] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [reaction] Emoji to remove. + /// * [status] Type of the recording. /// * [apiVersion] Defaults to `v1`. /// * [token] - /// * [messageId] ID of the message. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Reaction deleted successfully - /// * 400: Deleting reaction is not possible - /// * 404: Message not found + /// * 200: Recording started successfully + /// * 400: Starting recording is not possible /// /// See: - /// * [$delete] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [start] for a method executing this request and parsing the response. + /// * [$start_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> $deleteRaw({ - required String reaction, + _i3.Request $start_Request({ + required int status, required String token, - required int messageId, - ReactionDeleteApiVersion? apiVersion, + RecordingStartApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $status = _$jsonSerializers.serialize(status, specifiedType: const FullType(int)); + _parameters['status'] = $status; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingStartApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}{?status*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -7784,61 +7756,20 @@ class $ReactionClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $reaction = _$jsonSerializers.serialize(reaction, specifiedType: const FullType(String)); - _parameters['reaction'] = $reaction; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(int)); - _parameters['messageId'] = $messageId; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ReactionDeleteApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/reaction/{token}/{messageId}{?reaction*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $$delete_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $RecordingClient { - /// Creates a new `DynamiteClient` for recording requests. - $RecordingClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$start_Request`. - @_i2.experimental - _i1.DynamiteSerializer $start_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RecordingStartResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Start the recording. /// @@ -7856,52 +7787,77 @@ class $RecordingClient { /// * 400: Starting recording is not possible /// /// See: - /// * [startRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$start_Request] for the request send by this method. + /// * [$start_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> start({ required int status, required String token, RecordingStartApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await startRaw( + final _request = $start_Request( status: status, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $start_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Start the recording. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$stop_Request]. + @_i2.experimental + _i1.DynamiteSerializer $stop_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RecordingStopResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Stop the recording. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [stop] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [status] Type of the recording. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Recording started successfully - /// * 400: Starting recording is not possible + /// * 200: Recording stopped successfully + /// * 400: Stopping recording is not possible /// /// See: - /// * [start] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [stop] for a method executing this request and parsing the response. + /// * [$stop_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> startRaw({ - required int status, + _i3.Request $stop_Request({ required String token, - RecordingStartApiVersion? apiVersion, + RecordingStopApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingStopApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -7911,7 +7867,7 @@ class $RecordingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -7919,46 +7875,13 @@ class $RecordingClient { } // coverage:ignore-end - final $status = _$jsonSerializers.serialize(status, specifiedType: const FullType(int)); - _parameters['status'] = $status; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingStartApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}{?status*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $start_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$stop_Request`. - @_i2.experimental - _i1.DynamiteSerializer $stop_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RecordingStopResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Stop the recording. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -7974,48 +7897,82 @@ class $RecordingClient { /// * 400: Stopping recording is not possible /// /// See: - /// * [stopRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$stop_Request] for the request send by this method. + /// * [$stop_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> stop({ required String token, RecordingStopApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await stopRaw( + final _request = $stop_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $stop_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Stop the recording. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$store_Request]. + @_i2.experimental + _i1.DynamiteSerializer $store_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RecordingStoreResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Store the recording. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [store] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [owner] User that will own the recording file. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Recording stopped successfully - /// * 400: Stopping recording is not possible + /// * 200: Recording stored successfully + /// * 400: Storing recording is not possible + /// * 401: Missing permissions to store recording /// /// See: - /// * [stop] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [store] for a method executing this request and parsing the response. + /// * [$store_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> stopRaw({ + _i3.Request $store_Request({ + required String owner, required String token, - RecordingStopApiVersion? apiVersion, + RecordingStoreApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $owner = _$jsonSerializers.serialize(owner, specifiedType: const FullType(String)); + _parameters['owner'] = $owner; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingStoreApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}/store{?owner*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -8025,50 +7982,19 @@ class $RecordingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingStopApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $stop_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$store_Request`. - @_i2.experimental - _i1.DynamiteSerializer $store_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RecordingStoreResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Store the recording. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -8086,53 +8012,86 @@ class $RecordingClient { /// * 401: Missing permissions to store recording /// /// See: - /// * [storeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$store_Request] for the request send by this method. + /// * [$store_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> store({ required String owner, required String token, RecordingStoreApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await storeRaw( + final _request = $store_Request( owner: owner, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $store_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Store the recording. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$notificationDismiss_Request]. + @_i2.experimental + _i1.DynamiteSerializer $notificationDismiss_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RecordingNotificationDismissResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Dismiss the store call recording notification. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [notificationDismiss] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [owner] User that will own the recording file. + /// * [timestamp] Timestamp of the notification to be dismissed. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Recording stored successfully - /// * 400: Storing recording is not possible - /// * 401: Missing permissions to store recording + /// * 200: Notification dismissed successfully + /// * 400: Dismissing notification is not possible /// /// See: - /// * [store] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [notificationDismiss] for a method executing this request and parsing the response. + /// * [$notificationDismiss_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> storeRaw({ - required String owner, + _i3.Request $notificationDismiss_Request({ + required int timestamp, required String token, - RecordingStoreApiVersion? apiVersion, + RecordingNotificationDismissApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $timestamp = _$jsonSerializers.serialize(timestamp, specifiedType: const FullType(int)); + _parameters['timestamp'] = $timestamp; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingNotificationDismissApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}/notification{?timestamp*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -8142,53 +8101,21 @@ class $RecordingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $owner = _$jsonSerializers.serialize(owner, specifiedType: const FullType(String)); - _parameters['owner'] = $owner; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingStoreApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}/store{?owner*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $store_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$notificationDismiss_Request`. - @_i2.experimental - _i1.DynamiteSerializer $notificationDismiss_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RecordingNotificationDismissResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Dismiss the store call recording notification. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -8205,52 +8132,92 @@ class $RecordingClient { /// * 400: Dismissing notification is not possible /// /// See: - /// * [notificationDismissRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$notificationDismiss_Request] for the request send by this method. + /// * [$notificationDismiss_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> notificationDismiss({ required int timestamp, required String token, RecordingNotificationDismissApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await notificationDismissRaw( + final _request = $notificationDismiss_Request( timestamp: timestamp, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $notificationDismiss_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Dismiss the store call recording notification. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$shareToChat_Request]. + @_i2.experimental + _i1.DynamiteSerializer $shareToChat_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RecordingShareToChatResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Share the recorded file to the chat. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [shareToChat] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [fileId] ID of the file. /// * [timestamp] Timestamp of the notification to be dismissed. /// * [apiVersion] Defaults to `v1`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Notification dismissed successfully - /// * 400: Dismissing notification is not possible + /// * 200: Recording shared to chat successfully + /// * 400: Sharing recording to chat is not possible /// /// See: - /// * [notificationDismiss] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [shareToChat] for a method executing this request and parsing the response. + /// * [$shareToChat_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> notificationDismissRaw({ + _i3.Request $shareToChat_Request({ + required int fileId, required int timestamp, required String token, - RecordingNotificationDismissApiVersion? apiVersion, + RecordingShareToChatApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); + _parameters['fileId'] = $fileId; + + final $timestamp = _$jsonSerializers.serialize(timestamp, specifiedType: const FullType(int)); + _parameters['timestamp'] = $timestamp; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingShareToChatApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}/share-chat{?fileId*,timestamp*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -8260,7 +8227,7 @@ class $RecordingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -8268,50 +8235,13 @@ class $RecordingClient { } // coverage:ignore-end - final $timestamp = _$jsonSerializers.serialize(timestamp, specifiedType: const FullType(int)); - _parameters['timestamp'] = $timestamp; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingNotificationDismissApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}/notification{?timestamp*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $notificationDismiss_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$shareToChat_Request`. - @_i2.experimental - _i1.DynamiteSerializer $shareToChat_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RecordingShareToChatResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Share the recorded file to the chat. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -8329,7 +8259,8 @@ class $RecordingClient { /// * 400: Sharing recording to chat is not possible /// /// See: - /// * [shareToChatRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$shareToChat_Request] for the request send by this method. + /// * [$shareToChat_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> shareToChat({ required int fileId, required int timestamp, @@ -8337,48 +8268,71 @@ class $RecordingClient { RecordingShareToChatApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await shareToChatRaw( + final _request = $shareToChat_Request( fileId: fileId, timestamp: timestamp, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $shareToChat_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Share the recorded file to the chat. + /// Builds a serializer to parse the response of [$getWelcomeMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getWelcomeMessage_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RecordingGetWelcomeMessageResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the welcome message of a recording server. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getWelcomeMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [fileId] ID of the file. - /// * [timestamp] Timestamp of the notification to be dismissed. /// * [apiVersion] Defaults to `v1`. - /// * [token] + /// * [serverId] ID of the server. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Recording shared to chat successfully - /// * 400: Sharing recording to chat is not possible + /// * 200: Welcome message returned + /// * 404: Recording server not found or not configured + /// * 500 /// /// See: - /// * [shareToChat] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getWelcomeMessage] for a method executing this request and parsing the response. + /// * [$getWelcomeMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> shareToChatRaw({ - required int fileId, - required int timestamp, - required String token, - RecordingShareToChatApiVersion? apiVersion, + _i3.Request $getWelcomeMessage_Request({ + required int serverId, + RecordingGetWelcomeMessageApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $serverId = _$jsonSerializers.serialize(serverId, specifiedType: const FullType(int)); + _parameters['serverId'] = $serverId; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingGetWelcomeMessageApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/welcome/{serverId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -8388,7 +8342,7 @@ class $RecordingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -8396,52 +8350,13 @@ class $RecordingClient { } // coverage:ignore-end - final $fileId = _$jsonSerializers.serialize(fileId, specifiedType: const FullType(int)); - _parameters['fileId'] = $fileId; - - final $timestamp = _$jsonSerializers.serialize(timestamp, specifiedType: const FullType(int)); - _parameters['timestamp'] = $timestamp; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingShareToChatApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/{token}/share-chat{?fileId*,timestamp*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $shareToChat_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getWelcomeMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getWelcomeMessage_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RecordingGetWelcomeMessageResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get the welcome message of a recording server. /// /// This endpoint requires admin access. @@ -8460,51 +8375,95 @@ class $RecordingClient { /// * 500 /// /// See: - /// * [getWelcomeMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getWelcomeMessage_Request] for the request send by this method. + /// * [$getWelcomeMessage_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getWelcomeMessage({ required int serverId, RecordingGetWelcomeMessageApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getWelcomeMessageRaw( + final _request = $getWelcomeMessage_Request( serverId: serverId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getWelcomeMessage_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Get the welcome message of a recording server. - /// - /// This endpoint requires admin access. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $RoomClient { + /// Creates a new `DynamiteClient` for room requests. + $RoomClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$getRooms_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getRooms_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomGetRoomsResponseApplicationJson), + headersType: const FullType(RoomRoomGetRoomsHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get all currently existent rooms which the user has joined. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getRooms] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [apiVersion] Defaults to `v1`. - /// * [serverId] ID of the server. + /// * [noStatusUpdate] When the user status should not be automatically set to online set to 1 (default 0). Defaults to `0`. + /// * [includeStatus] Include the user status. Defaults to `0`. + /// * [modifiedSince] Filter rooms modified after a timestamp. Defaults to `0`. + /// * [apiVersion] Defaults to `v4`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Welcome message returned - /// * 404: Recording server not found or not configured - /// * 500 + /// * 200: Return list of rooms /// /// See: - /// * [getWelcomeMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getRooms] for a method executing this request and parsing the response. + /// * [$getRooms_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getWelcomeMessageRaw({ - required int serverId, - RecordingGetWelcomeMessageApiVersion? apiVersion, + _i3.Request $getRooms_Request({ + RoomGetRoomsNoStatusUpdate? noStatusUpdate, + RoomGetRoomsIncludeStatus? includeStatus, + int? modifiedSince, + RoomGetRoomsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $noStatusUpdate = + _$jsonSerializers.serialize(noStatusUpdate, specifiedType: const FullType(RoomGetRoomsNoStatusUpdate)); + $noStatusUpdate ??= 0; + _parameters['noStatusUpdate'] = $noStatusUpdate; + + var $includeStatus = + _$jsonSerializers.serialize(includeStatus, specifiedType: const FullType(RoomGetRoomsIncludeStatus)); + $includeStatus ??= 0; + _parameters['includeStatus'] = $includeStatus; + + var $modifiedSince = _$jsonSerializers.serialize(modifiedSince, specifiedType: const FullType(int)); + $modifiedSince ??= 0; + _parameters['modifiedSince'] = $modifiedSince; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetRoomsApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room{?noStatusUpdate*,includeStatus*,modifiedSince*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -8514,7 +8473,7 @@ class $RecordingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -8522,47 +8481,12 @@ class $RecordingClient { } // coverage:ignore-end - final $serverId = _$jsonSerializers.serialize(serverId, specifiedType: const FullType(int)); - _parameters['serverId'] = $serverId; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RecordingGetWelcomeMessageApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/recording/welcome/{serverId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getWelcomeMessage_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } -} - -class $RoomClient { - /// Creates a new `DynamiteClient` for room requests. - $RoomClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$getRooms_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getRooms_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomGetRoomsResponseApplicationJson), - headersType: const FullType(RoomRoomGetRoomsHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get all currently existent rooms which the user has joined. /// @@ -8580,7 +8504,8 @@ class $RoomClient { /// * 200: Return list of rooms /// /// See: - /// * [getRoomsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getRooms_Request] for the request send by this method. + /// * [$getRooms_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getRooms({ RoomGetRoomsNoStatusUpdate? noStatusUpdate, RoomGetRoomsIncludeStatus? includeStatus, @@ -8588,47 +8513,102 @@ class $RoomClient { RoomGetRoomsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getRoomsRaw( + final _request = $getRooms_Request( noStatusUpdate: noStatusUpdate, includeStatus: includeStatus, modifiedSince: modifiedSince, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getRooms_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get all currently existent rooms which the user has joined. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$createRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $createRoom_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomCreateRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 201}, + ); + + /// Create a room with a user, a group or a circle. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [createRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// - /// Parameters: - /// * [noStatusUpdate] When the user status should not be automatically set to online set to 1 (default 0). Defaults to `0`. - /// * [includeStatus] Include the user status. Defaults to `0`. - /// * [modifiedSince] Filter rooms modified after a timestamp. Defaults to `0`. + /// Parameters: + /// * [roomType] Type of the room. + /// * [invite] User, group, … ID to invite. Defaults to `''`. + /// * [roomName] Name of the room. Defaults to `''`. + /// * [source] Source of the invite ID ('circles' to create a room with a circle, etc.). Defaults to `''`. + /// * [objectType] Type of the object. Defaults to `''`. + /// * [objectId] ID of the object. Defaults to `''`. /// * [apiVersion] Defaults to `v4`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Return list of rooms + /// * 200: Room already existed + /// * 201: Room created successfully + /// * 400: Room type invalid + /// * 403: Missing permissions to create room + /// * 404: User, group or other target to invite was not found /// /// See: - /// * [getRooms] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [createRoom] for a method executing this request and parsing the response. + /// * [$createRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getRoomsRaw({ - RoomGetRoomsNoStatusUpdate? noStatusUpdate, - RoomGetRoomsIncludeStatus? includeStatus, - int? modifiedSince, - RoomGetRoomsApiVersion? apiVersion, + _i3.Request $createRoom_Request({ + required int roomType, + String? invite, + String? roomName, + String? source, + String? objectType, + String? objectId, + RoomCreateRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $roomType = _$jsonSerializers.serialize(roomType, specifiedType: const FullType(int)); + _parameters['roomType'] = $roomType; + + var $invite = _$jsonSerializers.serialize(invite, specifiedType: const FullType(String)); + $invite ??= ''; + _parameters['invite'] = $invite; + var $roomName = _$jsonSerializers.serialize(roomName, specifiedType: const FullType(String)); + $roomName ??= ''; + _parameters['roomName'] = $roomName; + + var $source = _$jsonSerializers.serialize(source, specifiedType: const FullType(String)); + $source ??= ''; + _parameters['source'] = $source; + + var $objectType = _$jsonSerializers.serialize(objectType, specifiedType: const FullType(String)); + $objectType ??= ''; + _parameters['objectType'] = $objectType; + + var $objectId = _$jsonSerializers.serialize(objectId, specifiedType: const FullType(String)); + $objectId ??= ''; + _parameters['objectId'] = $objectId; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomCreateRoomApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate( + '/ocs/v2.php/apps/spreed/api/{apiVersion}/room{?roomType*,invite*,roomName*,source*,objectType*,objectId*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -8638,7 +8618,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -8646,52 +8626,13 @@ class $RoomClient { } // coverage:ignore-end - var $noStatusUpdate = - _$jsonSerializers.serialize(noStatusUpdate, specifiedType: const FullType(RoomGetRoomsNoStatusUpdate)); - $noStatusUpdate ??= 0; - _parameters['noStatusUpdate'] = $noStatusUpdate; - - var $includeStatus = - _$jsonSerializers.serialize(includeStatus, specifiedType: const FullType(RoomGetRoomsIncludeStatus)); - $includeStatus ??= 0; - _parameters['includeStatus'] = $includeStatus; - - var $modifiedSince = _$jsonSerializers.serialize(modifiedSince, specifiedType: const FullType(int)); - $modifiedSince ??= 0; - _parameters['modifiedSince'] = $modifiedSince; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetRoomsApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room{?noStatusUpdate*,includeStatus*,modifiedSince*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getRooms_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$createRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $createRoom_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomCreateRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 201}, - ); - /// Create a room with a user, a group or a circle. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -8715,7 +8656,8 @@ class $RoomClient { /// * 404: User, group or other target to invite was not found /// /// See: - /// * [createRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$createRoom_Request] for the request send by this method. + /// * [$createRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> createRoom({ required int roomType, String? invite, @@ -8726,7 +8668,7 @@ class $RoomClient { RoomCreateRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await createRoomRaw( + final _request = $createRoom_Request( roomType: roomType, invite: invite, roomName: roomName, @@ -8736,50 +8678,61 @@ class $RoomClient { apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $createRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Create a room with a user, a group or a circle. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getListedRooms_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getListedRooms_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomGetListedRoomsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get listed rooms with optional search term. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getListedRooms] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [roomType] Type of the room. - /// * [invite] User, group, … ID to invite. Defaults to `''`. - /// * [roomName] Name of the room. Defaults to `''`. - /// * [source] Source of the invite ID ('circles' to create a room with a circle, etc.). Defaults to `''`. - /// * [objectType] Type of the object. Defaults to `''`. - /// * [objectId] ID of the object. Defaults to `''`. + /// * [searchTerm] search term. Defaults to `''`. /// * [apiVersion] Defaults to `v4`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Room already existed - /// * 201: Room created successfully - /// * 400: Room type invalid - /// * 403: Missing permissions to create room - /// * 404: User, group or other target to invite was not found + /// * 200: Return list of matching rooms /// /// See: - /// * [createRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getListedRooms] for a method executing this request and parsing the response. + /// * [$getListedRooms_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createRoomRaw({ - required int roomType, - String? invite, - String? roomName, - String? source, - String? objectType, - String? objectId, - RoomCreateRoomApiVersion? apiVersion, + _i3.Request $getListedRooms_Request({ + String? searchTerm, + RoomGetListedRoomsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $searchTerm = _$jsonSerializers.serialize(searchTerm, specifiedType: const FullType(String)); + $searchTerm ??= ''; + _parameters['searchTerm'] = $searchTerm; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetListedRoomsApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/listed-room{?searchTerm*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -8789,7 +8742,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -8797,60 +8750,13 @@ class $RoomClient { } // coverage:ignore-end - final $roomType = _$jsonSerializers.serialize(roomType, specifiedType: const FullType(int)); - _parameters['roomType'] = $roomType; - - var $invite = _$jsonSerializers.serialize(invite, specifiedType: const FullType(String)); - $invite ??= ''; - _parameters['invite'] = $invite; - - var $roomName = _$jsonSerializers.serialize(roomName, specifiedType: const FullType(String)); - $roomName ??= ''; - _parameters['roomName'] = $roomName; - - var $source = _$jsonSerializers.serialize(source, specifiedType: const FullType(String)); - $source ??= ''; - _parameters['source'] = $source; - - var $objectType = _$jsonSerializers.serialize(objectType, specifiedType: const FullType(String)); - $objectType ??= ''; - _parameters['objectType'] = $objectType; - - var $objectId = _$jsonSerializers.serialize(objectId, specifiedType: const FullType(String)); - $objectId ??= ''; - _parameters['objectId'] = $objectId; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomCreateRoomApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/spreed/api/{apiVersion}/room{?roomType*,invite*,roomName*,source*,objectType*,objectId*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $createRoom_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getListedRooms_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getListedRooms_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomGetListedRoomsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get listed rooms with optional search term. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -8865,47 +8771,68 @@ class $RoomClient { /// * 200: Return list of matching rooms /// /// See: - /// * [getListedRoomsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getListedRooms_Request] for the request send by this method. + /// * [$getListedRooms_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getListedRooms({ String? searchTerm, RoomGetListedRoomsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getListedRoomsRaw( + final _request = $getListedRooms_Request( searchTerm: searchTerm, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getListedRooms_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get listed rooms with optional search term. + /// Builds a serializer to parse the response of [$getNoteToSelfConversation_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getNoteToSelfConversation_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomGetNoteToSelfConversationResponseApplicationJson), + headersType: const FullType(RoomRoomGetNoteToSelfConversationHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the "Note to self" conversation for the user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// It will be automatically created when it is currently missing. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getNoteToSelfConversation] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [searchTerm] search term. Defaults to `''`. /// * [apiVersion] Defaults to `v4`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Return list of matching rooms + /// * 200: Room returned successfully /// /// See: - /// * [getListedRooms] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getNoteToSelfConversation] for a method executing this request and parsing the response. + /// * [$getNoteToSelfConversation_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getListedRoomsRaw({ - String? searchTerm, - RoomGetListedRoomsApiVersion? apiVersion, + _i3.Request $getNoteToSelfConversation_Request({ + RoomGetNoteToSelfConversationApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetNoteToSelfConversationApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/note-to-self').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -8915,7 +8842,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -8923,41 +8850,13 @@ class $RoomClient { } // coverage:ignore-end - var $searchTerm = _$jsonSerializers.serialize(searchTerm, specifiedType: const FullType(String)); - $searchTerm ??= ''; - _parameters['searchTerm'] = $searchTerm; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetListedRoomsApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/listed-room{?searchTerm*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getListedRooms_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getNoteToSelfConversation_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getNoteToSelfConversation_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomGetNoteToSelfConversationResponseApplicationJson), - headersType: const FullType(RoomRoomGetNoteToSelfConversationHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get the "Note to self" conversation for the user. /// /// It will be automatically created when it is currently missing. @@ -8973,49 +8872,79 @@ class $RoomClient { /// * 200: Room returned successfully /// /// See: - /// * [getNoteToSelfConversationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getNoteToSelfConversation_Request] for the request send by this method. + /// * [$getNoteToSelfConversation_Serializer] for a converter to parse the `Response` from an executed request. Future< _i1.DynamiteResponse> getNoteToSelfConversation({ RoomGetNoteToSelfConversationApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getNoteToSelfConversationRaw( + final _request = $getNoteToSelfConversation_Request( apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getNoteToSelfConversation_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the "Note to self" conversation for the user. - /// - /// It will be automatically created when it is currently missing. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getSingleRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getSingleRoom_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomGetSingleRoomResponseApplicationJson), + headersType: const FullType(RoomRoomGetSingleRoomHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getSingleRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [apiVersion] Defaults to `v4`. + /// * [token] Token of the room. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Room returned successfully + /// * 200: Room returned + /// * 401: SIP request invalid + /// * 404: Room not found /// /// See: - /// * [getNoteToSelfConversation] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getSingleRoom] for a method executing this request and parsing the response. + /// * [$getSingleRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future< - _i1.DynamiteRawResponse> getNoteToSelfConversationRaw({ - RoomGetNoteToSelfConversationApiVersion? apiVersion, + _i3.Request $getSingleRoom_Request({ + required String token, + RoomGetSingleRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetSingleRoomApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -9025,46 +8954,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetNoteToSelfConversationApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/note-to-self').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getNoteToSelfConversation_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getSingleRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getSingleRoom_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomGetSingleRoomResponseApplicationJson), - headersType: const FullType(RoomRoomGetSingleRoomHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -9081,50 +8983,83 @@ class $RoomClient { /// * 404: Room not found /// /// See: - /// * [getSingleRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getSingleRoom_Request] for the request send by this method. + /// * [$getSingleRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getSingleRoom({ required String token, RoomGetSingleRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getSingleRoomRaw( + final _request = $getSingleRoom_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getSingleRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$renameRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $renameRoom_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomRenameRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Rename a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [renameRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [roomName] New name. /// * [apiVersion] Defaults to `v4`. - /// * [token] Token of the room. + /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Room returned - /// * 401: SIP request invalid - /// * 404: Room not found + /// * 200: Room renamed successfully + /// * 400: Renaming room is not possible /// /// See: - /// * [getSingleRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [renameRoom] for a method executing this request and parsing the response. + /// * [$renameRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getSingleRoomRaw({ + _i3.Request $renameRoom_Request({ + required String roomName, required String token, - RoomGetSingleRoomApiVersion? apiVersion, + RoomRenameRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $roomName = _$jsonSerializers.serialize(roomName, specifiedType: const FullType(String)); + _parameters['roomName'] = $roomName; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomRenameRoomApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}{?roomName*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -9134,51 +9069,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetSingleRoomApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getSingleRoom_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$renameRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $renameRoom_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomRenameRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Rename a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -9195,52 +9098,78 @@ class $RoomClient { /// * 400: Renaming room is not possible /// /// See: - /// * [renameRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$renameRoom_Request] for the request send by this method. + /// * [$renameRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> renameRoom({ required String roomName, required String token, RoomRenameRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await renameRoomRaw( + final _request = $renameRoom_Request( roomName: roomName, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $renameRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Rename a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$deleteRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteRoom_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomDeleteRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Delete a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [roomName] New name. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Room renamed successfully - /// * 400: Renaming room is not possible + /// * 200: Room successfully deleted + /// * 400: Deleting room is not possible /// /// See: - /// * [renameRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteRoom] for a method executing this request and parsing the response. + /// * [$deleteRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> renameRoomRaw({ - required String roomName, + _i3.Request $deleteRoom_Request({ required String token, - RoomRenameRoomApiVersion? apiVersion, + RoomDeleteRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomDeleteRoomApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -9250,53 +9179,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $roomName = _$jsonSerializers.serialize(roomName, specifiedType: const FullType(String)); - _parameters['roomName'] = $roomName; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomRenameRoomApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}{?roomName*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $renameRoom_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteRoom_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomDeleteRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Delete a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -9312,26 +9207,41 @@ class $RoomClient { /// * 400: Deleting room is not possible /// /// See: - /// * [deleteRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteRoom_Request] for the request send by this method. + /// * [$deleteRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteRoom({ required String token, RoomDeleteRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteRoomRaw( + final _request = $deleteRoom_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $deleteRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Delete a room. + /// Builds a serializer to parse the response of [$getBreakoutRooms_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getBreakoutRooms_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomGetBreakoutRoomsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get breakout rooms. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// All for moderators and in case of "free selection", or the assigned breakout room for other participants. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getBreakoutRooms] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -9340,20 +9250,37 @@ class $RoomClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Room successfully deleted - /// * 400: Deleting room is not possible + /// * 200: Breakout rooms returned + /// * 400: Getting breakout rooms is not possible /// /// See: - /// * [deleteRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getBreakoutRooms] for a method executing this request and parsing the response. + /// * [$getBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteRoomRaw({ + _i3.Request $getBreakoutRooms_Request({ required String token, - RoomDeleteRoomApiVersion? apiVersion, + RoomGetBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetBreakoutRoomsApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/breakout-rooms').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -9363,49 +9290,21 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomDeleteRoomApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $deleteRoom_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getBreakoutRooms_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getBreakoutRooms_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomGetBreakoutRoomsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get breakout rooms. /// /// All for moderators and in case of "free selection", or the assigned breakout room for other participants. @@ -9423,28 +9322,39 @@ class $RoomClient { /// * 400: Getting breakout rooms is not possible /// /// See: - /// * [getBreakoutRoomsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getBreakoutRooms_Request] for the request send by this method. + /// * [$getBreakoutRooms_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getBreakoutRooms({ required String token, RoomGetBreakoutRoomsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getBreakoutRoomsRaw( + final _request = $getBreakoutRooms_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getBreakoutRooms_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get breakout rooms. - /// - /// All for moderators and in case of "free selection", or the assigned breakout room for other participants. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$makePublic_Request]. + @_i2.experimental + _i1.DynamiteSerializer $makePublic_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomMakePublicResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Allowed guests to join conversation. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [makePublic] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -9453,20 +9363,35 @@ class $RoomClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Breakout rooms returned - /// * 400: Getting breakout rooms is not possible + /// * 200: Allowed guests successfully + /// * 400: Allowing guests is not possible /// /// See: - /// * [getBreakoutRooms] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [makePublic] for a method executing this request and parsing the response. + /// * [$makePublic_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getBreakoutRoomsRaw({ + _i3.Request $makePublic_Request({ required String token, - RoomGetBreakoutRoomsApiVersion? apiVersion, + RoomMakePublicApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomMakePublicApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/public').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -9476,7 +9401,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -9484,45 +9409,13 @@ class $RoomClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetBreakoutRoomsApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/breakout-rooms').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getBreakoutRooms_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$makePublic_Request`. - @_i2.experimental - _i1.DynamiteSerializer $makePublic_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomMakePublicResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Allowed guests to join conversation. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -9538,26 +9431,39 @@ class $RoomClient { /// * 400: Allowing guests is not possible /// /// See: - /// * [makePublicRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$makePublic_Request] for the request send by this method. + /// * [$makePublic_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> makePublic({ required String token, RoomMakePublicApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await makePublicRaw( + final _request = $makePublic_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $makePublic_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Allowed guests to join conversation. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$makePrivate_Request]. + @_i2.experimental + _i1.DynamiteSerializer $makePrivate_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomMakePrivateResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Disallowed guests to join conversation. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [makePrivate] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -9566,20 +9472,35 @@ class $RoomClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Allowed guests successfully - /// * 400: Allowing guests is not possible + /// * 200: Room unpublished Disallowing guests successfully + /// * 400: Disallowing guests is not possible /// /// See: - /// * [makePublic] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [makePrivate] for a method executing this request and parsing the response. + /// * [$makePrivate_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> makePublicRaw({ + _i3.Request $makePrivate_Request({ required String token, - RoomMakePublicApiVersion? apiVersion, + RoomMakePrivateApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomMakePrivateApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/public').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -9589,7 +9510,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -9597,43 +9518,13 @@ class $RoomClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomMakePublicApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/public').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $makePublic_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$makePrivate_Request`. - @_i2.experimental - _i1.DynamiteSerializer $makePrivate_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomMakePrivateResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Disallowed guests to join conversation. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -9649,48 +9540,83 @@ class $RoomClient { /// * 400: Disallowing guests is not possible /// /// See: - /// * [makePrivateRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$makePrivate_Request] for the request send by this method. + /// * [$makePrivate_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> makePrivate({ required String token, RoomMakePrivateApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await makePrivateRaw( + final _request = $makePrivate_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $makePrivate_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Disallowed guests to join conversation. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setDescription_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setDescription_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetDescriptionResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Update the description of a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setDescription] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [description] New description. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Room unpublished Disallowing guests successfully - /// * 400: Disallowing guests is not possible + /// * 200: Description updated successfully + /// * 400: Updating description is not possible /// /// See: - /// * [makePrivate] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setDescription] for a method executing this request and parsing the response. + /// * [$setDescription_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> makePrivateRaw({ + _i3.Request $setDescription_Request({ + required String description, required String token, - RoomMakePrivateApiVersion? apiVersion, + RoomSetDescriptionApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $description = _$jsonSerializers.serialize(description, specifiedType: const FullType(String)); + _parameters['description'] = $description; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetDescriptionApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/description{?description*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -9700,51 +9626,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomMakePrivateApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/public').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $makePrivate_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setDescription_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setDescription_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetDescriptionResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Update the description of a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -9761,52 +9655,84 @@ class $RoomClient { /// * 400: Updating description is not possible /// /// See: - /// * [setDescriptionRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setDescription_Request] for the request send by this method. + /// * [$setDescription_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setDescription({ required String description, required String token, RoomSetDescriptionApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setDescriptionRaw( + final _request = $setDescription_Request( description: description, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setDescription_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update the description of a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setReadOnly_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setReadOnly_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetReadOnlyResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Set read-only state of a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setReadOnly] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [description] New description. + /// * [state] New read-only state. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Description updated successfully - /// * 400: Updating description is not possible + /// * 200: Read-only state updated successfully + /// * 400: Updating read-only state is not possible /// /// See: - /// * [setDescription] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setReadOnly] for a method executing this request and parsing the response. + /// * [$setReadOnly_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setDescriptionRaw({ - required String description, + _i3.Request $setReadOnly_Request({ + required RoomSetReadOnlyState state, required String token, - RoomSetDescriptionApiVersion? apiVersion, + RoomSetReadOnlyApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $state = _$jsonSerializers.serialize(state, specifiedType: const FullType(RoomSetReadOnlyState)); + _parameters['state'] = $state; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetReadOnlyApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/read-only{?state*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -9816,54 +9742,21 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $description = _$jsonSerializers.serialize(description, specifiedType: const FullType(String)); - _parameters['description'] = $description; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetDescriptionApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/description{?description*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setDescription_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setReadOnly_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setReadOnly_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetReadOnlyResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Set read-only state of a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -9880,52 +9773,84 @@ class $RoomClient { /// * 400: Updating read-only state is not possible /// /// See: - /// * [setReadOnlyRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setReadOnly_Request] for the request send by this method. + /// * [$setReadOnly_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setReadOnly({ required RoomSetReadOnlyState state, required String token, RoomSetReadOnlyApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setReadOnlyRaw( + final _request = $setReadOnly_Request( state: state, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setReadOnly_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Set read-only state of a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setListable_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setListable_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetListableResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Make a room listable. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setListable] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [state] New read-only state. + /// * [scope] Scope where the room is listable. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Read-only state updated successfully - /// * 400: Updating read-only state is not possible + /// * 200: Made room listable successfully + /// * 400: Making room listable is not possible /// /// See: - /// * [setReadOnly] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setListable] for a method executing this request and parsing the response. + /// * [$setListable_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setReadOnlyRaw({ - required RoomSetReadOnlyState state, + _i3.Request $setListable_Request({ + required RoomSetListableScope scope, required String token, - RoomSetReadOnlyApiVersion? apiVersion, + RoomSetListableApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $scope = _$jsonSerializers.serialize(scope, specifiedType: const FullType(RoomSetListableScope)); + _parameters['scope'] = $scope; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetListableApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/listable{?scope*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -9935,7 +9860,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -9943,47 +9868,13 @@ class $RoomClient { } // coverage:ignore-end - final $state = _$jsonSerializers.serialize(state, specifiedType: const FullType(RoomSetReadOnlyState)); - _parameters['state'] = $state; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetReadOnlyApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/read-only{?state*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setReadOnly_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setListable_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setListable_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetListableResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Make a room listable. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -10000,52 +9891,85 @@ class $RoomClient { /// * 400: Making room listable is not possible /// /// See: - /// * [setListableRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setListable_Request] for the request send by this method. + /// * [$setListable_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setListable({ required RoomSetListableScope scope, required String token, RoomSetListableApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setListableRaw( + final _request = $setListable_Request( scope: scope, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setListable_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Make a room listable. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setPassword_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setPassword_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetPasswordResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 403}, + ); + + /// Set a password for a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setPassword] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [scope] Scope where the room is listable. + /// * [password] New password. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Made room listable successfully - /// * 400: Making room listable is not possible + /// * 200: Password set successfully + /// * 403: Setting password is not allowed + /// * 400: Setting password is not possible /// /// See: - /// * [setListable] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setPassword] for a method executing this request and parsing the response. + /// * [$setPassword_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setListableRaw({ - required RoomSetListableScope scope, + _i3.Request $setPassword_Request({ + required String password, required String token, - RoomSetListableApiVersion? apiVersion, + RoomSetPasswordApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $password = _$jsonSerializers.serialize(password, specifiedType: const FullType(String)); + _parameters['password'] = $password; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetPasswordApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/password{?password*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -10055,55 +9979,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $scope = _$jsonSerializers.serialize(scope, specifiedType: const FullType(RoomSetListableScope)); - _parameters['scope'] = $scope; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetListableApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/listable{?scope*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setListable_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setPassword_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setPassword_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetPasswordResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 403}, - ); - /// Set a password for a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -10121,53 +10009,97 @@ class $RoomClient { /// * 400: Setting password is not possible /// /// See: - /// * [setPasswordRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setPassword_Request] for the request send by this method. + /// * [$setPassword_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setPassword({ required String password, required String token, RoomSetPasswordApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setPasswordRaw( + final _request = $setPassword_Request( password: password, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setPassword_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Set a password for a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setPermissions_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setPermissions_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetPermissionsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Update the permissions of a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setPermissions] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [password] New password. + /// * [permissions] New permissions. /// * [apiVersion] Defaults to `v4`. /// * [token] + /// * [mode] Level of the permissions ('call', 'default'). /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Password set successfully - /// * 403: Setting password is not allowed - /// * 400: Setting password is not possible + /// * 200: Permissions updated successfully + /// * 400: Updating permissions is not possible /// /// See: - /// * [setPassword] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setPermissions] for a method executing this request and parsing the response. + /// * [$setPermissions_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setPasswordRaw({ - required String password, + _i3.Request $setPermissions_Request({ + required RoomSetPermissionsPermissions permissions, required String token, - RoomSetPasswordApiVersion? apiVersion, + required RoomSetPermissionsMode mode, + RoomSetPermissionsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $permissions = + _$jsonSerializers.serialize(permissions, specifiedType: const FullType(RoomSetPermissionsPermissions)); + _parameters['permissions'] = $permissions; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $mode = _$jsonSerializers.serialize(mode, specifiedType: const FullType(RoomSetPermissionsMode)); + _i4.checkPattern( + $mode as String?, + RegExp(r'^(call|default)$'), + 'mode', + ); + _parameters['mode'] = $mode; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetPermissionsApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/permissions/{mode}{?permissions*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -10177,53 +10109,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $password = _$jsonSerializers.serialize(password, specifiedType: const FullType(String)); - _parameters['password'] = $password; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetPasswordApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/password{?password*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setPassword_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setPermissions_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setPermissions_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetPermissionsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Update the permissions of a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -10241,7 +10139,8 @@ class $RoomClient { /// * 400: Updating permissions is not possible /// /// See: - /// * [setPermissionsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setPermissions_Request] for the request send by this method. + /// * [$setPermissions_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setPermissions({ required RoomSetPermissionsPermissions permissions, required String token, @@ -10249,48 +10148,80 @@ class $RoomClient { RoomSetPermissionsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setPermissionsRaw( + final _request = $setPermissions_Request( permissions: permissions, token: token, mode: mode, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setPermissions_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update the permissions of a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getParticipants_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $getParticipants_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomGetParticipantsResponseApplicationJson), + headersType: const FullType(RoomRoomGetParticipantsHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get a list of participants for a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getParticipants] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [permissions] New permissions. + /// * [includeStatus] Include the user statuses. Defaults to `0`. /// * [apiVersion] Defaults to `v4`. /// * [token] - /// * [mode] Level of the permissions ('call', 'default'). /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Permissions updated successfully - /// * 400: Updating permissions is not possible + /// * 200: Participants returned + /// * 403: Missing permissions for getting participants /// /// See: - /// * [setPermissions] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getParticipants] for a method executing this request and parsing the response. + /// * [$getParticipants_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setPermissionsRaw({ - required RoomSetPermissionsPermissions permissions, + _i3.Request $getParticipants_Request({ required String token, - required RoomSetPermissionsMode mode, - RoomSetPermissionsApiVersion? apiVersion, + RoomGetParticipantsIncludeStatus? includeStatus, + RoomGetParticipantsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $includeStatus = + _$jsonSerializers.serialize(includeStatus, specifiedType: const FullType(RoomGetParticipantsIncludeStatus)); + $includeStatus ??= 0; + _parameters['includeStatus'] = $includeStatus; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetParticipantsApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants{?includeStatus*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -10300,64 +10231,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $permissions = - _$jsonSerializers.serialize(permissions, specifiedType: const FullType(RoomSetPermissionsPermissions)); - _parameters['permissions'] = $permissions; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $mode = _$jsonSerializers.serialize(mode, specifiedType: const FullType(RoomSetPermissionsMode)); - _i3.checkPattern( - $mode as String?, - RegExp(r'^(call|default)$'), - 'mode', - ); - _parameters['mode'] = $mode; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetPermissionsApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/permissions/{mode}{?permissions*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setPermissions_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getParticipants_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $getParticipants_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomGetParticipantsResponseApplicationJson), - headersType: const FullType(RoomRoomGetParticipantsHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get a list of participants for a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -10374,7 +10260,8 @@ class $RoomClient { /// * 403: Missing permissions for getting participants /// /// See: - /// * [getParticipantsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getParticipants_Request] for the request send by this method. + /// * [$getParticipants_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getParticipants({ required String token, @@ -10382,46 +10269,88 @@ class $RoomClient { RoomGetParticipantsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getParticipantsRaw( + final _request = $getParticipants_Request( token: token, includeStatus: includeStatus, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getParticipants_Serializer(); + final _rawResponse = + await _i1.ResponseConverter( + _serializer, + ).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get a list of participants for a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$addParticipantToRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $addParticipantToRoom_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomAddParticipantToRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Add a participant to a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [addParticipantToRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [includeStatus] Include the user statuses. Defaults to `0`. + /// * [newParticipant] New participant. + /// * [source] Source of the participant. Defaults to `users`. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// - /// Status codes: - /// * 200: Participants returned - /// * 403: Missing permissions for getting participants + /// Status codes: + /// * 200: Participant successfully added + /// * 404: User, group or other target to invite was not found + /// * 501: SIP dial-out is not configured + /// * 400: Adding participant is not possible /// /// See: - /// * [getParticipants] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [addParticipantToRoom] for a method executing this request and parsing the response. + /// * [$addParticipantToRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - getParticipantsRaw({ + _i3.Request $addParticipantToRoom_Request({ + required String newParticipant, required String token, - RoomGetParticipantsIncludeStatus? includeStatus, - RoomGetParticipantsApiVersion? apiVersion, + RoomAddParticipantToRoomSource? source, + RoomAddParticipantToRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $newParticipant = _$jsonSerializers.serialize(newParticipant, specifiedType: const FullType(String)); + _parameters['newParticipant'] = $newParticipant; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $source = _$jsonSerializers.serialize(source, specifiedType: const FullType(RoomAddParticipantToRoomSource)); + $source ??= 'users'; + _parameters['source'] = $source; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomAddParticipantToRoomApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants{?newParticipant*,source*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -10431,58 +10360,21 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $includeStatus = - _$jsonSerializers.serialize(includeStatus, specifiedType: const FullType(RoomGetParticipantsIncludeStatus)); - $includeStatus ??= 0; - _parameters['includeStatus'] = $includeStatus; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomGetParticipantsApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants{?includeStatus*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getParticipants_Serializer(); - return _i1.ResponseConverter( - _serializer, - ).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$addParticipantToRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $addParticipantToRoom_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomAddParticipantToRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Add a participant to a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -10502,7 +10394,8 @@ class $RoomClient { /// * 400: Adding participant is not possible /// /// See: - /// * [addParticipantToRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$addParticipantToRoom_Request] for the request send by this method. + /// * [$addParticipantToRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> addParticipantToRoom({ required String newParticipant, required String token, @@ -10510,50 +10403,87 @@ class $RoomClient { RoomAddParticipantToRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await addParticipantToRoomRaw( + final _request = $addParticipantToRoom_Request( newParticipant: newParticipant, token: token, source: source, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $addParticipantToRoom_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Add a participant to a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$getBreakoutRoomParticipants_Request]. + @_i2.experimental + _i1.DynamiteSerializer< + RoomGetBreakoutRoomParticipantsResponseApplicationJson, RoomRoomGetBreakoutRoomParticipantsHeaders> + $getBreakoutRoomParticipants_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomGetBreakoutRoomParticipantsResponseApplicationJson), + headersType: const FullType(RoomRoomGetBreakoutRoomParticipantsHeaders), + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the breakout room participants for a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getBreakoutRoomParticipants] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [newParticipant] New participant. - /// * [source] Source of the participant. Defaults to `users`. + /// * [includeStatus] Include the user statuses. Defaults to `0`. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Participant successfully added - /// * 404: User, group or other target to invite was not found - /// * 501: SIP dial-out is not configured - /// * 400: Adding participant is not possible + /// * 200: Breakout room participants returned + /// * 400: Getting breakout room participants is not possible + /// * 403: Missing permissions to get breakout room participants /// /// See: - /// * [addParticipantToRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getBreakoutRoomParticipants] for a method executing this request and parsing the response. + /// * [$getBreakoutRoomParticipants_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> addParticipantToRoomRaw({ - required String newParticipant, + _i3.Request $getBreakoutRoomParticipants_Request({ required String token, - RoomAddParticipantToRoomSource? source, - RoomAddParticipantToRoomApiVersion? apiVersion, + RoomGetBreakoutRoomParticipantsIncludeStatus? includeStatus, + RoomGetBreakoutRoomParticipantsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $includeStatus = _$jsonSerializers.serialize( + includeStatus, + specifiedType: const FullType(RoomGetBreakoutRoomParticipantsIncludeStatus), + ); + $includeStatus ??= 0; + _parameters['includeStatus'] = $includeStatus; + + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(RoomGetBreakoutRoomParticipantsApiVersion), + ); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate( + '/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/breakout-rooms/participants{?includeStatus*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -10563,62 +10493,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $newParticipant = _$jsonSerializers.serialize(newParticipant, specifiedType: const FullType(String)); - _parameters['newParticipant'] = $newParticipant; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $source = _$jsonSerializers.serialize(source, specifiedType: const FullType(RoomAddParticipantToRoomSource)); - $source ??= 'users'; - _parameters['source'] = $source; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomAddParticipantToRoomApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants{?newParticipant*,source*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $addParticipantToRoom_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getBreakoutRoomParticipants_Request`. - @_i2.experimental - _i1.DynamiteSerializer< - RoomGetBreakoutRoomParticipantsResponseApplicationJson, RoomRoomGetBreakoutRoomParticipantsHeaders> - $getBreakoutRoomParticipants_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomGetBreakoutRoomParticipantsResponseApplicationJson), - headersType: const FullType(RoomRoomGetBreakoutRoomParticipantsHeaders), - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Get the breakout room participants for a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -10636,7 +10523,8 @@ class $RoomClient { /// * 403: Missing permissions to get breakout room participants /// /// See: - /// * [getBreakoutRoomParticipantsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getBreakoutRoomParticipants_Request] for the request send by this method. + /// * [$getBreakoutRoomParticipants_Serializer] for a converter to parse the `Response` from an executed request. Future< _i1.DynamiteResponse> getBreakoutRoomParticipants({ @@ -10645,48 +10533,74 @@ class $RoomClient { RoomGetBreakoutRoomParticipantsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getBreakoutRoomParticipantsRaw( + final _request = $getBreakoutRoomParticipants_Request( token: token, includeStatus: includeStatus, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getBreakoutRoomParticipants_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the breakout room participants for a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$removeSelfFromRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $removeSelfFromRoom_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomRemoveSelfFromRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400, 404}, + ); + + /// Remove the current user from a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [removeSelfFromRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [includeStatus] Include the user statuses. Defaults to `0`. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Breakout room participants returned - /// * 400: Getting breakout room participants is not possible - /// * 403: Missing permissions to get breakout room participants + /// * 200: Participant removed successfully + /// * 400: Removing participant is not possible + /// * 404: Participant not found /// /// See: - /// * [getBreakoutRoomParticipants] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [removeSelfFromRoom] for a method executing this request and parsing the response. + /// * [$removeSelfFromRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future< - _i1.DynamiteRawResponse> getBreakoutRoomParticipantsRaw({ + _i3.Request $removeSelfFromRoom_Request({ required String token, - RoomGetBreakoutRoomParticipantsIncludeStatus? includeStatus, - RoomGetBreakoutRoomParticipantsApiVersion? apiVersion, + RoomRemoveSelfFromRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomRemoveSelfFromRoomApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/self').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -10696,63 +10610,21 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $includeStatus = _$jsonSerializers.serialize( - includeStatus, - specifiedType: const FullType(RoomGetBreakoutRoomParticipantsIncludeStatus), - ); - $includeStatus ??= 0; - _parameters['includeStatus'] = $includeStatus; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(RoomGetBreakoutRoomParticipantsApiVersion), - ); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/breakout-rooms/participants{?includeStatus*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getBreakoutRoomParticipants_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$removeSelfFromRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $removeSelfFromRoom_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomRemoveSelfFromRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400, 404}, - ); - /// Remove the current user from a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -10769,49 +10641,85 @@ class $RoomClient { /// * 404: Participant not found /// /// See: - /// * [removeSelfFromRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$removeSelfFromRoom_Request] for the request send by this method. + /// * [$removeSelfFromRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> removeSelfFromRoom({ required String token, RoomRemoveSelfFromRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await removeSelfFromRoomRaw( + final _request = $removeSelfFromRoom_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $removeSelfFromRoom_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Remove the current user from a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$removeAttendeeFromRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $removeAttendeeFromRoom_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomRemoveAttendeeFromRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400, 403, 404}, + ); + + /// Remove an attendee from a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [removeAttendeeFromRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [attendeeId] ID of the attendee. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Participant removed successfully - /// * 400: Removing participant is not possible - /// * 404: Participant not found + /// * 200: Attendee removed successfully + /// * 400: Removing attendee is not possible + /// * 403: Removing attendee is not allowed + /// * 404: Attendee not found /// /// See: - /// * [removeSelfFromRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [removeAttendeeFromRoom] for a method executing this request and parsing the response. + /// * [$removeAttendeeFromRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> removeSelfFromRoomRaw({ + _i3.Request $removeAttendeeFromRoom_Request({ + required int attendeeId, required String token, - RoomRemoveSelfFromRoomApiVersion? apiVersion, + RoomRemoveAttendeeFromRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); + _parameters['attendeeId'] = $attendeeId; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomRemoveAttendeeFromRoomApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/attendees{?attendeeId*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -10821,53 +10729,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomRemoveSelfFromRoomApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/self').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $removeSelfFromRoom_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$removeAttendeeFromRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $removeAttendeeFromRoom_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomRemoveAttendeeFromRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400, 403, 404}, - ); - /// Remove an attendee from a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -10886,54 +10760,101 @@ class $RoomClient { /// * 404: Attendee not found /// /// See: - /// * [removeAttendeeFromRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$removeAttendeeFromRoom_Request] for the request send by this method. + /// * [$removeAttendeeFromRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> removeAttendeeFromRoom({ required int attendeeId, required String token, RoomRemoveAttendeeFromRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await removeAttendeeFromRoomRaw( + final _request = $removeAttendeeFromRoom_Request( attendeeId: attendeeId, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $removeAttendeeFromRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Remove an attendee from a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setAttendeePermissions_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $setAttendeePermissions_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetAttendeePermissionsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400, 403, 404}, + ); + + /// Update the permissions of an attendee. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setAttendeePermissions] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [attendeeId] ID of the attendee. + /// * [method] Method of updating permissions ('set', 'remove', 'add'). + /// * [permissions] New permissions. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Attendee removed successfully - /// * 400: Removing attendee is not possible - /// * 403: Removing attendee is not allowed + /// * 200: Permissions updated successfully + /// * 400: Updating permissions is not possible + /// * 403: Missing permissions to update permissions /// * 404: Attendee not found /// /// See: - /// * [removeAttendeeFromRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setAttendeePermissions] for a method executing this request and parsing the response. + /// * [$setAttendeePermissions_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> removeAttendeeFromRoomRaw({ + _i3.Request $setAttendeePermissions_Request({ required int attendeeId, + required RoomSetAttendeePermissionsMethod method, + required RoomSetAttendeePermissionsPermissions permissions, required String token, - RoomRemoveAttendeeFromRoomApiVersion? apiVersion, + RoomSetAttendeePermissionsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); + _parameters['attendeeId'] = $attendeeId; + + final $method = + _$jsonSerializers.serialize(method, specifiedType: const FullType(RoomSetAttendeePermissionsMethod)); + _parameters['method'] = $method; + + final $permissions = + _$jsonSerializers.serialize(permissions, specifiedType: const FullType(RoomSetAttendeePermissionsPermissions)); + _parameters['permissions'] = $permissions; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetAttendeePermissionsApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate( + '/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/attendees/permissions{?attendeeId*,method*,permissions*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -10943,55 +10864,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); - _parameters['attendeeId'] = $attendeeId; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomRemoveAttendeeFromRoomApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/attendees{?attendeeId*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $removeAttendeeFromRoom_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setAttendeePermissions_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $setAttendeePermissions_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetAttendeePermissionsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400, 403, 404}, - ); - /// Update the permissions of an attendee. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -11012,7 +10897,8 @@ class $RoomClient { /// * 404: Attendee not found /// /// See: - /// * [setAttendeePermissionsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setAttendeePermissions_Request] for the request send by this method. + /// * [$setAttendeePermissions_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setAttendeePermissions({ required int attendeeId, required RoomSetAttendeePermissionsMethod method, @@ -11021,7 +10907,7 @@ class $RoomClient { RoomSetAttendeePermissionsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setAttendeePermissionsRaw( + final _request = $setAttendeePermissions_Request( attendeeId: attendeeId, method: method, permissions: permissions, @@ -11029,19 +10915,31 @@ class $RoomClient { apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setAttendeePermissions_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update the permissions of an attendee. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setAllAttendeesPermissions_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $setAllAttendeesPermissions_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetAllAttendeesPermissionsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Update the permissions of all attendees. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setAllAttendeesPermissions] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [attendeeId] ID of the attendee. /// * [method] Method of updating permissions ('set', 'remove', 'add'). /// * [permissions] New permissions. /// * [apiVersion] Defaults to `v4`. @@ -11051,89 +10949,71 @@ class $RoomClient { /// Status codes: /// * 200: Permissions updated successfully /// * 400: Updating permissions is not possible - /// * 403: Missing permissions to update permissions - /// * 404: Attendee not found /// /// See: - /// * [setAttendeePermissions] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setAllAttendeesPermissions] for a method executing this request and parsing the response. + /// * [$setAllAttendeesPermissions_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setAttendeePermissionsRaw({ - required int attendeeId, - required RoomSetAttendeePermissionsMethod method, - required RoomSetAttendeePermissionsPermissions permissions, + _i3.Request $setAllAttendeesPermissions_Request({ + required RoomSetAllAttendeesPermissionsMethod method, + required RoomSetAllAttendeesPermissionsPermissions permissions, required String token, - RoomSetAttendeePermissionsApiVersion? apiVersion, + RoomSetAllAttendeesPermissionsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end - final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); - _parameters['attendeeId'] = $attendeeId; - + }) { + final _parameters = {}; final $method = - _$jsonSerializers.serialize(method, specifiedType: const FullType(RoomSetAttendeePermissionsMethod)); + _$jsonSerializers.serialize(method, specifiedType: const FullType(RoomSetAllAttendeesPermissionsMethod)); _parameters['method'] = $method; - final $permissions = - _$jsonSerializers.serialize(permissions, specifiedType: const FullType(RoomSetAttendeePermissionsPermissions)); + final $permissions = _$jsonSerializers.serialize( + permissions, + specifiedType: const FullType(RoomSetAllAttendeesPermissionsPermissions), + ); _parameters['permissions'] = $permissions; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', ); _parameters['token'] = $token; - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetAttendeePermissionsApiVersion)); + var $apiVersion = _$jsonSerializers.serialize( + apiVersion, + specifiedType: const FullType(RoomSetAllAttendeesPermissionsApiVersion), + ); $apiVersion ??= 'v4'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/attendees/permissions{?attendeeId*,method*,permissions*}', + final _path = _i5.UriTemplate( + '/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/attendees/permissions/all{?method*,permissions*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $setAttendeePermissions_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); - } + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } - /// Builds a serializer to parse the response of `$setAllAttendeesPermissions_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $setAllAttendeesPermissions_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetAllAttendeesPermissionsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } /// Update the permissions of all attendees. /// @@ -11152,7 +11032,8 @@ class $RoomClient { /// * 400: Updating permissions is not possible /// /// See: - /// * [setAllAttendeesPermissionsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setAllAttendeesPermissions_Request] for the request send by this method. + /// * [$setAllAttendeesPermissions_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setAllAttendeesPermissions({ required RoomSetAllAttendeesPermissionsMethod method, required RoomSetAllAttendeesPermissionsPermissions permissions, @@ -11160,49 +11041,87 @@ class $RoomClient { RoomSetAllAttendeesPermissionsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setAllAttendeesPermissionsRaw( + final _request = $setAllAttendeesPermissions_Request( method: method, permissions: permissions, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setAllAttendeesPermissions_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update the permissions of all attendees. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$joinRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $joinRoom_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomJoinRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Join a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [joinRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [method] Method of updating permissions ('set', 'remove', 'add'). - /// * [permissions] New permissions. + /// * [password] Password of the room. Defaults to `''`. + /// * [force] Create a new session if necessary. Defaults to `1`. /// * [apiVersion] Defaults to `v4`. - /// * [token] + /// * [token] Token of the room. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Permissions updated successfully - /// * 400: Updating permissions is not possible + /// * 200: Room joined successfully + /// * 403: Joining room is not allowed + /// * 404: Room not found + /// * 409: Session already exists /// /// See: - /// * [setAllAttendeesPermissions] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [joinRoom] for a method executing this request and parsing the response. + /// * [$joinRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - setAllAttendeesPermissionsRaw({ - required RoomSetAllAttendeesPermissionsMethod method, - required RoomSetAllAttendeesPermissionsPermissions permissions, + _i3.Request $joinRoom_Request({ required String token, - RoomSetAllAttendeesPermissionsApiVersion? apiVersion, + String? password, + RoomJoinRoomForce? force, + RoomJoinRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $password = _$jsonSerializers.serialize(password, specifiedType: const FullType(String)); + $password ??= ''; + _parameters['password'] = $password; + + var $force = _$jsonSerializers.serialize(force, specifiedType: const FullType(RoomJoinRoomForce)); + $force ??= 1; + _parameters['force'] = $force; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomJoinRoomApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/active{?password*,force*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -11212,64 +11131,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $method = - _$jsonSerializers.serialize(method, specifiedType: const FullType(RoomSetAllAttendeesPermissionsMethod)); - _parameters['method'] = $method; - - final $permissions = _$jsonSerializers.serialize( - permissions, - specifiedType: const FullType(RoomSetAllAttendeesPermissionsPermissions), - ); - _parameters['permissions'] = $permissions; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize( - apiVersion, - specifiedType: const FullType(RoomSetAllAttendeesPermissionsApiVersion), - ); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/attendees/permissions/all{?method*,permissions*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setAllAttendeesPermissions_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$joinRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $joinRoom_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomJoinRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Join a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -11289,7 +11163,8 @@ class $RoomClient { /// * 409: Session already exists /// /// See: - /// * [joinRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$joinRoom_Request] for the request send by this method. + /// * [$joinRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> joinRoom({ required String token, String? password, @@ -11297,50 +11172,70 @@ class $RoomClient { RoomJoinRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await joinRoomRaw( + final _request = $joinRoom_Request( token: token, password: password, force: force, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $joinRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Join a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$leaveRoom_Request]. + @_i2.experimental + _i1.DynamiteSerializer $leaveRoom_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomLeaveRoomResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Leave a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [leaveRoom] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [password] Password of the room. Defaults to `''`. - /// * [force] Create a new session if necessary. Defaults to `1`. /// * [apiVersion] Defaults to `v4`. /// * [token] Token of the room. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Room joined successfully - /// * 403: Joining room is not allowed - /// * 404: Room not found - /// * 409: Session already exists + /// * 200: Successfully left the room /// /// See: - /// * [joinRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [leaveRoom] for a method executing this request and parsing the response. + /// * [$leaveRoom_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> joinRoomRaw({ + _i3.Request $leaveRoom_Request({ required String token, - String? password, - RoomJoinRoomForce? force, - RoomJoinRoomApiVersion? apiVersion, + RoomLeaveRoomApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomLeaveRoomApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/active') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -11350,58 +11245,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $password = _$jsonSerializers.serialize(password, specifiedType: const FullType(String)); - $password ??= ''; - _parameters['password'] = $password; - - var $force = _$jsonSerializers.serialize(force, specifiedType: const FullType(RoomJoinRoomForce)); - $force ??= 1; - _parameters['force'] = $force; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomJoinRoomApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/active{?password*,force*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $joinRoom_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$leaveRoom_Request`. - @_i2.experimental - _i1.DynamiteSerializer $leaveRoom_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomLeaveRoomResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Leave a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -11416,47 +11272,84 @@ class $RoomClient { /// * 200: Successfully left the room /// /// See: - /// * [leaveRoomRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$leaveRoom_Request] for the request send by this method. + /// * [$leaveRoom_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> leaveRoom({ required String token, RoomLeaveRoomApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await leaveRoomRaw( + final _request = $leaveRoom_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $leaveRoom_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Leave a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$resendInvitations_Request]. + @_i2.experimental + _i1.DynamiteSerializer $resendInvitations_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomResendInvitationsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 404}, + ); + + /// Resend invitations. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [resendInvitations] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [attendeeId] ID of the attendee. /// * [apiVersion] Defaults to `v4`. - /// * [token] Token of the room. + /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Successfully left the room + /// * 200: Invitation resent successfully + /// * 404: Attendee not found /// /// See: - /// * [leaveRoom] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [resendInvitations] for a method executing this request and parsing the response. + /// * [$resendInvitations_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> leaveRoomRaw({ + _i3.Request $resendInvitations_Request({ required String token, - RoomLeaveRoomApiVersion? apiVersion, + int? attendeeId, + RoomResendInvitationsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); + _parameters['attendeeId'] = $attendeeId; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomResendInvitationsApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate( + '/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/resend-invitations{?attendeeId*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -11466,50 +11359,21 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomLeaveRoomApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/active') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $leaveRoom_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$resendInvitations_Request`. - @_i2.experimental - _i1.DynamiteSerializer $resendInvitations_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomResendInvitationsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 404}, - ); - /// Resend invitations. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -11526,52 +11390,86 @@ class $RoomClient { /// * 404: Attendee not found /// /// See: - /// * [resendInvitationsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$resendInvitations_Request] for the request send by this method. + /// * [$resendInvitations_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> resendInvitations({ required String token, int? attendeeId, RoomResendInvitationsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await resendInvitationsRaw( + final _request = $resendInvitations_Request( token: token, attendeeId: attendeeId, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $resendInvitations_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Resend invitations. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setSessionState_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setSessionState_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetSessionStateResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Set active state for a session. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setSessionState] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [attendeeId] ID of the attendee. + /// * [state] of the room. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Invitation resent successfully - /// * 404: Attendee not found + /// * 200: Session state set successfully + /// * 400: The provided new state was invalid + /// * 404: The participant did not have a session /// /// See: - /// * [resendInvitations] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setSessionState] for a method executing this request and parsing the response. + /// * [$setSessionState_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> resendInvitationsRaw({ + _i3.Request $setSessionState_Request({ + required RoomSetSessionStateState state, required String token, - int? attendeeId, - RoomResendInvitationsApiVersion? apiVersion, + RoomSetSessionStateApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $state = _$jsonSerializers.serialize(state, specifiedType: const FullType(RoomSetSessionStateState)); + _parameters['state'] = $state; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetSessionStateApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/state{?state*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -11581,57 +11479,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); - _parameters['attendeeId'] = $attendeeId; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomResendInvitationsApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/resend-invitations{?attendeeId*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $resendInvitations_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setSessionState_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setSessionState_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetSessionStateResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Set active state for a session. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -11649,53 +11509,87 @@ class $RoomClient { /// * 404: The participant did not have a session /// /// See: - /// * [setSessionStateRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setSessionState_Request] for the request send by this method. + /// * [$setSessionState_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setSessionState({ required RoomSetSessionStateState state, required String token, RoomSetSessionStateApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setSessionStateRaw( + final _request = $setSessionState_Request( state: state, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setSessionState_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Set active state for a session. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$promoteModerator_Request]. + @_i2.experimental + _i1.DynamiteSerializer $promoteModerator_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomPromoteModeratorResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400, 403, 404}, + ); + + /// Promote an attendee to moderator. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [promoteModerator] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [state] of the room. + /// * [attendeeId] ID of the attendee. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Session state set successfully - /// * 400: The provided new state was invalid - /// * 404: The participant did not have a session + /// * 200: Attendee promoted to moderator successfully + /// * 400: Promoting attendee to moderator is not possible + /// * 403: Promoting attendee to moderator is not allowed + /// * 404: Attendee not found /// /// See: - /// * [setSessionState] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [promoteModerator] for a method executing this request and parsing the response. + /// * [$promoteModerator_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setSessionStateRaw({ - required RoomSetSessionStateState state, + _i3.Request $promoteModerator_Request({ + required int attendeeId, required String token, - RoomSetSessionStateApiVersion? apiVersion, + RoomPromoteModeratorApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); + _parameters['attendeeId'] = $attendeeId; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomPromoteModeratorApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/moderators{?attendeeId*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -11705,54 +11599,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $state = _$jsonSerializers.serialize(state, specifiedType: const FullType(RoomSetSessionStateState)); - _parameters['state'] = $state; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetSessionStateApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/participants/state{?state*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setSessionState_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$promoteModerator_Request`. - @_i2.experimental - _i1.DynamiteSerializer $promoteModerator_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomPromoteModeratorResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400, 403, 404}, - ); - /// Promote an attendee to moderator. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -11771,28 +11630,41 @@ class $RoomClient { /// * 404: Attendee not found /// /// See: - /// * [promoteModeratorRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$promoteModerator_Request] for the request send by this method. + /// * [$promoteModerator_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> promoteModerator({ required int attendeeId, required String token, RoomPromoteModeratorApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await promoteModeratorRaw( + final _request = $promoteModerator_Request( attendeeId: attendeeId, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $promoteModerator_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Promote an attendee to moderator. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$demoteModerator_Request]. + @_i2.experimental + _i1.DynamiteSerializer $demoteModerator_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomDemoteModeratorResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400, 403, 404}, + ); + + /// Demote an attendee from moderator. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [demoteModerator] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -11802,23 +11674,43 @@ class $RoomClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Attendee promoted to moderator successfully - /// * 400: Promoting attendee to moderator is not possible - /// * 403: Promoting attendee to moderator is not allowed + /// * 200: Attendee demoted from moderator successfully + /// * 400: Demoting attendee from moderator is not possible + /// * 403: Demoting attendee from moderator is not allowed /// * 404: Attendee not found /// /// See: - /// * [promoteModerator] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [demoteModerator] for a method executing this request and parsing the response. + /// * [$demoteModerator_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> promoteModeratorRaw({ + _i3.Request $demoteModerator_Request({ required int attendeeId, required String token, - RoomPromoteModeratorApiVersion? apiVersion, + RoomDemoteModeratorApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); + _parameters['attendeeId'] = $attendeeId; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomDemoteModeratorApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/moderators{?attendeeId*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -11828,54 +11720,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); - _parameters['attendeeId'] = $attendeeId; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomPromoteModeratorApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/moderators{?attendeeId*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $promoteModerator_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$demoteModerator_Request`. - @_i2.experimental - _i1.DynamiteSerializer $demoteModerator_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomDemoteModeratorResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400, 403, 404}, - ); - /// Demote an attendee from moderator. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -11894,54 +11751,78 @@ class $RoomClient { /// * 404: Attendee not found /// /// See: - /// * [demoteModeratorRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$demoteModerator_Request] for the request send by this method. + /// * [$demoteModerator_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> demoteModerator({ required int attendeeId, required String token, RoomDemoteModeratorApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await demoteModeratorRaw( + final _request = $demoteModerator_Request( attendeeId: attendeeId, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $demoteModerator_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Demote an attendee from moderator. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$addToFavorites_Request]. + @_i2.experimental + _i1.DynamiteSerializer $addToFavorites_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomAddToFavoritesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Add a room to the favorites. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [addToFavorites] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [attendeeId] ID of the attendee. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Attendee demoted from moderator successfully - /// * 400: Demoting attendee from moderator is not possible - /// * 403: Demoting attendee from moderator is not allowed - /// * 404: Attendee not found + /// * 200: Successfully added room to favorites /// /// See: - /// * [demoteModerator] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [addToFavorites] for a method executing this request and parsing the response. + /// * [$addToFavorites_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> demoteModeratorRaw({ - required int attendeeId, + _i3.Request $addToFavorites_Request({ required String token, - RoomDemoteModeratorApiVersion? apiVersion, + RoomAddToFavoritesApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomAddToFavoritesApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/favorite').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -11951,54 +11832,21 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $attendeeId = _$jsonSerializers.serialize(attendeeId, specifiedType: const FullType(int)); - _parameters['attendeeId'] = $attendeeId; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomDemoteModeratorApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/moderators{?attendeeId*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $demoteModerator_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$addToFavorites_Request`. - @_i2.experimental - _i1.DynamiteSerializer $addToFavorites_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomAddToFavoritesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Add a room to the favorites. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -12013,26 +11861,39 @@ class $RoomClient { /// * 200: Successfully added room to favorites /// /// See: - /// * [addToFavoritesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$addToFavorites_Request] for the request send by this method. + /// * [$addToFavorites_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> addToFavorites({ required String token, RoomAddToFavoritesApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await addToFavoritesRaw( + final _request = $addToFavorites_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $addToFavorites_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Add a room to the favorites. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$removeFromFavorites_Request]. + @_i2.experimental + _i1.DynamiteSerializer $removeFromFavorites_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomRemoveFromFavoritesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Remove a room from the favorites. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [removeFromFavorites] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -12041,19 +11902,35 @@ class $RoomClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Successfully added room to favorites + /// * 200: Successfully removed room from favorites /// /// See: - /// * [addToFavorites] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [removeFromFavorites] for a method executing this request and parsing the response. + /// * [$removeFromFavorites_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> addToFavoritesRaw({ + _i3.Request $removeFromFavorites_Request({ required String token, - RoomAddToFavoritesApiVersion? apiVersion, + RoomRemoveFromFavoritesApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomRemoveFromFavoritesApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/favorite').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -12063,7 +11940,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -12071,44 +11948,13 @@ class $RoomClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomAddToFavoritesApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/favorite').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $addToFavorites_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$removeFromFavorites_Request`. - @_i2.experimental - _i1.DynamiteSerializer $removeFromFavorites_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomRemoveFromFavoritesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Remove a room from the favorites. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -12123,47 +11969,83 @@ class $RoomClient { /// * 200: Successfully removed room from favorites /// /// See: - /// * [removeFromFavoritesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$removeFromFavorites_Request] for the request send by this method. + /// * [$removeFromFavorites_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> removeFromFavorites({ required String token, RoomRemoveFromFavoritesApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await removeFromFavoritesRaw( + final _request = $removeFromFavorites_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $removeFromFavorites_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Remove a room from the favorites. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setNotificationLevel_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setNotificationLevel_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetNotificationLevelResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Update the notification level for a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setNotificationLevel] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [level] New level. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Successfully removed room from favorites + /// * 200: Notification level updated successfully + /// * 400: Updating notification level is not possible /// /// See: - /// * [removeFromFavorites] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setNotificationLevel] for a method executing this request and parsing the response. + /// * [$setNotificationLevel_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> removeFromFavoritesRaw({ + _i3.Request $setNotificationLevel_Request({ + required int level, required String token, - RoomRemoveFromFavoritesApiVersion? apiVersion, + RoomSetNotificationLevelApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $level = _$jsonSerializers.serialize(level, specifiedType: const FullType(int)); + _parameters['level'] = $level; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetNotificationLevelApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/notify{?level*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -12173,7 +12055,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -12181,44 +12063,13 @@ class $RoomClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomRemoveFromFavoritesApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/favorite').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $removeFromFavorites_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setNotificationLevel_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setNotificationLevel_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetNotificationLevelResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Update the notification level for a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -12235,28 +12086,41 @@ class $RoomClient { /// * 400: Updating notification level is not possible /// /// See: - /// * [setNotificationLevelRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setNotificationLevel_Request] for the request send by this method. + /// * [$setNotificationLevel_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setNotificationLevel({ required int level, required String token, RoomSetNotificationLevelApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setNotificationLevelRaw( + final _request = $setNotificationLevel_Request( level: level, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setNotificationLevel_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update the notification level for a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setNotificationCalls_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setNotificationCalls_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetNotificationCallsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + + /// Update call notifications. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setNotificationCalls] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -12266,21 +12130,41 @@ class $RoomClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Notification level updated successfully - /// * 400: Updating notification level is not possible + /// * 200: Call notification level updated successfully + /// * 400: Updating call notification level is not possible /// /// See: - /// * [setNotificationLevel] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setNotificationCalls] for a method executing this request and parsing the response. + /// * [$setNotificationCalls_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setNotificationLevelRaw({ + _i3.Request $setNotificationCalls_Request({ required int level, required String token, - RoomSetNotificationLevelApiVersion? apiVersion, + RoomSetNotificationCallsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $level = _$jsonSerializers.serialize(level, specifiedType: const FullType(int)); + _parameters['level'] = $level; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetNotificationCallsApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/notify-calls{?level*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -12290,7 +12174,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -12298,48 +12182,13 @@ class $RoomClient { } // coverage:ignore-end - final $level = _$jsonSerializers.serialize(level, specifiedType: const FullType(int)); - _parameters['level'] = $level; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetNotificationLevelApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/notify{?level*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setNotificationLevel_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setNotificationCalls_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setNotificationCalls_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetNotificationCallsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - /// Update call notifications. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -12356,52 +12205,88 @@ class $RoomClient { /// * 400: Updating call notification level is not possible /// /// See: - /// * [setNotificationCallsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setNotificationCalls_Request] for the request send by this method. + /// * [$setNotificationCalls_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setNotificationCalls({ required int level, required String token, RoomSetNotificationCallsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setNotificationCallsRaw( + final _request = $setNotificationCalls_Request( level: level, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setNotificationCalls_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update call notifications. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setLobby_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setLobby_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetLobbyResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Update the lobby state for a room. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setLobby] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [level] New level. + /// * [state] New state. + /// * [timer] Timer when the lobby will be removed. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Call notification level updated successfully - /// * 400: Updating call notification level is not possible + /// * 200: Lobby state updated successfully + /// * 400: Updating lobby state is not possible /// /// See: - /// * [setNotificationCalls] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setLobby] for a method executing this request and parsing the response. + /// * [$setLobby_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setNotificationCallsRaw({ - required int level, + _i3.Request $setLobby_Request({ + required int state, required String token, - RoomSetNotificationCallsApiVersion? apiVersion, + int? timer, + RoomSetLobbyApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $state = _$jsonSerializers.serialize(state, specifiedType: const FullType(int)); + _parameters['state'] = $state; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + final $timer = _$jsonSerializers.serialize(timer, specifiedType: const FullType(int)); + _parameters['timer'] = $timer; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetLobbyApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/webinar/lobby{?state*,timer*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -12411,7 +12296,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -12419,47 +12304,13 @@ class $RoomClient { } // coverage:ignore-end - final $level = _$jsonSerializers.serialize(level, specifiedType: const FullType(int)); - _parameters['level'] = $level; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetNotificationCallsApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/notify-calls{?level*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setNotificationCalls_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setLobby_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setLobby_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetLobbyResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Update the lobby state for a room. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -12477,7 +12328,8 @@ class $RoomClient { /// * 400: Updating lobby state is not possible /// /// See: - /// * [setLobbyRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setLobby_Request] for the request send by this method. + /// * [$setLobby_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setLobby({ required int state, required String token, @@ -12485,48 +12337,81 @@ class $RoomClient { RoomSetLobbyApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setLobbyRaw( + final _request = $setLobby_Request( state: state, token: token, timer: timer, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setLobby_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update the lobby state for a room. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setsipEnabled_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setsipEnabled_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetsipEnabledResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Update SIP enabled state. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setsipEnabled] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: /// * [state] New state. - /// * [timer] Timer when the lobby will be removed. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Lobby state updated successfully - /// * 400: Updating lobby state is not possible + /// * 200: SIP enabled state updated successfully + /// * 400: Updating SIP enabled state is not possible + /// * 401: User not found + /// * 403: Missing permissions to update SIP enabled state + /// * 412: SIP not configured /// /// See: - /// * [setLobby] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setsipEnabled] for a method executing this request and parsing the response. + /// * [$setsipEnabled_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setLobbyRaw({ - required int state, + _i3.Request $setsipEnabled_Request({ + required RoomSetsipEnabledState state, required String token, - int? timer, - RoomSetLobbyApiVersion? apiVersion, + RoomSetsipEnabledApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $state = _$jsonSerializers.serialize(state, specifiedType: const FullType(RoomSetsipEnabledState)); + _parameters['state'] = $state; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetsipEnabledApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/webinar/sip{?state*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -12536,7 +12421,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -12544,50 +12429,13 @@ class $RoomClient { } // coverage:ignore-end - final $state = _$jsonSerializers.serialize(state, specifiedType: const FullType(int)); - _parameters['state'] = $state; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - final $timer = _$jsonSerializers.serialize(timer, specifiedType: const FullType(int)); - _parameters['timer'] = $timer; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetLobbyApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/webinar/lobby{?state*,timer*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setLobby_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setsipEnabled_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setsipEnabled_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetsipEnabledResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Update SIP enabled state. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -12607,55 +12455,87 @@ class $RoomClient { /// * 412: SIP not configured /// /// See: - /// * [setsipEnabledRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setsipEnabled_Request] for the request send by this method. + /// * [$setsipEnabled_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setsipEnabled({ required RoomSetsipEnabledState state, required String token, RoomSetsipEnabledApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setsipEnabledRaw( + final _request = $setsipEnabled_Request( state: state, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setsipEnabled_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update SIP enabled state. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setRecordingConsent_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setRecordingConsent_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetRecordingConsentResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Set recording consent requirement for this conversation. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setRecordingConsent] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [state] New state. + /// * [recordingConsent] New consent setting for the conversation (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.). /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: SIP enabled state updated successfully - /// * 400: Updating SIP enabled state is not possible - /// * 401: User not found - /// * 403: Missing permissions to update SIP enabled state - /// * 412: SIP not configured + /// * 200: Recording consent requirement set successfully + /// * 400: Setting recording consent requirement is not possible + /// * 412: No recording server is configured /// /// See: - /// * [setsipEnabled] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setRecordingConsent] for a method executing this request and parsing the response. + /// * [$setRecordingConsent_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setsipEnabledRaw({ - required RoomSetsipEnabledState state, + _i3.Request $setRecordingConsent_Request({ + required int recordingConsent, required String token, - RoomSetsipEnabledApiVersion? apiVersion, + RoomSetRecordingConsentApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $recordingConsent = _$jsonSerializers.serialize(recordingConsent, specifiedType: const FullType(int)); + _parameters['recordingConsent'] = $recordingConsent; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetRecordingConsentApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/recording-consent{?recordingConsent*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -12665,7 +12545,7 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -12673,48 +12553,13 @@ class $RoomClient { } // coverage:ignore-end - final $state = _$jsonSerializers.serialize(state, specifiedType: const FullType(RoomSetsipEnabledState)); - _parameters['state'] = $state; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetsipEnabledApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/webinar/sip{?state*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setsipEnabled_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setRecordingConsent_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setRecordingConsent_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetRecordingConsentResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Set recording consent requirement for this conversation. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -12732,53 +12577,85 @@ class $RoomClient { /// * 412: No recording server is configured /// /// See: - /// * [setRecordingConsentRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setRecordingConsent_Request] for the request send by this method. + /// * [$setRecordingConsent_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setRecordingConsent({ required int recordingConsent, required String token, RoomSetRecordingConsentApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setRecordingConsentRaw( + final _request = $setRecordingConsent_Request( recordingConsent: recordingConsent, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setRecordingConsent_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Set recording consent requirement for this conversation. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setMessageExpiration_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setMessageExpiration_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(RoomSetMessageExpirationResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Update message expiration time. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setMessageExpiration] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [recordingConsent] New consent setting for the conversation (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.). + /// * [seconds] New time. /// * [apiVersion] Defaults to `v4`. /// * [token] /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Recording consent requirement set successfully - /// * 400: Setting recording consent requirement is not possible - /// * 412: No recording server is configured + /// * 200: Message expiration time updated successfully + /// * 400: Updating message expiration time is not possible /// /// See: - /// * [setRecordingConsent] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setMessageExpiration] for a method executing this request and parsing the response. + /// * [$setMessageExpiration_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setRecordingConsentRaw({ - required int recordingConsent, + _i3.Request $setMessageExpiration_Request({ + required int seconds, required String token, - RoomSetRecordingConsentApiVersion? apiVersion, + RoomSetMessageExpirationApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $seconds = _$jsonSerializers.serialize(seconds, specifiedType: const FullType(int)); + _parameters['seconds'] = $seconds; + + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetMessageExpirationApiVersion)); + $apiVersion ??= 'v4'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/message-expiration{?seconds*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -12788,57 +12665,19 @@ class $RoomClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); } // coverage:ignore-end - final $recordingConsent = _$jsonSerializers.serialize(recordingConsent, specifiedType: const FullType(int)); - _parameters['recordingConsent'] = $recordingConsent; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetRecordingConsentApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/recording-consent{?recordingConsent*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setRecordingConsent_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setMessageExpiration_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setMessageExpiration_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(RoomSetMessageExpirationResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Update message expiration time. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -12855,97 +12694,26 @@ class $RoomClient { /// * 400: Updating message expiration time is not possible /// /// See: - /// * [setMessageExpirationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setMessageExpiration_Request] for the request send by this method. + /// * [$setMessageExpiration_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setMessageExpiration({ required int seconds, required String token, RoomSetMessageExpirationApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setMessageExpirationRaw( + final _request = $setMessageExpiration_Request( seconds: seconds, token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Update message expiration time. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [seconds] New time. - /// * [apiVersion] Defaults to `v4`. - /// * [token] - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Message expiration time updated successfully - /// * 400: Updating message expiration time is not possible - /// - /// See: - /// * [setMessageExpiration] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> setMessageExpirationRaw({ - required int seconds, - required String token, - RoomSetMessageExpirationApiVersion? apiVersion, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end - final $seconds = _$jsonSerializers.serialize(seconds, specifiedType: const FullType(int)); - _parameters['seconds'] = $seconds; - - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(RoomSetMessageExpirationApiVersion)); - $apiVersion ??= 'v4'; - _parameters['apiVersion'] = $apiVersion; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/message-expiration{?seconds*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $setMessageExpiration_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -12955,7 +12723,7 @@ class $SettingsClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$setUserSetting_Request`. + /// Builds a serializer to parse the response of [$setUserSetting_Request]. @_i2.experimental _i1.DynamiteSerializer $setUserSetting_Serializer() => _i1.DynamiteSerializer( @@ -12967,42 +12735,7 @@ class $SettingsClient { /// Update user setting. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [key] Key to update. - /// * [value] New value for the key. - /// * [apiVersion] Defaults to `v1`. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: User setting updated successfully - /// * 400: Updating user setting is not possible - /// - /// See: - /// * [setUserSettingRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setUserSetting({ - required SettingsSetUserSettingKey key, - SettingsSetUserSettingValue? value, - SettingsSetUserSettingApiVersion? apiVersion, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await setUserSettingRaw( - key: key, - value: value, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Update user setting. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setUserSetting] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -13016,17 +12749,32 @@ class $SettingsClient { /// * 400: Updating user setting is not possible /// /// See: - /// * [setUserSetting] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setUserSetting] for a method executing this request and parsing the response. + /// * [$setUserSetting_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setUserSettingRaw({ + _i3.Request $setUserSetting_Request({ required SettingsSetUserSettingKey key, SettingsSetUserSettingValue? value, SettingsSetUserSettingApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(SettingsSetUserSettingKey)); + _parameters['key'] = $key; + + final $value = _$jsonSerializers.serialize(value, specifiedType: const FullType(SettingsSetUserSettingValue)); + _parameters['value'] = $value; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SettingsSetUserSettingApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/settings/user{?key*,value*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -13036,7 +12784,7 @@ class $SettingsClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -13044,87 +12792,66 @@ class $SettingsClient { } // coverage:ignore-end - final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(SettingsSetUserSettingKey)); - _parameters['key'] = $key; - - final $value = _$jsonSerializers.serialize(value, specifiedType: const FullType(SettingsSetUserSettingValue)); - _parameters['value'] = $value; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SettingsSetUserSettingApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/settings/user{?key*,value*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $setUserSetting_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setsipSettings_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setsipSettings_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(SettingsSetsipSettingsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Update SIP bridge settings. - /// - /// This endpoint requires admin access. + /// Update user setting. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [sipGroups] New SIP groups. Defaults to `[]`. - /// * [dialInInfo] New dial info. Defaults to `''`. - /// * [sharedSecret] New shared secret. Defaults to `''`. + /// * [key] Key to update. + /// * [value] New value for the key. /// * [apiVersion] Defaults to `v1`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Successfully set new SIP settings + /// * 200: User setting updated successfully + /// * 400: Updating user setting is not possible /// /// See: - /// * [setsipSettingsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setsipSettings({ - BuiltList? sipGroups, - String? dialInInfo, - String? sharedSecret, - SettingsSetsipSettingsApiVersion? apiVersion, + /// * [$setUserSetting_Request] for the request send by this method. + /// * [$setUserSetting_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setUserSetting({ + required SettingsSetUserSettingKey key, + SettingsSetUserSettingValue? value, + SettingsSetUserSettingApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await setsipSettingsRaw( - sipGroups: sipGroups, - dialInInfo: dialInInfo, - sharedSecret: sharedSecret, + final _request = $setUserSetting_Request( + key: key, + value: value, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setUserSetting_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$setsipSettings_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setsipSettings_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(SettingsSetsipSettingsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Update SIP bridge settings. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setsipSettings] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -13138,35 +12865,17 @@ class $SettingsClient { /// * 200: Successfully set new SIP settings /// /// See: - /// * [setsipSettings] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setsipSettings] for a method executing this request and parsing the response. + /// * [$setsipSettings_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setsipSettingsRaw({ + _i3.Request $setsipSettings_Request({ BuiltList? sipGroups, String? dialInInfo, String? sharedSecret, SettingsSetsipSettingsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end + }) { + final _parameters = {}; var $sipGroups = _$jsonSerializers.serialize(sipGroups, specifiedType: const FullType(BuiltList, [FullType(String)])); $sipGroups ??= []; @@ -13185,76 +12894,98 @@ class $SettingsClient { $apiVersion ??= 'v1'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( + final _path = _i5.UriTemplate( '/ocs/v2.php/apps/spreed/api/{apiVersion}/settings/sip{?sipGroups%5B%5D*,dialInInfo*,sharedSecret*}', ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $setsipSettings_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } -} - -class $SignalingClient { - /// Creates a new `DynamiteClient` for signaling requests. - $SignalingClient(this._rootClient); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } - final $Client _rootClient; +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - /// Builds a serializer to parse the response of `$getSettings_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getSettings_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(SignalingGetSettingsResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); + return _request; + } - /// Get the signaling settings. + /// Update SIP bridge settings. + /// + /// This endpoint requires admin access. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [token] Token of the room. Defaults to `''`. - /// * [apiVersion] Defaults to `v3`. + /// * [sipGroups] New SIP groups. Defaults to `[]`. + /// * [dialInInfo] New dial info. Defaults to `''`. + /// * [sharedSecret] New shared secret. Defaults to `''`. + /// * [apiVersion] Defaults to `v1`. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Signaling settings returned - /// * 401: Recording request invalid - /// * 404: Room not found + /// * 200: Successfully set new SIP settings /// /// See: - /// * [getSettingsRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getSettings({ - String? token, - SignalingGetSettingsApiVersion? apiVersion, + /// * [$setsipSettings_Request] for the request send by this method. + /// * [$setsipSettings_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setsipSettings({ + BuiltList? sipGroups, + String? dialInInfo, + String? sharedSecret, + SettingsSetsipSettingsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getSettingsRaw( - token: token, + final _request = $setsipSettings_Request( + sipGroups: sipGroups, + dialInInfo: dialInInfo, + sharedSecret: sharedSecret, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setsipSettings_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} + +class $SignalingClient { + /// Creates a new `DynamiteClient` for signaling requests. + $SignalingClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$getSettings_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getSettings_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(SignalingGetSettingsResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); /// Get the signaling settings. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getSettings] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -13268,16 +12999,29 @@ class $SignalingClient { /// * 404: Room not found /// /// See: - /// * [getSettings] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getSettings] for a method executing this request and parsing the response. + /// * [$getSettings_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getSettingsRaw({ + _i3.Request $getSettings_Request({ String? token, SignalingGetSettingsApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + var $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + $token ??= ''; + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SignalingGetSettingsApiVersion)); + $apiVersion ??= 'v3'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/signaling/settings{?token*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -13287,84 +13031,68 @@ class $SignalingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - var $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - $token ??= ''; - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SignalingGetSettingsApiVersion)); - $apiVersion ??= 'v3'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/signaling/settings{?token*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getSettings_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$pullMessages_Request`. - @_i2.experimental - _i1.DynamiteSerializer $pullMessages_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(SignalingPullMessagesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 404, 409}, - ); - - /// Get signaling messages. + /// Get the signaling settings. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [token] Token of the room. Defaults to `''`. /// * [apiVersion] Defaults to `v3`. - /// * [token] Token of the room. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Signaling messages returned - /// * 404: Session, room or participant not found - /// * 409: Session killed - /// * 400: Getting signaling messages is not possible + /// * 200: Signaling settings returned + /// * 401: Recording request invalid + /// * 404: Room not found /// /// See: - /// * [pullMessagesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> pullMessages({ - required String token, - SignalingPullMessagesApiVersion? apiVersion, + /// * [$getSettings_Request] for the request send by this method. + /// * [$getSettings_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getSettings({ + String? token, + SignalingGetSettingsApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await pullMessagesRaw( + final _request = $getSettings_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getSettings_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$pullMessages_Request]. + @_i2.experimental + _i1.DynamiteSerializer $pullMessages_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(SignalingPullMessagesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 404, 409}, + ); + /// Get signaling messages. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [pullMessages] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -13379,16 +13107,32 @@ class $SignalingClient { /// * 400: Getting signaling messages is not possible /// /// See: - /// * [pullMessages] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [pullMessages] for a method executing this request and parsing the response. + /// * [$pullMessages_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> pullMessagesRaw({ + _i3.Request $pullMessages_Request({ required String token, SignalingPullMessagesApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _i4.checkPattern( + $token as String?, + RegExp(r'^[a-z0-9]{4,30}$'), + 'token', + ); + _parameters['token'] = $token; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SignalingPullMessagesApiVersion)); + $apiVersion ??= 'v3'; + _parameters['apiVersion'] = $apiVersion; + final _path = _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/signaling/{token}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -13398,88 +13142,69 @@ class $SignalingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( - $token as String?, - RegExp(r'^[a-z0-9]{4,30}$'), - 'token', - ); - _parameters['token'] = $token; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SignalingPullMessagesApiVersion)); - $apiVersion ??= 'v3'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/signaling/{token}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $pullMessages_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$sendMessages_Request`. - @_i2.experimental - _i1.DynamiteSerializer $sendMessages_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(SignalingSendMessagesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Send signaling messages. + /// Get signaling messages. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [messages] JSON encoded messages. /// * [apiVersion] Defaults to `v3`. /// * [token] Token of the room. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Signaling message sent successfully - /// * 400: Sending signaling message is not possible + /// * 200: Signaling messages returned + /// * 404: Session, room or participant not found + /// * 409: Session killed + /// * 400: Getting signaling messages is not possible /// /// See: - /// * [sendMessagesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> sendMessages({ - required String messages, + /// * [$pullMessages_Request] for the request send by this method. + /// * [$pullMessages_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> pullMessages({ required String token, - SignalingSendMessagesApiVersion? apiVersion, + SignalingPullMessagesApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await sendMessagesRaw( - messages: messages, + final _request = $pullMessages_Request( token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $pullMessages_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$sendMessages_Request]. + @_i2.experimental + _i1.DynamiteSerializer $sendMessages_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(SignalingSendMessagesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Send signaling messages. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [sendMessages] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -13493,37 +13218,21 @@ class $SignalingClient { /// * 400: Sending signaling message is not possible /// /// See: - /// * [sendMessages] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [sendMessages] for a method executing this request and parsing the response. + /// * [$sendMessages_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> sendMessagesRaw({ + _i3.Request $sendMessages_Request({ required String messages, required String token, SignalingSendMessagesApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end + }) { + final _parameters = {}; final $messages = _$jsonSerializers.serialize(messages, specifiedType: const FullType(String)); _parameters['messages'] = $messages; final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _i3.checkPattern( + _i4.checkPattern( $token as String?, RegExp(r'^[a-z0-9]{4,30}$'), 'token', @@ -13535,74 +13244,87 @@ class $SignalingClient { $apiVersion ??= 'v3'; _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/signaling/{token}{?messages*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/signaling/{token}{?messages*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - final _serializer = $sendMessages_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); - } - - /// Builds a serializer to parse the response of `$getWelcomeMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getWelcomeMessage_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(SignalingGetWelcomeMessageResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, + if (authentication != null) { + _request.headers.addAll( + authentication.headers, ); + } - /// Get the welcome message from a signaling server. - /// - /// Only available for logged-in users because guests can not use the apps right now. - /// This endpoint requires admin access. +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + + return _request; + } + + /// Send signaling messages. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [messages] JSON encoded messages. /// * [apiVersion] Defaults to `v3`. - /// * [serverId] ID of the signaling server. + /// * [token] Token of the room. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Welcome message returned - /// * 404: Signaling server not found - /// * 500 + /// * 200: Signaling message sent successfully + /// * 400: Sending signaling message is not possible /// /// See: - /// * [getWelcomeMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getWelcomeMessage({ - required int serverId, - SignalingGetWelcomeMessageApiVersion? apiVersion, + /// * [$sendMessages_Request] for the request send by this method. + /// * [$sendMessages_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> sendMessages({ + required String messages, + required String token, + SignalingSendMessagesApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _rawResponse = await getWelcomeMessageRaw( - serverId: serverId, + final _request = $sendMessages_Request( + messages: messages, + token: token, apiVersion: apiVersion, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $sendMessages_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getWelcomeMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getWelcomeMessage_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(SignalingGetWelcomeMessageResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get the welcome message from a signaling server. /// /// Only available for logged-in users because guests can not use the apps right now. /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getWelcomeMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -13616,16 +13338,28 @@ class $SignalingClient { /// * 500 /// /// See: - /// * [getWelcomeMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getWelcomeMessage] for a method executing this request and parsing the response. + /// * [$getWelcomeMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getWelcomeMessageRaw({ + _i3.Request $getWelcomeMessage_Request({ required int serverId, SignalingGetWelcomeMessageApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $serverId = _$jsonSerializers.serialize(serverId, specifiedType: const FullType(int)); + _parameters['serverId'] = $serverId; + + var $apiVersion = + _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SignalingGetWelcomeMessageApiVersion)); + $apiVersion ??= 'v3'; + _parameters['apiVersion'] = $apiVersion; + final _path = + _i5.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/signaling/welcome/{serverId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -13635,7 +13369,7 @@ class $SignalingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -13643,29 +13377,51 @@ class $SignalingClient { } // coverage:ignore-end - final $serverId = _$jsonSerializers.serialize(serverId, specifiedType: const FullType(int)); - _parameters['serverId'] = $serverId; - - var $apiVersion = - _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(SignalingGetWelcomeMessageApiVersion)); - $apiVersion ??= 'v3'; - _parameters['apiVersion'] = $apiVersion; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/spreed/api/{apiVersion}/signaling/welcome/{serverId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + return _request; + } + + /// Get the welcome message from a signaling server. + /// + /// Only available for logged-in users because guests can not use the apps right now. + /// This endpoint requires admin access. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [apiVersion] Defaults to `v3`. + /// * [serverId] ID of the signaling server. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Welcome message returned + /// * 404: Signaling server not found + /// * 500 + /// + /// See: + /// * [$getWelcomeMessage_Request] for the request send by this method. + /// * [$getWelcomeMessage_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getWelcomeMessage({ + required int serverId, + SignalingGetWelcomeMessageApiVersion? apiVersion, + bool? oCSAPIRequest, + }) async { + final _request = $getWelcomeMessage_Request( + serverId: serverId, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getWelcomeMessage_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -13675,7 +13431,7 @@ class $TempAvatarClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$postAvatar_Request`. + /// Builds a serializer to parse the response of [$postAvatar_Request]. @_i2.experimental _i1.DynamiteSerializer $postAvatar_Serializer() => _i1.DynamiteSerializer( @@ -13687,33 +13443,7 @@ class $TempAvatarClient { /// Upload your avatar as a user. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Avatar uploaded successfully - /// * 400: Uploading avatar is not possible - /// - /// See: - /// * [postAvatarRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> postAvatar({ - bool? oCSAPIRequest, - }) async { - final _rawResponse = await postAvatarRaw( - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Upload your avatar as a user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [postAvatar] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -13724,13 +13454,14 @@ class $TempAvatarClient { /// * 400: Uploading avatar is not possible /// /// See: - /// * [postAvatar] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [postAvatar] for a method executing this request and parsing the response. + /// * [$postAvatar_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> postAvatarRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $postAvatar_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/spreed/temp-user-avatar'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -13740,7 +13471,7 @@ class $TempAvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -13750,30 +13481,12 @@ class $TempAvatarClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/spreed/temp-user-avatar'; - final _response = await _rootClient.executeRequest( - 'post', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $postAvatar_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteAvatar_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteAvatar_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(TempAvatarDeleteAvatarResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200, 400}, - ); - - /// Delete your avatar as a user. + /// Upload your avatar as a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -13782,26 +13495,39 @@ class $TempAvatarClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Avatar deleted successfully - /// * 400: Deleting avatar is not possible + /// * 200: Avatar uploaded successfully + /// * 400: Uploading avatar is not possible /// /// See: - /// * [deleteAvatarRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> deleteAvatar({ + /// * [$postAvatar_Request] for the request send by this method. + /// * [$postAvatar_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> postAvatar({ bool? oCSAPIRequest, }) async { - final _rawResponse = await deleteAvatarRaw( + final _request = $postAvatar_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $postAvatar_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$deleteAvatar_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteAvatar_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(TempAvatarDeleteAvatarResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200, 400}, + ); + /// Delete your avatar as a user. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteAvatar] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -13812,13 +13538,14 @@ class $TempAvatarClient { /// * 400: Deleting avatar is not possible /// /// See: - /// * [deleteAvatar] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteAvatar] for a method executing this request and parsing the response. + /// * [$deleteAvatar_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteAvatarRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $deleteAvatar_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/spreed/temp-user-avatar'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -13828,7 +13555,7 @@ class $TempAvatarClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -13838,17 +13565,38 @@ class $TempAvatarClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/apps/spreed/temp-user-avatar'; - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, + return _request; + } + + /// Delete your avatar as a user. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Avatar deleted successfully + /// * 400: Deleting avatar is not possible + /// + /// See: + /// * [$deleteAvatar_Request] for the request send by this method. + /// * [$deleteAvatar_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> deleteAvatar({ + bool? oCSAPIRequest, + }) async { + final _request = $deleteAvatar_Request( + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $deleteAvatar_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -39608,13 +39356,13 @@ extension $e620970959f428e934829e52f32b7089Extension on _$e620970959f428e934829e List get _names => const ['builtListNever', 'chatMessage']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -39688,13 +39436,13 @@ extension $bd993fb3f40af33e8594d0d698208560Extension on _$bd993fb3f40af33e8594d0 List get _names => const ['builtListNever', 'roomAddParticipantToRoomResponseApplicationJsonOcsData0']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -39774,13 +39522,13 @@ extension $b2c4857c0136baea42828d89c87c757dExtension on _$b2c4857c0136baea42828d List get _names => const [r'$int', 'string']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -39850,13 +39598,13 @@ extension $1df642f5035aea3b22543ab331c3fb01Extension on _$1df642f5035aea3b22543a List get _names => const ['builtListSignalingSession', 'string']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -39932,13 +39680,13 @@ extension $bc4aac45771b11649d372f39a92b1cf3Extension on _$bc4aac45771b11649d372f List get _names => const ['builtListNever', 'publicCapabilities0']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i4.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i4.validateAnyOf( _values, _names, ); @@ -41511,9 +41259,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) + ..add(_i6.DynamiteDoubleSerializer()) ..addPlugin( - _i6.StandardJsonPlugin( + _i7.StandardJsonPlugin( typesToLeaveAsList: const { _$e620970959f428e934829e52f32b7089, _$bd993fb3f40af33e8594d0d698208560, @@ -41523,7 +41271,7 @@ final Serializers _$jsonSerializers = (_$serializers.toBuilder() }, ), ) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/theming.openapi.dart b/packages/nextcloud/lib/src/api/theming.openapi.dart index 31fde48ace3..bf4c9fd3162 100644 --- a/packages/nextcloud/lib/src/api/theming.openapi.dart +++ b/packages/nextcloud/lib/src/api/theming.openapi.dart @@ -21,13 +21,14 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i4; +import 'package:dynamite_runtime/utils.dart' as _i5; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i3; +import 'package:uri/uri.dart' as _i4; part 'theming.openapi.g.dart'; @@ -66,7 +67,7 @@ class $IconClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getFavicon_Request`. + /// Builds a serializer to parse the response of [$getFavicon_Request]. @_i2.experimental _i1.DynamiteSerializer $getFavicon_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -77,32 +78,7 @@ class $IconClient { /// Return a 32x32 favicon as png. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [app] ID of the app. Defaults to `core`. - /// - /// Status codes: - /// * 200: Favicon returned - /// * 404: Favicon not found - /// * 500 - /// - /// See: - /// * [getFaviconRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getFavicon({String? app}) async { - final _rawResponse = await getFaviconRaw( - app: app, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Return a 32x32 favicon as png. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getFavicon] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -114,12 +90,19 @@ class $IconClient { /// * 500 /// /// See: - /// * [getFavicon] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getFavicon] for a method executing this request and parsing the response. + /// * [$getFavicon_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getFaviconRaw({String? app}) async { - final _parameters = {}; - final _headers = {'Accept': 'image/x-icon'}; + _i3.Request $getFavicon_Request({String? app}) { + final _parameters = {}; + var $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); + $app ??= 'core'; + _parameters['app'] = $app; + final _path = _i4.UriTemplate('/index.php/apps/theming/favicon/{app}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'image/x-icon'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -129,37 +112,16 @@ class $IconClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - var $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); - $app ??= 'core'; - _parameters['app'] = $app; - - final _path = _i3.UriTemplate('/index.php/apps/theming/favicon/{app}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getFavicon_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getTouchIcon_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getTouchIcon_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Uint8List), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Return a 512x512 icon for touch devices. + /// Return a 32x32 favicon as png. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -168,25 +130,36 @@ class $IconClient { /// * [app] ID of the app. Defaults to `core`. /// /// Status codes: - /// * 200: Touch icon returned - /// * 404: Touch icon not found + /// * 200: Favicon returned + /// * 404: Favicon not found /// * 500 /// /// See: - /// * [getTouchIconRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getTouchIcon({String? app}) async { - final _rawResponse = await getTouchIconRaw( + /// * [$getFavicon_Request] for the request send by this method. + /// * [$getFavicon_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getFavicon({String? app}) async { + final _request = $getFavicon_Request( app: app, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getFavicon_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getTouchIcon_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getTouchIcon_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Uint8List), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Return a 512x512 icon for touch devices. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getTouchIcon] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -198,12 +171,19 @@ class $IconClient { /// * 500 /// /// See: - /// * [getTouchIcon] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getTouchIcon] for a method executing this request and parsing the response. + /// * [$getTouchIcon_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getTouchIconRaw({String? app}) async { - final _parameters = {}; - final _headers = {'Accept': 'image/png'}; + _i3.Request $getTouchIcon_Request({String? app}) { + final _parameters = {}; + var $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); + $app ??= 'core'; + _parameters['app'] = $app; + final _path = _i4.UriTemplate('/index.php/apps/theming/icon/{app}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'image/png'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -213,69 +193,54 @@ class $IconClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - var $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); - $app ??= 'core'; - _parameters['app'] = $app; - - final _path = _i3.UriTemplate('/index.php/apps/theming/icon/{app}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getTouchIcon_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getThemedIcon_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getThemedIcon_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(Uint8List), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get a themed icon. + /// Return a 512x512 icon for touch devices. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [app] ID of the app. - /// * [image] image file name (svg required). + /// * [app] ID of the app. Defaults to `core`. /// /// Status codes: - /// * 200: Themed icon returned - /// * 404: Themed icon not found + /// * 200: Touch icon returned + /// * 404: Touch icon not found /// * 500 /// /// See: - /// * [getThemedIconRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getThemedIcon({ - required String app, - required String image, - }) async { - final _rawResponse = await getThemedIconRaw( + /// * [$getTouchIcon_Request] for the request send by this method. + /// * [$getTouchIcon_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getTouchIcon({String? app}) async { + final _request = $getTouchIcon_Request( app: app, - image: image, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getTouchIcon_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getThemedIcon_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getThemedIcon_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(Uint8List), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get a themed icon. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getThemedIcon] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -288,15 +253,29 @@ class $IconClient { /// * 500 /// /// See: - /// * [getThemedIcon] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getThemedIcon] for a method executing this request and parsing the response. + /// * [$getThemedIcon_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getThemedIconRaw({ + _i3.Request $getThemedIcon_Request({ required String app, required String image, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'image/svg+xml'}; + }) { + final _parameters = {}; + final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); + _parameters['app'] = $app; + + final $image = _$jsonSerializers.serialize(image, specifiedType: const FullType(String)); + _i5.checkPattern( + $image as String?, + RegExp(r'^.+$'), + 'image', + ); + _parameters['image'] = $image; + final _path = _i4.UriTemplate('/index.php/apps/theming/img/{app}/{image}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'image/svg+xml'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -306,32 +285,45 @@ class $IconClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - final $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); - _parameters['app'] = $app; - - final $image = _$jsonSerializers.serialize(image, specifiedType: const FullType(String)); - _i4.checkPattern( - $image as String?, - RegExp(r'^.+$'), - 'image', - ); - _parameters['image'] = $image; + return _request; + } - final _path = _i3.UriTemplate('/index.php/apps/theming/img/{app}/{image}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + /// Get a themed icon. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [app] ID of the app. + /// * [image] image file name (svg required). + /// + /// Status codes: + /// * 200: Themed icon returned + /// * 404: Themed icon not found + /// * 500 + /// + /// See: + /// * [$getThemedIcon_Request] for the request send by this method. + /// * [$getThemedIcon_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getThemedIcon({ + required String app, + required String image, + }) async { + final _request = $getThemedIcon_Request( + app: app, + image: image, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getThemedIcon_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -343,7 +335,7 @@ class $ThemingClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getThemeStylesheet_Request`. + /// Builds a serializer to parse the response of [$getThemeStylesheet_Request]. @_i2.experimental _i1.DynamiteSerializer $getThemeStylesheet_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(String), @@ -354,7 +346,7 @@ class $ThemingClient { /// Get the CSS stylesheet for a theme. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getThemeStylesheet] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -367,26 +359,55 @@ class $ThemingClient { /// * 404: Theme not found /// /// See: - /// * [getThemeStylesheetRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getThemeStylesheet({ + /// * [getThemeStylesheet] for a method executing this request and parsing the response. + /// * [$getThemeStylesheet_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getThemeStylesheet_Request({ required String themeId, ThemingGetThemeStylesheetPlain? plain, ThemingGetThemeStylesheetWithCustomCss? withCustomCss, - }) async { - final _rawResponse = await getThemeStylesheetRaw( - themeId: themeId, - plain: plain, - withCustomCss: withCustomCss, + }) { + final _parameters = {}; + final $themeId = _$jsonSerializers.serialize(themeId, specifiedType: const FullType(String)); + _parameters['themeId'] = $themeId; + + var $plain = _$jsonSerializers.serialize(plain, specifiedType: const FullType(ThemingGetThemeStylesheetPlain)); + $plain ??= 0; + _parameters['plain'] = $plain; + + var $withCustomCss = _$jsonSerializers.serialize( + withCustomCss, + specifiedType: const FullType(ThemingGetThemeStylesheetWithCustomCss), ); + $withCustomCss ??= 0; + _parameters['withCustomCss'] = $withCustomCss; - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + final _path = + _i4.UriTemplate('/index.php/apps/theming/theme/{themeId}.css{?plain*,withCustomCss*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'text/css'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end + return _request; } /// Get the CSS stylesheet for a theme. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -399,58 +420,26 @@ class $ThemingClient { /// * 404: Theme not found /// /// See: - /// * [getThemeStylesheet] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getThemeStylesheetRaw({ + /// * [$getThemeStylesheet_Request] for the request send by this method. + /// * [$getThemeStylesheet_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getThemeStylesheet({ required String themeId, ThemingGetThemeStylesheetPlain? plain, ThemingGetThemeStylesheetWithCustomCss? withCustomCss, }) async { - final _parameters = {}; - final _headers = {'Accept': 'text/css'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end - final $themeId = _$jsonSerializers.serialize(themeId, specifiedType: const FullType(String)); - _parameters['themeId'] = $themeId; - - var $plain = _$jsonSerializers.serialize(plain, specifiedType: const FullType(ThemingGetThemeStylesheetPlain)); - $plain ??= 0; - _parameters['plain'] = $plain; - - var $withCustomCss = _$jsonSerializers.serialize( - withCustomCss, - specifiedType: const FullType(ThemingGetThemeStylesheetWithCustomCss), - ); - $withCustomCss ??= 0; - _parameters['withCustomCss'] = $withCustomCss; - - final _path = - _i3.UriTemplate('/index.php/apps/theming/theme/{themeId}.css{?plain*,withCustomCss*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getThemeStylesheet_Request( + themeId: themeId, + plain: plain, + withCustomCss: withCustomCss, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getThemeStylesheet_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$getImage_Request`. + /// Builds a serializer to parse the response of [$getImage_Request]. @_i2.experimental _i1.DynamiteSerializer $getImage_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -461,7 +450,7 @@ class $ThemingClient { /// Get an image. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getImage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -474,24 +463,46 @@ class $ThemingClient { /// * 500 /// /// See: - /// * [getImageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getImage({ + /// * [getImage] for a method executing this request and parsing the response. + /// * [$getImage_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getImage_Request({ required String key, ThemingGetImageUseSvg? useSvg, - }) async { - final _rawResponse = await getImageRaw( - key: key, - useSvg: useSvg, + }) { + final _parameters = {}; + final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(String)); + _parameters['key'] = $key; + + var $useSvg = _$jsonSerializers.serialize(useSvg, specifiedType: const FullType(ThemingGetImageUseSvg)); + $useSvg ??= 1; + _parameters['useSvg'] = $useSvg; + + final _path = _i4.UriTemplate('/index.php/apps/theming/image/{key}{?useSvg*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } + +// coverage:ignore-end + return _request; } /// Get an image. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -504,49 +515,24 @@ class $ThemingClient { /// * 500 /// /// See: - /// * [getImage] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getImageRaw({ + /// * [$getImage_Request] for the request send by this method. + /// * [$getImage_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getImage({ required String key, ThemingGetImageUseSvg? useSvg, }) async { - final _parameters = {}; - final _headers = {'Accept': '*/*'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } - -// coverage:ignore-end - final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(String)); - _parameters['key'] = $key; - - var $useSvg = _$jsonSerializers.serialize(useSvg, specifiedType: const FullType(ThemingGetImageUseSvg)); - $useSvg ??= 1; - _parameters['useSvg'] = $useSvg; - - final _path = _i3.UriTemplate('/index.php/apps/theming/image/{key}{?useSvg*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getImage_Request( + key: key, + useSvg: useSvg, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getImage_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Builds a serializer to parse the response of `$getManifest_Request`. + /// Builds a serializer to parse the response of [$getManifest_Request]. @_i2.experimental _i1.DynamiteSerializer $getManifest_Serializer() => _i1.DynamiteSerializer( @@ -558,7 +544,7 @@ class $ThemingClient { /// Get the manifest for an app. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getManifest] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -569,36 +555,19 @@ class $ThemingClient { /// * 404: App not found /// /// See: - /// * [getManifestRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getManifest({String? app}) async { - final _rawResponse = await getManifestRaw( - app: app, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get the manifest for an app. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [app] ID of the app. Defaults to `core`. - /// - /// Status codes: - /// * 200: Manifest returned - /// * 404: App not found - /// - /// See: - /// * [getManifest] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getManifest] for a method executing this request and parsing the response. + /// * [$getManifest_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getManifestRaw({String? app}) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $getManifest_Request({String? app}) { + final _parameters = {}; + var $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); + $app ??= 'core'; + _parameters['app'] = $app; + final _path = _i4.UriTemplate('/index.php/apps/theming/manifest/{app}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -608,25 +577,40 @@ class $ThemingClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } // coverage:ignore-end - var $app = _$jsonSerializers.serialize(app, specifiedType: const FullType(String)); - $app ??= 'core'; - _parameters['app'] = $app; + return _request; + } - final _path = _i3.UriTemplate('/index.php/apps/theming/manifest/{app}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + /// Get the manifest for an app. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [app] ID of the app. Defaults to `core`. + /// + /// Status codes: + /// * 200: Manifest returned + /// * 404: App not found + /// + /// See: + /// * [$getManifest_Request] for the request send by this method. + /// * [$getManifest_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getManifest({String? app}) async { + final _request = $getManifest_Request( + app: app, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getManifest_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -636,7 +620,7 @@ class $UserThemeClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getBackground_Request`. + /// Builds a serializer to parse the response of [$getBackground_Request]. @_i2.experimental _i1.DynamiteSerializer $getBackground_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(Uint8List), @@ -647,7 +631,7 @@ class $UserThemeClient { /// Get the background image. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getBackground] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: @@ -655,30 +639,14 @@ class $UserThemeClient { /// * 404: Background image not found /// /// See: - /// * [getBackgroundRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getBackground() async { - final _rawResponse = await getBackgroundRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Get the background image. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Status codes: - /// * 200: Background image returned - /// * 404: Background image not found - /// - /// See: - /// * [getBackground] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getBackground] for a method executing this request and parsing the response. + /// * [$getBackground_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getBackgroundRaw() async { - final _headers = {'Accept': '*/*'}; - + _i3.Request $getBackground_Request() { + const _path = '/index.php/apps/theming/background'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = '*/*'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -688,7 +656,7 @@ class $UserThemeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -696,60 +664,43 @@ class $UserThemeClient { } // coverage:ignore-end - const _path = '/index.php/apps/theming/background'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getBackground_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$enableTheme_Request`. - @_i2.experimental - _i1.DynamiteSerializer $enableTheme_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UserThemeEnableThemeResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Enable theme. + /// Get the background image. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// - /// Parameters: - /// * [themeId] the theme ID. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// /// Status codes: - /// * 200: Theme enabled successfully - /// * 400: Enabling theme is not possible - /// * 500 + /// * 200: Background image returned + /// * 404: Background image not found /// /// See: - /// * [enableThemeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> enableTheme({ - required String themeId, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await enableThemeRaw( - themeId: themeId, - oCSAPIRequest: oCSAPIRequest, - ); + /// * [$getBackground_Request] for the request send by this method. + /// * [$getBackground_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getBackground() async { + final _request = $getBackground_Request(); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getBackground_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$enableTheme_Request]. + @_i2.experimental + _i1.DynamiteSerializer $enableTheme_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UserThemeEnableThemeResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Enable theme. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [enableTheme] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -762,15 +713,21 @@ class $UserThemeClient { /// * 500 /// /// See: - /// * [enableTheme] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [enableTheme] for a method executing this request and parsing the response. + /// * [$enableTheme_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> enableThemeRaw({ + _i3.Request $enableTheme_Request({ required String themeId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $themeId = _$jsonSerializers.serialize(themeId, specifiedType: const FullType(String)); + _parameters['themeId'] = $themeId; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/theming/api/v1/theme/{themeId}/enable').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -780,7 +737,7 @@ class $UserThemeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -788,35 +745,14 @@ class $UserThemeClient { } // coverage:ignore-end - final $themeId = _$jsonSerializers.serialize(themeId, specifiedType: const FullType(String)); - _parameters['themeId'] = $themeId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i3.UriTemplate('/ocs/v2.php/apps/theming/api/v1/theme/{themeId}/enable').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); - - final _serializer = $enableTheme_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$disableTheme_Request`. - @_i2.experimental - _i1.DynamiteSerializer $disableTheme_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UserThemeDisableThemeResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Disable theme. + /// Enable theme. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -826,29 +762,42 @@ class $UserThemeClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Theme disabled successfully - /// * 400: Disabling theme is not possible + /// * 200: Theme enabled successfully + /// * 400: Enabling theme is not possible /// * 500 /// /// See: - /// * [disableThemeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> disableTheme({ + /// * [$enableTheme_Request] for the request send by this method. + /// * [$enableTheme_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> enableTheme({ required String themeId, bool? oCSAPIRequest, }) async { - final _rawResponse = await disableThemeRaw( + final _request = $enableTheme_Request( themeId: themeId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $enableTheme_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$disableTheme_Request]. + @_i2.experimental + _i1.DynamiteSerializer $disableTheme_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UserThemeDisableThemeResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Disable theme. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [disableTheme] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -861,15 +810,21 @@ class $UserThemeClient { /// * 500 /// /// See: - /// * [disableTheme] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [disableTheme] for a method executing this request and parsing the response. + /// * [$disableTheme_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> disableThemeRaw({ + _i3.Request $disableTheme_Request({ required String themeId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $themeId = _$jsonSerializers.serialize(themeId, specifiedType: const FullType(String)); + _parameters['themeId'] = $themeId; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/theming/api/v1/theme/{themeId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -879,7 +834,7 @@ class $UserThemeClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -887,22 +842,44 @@ class $UserThemeClient { } // coverage:ignore-end - final $themeId = _$jsonSerializers.serialize(themeId, specifiedType: const FullType(String)); - _parameters['themeId'] = $themeId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i4.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i3.UriTemplate('/ocs/v2.php/apps/theming/api/v1/theme/{themeId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, + return _request; + } + + /// Disable theme. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [themeId] the theme ID. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Theme disabled successfully + /// * 400: Disabling theme is not possible + /// * 500 + /// + /// See: + /// * [$disableTheme_Request] for the request send by this method. + /// * [$disableTheme_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> disableTheme({ + required String themeId, + bool? oCSAPIRequest, + }) async { + final _request = $disableTheme_Request( + themeId: themeId, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $disableTheme_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -1142,7 +1119,7 @@ abstract class ThemingGetManifestResponseApplicationJson_Icons @BuiltValueHook(finalizeBuilder: true) static void _validate(ThemingGetManifestResponseApplicationJson_IconsBuilder b) { - _i4.checkMinLength( + _i5.checkMinLength( b.src, 1, 'src', @@ -1537,9 +1514,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin()) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin()) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/updatenotification.openapi.dart b/packages/nextcloud/lib/src/api/updatenotification.openapi.dart index fa2df918533..ee1358388c2 100644 --- a/packages/nextcloud/lib/src/api/updatenotification.openapi.dart +++ b/packages/nextcloud/lib/src/api/updatenotification.openapi.dart @@ -18,11 +18,12 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i5; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; import 'package:uri/uri.dart' as _i4; @@ -57,7 +58,7 @@ class $ApiClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$getAppList_Request`. + /// Builds a serializer to parse the response of [$getAppList_Request]. @_i2.experimental _i1.DynamiteSerializer $getAppList_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(ApiGetAppListResponseApplicationJson), @@ -70,7 +71,7 @@ class $ApiClient { /// /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [getAppList] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -83,28 +84,56 @@ class $ApiClient { /// * 404: New versions not found /// /// See: - /// * [getAppListRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getAppList({ + /// * [getAppList] for a method executing this request and parsing the response. + /// * [$getAppList_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $getAppList_Request({ required String newVersion, ApiGetAppListApiVersion? apiVersion, bool? oCSAPIRequest, - }) async { - final _rawResponse = await getAppListRaw( - newVersion: newVersion, - apiVersion: apiVersion, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $newVersion = _$jsonSerializers.serialize(newVersion, specifiedType: const FullType(String)); + _parameters['newVersion'] = $newVersion; + + var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ApiGetAppListApiVersion)); + $apiVersion ??= 'v1'; + _parameters['apiVersion'] = $apiVersion; + + final _path = _i4.UriTemplate('/ocs/v2.php/apps/updatenotification/api/{apiVersion}/applist/{newVersion}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// List available updates for apps. /// /// This endpoint requires admin access. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -117,54 +146,24 @@ class $ApiClient { /// * 404: New versions not found /// /// See: - /// * [getAppList] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> getAppListRaw({ + /// * [$getAppList_Request] for the request send by this method. + /// * [$getAppList_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getAppList({ required String newVersion, ApiGetAppListApiVersion? apiVersion, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $newVersion = _$jsonSerializers.serialize(newVersion, specifiedType: const FullType(String)); - _parameters['newVersion'] = $newVersion; - - var $apiVersion = _$jsonSerializers.serialize(apiVersion, specifiedType: const FullType(ApiGetAppListApiVersion)); - $apiVersion ??= 'v1'; - _parameters['apiVersion'] = $apiVersion; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/updatenotification/api/{apiVersion}/applist/{newVersion}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, + final _request = $getAppList_Request( + newVersion: newVersion, + apiVersion: apiVersion, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $getAppList_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -444,9 +443,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin()) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin()) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/uppush.openapi.dart b/packages/nextcloud/lib/src/api/uppush.openapi.dart index aa0811f04c3..ee9ec90296b 100644 --- a/packages/nextcloud/lib/src/api/uppush.openapi.dart +++ b/packages/nextcloud/lib/src/api/uppush.openapi.dart @@ -18,12 +18,13 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i5; +import 'package:built_value/standard_json_plugin.dart' as _i6; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i4; +import 'package:dynamite_runtime/built_value.dart' as _i5; import 'package:dynamite_runtime/http_client.dart' as _i1; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; -import 'package:uri/uri.dart' as _i3; +import 'package:uri/uri.dart' as _i4; part 'uppush.openapi.g.dart'; @@ -47,7 +48,7 @@ class $Client extends _i1.DynamiteClient { authentications: client.authentications, ); - /// Builds a serializer to parse the response of `$check_Request`. + /// Builds a serializer to parse the response of [$check_Request]. @_i2.experimental _i1.DynamiteSerializer $check_Serializer() => _i1.DynamiteSerializer( bodyType: const FullType(CheckResponseApplicationJson), @@ -56,6 +57,43 @@ class $Client extends _i1.DynamiteClient { validStatuses: const {200}, ); + /// Check if the UnifiedPush provider is present. + /// + /// Returns a `DynamiteRequest` backing the [check] operation. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200 + /// + /// See: + /// * [check] for a method executing this request and parsing the response. + /// * [$check_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $check_Request() { + const _path = '/index.php/apps/uppush'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for basic_auth'); + } + +// coverage:ignore-end + return _request; + } + /// Check if the UnifiedPush provider is present. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -65,29 +103,54 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [checkRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$check_Request] for the request send by this method. + /// * [$check_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> check() async { - final _rawResponse = await checkRaw(); + final _request = $check_Request(); + final _response = await sendWithCookies(_request); + final _serializer = $check_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Check if the UnifiedPush provider is present. + /// Builds a serializer to parse the response of [$setKeepalive_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setKeepalive_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(SetKeepaliveResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Set keepalive interval. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// This endpoint requires admin access. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setKeepalive] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// + /// Parameters: + /// * [keepalive] Keep alive value in seconds. + /// /// Status codes: /// * 200 /// /// See: - /// * [check] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setKeepalive] for a method executing this request and parsing the response. + /// * [$setKeepalive_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> checkRaw() async { - final _headers = {'Accept': 'application/json'}; + _i3.Request $setKeepalive_Request({required int keepalive}) { + final _parameters = {}; + final $keepalive = _$jsonSerializers.serialize(keepalive, specifiedType: const FullType(int)); + _parameters['keepalive'] = $keepalive; + final _path = _i4.UriTemplate('/index.php/apps/uppush/keepalive{?keepalive*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -97,7 +160,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -105,27 +168,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - const _path = '/index.php/apps/uppush'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $check_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setKeepalive_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setKeepalive_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(SetKeepaliveResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Set keepalive interval. /// /// This endpoint requires admin access. @@ -140,39 +185,54 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [setKeepaliveRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setKeepalive_Request] for the request send by this method. + /// * [$setKeepalive_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setKeepalive({required int keepalive}) async { - final _rawResponse = await setKeepaliveRaw( + final _request = $setKeepalive_Request( keepalive: keepalive, ); + final _response = await sendWithCookies(_request); + final _serializer = $setKeepalive_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Set keepalive interval. - /// - /// This endpoint requires admin access. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$createDevice_Request]. + @_i2.experimental + _i1.DynamiteSerializer $createDevice_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(CreateDeviceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Request to create a new deviceId. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [createDevice] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [keepalive] Keep alive value in seconds. + /// * [deviceName] Name of the device. /// /// Status codes: /// * 200 /// /// See: - /// * [setKeepalive] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [createDevice] for a method executing this request and parsing the response. + /// * [$createDevice_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setKeepaliveRaw({ - required int keepalive, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $createDevice_Request({required String deviceName}) { + final _parameters = {}; + final $deviceName = _$jsonSerializers.serialize(deviceName, specifiedType: const FullType(String)); + _parameters['deviceName'] = $deviceName; + final _path = _i4.UriTemplate('/index.php/apps/uppush/device{?deviceName*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -182,7 +242,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -190,30 +250,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $keepalive = _$jsonSerializers.serialize(keepalive, specifiedType: const FullType(int)); - _parameters['keepalive'] = $keepalive; - - final _path = _i3.UriTemplate('/index.php/apps/uppush/keepalive{?keepalive*}').expand(_parameters); - final _response = await executeRequest( - 'put', - _path, - headers: _headers, - ); - - final _serializer = $setKeepalive_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$createDevice_Request`. - @_i2.experimental - _i1.DynamiteSerializer $createDevice_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(CreateDeviceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Request to create a new deviceId. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -226,39 +265,54 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [createDeviceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$createDevice_Request] for the request send by this method. + /// * [$createDevice_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> createDevice({ required String deviceName, }) async { - final _rawResponse = await createDeviceRaw( + final _request = $createDevice_Request( deviceName: deviceName, ); + final _response = await sendWithCookies(_request); + final _serializer = $createDevice_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Request to create a new deviceId. + /// Builds a serializer to parse the response of [$syncDevice_Request]. + @_i2.experimental + _i1.DynamiteSerializer $syncDevice_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(SyncDeviceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {401}, + ); + + /// Request to get push messages. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// This is a public page since it has to be handle by the non-connected app (NextPush app and not Nextcloud-app). /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [syncDevice] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// - /// Parameters: - /// * [deviceName] Name of the device. - /// /// Status codes: - /// * 200 + /// * 401: Missing permissions to sync device /// /// See: - /// * [createDevice] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [syncDevice] for a method executing this request and parsing the response. + /// * [$syncDevice_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createDeviceRaw({ - required String deviceName, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $syncDevice_Request({required String deviceId}) { + final _parameters = {}; + final $deviceId = _$jsonSerializers.serialize(deviceId, specifiedType: const FullType(String)); + _parameters['deviceId'] = $deviceId; + final _path = _i4.UriTemplate('/index.php/apps/uppush/device/{deviceId}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -268,7 +322,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -276,29 +330,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $deviceName = _$jsonSerializers.serialize(deviceName, specifiedType: const FullType(String)); - _parameters['deviceName'] = $deviceName; - - final _path = _i3.UriTemplate('/index.php/apps/uppush/device{?deviceName*}').expand(_parameters); - final _response = await executeRequest( - 'put', - _path, - headers: _headers, - ); - - final _serializer = $createDevice_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$syncDevice_Request`. - @_i2.experimental - _i1.DynamiteSerializer $syncDevice_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(SyncDeviceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {401}, - ); - /// Request to get push messages. /// /// This is a public page since it has to be handle by the non-connected app (NextPush app and not Nextcloud-app). @@ -310,36 +344,51 @@ class $Client extends _i1.DynamiteClient { /// * 401: Missing permissions to sync device /// /// See: - /// * [syncDeviceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$syncDevice_Request] for the request send by this method. + /// * [$syncDevice_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> syncDevice({required String deviceId}) async { - final _rawResponse = await syncDeviceRaw( + final _request = $syncDevice_Request( deviceId: deviceId, ); + final _response = await sendWithCookies(_request); + final _serializer = $syncDevice_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Request to get push messages. - /// - /// This is a public page since it has to be handle by the non-connected app (NextPush app and not Nextcloud-app). - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$deleteDevice_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteDevice_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(DeleteDeviceResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Delete a device. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteDevice] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: - /// * 401: Missing permissions to sync device + /// * 200: Device deleted successfully /// /// See: - /// * [syncDevice] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteDevice] for a method executing this request and parsing the response. + /// * [$deleteDevice_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> syncDeviceRaw({ - required String deviceId, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $deleteDevice_Request({required String deviceId}) { + final _parameters = {}; + final $deviceId = _$jsonSerializers.serialize(deviceId, specifiedType: const FullType(String)); + _parameters['deviceId'] = $deviceId; + final _path = _i4.UriTemplate('/index.php/apps/uppush/device/{deviceId}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -349,7 +398,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -357,30 +406,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $deviceId = _$jsonSerializers.serialize(deviceId, specifiedType: const FullType(String)); - _parameters['deviceId'] = $deviceId; - - final _path = _i3.UriTemplate('/index.php/apps/uppush/device/{deviceId}').expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $syncDevice_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteDevice_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteDevice_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(DeleteDeviceResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Delete a device. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -390,36 +418,62 @@ class $Client extends _i1.DynamiteClient { /// * 200: Device deleted successfully /// /// See: - /// * [deleteDeviceRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteDevice_Request] for the request send by this method. + /// * [$deleteDevice_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteDevice({ required String deviceId, }) async { - final _rawResponse = await deleteDeviceRaw( + final _request = $deleteDevice_Request( deviceId: deviceId, ); + final _response = await sendWithCookies(_request); + final _serializer = $deleteDevice_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Delete a device. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$createApp_Request]. + @_i2.experimental + _i1.DynamiteSerializer $createApp_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(CreateAppResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Create an authorization token for a new 3rd party service. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [createApp] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// + /// Parameters: + /// * [deviceId] ID of the device. + /// * [appName] Name of the app. + /// /// Status codes: - /// * 200: Device deleted successfully + /// * 200: App created successfully /// /// See: - /// * [deleteDevice] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [createApp] for a method executing this request and parsing the response. + /// * [$createApp_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteDeviceRaw({ + _i3.Request $createApp_Request({ required String deviceId, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + required String appName, + }) { + final _parameters = {}; + final $deviceId = _$jsonSerializers.serialize(deviceId, specifiedType: const FullType(String)); + _parameters['deviceId'] = $deviceId; + final $appName = _$jsonSerializers.serialize(appName, specifiedType: const FullType(String)); + _parameters['appName'] = $appName; + + final _path = _i4.UriTemplate('/index.php/apps/uppush/app{?deviceId*,appName*}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -429,7 +483,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -437,29 +491,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $deviceId = _$jsonSerializers.serialize(deviceId, specifiedType: const FullType(String)); - _parameters['deviceId'] = $deviceId; - - final _path = _i3.UriTemplate('/index.php/apps/uppush/device/{deviceId}').expand(_parameters); - final _response = await executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $deleteDevice_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$createApp_Request`. - @_i2.experimental - _i1.DynamiteSerializer $createApp_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(CreateAppResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Create an authorization token for a new 3rd party service. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -473,43 +507,54 @@ class $Client extends _i1.DynamiteClient { /// * 200: App created successfully /// /// See: - /// * [createAppRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$createApp_Request] for the request send by this method. + /// * [$createApp_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> createApp({ required String deviceId, required String appName, }) async { - final _rawResponse = await createAppRaw( + final _request = $createApp_Request( deviceId: deviceId, appName: appName, ); + final _response = await sendWithCookies(_request); + final _serializer = $createApp_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Create an authorization token for a new 3rd party service. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$deleteApp_Request]. + @_i2.experimental + _i1.DynamiteSerializer $deleteApp_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(DeleteAppResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Delete an authorization token. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [deleteApp] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// - /// Parameters: - /// * [deviceId] ID of the device. - /// * [appName] Name of the app. - /// /// Status codes: - /// * 200: App created successfully + /// * 200: App deleted successfully /// /// See: - /// * [createApp] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [deleteApp] for a method executing this request and parsing the response. + /// * [$deleteApp_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> createAppRaw({ - required String deviceId, - required String appName, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $deleteApp_Request({required String token}) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _parameters['token'] = $token; + final _path = _i4.UriTemplate('/index.php/apps/uppush/app/{token}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -519,7 +564,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -527,32 +572,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $deviceId = _$jsonSerializers.serialize(deviceId, specifiedType: const FullType(String)); - _parameters['deviceId'] = $deviceId; - - final $appName = _$jsonSerializers.serialize(appName, specifiedType: const FullType(String)); - _parameters['appName'] = $appName; - - final _path = _i3.UriTemplate('/index.php/apps/uppush/app{?deviceId*,appName*}').expand(_parameters); - final _response = await executeRequest( - 'put', - _path, - headers: _headers, - ); - - final _serializer = $createApp_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$deleteApp_Request`. - @_i2.experimental - _i1.DynamiteSerializer $deleteApp_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(DeleteAppResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Delete an authorization token. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -562,32 +584,51 @@ class $Client extends _i1.DynamiteClient { /// * 200: App deleted successfully /// /// See: - /// * [deleteAppRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$deleteApp_Request] for the request send by this method. + /// * [$deleteApp_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> deleteApp({required String token}) async { - final _rawResponse = await deleteAppRaw( + final _request = $deleteApp_Request( token: token, ); + final _response = await sendWithCookies(_request); + final _serializer = $deleteApp_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Delete an authorization token. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$unifiedpushDiscovery_Request]. + @_i2.experimental + _i1.DynamiteSerializer $unifiedpushDiscovery_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UnifiedpushDiscoveryResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Unifiedpush discovery Following specifications. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [unifiedpushDiscovery] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: - /// * 200: App deleted successfully + /// * 200 /// /// See: - /// * [deleteApp] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [unifiedpushDiscovery] for a method executing this request and parsing the response. + /// * [$unifiedpushDiscovery_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> deleteAppRaw({required String token}) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $unifiedpushDiscovery_Request({required String token}) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _parameters['token'] = $token; + final _path = _i4.UriTemplate('/index.php/apps/uppush/push/{token}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -597,7 +638,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -605,30 +646,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _parameters['token'] = $token; - - final _path = _i3.UriTemplate('/index.php/apps/uppush/app/{token}').expand(_parameters); - final _response = await executeRequest( - 'delete', - _path, - headers: _headers, - ); - - final _serializer = $deleteApp_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$unifiedpushDiscovery_Request`. - @_i2.experimental - _i1.DynamiteSerializer $unifiedpushDiscovery_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UnifiedpushDiscoveryResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Unifiedpush discovery Following specifications. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -638,36 +658,52 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [unifiedpushDiscoveryRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$unifiedpushDiscovery_Request] for the request send by this method. + /// * [$unifiedpushDiscovery_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> unifiedpushDiscovery({ required String token, }) async { - final _rawResponse = await unifiedpushDiscoveryRaw( + final _request = $unifiedpushDiscovery_Request( token: token, ); + final _response = await sendWithCookies(_request); + final _serializer = $unifiedpushDiscovery_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Unifiedpush discovery Following specifications. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$push_Request]. + @_i2.experimental + _i1.DynamiteSerializer $push_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(PushResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {201}, + ); + + /// Receive notifications from 3rd parties. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [push] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: - /// * 200 + /// * 201: Notification pushed successfully /// /// See: - /// * [unifiedpushDiscovery] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [push] for a method executing this request and parsing the response. + /// * [$push_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> unifiedpushDiscoveryRaw({ - required String token, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + _i3.Request $push_Request({required String token}) { + final _parameters = {}; + final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); + _parameters['token'] = $token; + final _path = _i4.UriTemplate('/index.php/apps/uppush/push/{token}').expand(_parameters); + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -677,7 +713,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -685,29 +721,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _parameters['token'] = $token; - - final _path = _i3.UriTemplate('/index.php/apps/uppush/push/{token}').expand(_parameters); - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $unifiedpushDiscovery_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$push_Request`. - @_i2.experimental - _i1.DynamiteSerializer $push_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(PushResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {201}, - ); - /// Receive notifications from 3rd parties. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -717,32 +733,46 @@ class $Client extends _i1.DynamiteClient { /// * 201: Notification pushed successfully /// /// See: - /// * [pushRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$push_Request] for the request send by this method. + /// * [$push_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> push({required String token}) async { - final _rawResponse = await pushRaw( + final _request = $push_Request( token: token, ); + final _response = await sendWithCookies(_request); + final _serializer = $push_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Receive notifications from 3rd parties. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$gatewayMatrixDiscovery_Request]. + @_i2.experimental + _i1.DynamiteSerializer $gatewayMatrixDiscovery_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(GatewayMatrixDiscoveryResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Matrix Gateway discovery. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [gatewayMatrixDiscovery] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: - /// * 201: Notification pushed successfully + /// * 200 /// /// See: - /// * [push] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [gatewayMatrixDiscovery] for a method executing this request and parsing the response. + /// * [$gatewayMatrixDiscovery_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> pushRaw({required String token}) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + _i3.Request $gatewayMatrixDiscovery_Request() { + const _path = '/index.php/apps/uppush/gateway/matrix'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -752,7 +782,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -760,30 +790,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - final $token = _$jsonSerializers.serialize(token, specifiedType: const FullType(String)); - _parameters['token'] = $token; - - final _path = _i3.UriTemplate('/index.php/apps/uppush/push/{token}').expand(_parameters); - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); - - final _serializer = $push_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$gatewayMatrixDiscovery_Request`. - @_i2.experimental - _i1.DynamiteSerializer $gatewayMatrixDiscovery_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(GatewayMatrixDiscoveryResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Matrix Gateway discovery. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -793,30 +802,45 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [gatewayMatrixDiscoveryRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$gatewayMatrixDiscovery_Request] for the request send by this method. + /// * [$gatewayMatrixDiscovery_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> gatewayMatrixDiscovery() async { - final _rawResponse = await gatewayMatrixDiscoveryRaw(); + final _request = $gatewayMatrixDiscovery_Request(); + final _response = await sendWithCookies(_request); + final _serializer = $gatewayMatrixDiscovery_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Matrix Gateway discovery. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$gatewayMatrix_Request]. + @_i2.experimental + _i1.DynamiteSerializer $gatewayMatrix_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(GatewayMatrixResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Matrix Gateway. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [gatewayMatrix] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Status codes: /// * 200 /// /// See: - /// * [gatewayMatrixDiscovery] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [gatewayMatrix] for a method executing this request and parsing the response. + /// * [$gatewayMatrix_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> - gatewayMatrixDiscoveryRaw() async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $gatewayMatrix_Request() { + const _path = '/index.php/apps/uppush/gateway/matrix'; + final _uri = Uri.parse('$baseURL$_path'); + final _request = _i3.Request('post', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -826,7 +850,7 @@ class $Client extends _i1.DynamiteClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -834,27 +858,9 @@ class $Client extends _i1.DynamiteClient { } // coverage:ignore-end - const _path = '/index.php/apps/uppush/gateway/matrix'; - final _response = await executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $gatewayMatrixDiscovery_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$gatewayMatrix_Request`. - @_i2.experimental - _i1.DynamiteSerializer $gatewayMatrix_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(GatewayMatrixResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Matrix Gateway. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -864,55 +870,16 @@ class $Client extends _i1.DynamiteClient { /// * 200 /// /// See: - /// * [gatewayMatrixRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$gatewayMatrix_Request] for the request send by this method. + /// * [$gatewayMatrix_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> gatewayMatrix() async { - final _rawResponse = await gatewayMatrixRaw(); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Matrix Gateway. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Status codes: - /// * 200 - /// - /// See: - /// * [gatewayMatrix] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> gatewayMatrixRaw() async { - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for basic_auth'); - } - -// coverage:ignore-end - const _path = '/index.php/apps/uppush/gateway/matrix'; - final _response = await executeRequest( - 'post', - _path, - headers: _headers, - ); + final _request = $gatewayMatrix_Request(); + final _response = await sendWithCookies(_request); final _serializer = $gatewayMatrix_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -1471,9 +1438,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i4.DynamiteDoubleSerializer()) - ..addPlugin(_i5.StandardJsonPlugin()) - ..addPlugin(const _i4.HeaderPlugin()) - ..addPlugin(const _i4.ContentStringPlugin())) + ..add(_i5.DynamiteDoubleSerializer()) + ..addPlugin(_i6.StandardJsonPlugin()) + ..addPlugin(const _i5.HeaderPlugin()) + ..addPlugin(const _i5.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/user_status.openapi.dart b/packages/nextcloud/lib/src/api/user_status.openapi.dart index 3b25b99af5b..f1d7d9d507e 100644 --- a/packages/nextcloud/lib/src/api/user_status.openapi.dart +++ b/packages/nextcloud/lib/src/api/user_status.openapi.dart @@ -19,11 +19,12 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i5; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; import 'package:uri/uri.dart' as _i4; @@ -64,7 +65,7 @@ class $HeartbeatClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$heartbeat_Request`. + /// Builds a serializer to parse the response of [$heartbeat_Request]. @_i2.experimental _i1.DynamiteSerializer $heartbeat_Serializer() => _i1.DynamiteSerializer( @@ -76,7 +77,7 @@ class $HeartbeatClient { /// Keep the status alive. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Returns a `DynamiteRequest` backing the [heartbeat] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -90,24 +91,48 @@ class $HeartbeatClient { /// * 204: User has no status to keep alive /// /// See: - /// * [heartbeatRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> heartbeat({ + /// * [heartbeat] for a method executing this request and parsing the response. + /// * [$heartbeat_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $heartbeat_Request({ required String status, bool? oCSAPIRequest, - }) async { - final _rawResponse = await heartbeatRaw( - status: status, - oCSAPIRequest: oCSAPIRequest, + }) { + final _parameters = {}; + final $status = _$jsonSerializers.serialize(status, specifiedType: const FullType(String)); + _parameters['status'] = $status; + + final _path = _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/heartbeat{?status*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; +// coverage:ignore-start + final authentication = _rootClient.authentications?.firstWhereOrNull( + (auth) => switch (auth) { + _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, + _ => false, + }, ); - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + if (authentication != null) { + _request.headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for bearer_auth or basic_auth'); + } + +// coverage:ignore-end + var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); + $oCSAPIRequest ??= true; + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); + + return _request; } /// Keep the status alive. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -121,15 +146,61 @@ class $HeartbeatClient { /// * 204: User has no status to keep alive /// /// See: - /// * [heartbeat] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> heartbeatRaw({ + /// * [$heartbeat_Request] for the request send by this method. + /// * [$heartbeat_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> heartbeat({ required String status, bool? oCSAPIRequest, }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + final _request = $heartbeat_Request( + status: status, + oCSAPIRequest: oCSAPIRequest, + ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $heartbeat_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); + } +} + +class $PredefinedStatusClient { + /// Creates a new `DynamiteClient` for predefined_status requests. + $PredefinedStatusClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$findAll_Request]. + @_i2.experimental + _i1.DynamiteSerializer $findAll_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(PredefinedStatusFindAllResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get all predefined messages. + /// + /// Returns a `DynamiteRequest` backing the [findAll] operation. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Predefined statuses returned + /// + /// See: + /// * [findAll] for a method executing this request and parsing the response. + /// * [$findAll_Serializer] for a converter to parse the `Response` from an executed this request. + @_i2.experimental + _i3.Request $findAll_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/user_status/api/v1/predefined_statuses'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -139,7 +210,7 @@ class $HeartbeatClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -147,40 +218,12 @@ class $HeartbeatClient { } // coverage:ignore-end - final $status = _$jsonSerializers.serialize(status, specifiedType: const FullType(String)); - _parameters['status'] = $status; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/heartbeat{?status*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); - - final _serializer = $heartbeat_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $PredefinedStatusClient { - /// Creates a new `DynamiteClient` for predefined_status requests. - $PredefinedStatusClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$findAll_Request`. - @_i2.experimental - _i1.DynamiteSerializer $findAll_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(PredefinedStatusFindAllResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get all predefined messages. /// @@ -194,38 +237,71 @@ class $PredefinedStatusClient { /// * 200: Predefined statuses returned /// /// See: - /// * [findAllRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$findAll_Request] for the request send by this method. + /// * [$findAll_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> findAll({ bool? oCSAPIRequest, }) async { - final _rawResponse = await findAllRaw( + final _request = $findAll_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $findAll_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Get all predefined messages. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $StatusesClient { + /// Creates a new `DynamiteClient` for statuses requests. + $StatusesClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$findAll_Request]. + @_i2.experimental + _i1.DynamiteSerializer $findAll_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(StatusesFindAllResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Find statuses of users. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [findAll] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [limit] Maximum number of statuses to find. + /// * [offset] Offset for finding statuses. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Predefined statuses returned + /// * 200: Statuses returned /// /// See: - /// * [findAll] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [findAll] for a method executing this request and parsing the response. + /// * [$findAll_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> findAllRaw({ + _i3.Request $findAll_Request({ + int? limit, + int? offset, bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); + _parameters['limit'] = $limit; + + final $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); + _parameters['offset'] = $offset; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/statuses{?limit*,offset*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -235,7 +311,7 @@ class $PredefinedStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -245,34 +321,10 @@ class $PredefinedStatusClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/user_status/api/v1/predefined_statuses'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $findAll_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $StatusesClient { - /// Creates a new `DynamiteClient` for statuses requests. - $StatusesClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$findAll_Request`. - @_i2.experimental - _i1.DynamiteSerializer $findAll_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(StatusesFindAllResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Find statuses of users. /// @@ -288,47 +340,64 @@ class $StatusesClient { /// * 200: Statuses returned /// /// See: - /// * [findAllRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$findAll_Request] for the request send by this method. + /// * [$findAll_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> findAll({ int? limit, int? offset, bool? oCSAPIRequest, }) async { - final _rawResponse = await findAllRaw( + final _request = $findAll_Request( limit: limit, offset: offset, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $findAll_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Find statuses of users. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$find_Request]. + @_i2.experimental + _i1.DynamiteSerializer $find_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(StatusesFindResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Find the status of a user. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [find] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [limit] Maximum number of statuses to find. - /// * [offset] Offset for finding statuses. + /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Statuses returned + /// * 200: Status returned + /// * 404: The user was not found /// /// See: - /// * [findAll] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [find] for a method executing this request and parsing the response. + /// * [$find_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> findAllRaw({ - int? limit, - int? offset, + _i3.Request $find_Request({ + required String userId, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); + _parameters['userId'] = $userId; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/statuses/{userId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -338,7 +407,7 @@ class $StatusesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -346,36 +415,13 @@ class $StatusesClient { } // coverage:ignore-end - final $limit = _$jsonSerializers.serialize(limit, specifiedType: const FullType(int)); - _parameters['limit'] = $limit; - - final $offset = _$jsonSerializers.serialize(offset, specifiedType: const FullType(int)); - _parameters['offset'] = $offset; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/statuses{?limit*,offset*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $findAll_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$find_Request`. - @_i2.experimental - _i1.DynamiteSerializer $find_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(StatusesFindResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Find the status of a user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -390,44 +436,62 @@ class $StatusesClient { /// * 404: The user was not found /// /// See: - /// * [findRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$find_Request] for the request send by this method. + /// * [$find_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> find({ required String userId, bool? oCSAPIRequest, }) async { - final _rawResponse = await findRaw( + final _request = $find_Request( userId: userId, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $find_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } +} - /// Find the status of a user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. +class $UserStatusClient { + /// Creates a new `DynamiteClient` for user_status requests. + $UserStatusClient(this._rootClient); + + final $Client _rootClient; + + /// Builds a serializer to parse the response of [$getStatus_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getStatus_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UserStatusGetStatusResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Get the status of the current user. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getStatus] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [userId] ID of the user. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Status returned + /// * 200: The status was found successfully /// * 404: The user was not found /// /// See: - /// * [find] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getStatus] for a method executing this request and parsing the response. + /// * [$getStatus_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> findRaw({ - required String userId, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getStatus_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/user_status/api/v1/user_status'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -437,7 +501,7 @@ class $StatusesClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -445,40 +509,12 @@ class $StatusesClient { } // coverage:ignore-end - final $userId = _$jsonSerializers.serialize(userId, specifiedType: const FullType(String)); - _parameters['userId'] = $userId; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/statuses/{userId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $find_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } -} - -class $UserStatusClient { - /// Creates a new `DynamiteClient` for user_status requests. - $UserStatusClient(this._rootClient); - - final $Client _rootClient; - - /// Builds a serializer to parse the response of `$getStatus_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getStatus_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UserStatusGetStatusResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); /// Get the status of the current user. /// @@ -493,39 +529,62 @@ class $UserStatusClient { /// * 404: The user was not found /// /// See: - /// * [getStatusRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$getStatus_Request] for the request send by this method. + /// * [$getStatus_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> getStatus({ bool? oCSAPIRequest, }) async { - final _rawResponse = await getStatusRaw( + final _request = $getStatus_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getStatus_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Get the status of the current user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setStatus_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setStatus_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UserStatusSetStatusResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Update the status type of the current user. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setStatus] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [statusType] The new status type. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: The status was found successfully - /// * 404: The user was not found + /// * 200: The status was updated successfully + /// * 400: The status type is invalid /// /// See: - /// * [getStatus] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setStatus] for a method executing this request and parsing the response. + /// * [$setStatus_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getStatusRaw({ + _i3.Request $setStatus_Request({ + required String statusType, bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $statusType = _$jsonSerializers.serialize(statusType, specifiedType: const FullType(String)); + _parameters['statusType'] = $statusType; + final _path = + _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/user_status/status{?statusType*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -535,7 +594,7 @@ class $UserStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -545,29 +604,11 @@ class $UserStatusClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/apps/user_status/api/v1/user_status'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getStatus_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setStatus_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setStatus_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UserStatusSetStatusResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Update the status type of the current user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -582,44 +623,70 @@ class $UserStatusClient { /// * 400: The status type is invalid /// /// See: - /// * [setStatusRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setStatus_Request] for the request send by this method. + /// * [$setStatus_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setStatus({ required String statusType, bool? oCSAPIRequest, }) async { - final _rawResponse = await setStatusRaw( + final _request = $setStatus_Request( statusType: statusType, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setStatus_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Update the status type of the current user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setPredefinedMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $setPredefinedMessage_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(UserStatusSetPredefinedMessageResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Set the message to a predefined message for the current user. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setPredefinedMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [statusType] The new status type. + /// * [messageId] ID of the predefined message. + /// * [clearAt] When the message should be cleared. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: The status was updated successfully - /// * 400: The status type is invalid + /// * 200: The message was updated successfully + /// * 400: The clearAt or message-id is invalid /// /// See: - /// * [setStatus] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setPredefinedMessage] for a method executing this request and parsing the response. + /// * [$setPredefinedMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setStatusRaw({ - required String statusType, + _i3.Request $setPredefinedMessage_Request({ + required String messageId, + int? clearAt, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(String)); + _parameters['messageId'] = $messageId; + final $clearAt = _$jsonSerializers.serialize(clearAt, specifiedType: const FullType(int)); + _parameters['clearAt'] = $clearAt; + + final _path = + _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/user_status/message/predefined{?messageId*,clearAt*}') + .expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -629,7 +696,7 @@ class $UserStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -637,35 +704,13 @@ class $UserStatusClient { } // coverage:ignore-end - final $statusType = _$jsonSerializers.serialize(statusType, specifiedType: const FullType(String)); - _parameters['statusType'] = $statusType; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/user_status/status{?statusType*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setStatus_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setPredefinedMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $setPredefinedMessage_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(UserStatusSetPredefinedMessageResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Set the message to a predefined message for the current user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -681,48 +726,78 @@ class $UserStatusClient { /// * 400: The clearAt or message-id is invalid /// /// See: - /// * [setPredefinedMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setPredefinedMessage_Request] for the request send by this method. + /// * [$setPredefinedMessage_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setPredefinedMessage({ required String messageId, int? clearAt, bool? oCSAPIRequest, }) async { - final _rawResponse = await setPredefinedMessageRaw( + final _request = $setPredefinedMessage_Request( messageId: messageId, clearAt: clearAt, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setPredefinedMessage_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Set the message to a predefined message for the current user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$setCustomMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setCustomMessage_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UserStatusSetCustomMessageResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Set the message to a custom message for the current user. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setCustomMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [messageId] ID of the predefined message. + /// * [statusIcon] Icon of the status. + /// * [message] Message of the status. /// * [clearAt] When the message should be cleared. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: /// * 200: The message was updated successfully - /// * 400: The clearAt or message-id is invalid + /// * 400: The clearAt or icon is invalid or the message is too long /// /// See: - /// * [setPredefinedMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setCustomMessage] for a method executing this request and parsing the response. + /// * [$setCustomMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setPredefinedMessageRaw({ - required String messageId, + _i3.Request $setCustomMessage_Request({ + String? statusIcon, + String? message, int? clearAt, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $statusIcon = _$jsonSerializers.serialize(statusIcon, specifiedType: const FullType(String)); + _parameters['statusIcon'] = $statusIcon; + final $message = _$jsonSerializers.serialize(message, specifiedType: const FullType(String)); + _parameters['message'] = $message; + + final $clearAt = _$jsonSerializers.serialize(clearAt, specifiedType: const FullType(int)); + _parameters['clearAt'] = $clearAt; + + final _path = _i4.UriTemplate( + '/ocs/v2.php/apps/user_status/api/v1/user_status/message/custom{?statusIcon*,message*,clearAt*}', + ).expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -732,7 +807,7 @@ class $UserStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -740,40 +815,13 @@ class $UserStatusClient { } // coverage:ignore-end - final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(String)); - _parameters['messageId'] = $messageId; - - final $clearAt = _$jsonSerializers.serialize(clearAt, specifiedType: const FullType(int)); - _parameters['clearAt'] = $clearAt; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/user_status/message/predefined{?messageId*,clearAt*}') - .expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setPredefinedMessage_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setCustomMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setCustomMessage_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UserStatusSetCustomMessageResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Set the message to a custom message for the current user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -790,52 +838,59 @@ class $UserStatusClient { /// * 400: The clearAt or icon is invalid or the message is too long /// /// See: - /// * [setCustomMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$setCustomMessage_Request] for the request send by this method. + /// * [$setCustomMessage_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> setCustomMessage({ String? statusIcon, String? message, int? clearAt, bool? oCSAPIRequest, }) async { - final _rawResponse = await setCustomMessageRaw( + final _request = $setCustomMessage_Request( statusIcon: statusIcon, message: message, clearAt: clearAt, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setCustomMessage_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Set the message to a custom message for the current user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$clearMessage_Request]. + @_i2.experimental + _i1.DynamiteSerializer $clearMessage_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UserStatusClearMessageResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Clear the message of the current user. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [clearMessage] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [statusIcon] Icon of the status. - /// * [message] Message of the status. - /// * [clearAt] When the message should be cleared. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: The message was updated successfully - /// * 400: The clearAt or icon is invalid or the message is too long + /// * 200: Message cleared successfully /// /// See: - /// * [setCustomMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [clearMessage] for a method executing this request and parsing the response. + /// * [$clearMessage_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setCustomMessageRaw({ - String? statusIcon, - String? message, - int? clearAt, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - + _i3.Request $clearMessage_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/user_status/api/v1/user_status/message'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -845,7 +900,7 @@ class $UserStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -853,43 +908,13 @@ class $UserStatusClient { } // coverage:ignore-end - final $statusIcon = _$jsonSerializers.serialize(statusIcon, specifiedType: const FullType(String)); - _parameters['statusIcon'] = $statusIcon; - - final $message = _$jsonSerializers.serialize(message, specifiedType: const FullType(String)); - _parameters['message'] = $message; - - final $clearAt = _$jsonSerializers.serialize(clearAt, specifiedType: const FullType(int)); - _parameters['clearAt'] = $clearAt; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate( - '/ocs/v2.php/apps/user_status/api/v1/user_status/message/custom{?statusIcon*,message*,clearAt*}', - ).expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setCustomMessage_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$clearMessage_Request`. - @_i2.experimental - _i1.DynamiteSerializer $clearMessage_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UserStatusClearMessageResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Clear the message of the current user. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -902,38 +927,61 @@ class $UserStatusClient { /// * 200: Message cleared successfully /// /// See: - /// * [clearMessageRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$clearMessage_Request] for the request send by this method. + /// * [$clearMessage_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> clearMessage({ bool? oCSAPIRequest, }) async { - final _rawResponse = await clearMessageRaw( + final _request = $clearMessage_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $clearMessage_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } - /// Clear the message of the current user. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. + /// Builds a serializer to parse the response of [$revertStatus_Request]. + @_i2.experimental + _i1.DynamiteSerializer $revertStatus_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(UserStatusRevertStatusResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + + /// Revert the status to the previous status. /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [revertStatus] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [messageId] ID of the message to delete. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Message cleared successfully + /// * 200: Status reverted /// /// See: - /// * [clearMessage] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [revertStatus] for a method executing this request and parsing the response. + /// * [$revertStatus_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> clearMessageRaw({ + _i3.Request $revertStatus_Request({ + required String messageId, bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(String)); + _parameters['messageId'] = $messageId; + final _path = + _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/user_status/revert/{messageId}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('delete', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -943,7 +991,7 @@ class $UserStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -953,29 +1001,11 @@ class $UserStatusClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/user_status/api/v1/user_status/message'; - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $clearMessage_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$revertStatus_Request`. - @_i2.experimental - _i1.DynamiteSerializer $revertStatus_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(UserStatusRevertStatusResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - /// Revert the status to the previous status. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. @@ -989,77 +1019,22 @@ class $UserStatusClient { /// * 200: Status reverted /// /// See: - /// * [revertStatusRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. + /// * [$revertStatus_Request] for the request send by this method. + /// * [$revertStatus_Serializer] for a converter to parse the `Response` from an executed request. Future<_i1.DynamiteResponse> revertStatus({ required String messageId, bool? oCSAPIRequest, }) async { - final _rawResponse = await revertStatusRaw( + final _request = $revertStatus_Request( messageId: messageId, oCSAPIRequest: oCSAPIRequest, ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Revert the status to the previous status. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [messageId] ID of the message to delete. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Status reverted - /// - /// See: - /// * [revertStatus] for an operation that returns a `DynamiteResponse` with a stable API. - @_i2.experimental - Future<_i1.DynamiteRawResponse> revertStatusRaw({ - required String messageId, - bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; - -// coverage:ignore-start - final authentication = _rootClient.authentications?.firstWhereOrNull( - (auth) => switch (auth) { - _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true, - _ => false, - }, - ); - - if (authentication != null) { - _headers.addAll( - authentication.headers, - ); - } else { - throw Exception('Missing authentication for bearer_auth or basic_auth'); - } - -// coverage:ignore-end - final $messageId = _$jsonSerializers.serialize(messageId, specifiedType: const FullType(String)); - _parameters['messageId'] = $messageId; - - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); - $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/user_status/api/v1/user_status/revert/{messageId}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'delete', - _path, - headers: _headers, - ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $revertStatus_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -2329,13 +2304,13 @@ extension $557344b3ba734aacc7109e5420fcb6c5Extension on _$557344b3ba734aacc7109e List get _names => const ['clearAtTimeType', r'$int']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i5.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i5.validateAnyOf( _values, _names, ); @@ -2406,13 +2381,13 @@ extension $d77829de8b7590d2e16cdb714800f5beExtension on _$d77829de8b7590d2e16cdb List get _names => const ['builtListNever', 'private']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i5.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i5.validateAnyOf( _values, _names, ); @@ -2613,16 +2588,16 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) + ..add(_i6.DynamiteDoubleSerializer()) ..addPlugin( - _i6.StandardJsonPlugin( + _i7.StandardJsonPlugin( typesToLeaveAsList: const { _$557344b3ba734aacc7109e5420fcb6c5, _$d77829de8b7590d2e16cdb714800f5be, }, ), ) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/lib/src/api/weather_status.openapi.dart b/packages/nextcloud/lib/src/api/weather_status.openapi.dart index e72d0b09a99..84ab9b39ec0 100644 --- a/packages/nextcloud/lib/src/api/weather_status.openapi.dart +++ b/packages/nextcloud/lib/src/api/weather_status.openapi.dart @@ -18,11 +18,12 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart' as _i6; +import 'package:built_value/standard_json_plugin.dart' as _i7; import 'package:collection/collection.dart'; -import 'package:dynamite_runtime/built_value.dart' as _i5; +import 'package:dynamite_runtime/built_value.dart' as _i6; import 'package:dynamite_runtime/http_client.dart' as _i1; -import 'package:dynamite_runtime/utils.dart' as _i3; +import 'package:dynamite_runtime/utils.dart' as _i5; +import 'package:http/http.dart' as _i3; import 'package:meta/meta.dart' as _i2; import 'package:uri/uri.dart' as _i4; @@ -57,7 +58,7 @@ class $WeatherStatusClient { final $Client _rootClient; - /// Builds a serializer to parse the response of `$setMode_Request`. + /// Builds a serializer to parse the response of [$setMode_Request]. @_i2.experimental _i1.DynamiteSerializer $setMode_Serializer() => _i1.DynamiteSerializer( @@ -69,35 +70,7 @@ class $WeatherStatusClient { /// Change the weather status mode. There are currently 2 modes: - ask the browser - use the user defined address. /// - /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. - /// Throws a `DynamiteApiException` if the API call does not return an expected status code. - /// - /// Parameters: - /// * [mode] New mode. - /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. - /// - /// Status codes: - /// * 200: Weather status mode updated - /// - /// See: - /// * [setModeRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setMode({ - required int mode, - bool? oCSAPIRequest, - }) async { - final _rawResponse = await setModeRaw( - mode: mode, - oCSAPIRequest: oCSAPIRequest, - ); - - return _i1.DynamiteResponse.fromRawResponse(_rawResponse); - } - - /// Change the weather status mode. There are currently 2 modes: - ask the browser - use the user defined address. - /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setMode] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -108,15 +81,21 @@ class $WeatherStatusClient { /// * 200: Weather status mode updated /// /// See: - /// * [setMode] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setMode] for a method executing this request and parsing the response. + /// * [$setMode_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setModeRaw({ + _i3.Request $setMode_Request({ required int mode, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $mode = _$jsonSerializers.serialize(mode, specifiedType: const FullType(int)); + _parameters['mode'] = $mode; + final _path = _i4.UriTemplate('/ocs/v2.php/apps/weather_status/api/v1/mode{?mode*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -126,7 +105,7 @@ class $WeatherStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -134,62 +113,57 @@ class $WeatherStatusClient { } // coverage:ignore-end - final $mode = _$jsonSerializers.serialize(mode, specifiedType: const FullType(int)); - _parameters['mode'] = $mode; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = _i4.UriTemplate('/ocs/v2.php/apps/weather_status/api/v1/mode{?mode*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setMode_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$usePersonalAddress_Request`. - @_i2.experimental - _i1.DynamiteSerializer - $usePersonalAddress_Serializer() => _i1.DynamiteSerializer( - bodyType: const FullType(WeatherStatusUsePersonalAddressResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Try to use the address set in user personal settings as weather location. + /// Change the weather status mode. There are currently 2 modes: - ask the browser - use the user defined address. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [mode] New mode. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Address updated + /// * 200: Weather status mode updated /// /// See: - /// * [usePersonalAddressRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> usePersonalAddress({ + /// * [$setMode_Request] for the request send by this method. + /// * [$setMode_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setMode({ + required int mode, bool? oCSAPIRequest, }) async { - final _rawResponse = await usePersonalAddressRaw( + final _request = $setMode_Request( + mode: mode, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setMode_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer).convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$usePersonalAddress_Request]. + @_i2.experimental + _i1.DynamiteSerializer + $usePersonalAddress_Serializer() => _i1.DynamiteSerializer( + bodyType: const FullType(WeatherStatusUsePersonalAddressResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Try to use the address set in user personal settings as weather location. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [usePersonalAddress] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -199,13 +173,14 @@ class $WeatherStatusClient { /// * 200: Address updated /// /// See: - /// * [usePersonalAddress] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [usePersonalAddress] for a method executing this request and parsing the response. + /// * [$usePersonalAddress_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> usePersonalAddressRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $usePersonalAddress_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/weather_status/api/v1/use-personal'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -215,7 +190,7 @@ class $WeatherStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -225,31 +200,12 @@ class $WeatherStatusClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/apps/weather_status/api/v1/use-personal'; - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); - - final _serializer = $usePersonalAddress_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getLocation_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getLocation_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(WeatherStatusGetLocationResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get stored user location. + /// Try to use the address set in user personal settings as weather location. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -258,25 +214,39 @@ class $WeatherStatusClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Location returned + /// * 200: Address updated /// /// See: - /// * [getLocationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getLocation({ + /// * [$usePersonalAddress_Request] for the request send by this method. + /// * [$usePersonalAddress_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> usePersonalAddress({ bool? oCSAPIRequest, }) async { - final _rawResponse = await getLocationRaw( + final _request = $usePersonalAddress_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $usePersonalAddress_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getLocation_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getLocation_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(WeatherStatusGetLocationResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get stored user location. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getLocation] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -286,13 +256,14 @@ class $WeatherStatusClient { /// * 200: Location returned /// /// See: - /// * [getLocation] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getLocation] for a method executing this request and parsing the response. + /// * [$getLocation_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getLocationRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getLocation_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/weather_status/api/v1/location'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -302,7 +273,7 @@ class $WeatherStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -312,66 +283,52 @@ class $WeatherStatusClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - const _path = '/ocs/v2.php/apps/weather_status/api/v1/location'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); - - final _serializer = $getLocation_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setLocation_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setLocation_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(WeatherStatusSetLocationResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Set address and resolve it to get coordinates or directly set coordinates and get address with reverse geocoding. + /// Get stored user location. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [address] Any approximative or exact address. - /// * [lat] Latitude in decimal degree format. - /// * [lon] Longitude in decimal degree format. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Location updated + /// * 200: Location returned /// /// See: - /// * [setLocationRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setLocation({ - String? address, - double? lat, - double? lon, + /// * [$getLocation_Request] for the request send by this method. + /// * [$getLocation_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getLocation({ bool? oCSAPIRequest, }) async { - final _rawResponse = await setLocationRaw( - address: address, - lat: lat, - lon: lon, + final _request = $getLocation_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getLocation_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$setLocation_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setLocation_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(WeatherStatusSetLocationResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Set address and resolve it to get coordinates or directly set coordinates and get address with reverse geocoding. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setLocation] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -384,17 +341,30 @@ class $WeatherStatusClient { /// * 200: Location updated /// /// See: - /// * [setLocation] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setLocation] for a method executing this request and parsing the response. + /// * [$setLocation_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setLocationRaw({ + _i3.Request $setLocation_Request({ String? address, double? lat, double? lon, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $address = _$jsonSerializers.serialize(address, specifiedType: const FullType(String)); + _parameters['address'] = $address; + final $lat = _$jsonSerializers.serialize(lat, specifiedType: const FullType(double)); + _parameters['lat'] = $lat; + + final $lon = _$jsonSerializers.serialize(lon, specifiedType: const FullType(double)); + _parameters['lon'] = $lon; + + final _path = + _i4.UriTemplate('/ocs/v2.php/apps/weather_status/api/v1/location{?address*,lat*,lon*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -404,7 +374,7 @@ class $WeatherStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -412,70 +382,63 @@ class $WeatherStatusClient { } // coverage:ignore-end - final $address = _$jsonSerializers.serialize(address, specifiedType: const FullType(String)); - _parameters['address'] = $address; - - final $lat = _$jsonSerializers.serialize(lat, specifiedType: const FullType(double)); - _parameters['lat'] = $lat; - - final $lon = _$jsonSerializers.serialize(lon, specifiedType: const FullType(double)); - _parameters['lon'] = $lon; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/weather_status/api/v1/location{?address*,lat*,lon*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $setLocation_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getForecast_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getForecast_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(WeatherStatusGetForecastResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get forecast for current location. + /// Set address and resolve it to get coordinates or directly set coordinates and get address with reverse geocoding. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: + /// * [address] Any approximative or exact address. + /// * [lat] Latitude in decimal degree format. + /// * [lon] Longitude in decimal degree format. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Forecast returned - /// * 404: Forecast not found + /// * 200: Location updated /// /// See: - /// * [getForecastRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getForecast({ + /// * [$setLocation_Request] for the request send by this method. + /// * [$setLocation_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setLocation({ + String? address, + double? lat, + double? lon, bool? oCSAPIRequest, }) async { - final _rawResponse = await getForecastRaw( + final _request = $setLocation_Request( + address: address, + lat: lat, + lon: lon, oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $setLocation_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getForecast_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getForecast_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(WeatherStatusGetForecastResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get forecast for current location. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getForecast] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -486,13 +449,14 @@ class $WeatherStatusClient { /// * 404: Forecast not found /// /// See: - /// * [getForecast] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getForecast] for a method executing this request and parsing the response. + /// * [$getForecast_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getForecastRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getForecast_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/weather_status/api/v1/forecast'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -502,7 +466,7 @@ class $WeatherStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -512,30 +476,12 @@ class $WeatherStatusClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/weather_status/api/v1/forecast'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getForecast_Serializer(); - return _i1.ResponseConverter(_serializer).convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$getFavorites_Request`. - @_i2.experimental - _i1.DynamiteSerializer $getFavorites_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(WeatherStatusGetFavoritesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Get favorites list. + /// Get forecast for current location. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. @@ -544,25 +490,39 @@ class $WeatherStatusClient { /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Favorites returned + /// * 200: Forecast returned + /// * 404: Forecast not found /// /// See: - /// * [getFavoritesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> getFavorites({ + /// * [$getForecast_Request] for the request send by this method. + /// * [$getForecast_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getForecast({ bool? oCSAPIRequest, }) async { - final _rawResponse = await getFavoritesRaw( + final _request = $getForecast_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getForecast_Serializer(); + final _rawResponse = await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$getFavorites_Request]. + @_i2.experimental + _i1.DynamiteSerializer $getFavorites_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(WeatherStatusGetFavoritesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Get favorites list. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [getFavorites] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -572,13 +532,14 @@ class $WeatherStatusClient { /// * 200: Favorites returned /// /// See: - /// * [getFavorites] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [getFavorites] for a method executing this request and parsing the response. + /// * [$getFavorites_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> getFavoritesRaw({ - bool? oCSAPIRequest, - }) async { - final _headers = {'Accept': 'application/json'}; - + _i3.Request $getFavorites_Request({bool? oCSAPIRequest}) { + const _path = '/ocs/v2.php/apps/weather_status/api/v1/favorites'; + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('get', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -588,7 +549,7 @@ class $WeatherStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -598,61 +559,53 @@ class $WeatherStatusClient { // coverage:ignore-end var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); - - const _path = '/ocs/v2.php/apps/weather_status/api/v1/favorites'; - final _response = await _rootClient.executeRequest( - 'get', - _path, - headers: _headers, - ); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _serializer = $getFavorites_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + return _request; } - /// Builds a serializer to parse the response of `$setFavorites_Request`. - @_i2.experimental - _i1.DynamiteSerializer $setFavorites_Serializer() => - _i1.DynamiteSerializer( - bodyType: const FullType(WeatherStatusSetFavoritesResponseApplicationJson), - headersType: null, - serializers: _$jsonSerializers, - validStatuses: const {200}, - ); - - /// Set favorites list. + /// Get favorites list. /// /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: - /// * [favorites] Favorite addresses. /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. /// /// Status codes: - /// * 200: Favorites updated + /// * 200: Favorites returned /// /// See: - /// * [setFavoritesRaw] for an experimental operation that returns a `DynamiteRawResponse` that can be serialized. - Future<_i1.DynamiteResponse> setFavorites({ - required BuiltList favorites, + /// * [$getFavorites_Request] for the request send by this method. + /// * [$getFavorites_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> getFavorites({ bool? oCSAPIRequest, }) async { - final _rawResponse = await setFavoritesRaw( - favorites: favorites, + final _request = $getFavorites_Request( oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); + final _serializer = $getFavorites_Serializer(); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } + /// Builds a serializer to parse the response of [$setFavorites_Request]. + @_i2.experimental + _i1.DynamiteSerializer $setFavorites_Serializer() => + _i1.DynamiteSerializer( + bodyType: const FullType(WeatherStatusSetFavoritesResponseApplicationJson), + headersType: null, + serializers: _$jsonSerializers, + validStatuses: const {200}, + ); + /// Set favorites list. /// - /// This method and the response it returns is experimental. The API might change without a major version bump. - /// - /// Returns a [Future] containing a `DynamiteRawResponse` with the raw `HttpClientResponse` and serialization helpers. + /// Returns a `DynamiteRequest` backing the [setFavorites] operation. /// Throws a `DynamiteApiException` if the API call does not return an expected status code. /// /// Parameters: @@ -663,15 +616,23 @@ class $WeatherStatusClient { /// * 200: Favorites updated /// /// See: - /// * [setFavorites] for an operation that returns a `DynamiteResponse` with a stable API. + /// * [setFavorites] for a method executing this request and parsing the response. + /// * [$setFavorites_Serializer] for a converter to parse the `Response` from an executed this request. @_i2.experimental - Future<_i1.DynamiteRawResponse> setFavoritesRaw({ + _i3.Request $setFavorites_Request({ required BuiltList favorites, bool? oCSAPIRequest, - }) async { - final _parameters = {}; - final _headers = {'Accept': 'application/json'}; + }) { + final _parameters = {}; + final $favorites = + _$jsonSerializers.serialize(favorites, specifiedType: const FullType(BuiltList, [FullType(String)])); + _parameters['favorites%5B%5D'] = $favorites; + final _path = + _i4.UriTemplate('/ocs/v2.php/apps/weather_status/api/v1/favorites{?favorites%5B%5D*}').expand(_parameters); + final _uri = Uri.parse('${_rootClient.baseURL}$_path'); + final _request = _i3.Request('put', _uri); + _request.headers['Accept'] = 'application/json'; // coverage:ignore-start final authentication = _rootClient.authentications?.firstWhereOrNull( (auth) => switch (auth) { @@ -681,7 +642,7 @@ class $WeatherStatusClient { ); if (authentication != null) { - _headers.addAll( + _request.headers.addAll( authentication.headers, ); } else { @@ -689,25 +650,43 @@ class $WeatherStatusClient { } // coverage:ignore-end - final $favorites = - _$jsonSerializers.serialize(favorites, specifiedType: const FullType(BuiltList, [FullType(String)])); - _parameters['favorites%5B%5D'] = $favorites; - var $oCSAPIRequest = _$jsonSerializers.serialize(oCSAPIRequest, specifiedType: const FullType(bool)); $oCSAPIRequest ??= true; - _headers['OCS-APIRequest'] = const _i3.HeaderEncoder().convert($oCSAPIRequest); + _request.headers['OCS-APIRequest'] = const _i5.HeaderEncoder().convert($oCSAPIRequest); - final _path = - _i4.UriTemplate('/ocs/v2.php/apps/weather_status/api/v1/favorites{?favorites%5B%5D*}').expand(_parameters); - final _response = await _rootClient.executeRequest( - 'put', - _path, - headers: _headers, + return _request; + } + + /// Set favorites list. + /// + /// Returns a [Future] containing a `DynamiteResponse` with the status code, deserialized body and headers. + /// Throws a `DynamiteApiException` if the API call does not return an expected status code. + /// + /// Parameters: + /// * [favorites] Favorite addresses. + /// * [oCSAPIRequest] Required to be true for the API request to pass. Defaults to `true`. + /// + /// Status codes: + /// * 200: Favorites updated + /// + /// See: + /// * [$setFavorites_Request] for the request send by this method. + /// * [$setFavorites_Serializer] for a converter to parse the `Response` from an executed request. + Future<_i1.DynamiteResponse> setFavorites({ + required BuiltList favorites, + bool? oCSAPIRequest, + }) async { + final _request = $setFavorites_Request( + favorites: favorites, + oCSAPIRequest: oCSAPIRequest, ); + final _response = await _rootClient.sendWithCookies(_request); final _serializer = $setFavorites_Serializer(); - return _i1.ResponseConverter(_serializer) - .convert(_response); + final _rawResponse = + await _i1.ResponseConverter(_serializer) + .convert(_response); + return _i1.DynamiteResponse.fromRawResponse(_rawResponse); } } @@ -2067,13 +2046,13 @@ extension $20fe3de793aed6fbf929c9b82b472b1aExtension on _$20fe3de793aed6fbf929c9 List get _names => const ['builtListForecast', 'weatherStatusGetForecastResponseApplicationJsonOcsData1']; /// {@macro Dynamite.validateOneOf} - void validateOneOf() => _i3.validateOneOf( + void validateOneOf() => _i5.validateOneOf( _values, _names, ); /// {@macro Dynamite.validateAnyOf} - void validateAnyOf() => _i3.validateAnyOf( + void validateAnyOf() => _i5.validateAnyOf( _values, _names, ); @@ -2287,9 +2266,9 @@ final Serializers _$serializers = (Serializers().toBuilder() @_i2.visibleForTesting final Serializers $jsonSerializers = _$jsonSerializers; final Serializers _$jsonSerializers = (_$serializers.toBuilder() - ..add(_i5.DynamiteDoubleSerializer()) - ..addPlugin(_i6.StandardJsonPlugin(typesToLeaveAsList: const {_$20fe3de793aed6fbf929c9b82b472b1a})) - ..addPlugin(const _i5.HeaderPlugin()) - ..addPlugin(const _i5.ContentStringPlugin())) + ..add(_i6.DynamiteDoubleSerializer()) + ..addPlugin(_i7.StandardJsonPlugin(typesToLeaveAsList: const {_$20fe3de793aed6fbf929c9b82b472b1a})) + ..addPlugin(const _i6.HeaderPlugin()) + ..addPlugin(const _i6.ContentStringPlugin())) .build(); // coverage:ignore-end diff --git a/packages/nextcloud/test/fixtures/notes/get_and_update_settings.regexp b/packages/nextcloud/test/fixtures/notes/get_and_update_settings.regexp index dc55265f9fd..c0a7bb4eb68 100644 --- a/packages/nextcloud/test/fixtures/notes/get_and_update_settings.regexp +++ b/packages/nextcloud/test/fixtures/notes/get_and_update_settings.regexp @@ -4,7 +4,7 @@ authorization: Basic mock PUT http://localhost/index\.php/apps/notes/api/v1/settings accept: application/json authorization: Basic mock -content-type: application/json +content-type: application/json; charset=utf-8 \{"notesPath":"Test Notes","fileSuffix":"\.txt","noteMode":"preview"\} GET http://localhost/index\.php/apps/notes/api/v1/settings accept: application/json diff --git a/tool/find-untested-neon-apis.sh b/tool/find-untested-neon-apis.sh index af371519c2c..32748664591 100755 --- a/tool/find-untested-neon-apis.sh +++ b/tool/find-untested-neon-apis.sh @@ -4,7 +4,7 @@ cd "$(dirname "$0")/.." function find_apis() { # shellcheck disable=SC2068 - grep -r $@ --include "*\.dart" -e "client\([0-9]\)\?\.[^.]*.[^(]*(" -oh | sed "s/^client\([0-9]\)\?\.//" | sed "s/($//" | sed "s/Raw$//" | grep -v "_Serializer" | grep -v "send" | grep -v "^executeRawRequest" | sort | uniq + grep -r $@ --include "*\.dart" -e "client\([0-9]\)\?\.[^.]*.[^(]*(" -oh | sed "s/^client\([0-9]\)\?\.//" | sed "s/($//" | sed "s/Raw$//" | grep -v "_Serializer" | grep -v "send" | grep -v "_Request" | grep -v "^executeRawRequest" | sort | uniq } used_apis=("$(find_apis "packages/neon_framework" "packages/neon/"*)")