// GENERATED CODE - DO NOT MODIFY BY HAND part of 'api_service.dart'; // ************************************************************************** // RetrofitGenerator // ************************************************************************** // ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element class _ApiService implements ApiService { _ApiService( this._dio, { this.baseUrl, this.errorLogger, }); final Dio _dio; String? baseUrl; final ParseErrorLogger? errorLogger; @override Future> login(String phoneNumber) async { final _extra = {}; final queryParameters = {}; final _headers = {r'Content-Type': 'application/json'}; _headers.removeWhere((k, v) => v == null); final _data = {'phoneNumber': phoneNumber}; final _options = _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, contentType: 'application/json', ) .compose( _dio.options, '/app/login', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ApiResponse _value; try { _value = ApiResponse.fromJson( _result.data!, (json) => LoginInfo.fromJson(json as Map), ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> logout(String token) async { final _extra = {}; final queryParameters = {}; final _headers = {r'token': token}; _headers.removeWhere((k, v) => v == null); const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/app/logout', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ApiResponse _value; try { _value = ApiResponse.fromJson( _result.data!, (json) => json as dynamic, ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> sendCaptchaCode(String phoneNumber) async { final _extra = {}; final queryParameters = {}; final _headers = {r'Content-Type': 'application/json'}; _headers.removeWhere((k, v) => v == null); final _data = {'phoneNumber': phoneNumber}; final _options = _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, contentType: 'application/json', ) .compose( _dio.options, '/app/sendCaptchaCode', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ApiResponse _value; try { _value = ApiResponse.fromJson( _result.data!, (json) => json as dynamic, ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> checkCaptchaCode( String captchaCode, String phoneNumber, ) async { final _extra = {}; final queryParameters = {}; final _headers = {r'Content-Type': 'application/json'}; _headers.removeWhere((k, v) => v == null); final _data = { 'captchaCode': captchaCode, 'phoneNumber': phoneNumber, }; final _options = _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, contentType: 'application/json', ) .compose( _dio.options, '/app/checkCaptchaCode', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ApiResponse _value; try { _value = ApiResponse.fromJson( _result.data!, (json) => json as dynamic, ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future>> dictList(String dictType) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/app/api/type/${dictType}', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ApiResponse> _value; try { _value = ApiResponse>.fromJson( _result.data!, (json) => json is List ? json .map( (i) => DictInfo.fromJson(i as Map)) .toList() : List.empty(), ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> getVersion(String type) async { final _extra = {}; final queryParameters = {r'type': type}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/app/api/findVersion', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ApiResponse _value; try { _value = ApiResponse.fromJson( _result.data!, (json) => VersionInfo.fromJson(json as Map), ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future>> getPatientList() async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/app/user/list', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ApiResponse> _value; try { _value = ApiResponse>.fromJson( _result.data!, (json) => json is List ? json .map( (i) => PatientInfo.fromJson(i as Map)) .toList() : List.empty(), ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future>> getClinicList() async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/app/api/clinicList', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ApiResponse> _value; try { _value = ApiResponse>.fromJson( _result.data!, (json) => json is List ? json .map( (i) => ClinicInfo.fromJson(i as Map)) .toList() : List.empty(), ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> addPatient( String name, String idCard, String relation, ) async { final _extra = {}; final queryParameters = {}; final _headers = {r'Content-Type': 'application/json'}; _headers.removeWhere((k, v) => v == null); final _data = { 'patientName': name, 'identificationCard': idCard, 'relationship': relation, }; final _options = _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, contentType: 'application/json', ) .compose( _dio.options, '/app/user', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch>(_options); late ApiResponse _value; try { _value = ApiResponse.fromJson( _result.data!, (json) => json as dynamic, ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } return _value; } @override Future> getPrivacyPolicy() async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/app/api/privacyPolicy', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch(_options); late String _value; try { _value = _result.data!; } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); return httpResponse; } @override Future> getUserAgreement() async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/app/api/userAgreement', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch(_options); late String _value; try { _value = _result.data!; } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); return httpResponse; } @override Future> getPermissionDescription(String type) async { final _extra = {}; final queryParameters = {r'type': type}; final _headers = {}; const Map? _data = null; final _options = _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/app/api/permissionDescription', queryParameters: queryParameters, data: _data, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, ))); final _result = await _dio.fetch(_options); late String _value; try { _value = _result.data!; } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); return httpResponse; } 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(); } }