Browse Source

perf(nextcloud): use stream based body decoding

Signed-off-by: Nikolas Rimikis <rimikis.nikolas@gmail.com>
pull/592/head
Nikolas Rimikis 1 year ago
parent
commit
ed6502697a
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 4
      packages/dynamite/dynamite/lib/src/openapi_builder.dart
  2. 5
      packages/nextcloud/lib/src/api/core.openapi.dart
  3. 5
      packages/nextcloud/lib/src/api/files_sharing.openapi.dart
  4. 5
      packages/nextcloud/lib/src/api/news.openapi.dart
  5. 4
      packages/nextcloud/lib/src/api/notes.openapi.dart
  6. 5
      packages/nextcloud/lib/src/api/notifications.openapi.dart
  7. 5
      packages/nextcloud/lib/src/api/provisioning_api.openapi.dart
  8. 5
      packages/nextcloud/lib/src/api/settings.openapi.dart
  9. 5
      packages/nextcloud/lib/src/api/theming.openapi.dart
  10. 5
      packages/nextcloud/lib/src/api/uppush.openapi.dart
  11. 5
      packages/nextcloud/lib/src/api/user_status.openapi.dart
  12. 2
      packages/nextcloud/lib/src/webdav/client.dart

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

@ -144,11 +144,9 @@ class OpenAPIBuilder implements Builder {
),
)
..body = Block.of([
const Code('final data = await response.bodyBytes;'),
const Code(''),
const Code('String body;'),
const Code('try {'),
const Code('body = utf8.decode(data);'),
const Code('body = await response.body;'),
const Code('} on FormatException {'),
const Code("body = 'binary';"),
const Code('}'),

5
packages/nextcloud/lib/src/api/core.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
@ -34,11 +33,9 @@ class CoreApiException extends DynamiteApiException {
);
static Future<CoreApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

5
packages/nextcloud/lib/src/api/files_sharing.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
@ -34,11 +33,9 @@ class FilesSharingApiException extends DynamiteApiException {
);
static Future<FilesSharingApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

5
packages/nextcloud/lib/src/api/news.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
@ -34,11 +33,9 @@ class NewsApiException extends DynamiteApiException {
);
static Future<NewsApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

4
packages/nextcloud/lib/src/api/notes.openapi.dart

@ -34,11 +34,9 @@ class NotesApiException extends DynamiteApiException {
);
static Future<NotesApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

5
packages/nextcloud/lib/src/api/notifications.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
@ -34,11 +33,9 @@ class NotificationsApiException extends DynamiteApiException {
);
static Future<NotificationsApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

5
packages/nextcloud/lib/src/api/provisioning_api.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
@ -34,11 +33,9 @@ class ProvisioningApiApiException extends DynamiteApiException {
);
static Future<ProvisioningApiApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

5
packages/nextcloud/lib/src/api/settings.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_value/built_value.dart';
@ -32,11 +31,9 @@ class SettingsApiException extends DynamiteApiException {
);
static Future<SettingsApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

5
packages/nextcloud/lib/src/api/theming.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
@ -34,11 +33,9 @@ class ThemingApiException extends DynamiteApiException {
);
static Future<ThemingApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

5
packages/nextcloud/lib/src/api/uppush.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
@ -33,11 +32,9 @@ class UppushApiException extends DynamiteApiException {
);
static Future<UppushApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

5
packages/nextcloud/lib/src/api/user_status.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
@ -34,11 +33,9 @@ class UserStatusApiException extends DynamiteApiException {
);
static Future<UserStatusApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}

2
packages/nextcloud/lib/src/webdav/client.dart

@ -55,7 +55,7 @@ class WebDavClient {
throw DynamiteApiException(
response.statusCode,
response.responseHeaders,
utf8.decode(await response.bodyBytes),
await response.body,
);
}

Loading…
Cancel
Save