Browse Source

dynamite,nextcloud: Cleanup merge mess

pull/131/head
jld3103 2 years ago
parent
commit
db924c0eeb
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 6
      packages/dynamite/lib/src/openapi_builder.dart
  2. 24
      packages/nextcloud/lib/src/nextcloud.openapi.dart

6
packages/dynamite/lib/src/openapi_builder.dart

@ -910,7 +910,6 @@ class OpenAPIBuilder implements Builder {
for (final header in {...baseHeaders, ...headers}.entries) { for (final header in {...baseHeaders, ...headers}.entries) {
request.headers.add(header.key, header.value); request.headers.add(header.key, header.value);
} }
<<<<<<< Updated upstream
if (body != null) { if (body != null) {
request.add(body.toList()); request.add(body.toList());
} }
@ -927,11 +926,6 @@ class OpenAPIBuilder implements Builder {
responseHeaders[name] = values.last; responseHeaders[name] = values.last;
}); });
return Response( return Response(
=======
final response = await http.Response.fromStream(await request.send());
return _Response(
>>>>>>> Stashed changes
response.statusCode, response.statusCode,
responseHeaders, responseHeaders,
await response.bodyBytes, await response.bodyBytes,

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

@ -15,8 +15,22 @@ extension HttpClientResponseBody on HttpClientResponse {
Future<String> get body async => utf8.decode(await bodyBytes); Future<String> get body async => utf8.decode(await bodyBytes);
} }
class Response { class Response<T, U> {
Response( Response(
this.data,
this.headers,
);
final T data;
final U headers;
@override
String toString() => 'Response(data: $data, headers: $headers)';
}
class _Response {
_Response(
this.statusCode, this.statusCode,
this.headers, this.headers,
this.body, this.body,
@ -29,17 +43,17 @@ class Response {
final Uint8List body; final Uint8List body;
@override @override
String toString() => 'Response(statusCode: $statusCode, headers: $headers, body: ${utf8.decode(body)})'; String toString() => '_Response(statusCode: $statusCode, headers: $headers, body: ${utf8.decode(body)})';
} }
class ApiException extends Response implements Exception { class ApiException extends _Response implements Exception {
ApiException( ApiException(
super.statusCode, super.statusCode,
super.headers, super.headers,
super.body, super.body,
); );
factory ApiException.fromResponse(Response response) => ApiException( factory ApiException.fromResponse(_Response response) => ApiException(
response.statusCode, response.statusCode,
response.headers, response.headers,
response.body, response.body,
@ -104,7 +118,7 @@ class Client {
NotificationsClient get notifications => NotificationsClient(this); NotificationsClient get notifications => NotificationsClient(this);
ProvisioningApiClient get provisioningApi => ProvisioningApiClient(this); ProvisioningApiClient get provisioningApi => ProvisioningApiClient(this);
UserStatusClient get userStatus => UserStatusClient(this); UserStatusClient get userStatus => UserStatusClient(this);
Future<Response> doRequest( Future<_Response> doRequest(
String method, String method,
String path, String path,
Map<String, String> headers, Map<String, String> headers,

Loading…
Cancel
Save