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) {
request.headers.add(header.key, header.value);
}
<<<<<<< Updated upstream
if (body != null) {
request.add(body.toList());
}
@ -927,11 +926,6 @@ class OpenAPIBuilder implements Builder {
responseHeaders[name] = values.last;
});
return Response(
=======
final response = await http.Response.fromStream(await request.send());
return _Response(
>>>>>>> Stashed changes
response.statusCode,
responseHeaders,
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);
}
class Response {
class Response<T, U> {
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.headers,
this.body,
@ -29,17 +43,17 @@ class Response {
final Uint8List body;
@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(
super.statusCode,
super.headers,
super.body,
);
factory ApiException.fromResponse(Response response) => ApiException(
factory ApiException.fromResponse(_Response response) => ApiException(
response.statusCode,
response.headers,
response.body,
@ -104,7 +118,7 @@ class Client {
NotificationsClient get notifications => NotificationsClient(this);
ProvisioningApiClient get provisioningApi => ProvisioningApiClient(this);
UserStatusClient get userStatus => UserStatusClient(this);
Future<Response> doRequest(
Future<_Response> doRequest(
String method,
String path,
Map<String, String> headers,

Loading…
Cancel
Save