// GENERATED CODE - DO NOT MODIFY BY HAND part of 'profile_service.dart'; // ************************************************************************** // RetrofitGenerator // ************************************************************************** // ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations class _ProfileService implements ProfileService { _ProfileService( this._dio, { this.baseUrl, this.errorLogger, }); final Dio _dio; String? baseUrl; final ParseErrorLogger? errorLogger; @override Future getProfileBySlug({required String slug}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/profile/show/${slug}', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ProfileModel _value; try { _value = ProfileModel.fromJson(_result.data!); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future getMyProfile() async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/profile/index', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ProfileModel _value; try { _value = ProfileModel.fromJson(_result.data!); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future getMyProfileDetails() async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/profile/detailz', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ProfileDetailsModel _value; try { _value = ProfileDetailsModel.fromJson(_result.data!); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future addCircumference({ required int chestCircumference, required int waistCircumference, required int hipCircumference, }) async { final _extra = {}; final queryParameters = {}; final _headers = {}; final _data = FormData(); _data.fields.add(MapEntry( 'chest_circumference', chestCircumference.toString(), )); _data.fields.add(MapEntry( 'waist_circumference', waistCircumference.toString(), )); _data.fields.add(MapEntry( 'hip_circumference', hipCircumference.toString(), )); final _options = _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/profile/addCircumference', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); await _dio.fetch(_options); } @override Future addWeight({required double weight}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; final _data = FormData(); _data.fields.add(MapEntry( 'weight', weight.toString(), )); final _options = _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/profile/addWeight', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); await _dio.fetch(_options); } @override Future> getBlogPostByAuthorSlug( {required String slug}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/blogPosts/search_by_author/${slug}', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late List _value; try { _value = _result.data! .map((dynamic i) => FeedBlogPostModel.fromJson(i as Map)) .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> getWeight({required String period}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/profile/measure/weight/${period}', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late List _value; try { _value = _result.data! .map((dynamic i) => WeightModel.fromJson(i as Map)) .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> getWeightBySlug({ required String period, required String slug, }) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/profile/measure/weight/${period}/${slug}', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late List _value; try { _value = _result.data! .map((dynamic i) => WeightModel.fromJson(i as Map)) .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> getCircumferences( {required String period}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/profile/measure/circumferences/${period}', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late List _value; try { _value = _result.data! .map((dynamic i) => CircumferenceModel.fromJson(i as Map)) .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> getCircumferencesBySlug({ required String period, required String slug, }) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/api/profile/measure/circumferences/${period}/{user}', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late List _value; try { _value = _result.data! .map((dynamic i) => CircumferenceModel.fromJson(i as Map)) .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { requestOptions.responseType = ResponseType.json; } } return requestOptions; } String _combineBaseUrls( String dioBaseUrl, String? baseUrl, ) { if (baseUrl == null || baseUrl.trim().isEmpty) { return dioBaseUrl; } final url = Uri.parse(baseUrl); if (url.isAbsolute) { return url.toString(); } return Uri.parse(dioBaseUrl).resolveUri(url).toString(); } }