Well, generator made some bad decissions

This commit is contained in:
Andrew 2023-04-24 19:02:04 +07:00
parent f076ae3790
commit 68cdcf45e7

View file

@ -25,7 +25,6 @@ import 'package:tuuli_api/src/model/table_items_response.dart';
import 'package:tuuli_api/src/model/user_update_definition.dart';
class DefaultApi {
final Dio _dio;
final Serializers _serializers;
@ -50,7 +49,7 @@ class DefaultApi {
/// Throws [DioError] if API call or serialization fails
Future<Response<OkResponse>> createItemItemsTableNamePost({
required String tableName,
required JsonObject body,
required Map<String, dynamic> body,
String? accessToken,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
@ -59,7 +58,8 @@ class DefaultApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/items/{tableName}/+'.replaceAll('{' r'tableName' '}', tableName.toString());
final _path = r'/items/{tableName}/+'
.replaceAll('{' r'tableName' '}', tableName.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@ -78,10 +78,9 @@ class DefaultApi {
try {
_bodyData = body;
} catch(error, stackTrace) {
} catch (error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
requestOptions: _options.compose(
_dio.options,
_path,
),
@ -108,7 +107,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -158,7 +156,8 @@ class DefaultApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/createTable/{tableName}'.replaceAll('{' r'tableName' '}', tableName.toString());
final _path = r'/api/createTable/{tableName}'
.replaceAll('{' r'tableName' '}', tableName.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@ -178,10 +177,9 @@ class DefaultApi {
try {
const _type = FullType(BuiltList, [FullType(String)]);
_bodyData = _serializers.serialize(requestBody, specifiedType: _type);
} catch(error, stackTrace) {
} catch (error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
requestOptions: _options.compose(
_dio.options,
_path,
),
@ -208,7 +206,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -275,11 +272,11 @@ class DefaultApi {
try {
const _type = FullType(CreateUserDefinition);
_bodyData = _serializers.serialize(createUserDefinition, specifiedType: _type);
} catch(error, stackTrace) {
_bodyData =
_serializers.serialize(createUserDefinition, specifiedType: _type);
} catch (error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
requestOptions: _options.compose(
_dio.options,
_path,
),
@ -306,7 +303,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -356,7 +352,8 @@ class DefaultApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/items/{tableName}/-'.replaceAll('{' r'tableName' '}', tableName.toString());
final _path = r'/items/{tableName}/-'
.replaceAll('{' r'tableName' '}', tableName.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@ -375,11 +372,11 @@ class DefaultApi {
try {
const _type = FullType(BuiltList, [FullType(ColumnConditionCompat)]);
_bodyData = _serializers.serialize(columnConditionCompat, specifiedType: _type);
} catch(error, stackTrace) {
_bodyData =
_serializers.serialize(columnConditionCompat, specifiedType: _type);
} catch (error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
requestOptions: _options.compose(
_dio.options,
_path,
),
@ -406,7 +403,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -454,7 +450,8 @@ class DefaultApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/dropTable/{tableName}'.replaceAll('{' r'tableName' '}', tableName.toString());
final _path = r'/api/dropTable/{tableName}'
.replaceAll('{' r'tableName' '}', tableName.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@ -484,7 +481,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -549,10 +545,9 @@ class DefaultApi {
try {
const _type = FullType(AuthModel);
_bodyData = _serializers.serialize(authModel, specifiedType: _type);
} catch(error, stackTrace) {
} catch (error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
requestOptions: _options.compose(
_dio.options,
_path,
),
@ -579,7 +574,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as AccessTokenResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -654,7 +648,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as JsonObject;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -704,7 +697,8 @@ class DefaultApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/items/{tableName}'.replaceAll('{' r'tableName' '}', tableName.toString());
final _path = r'/items/{tableName}'
.replaceAll('{' r'tableName' '}', tableName.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@ -723,11 +717,11 @@ class DefaultApi {
try {
const _type = FullType(ItemsFieldSelectorList);
_bodyData = _serializers.serialize(itemsFieldSelectorList, specifiedType: _type);
} catch(error, stackTrace) {
_bodyData =
_serializers.serialize(itemsFieldSelectorList, specifiedType: _type);
} catch (error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
requestOptions: _options.compose(
_dio.options,
_path,
),
@ -754,7 +748,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as TableItemsResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -830,7 +823,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as BuiltList<TableDefinition>;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -899,10 +891,9 @@ class DefaultApi {
_bodyData = FormData.fromMap(<String, dynamic>{
r'asset': asset,
});
} catch(error, stackTrace) {
} catch (error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
requestOptions: _options.compose(
_dio.options,
_path,
),
@ -929,7 +920,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as CreateAssetResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -981,7 +971,8 @@ class DefaultApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/assets/{asset_id}/-'.replaceAll('{' r'asset_id' '}', assetId.toString());
final _path = r'/assets/{asset_id}/-'
.replaceAll('{' r'asset_id' '}', assetId.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@ -996,8 +987,12 @@ class DefaultApi {
);
final _queryParameters = <String, dynamic>{
if (checkReferences != null) r'check_references': encodeQueryParameter(_serializers, checkReferences, const FullType(bool)),
if (deleteReferencing != null) r'delete_referencing': encodeQueryParameter(_serializers, deleteReferencing, const FullType(bool)),
if (checkReferences != null)
r'check_references': encodeQueryParameter(
_serializers, checkReferences, const FullType(bool)),
if (deleteReferencing != null)
r'delete_referencing': encodeQueryParameter(
_serializers, deleteReferencing, const FullType(bool)),
};
final _response = await _dio.request<Object>(
@ -1017,7 +1012,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -1080,7 +1074,8 @@ class DefaultApi {
);
final _queryParameters = <String, dynamic>{
r'user_id': encodeQueryParameter(_serializers, userId, const FullType(int)),
r'user_id':
encodeQueryParameter(_serializers, userId, const FullType(int)),
};
final _response = await _dio.request<Object>(
@ -1100,7 +1095,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -1150,7 +1144,8 @@ class DefaultApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/assets/{asset_id}/*'.replaceAll('{' r'asset_id' '}', assetId.toString());
final _path = r'/assets/{asset_id}/*'
.replaceAll('{' r'asset_id' '}', assetId.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@ -1165,7 +1160,8 @@ class DefaultApi {
);
final _queryParameters = <String, dynamic>{
r'asset_description': encodeQueryParameter(_serializers, assetDescription, const FullType(String)),
r'asset_description': encodeQueryParameter(
_serializers, assetDescription, const FullType(String)),
};
final _response = await _dio.request<Object>(
@ -1185,7 +1181,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -1226,7 +1221,8 @@ class DefaultApi {
/// Throws [DioError] if API call or serialization fails
Future<Response<OkResponse>> updateItemInTableItemsTableNamePost({
required String tableName,
required BodyUpdateItemInTableItemsTableNamePost bodyUpdateItemInTableItemsTableNamePost,
required BodyUpdateItemInTableItemsTableNamePost
bodyUpdateItemInTableItemsTableNamePost,
String? accessToken,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
@ -1235,7 +1231,8 @@ class DefaultApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/items/{tableName}/*'.replaceAll('{' r'tableName' '}', tableName.toString());
final _path = r'/items/{tableName}/*'
.replaceAll('{' r'tableName' '}', tableName.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@ -1254,11 +1251,12 @@ class DefaultApi {
try {
const _type = FullType(BodyUpdateItemInTableItemsTableNamePost);
_bodyData = _serializers.serialize(bodyUpdateItemInTableItemsTableNamePost, specifiedType: _type);
} catch(error, stackTrace) {
_bodyData = _serializers.serialize(
bodyUpdateItemInTableItemsTableNamePost,
specifiedType: _type);
} catch (error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
requestOptions: _options.compose(
_dio.options,
_path,
),
@ -1285,7 +1283,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -1352,11 +1349,11 @@ class DefaultApi {
try {
const _type = FullType(UserUpdateDefinition);
_bodyData = _serializers.serialize(userUpdateDefinition, specifiedType: _type);
} catch(error, stackTrace) {
_bodyData =
_serializers.serialize(userUpdateDefinition, specifiedType: _type);
} catch (error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
requestOptions: _options.compose(
_dio.options,
_path,
),
@ -1383,7 +1380,6 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as OkResponse;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
@ -1405,5 +1401,4 @@ class DefaultApi {
extra: _response.extra,
);
}
}