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