content: // 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,
    }) {
      baseUrl ??= 'https://todo.iraqsapp.com/';
    }
  
    final Dio _dio;
  
    String? baseUrl;
  
    @override
    Future<SignupResponse> signup(SignupRequestBody signupRequestBody) async {
      final _extra = <String, dynamic>{};
      final queryParameters = <String, dynamic>{};
      final _headers = <String, dynamic>{};
      final _data = <String, dynamic>{};
      _data.addAll(signupRequestBody.toJson());
      final _result = await _dio
          .fetch<Map<String, dynamic>>(_setStreamType<SignupResponse>(Options(
        method: 'POST',
        headers: _headers,
        extra: _extra,
      )
              .compose(
                _dio.options,
                'auth/register',
                queryParameters: queryParameters,
                data: _data,
              )
              .copyWith(
                  baseUrl: _combineBaseUrls(
                _dio.options.baseUrl,
                baseUrl,
              ))));
      final _value = SignupResponse.fromJson(_result.data!);
      return _value;
    }
  
    @override
    Future<LoginResponse> login(LoginRequestBody loginRequestBody) async {
      final _extra = <String, dynamic>{};
      final queryParameters = <String, dynamic>{};
      final _headers = <String, dynamic>{};
      final _data = <String, dynamic>{};
      _data.addAll(loginRequestBody.toJson());
      final _result = await _dio
          .fetch<Map<String, dynamic>>(_setStreamType<LoginResponse>(Options(
        method: 'POST',
        headers: _headers,
        extra: _extra,
      )
              .compose(
                _dio.options,
                'auth/login',
                queryParameters: queryParameters,
                data: _data,
              )
              .copyWith(
                  baseUrl: _combineBaseUrls(
                _dio.options.baseUrl,
                baseUrl,
              ))));
      final _value = LoginResponse.fromJson(_result.data!);
      return _value;
    }
  
    @override
    Future<RefreshTokenResponse> refreshToken(String refreshToken) async {
      final _extra = <String, dynamic>{};
      final queryParameters = <String, dynamic>{r'token': refreshToken};
      final _headers = <String, dynamic>{};
      const Map<String, dynamic>? _data = null;
      final _result = await _dio.fetch<Map<String, dynamic>>(
          _setStreamType<RefreshTokenResponse>(Options(
        method: 'GET',
        headers: _headers,
        extra: _extra,
      )
              .compose(
                _dio.options,
                'auth/refresh-token',
                queryParameters: queryParameters,
                data: _data,
              )
              .copyWith(
                  baseUrl: _combineBaseUrls(
                _dio.options.baseUrl,
                baseUrl,
              ))));
      final _value = RefreshTokenResponse.fromJson(_result.data!);
      return _value;
    }
  
    @override
    Future<List<TodoResponse>> getTodosList(int pageNum) async {
      final _extra = <String, dynamic>{};
      final queryParameters = <String, dynamic>{r'page': pageNum};
      final _headers = <String, dynamic>{};
      const Map<String, dynamic>? _data = null;
      final _result = await _dio
          .fetch<List<dynamic>>(_setStreamType<List<TodoResponse>>(Options(
        method: 'GET',
        headers: _headers,
        extra: _extra,
      )
              .compose(
                _dio.options,
                'todos',
                queryParameters: queryParameters,
                data: _data,
              )
              .copyWith(
                  baseUrl: _combineBaseUrls(
                _dio.options.baseUrl,
                baseUrl,
              ))));
      var _value = _result.data!
          .map((dynamic i) => TodoResponse.fromJson(i as Map<String, dynamic>))
          .toList();
      return _value;
    }
  
    @override
    Future<void> createTask(AddEditTaskRequestBody addEditTaskRequestBody) async {
      final _extra = <String, dynamic>{};
      final queryParameters = <String, dynamic>{};
      final _headers = <String, dynamic>{};
      final _data = <String, dynamic>{};
      _data.addAll(addEditTaskRequestBody.toJson());
      await _dio.fetch<void>(_setStreamType<void>(Options(
        method: 'POST',
        headers: _headers,
        extra: _extra,
      )
          .compose(
            _dio.options,
            'todos',
            queryParameters: queryParameters,
            data: _data,
          )
          .copyWith(
              baseUrl: _combineBaseUrls(
            _dio.options.baseUrl,
            baseUrl,
          ))));
    }
  
    @override
    Future<ProfileResponse> getProfile() async {
      final _extra = <String, dynamic>{};
      final queryParameters = <String, dynamic>{};
      final _headers = <String, dynamic>{};
      const Map<String, dynamic>? _data = null;
      final _result = await _dio
          .fetch<Map<String, dynamic>>(_setStreamType<ProfileResponse>(Options(
        method: 'GET',
        headers: _headers,
        extra: _extra,
      )
              .compose(
                _dio.options,
                'auth/profile',
                queryParameters: queryParameters,
                data: _data,
              )
              .copyWith(
                  baseUrl: _combineBaseUrls(
                _dio.options.baseUrl,
                baseUrl,
              ))));
      final _value = ProfileResponse.fromJson(_result.data!);
      return _value;
    }
  
    @override
    Future<TodoResponse> getTodoById(String id) async {
      final _extra = <String, dynamic>{};
      final queryParameters = <String, dynamic>{};
      final _headers = <String, dynamic>{};
      const Map<String, dynamic>? _data = null;
      final _result = await _dio
          .fetch<Map<String, dynamic>>(_setStreamType<TodoResponse>(Options(
        method: 'GET',
        headers: _headers,
        extra: _extra,
      )
              .compose(
                _dio.options,
                '/todos/${id}',
                queryParameters: queryParameters,
                data: _data,
              )
              .copyWith(
                  baseUrl: _combineBaseUrls(
                _dio.options.baseUrl,
                baseUrl,
              ))));
      final _value = TodoResponse.fromJson(_result.data!);
      return _value;
    }
  
    @override
    Future<void> deleteTodoById(String id) async {
      final _extra = <String, dynamic>{};
      final queryParameters = <String, dynamic>{};
      final _headers = <String, dynamic>{};
      const Map<String, dynamic>? _data = null;
      await _dio.fetch<void>(_setStreamType<void>(Options(
        method: 'DELETE',
        headers: _headers,
        extra: _extra,
      )
          .compose(
            _dio.options,
            'todos/${id}',
            queryParameters: queryParameters,
            data: _data,
          )
          .copyWith(
              baseUrl: _combineBaseUrls(
            _dio.options.baseUrl,
            baseUrl,
          ))));
    }
  
    @override
    Future<void> editTask(
      String id,
      EditTaskRequestBody editTaskRequestBody,
    ) async {
      final _extra = <String, dynamic>{};
      final queryParameters = <String, dynamic>{};
      final _headers = <String, dynamic>{};
      final _data = <String, dynamic>{};
      _data.addAll(editTaskRequestBody.toJson());
      await _dio.fetch<void>(_setStreamType<void>(Options(
        method: 'PUT',
        headers: _headers,
        extra: _extra,
      )
          .compose(
            _dio.options,
            'todos/${id}',
            queryParameters: queryParameters,
            data: _data,
          )
          .copyWith(
              baseUrl: _combineBaseUrls(
            _dio.options.baseUrl,
            baseUrl,
          ))));
    }
  
    RequestOptions _setStreamType<T>(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();
    }
  }
  