| 1 | // |
| 2 | // AUTO-GENERATED FILE, DO NOT MODIFY! |
| 3 | // |
| 4 | |
| 5 | import 'package:dio/dio.dart'; |
| 6 | import 'package:built_value/serializer.dart'; |
| 7 | import 'package:openapi/src/serializers.dart'; |
| 8 | import 'package:openapi/src/auth/api_key_auth.dart'; |
| 9 | import 'package:openapi/src/auth/basic_auth.dart'; |
| 10 | import 'package:openapi/src/auth/bearer_auth.dart'; |
| 11 | import 'package:openapi/src/auth/oauth.dart'; |
| 12 | import 'package:openapi/src/api/airlines_api.dart'; |
| 13 | import 'package:openapi/src/api/airports_api.dart'; |
| 14 | import 'package:openapi/src/api/app_api.dart'; |
| 15 | import 'package:openapi/src/api/authentication_api.dart'; |
| 16 | import 'package:openapi/src/api/flight_api.dart'; |
| 17 | import 'package:openapi/src/api/flight_alerts_api.dart'; |
| 18 | import 'package:openapi/src/api/flights_api.dart'; |
| 19 | import 'package:openapi/src/api/profile_api.dart'; |
| 20 | |
| 21 | class Openapi { |
| 22 | static const String |
| 23 | |
| 24 | final Dio dio; |
| 25 | final Serializers serializers; |
| 26 | |
| 27 | Openapi({ |
| 28 | Dio? dio, |
| 29 | Serializers? serializers, |
| 30 | String? basePathOverride, |
| 31 | List<Interceptor>? interceptors |
| 32 | }) : this.serializers = serializers |
| 33 | this.dio = dio ?? |
| 34 | Dio(BaseOptions( |
| 35 | baseUrl: basePathOverride ?? basePath, |
| 36 | connectTimeout: const Duration(milliseconds |
| 37 | receiveTimeout: const Duration(milliseconds |
| 38 | )) { |
| 39 | if (interceptors == null) { |
| 40 | this.dio.interceptors.addAll |
| 41 | OAuthInterceptor(), |
| 42 | BasicAuthInterceptor(), |
| 43 | BearerAuthInterceptor(), |
| 44 | ApiKeyAuthInterceptor(), |
| 45 | ]); |
| 46 | } else { |
| 47 | this.dio.interceptors.addAll |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | void setOAuthToken(String |
| 52 | if (this.dio.interceptors |
| 53 | (this.dio.interceptors.firstWhere |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | void setBearerAuth(String |
| 58 | if (this.dio.interceptors |
| 59 | (this.dio.interceptors.firstWhere |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | void setBasicAuth(String |
| 64 | if (this.dio.interceptors |
| 65 | (this.dio.interceptors.firstWhere |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void setApiKey(String |
| 70 | if (this.dio.interceptors |
| 71 | (this.dio.interceptors.firstWhere |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /// Get AirlinesApi instance, base route and serializer can be overridden by a given but be careful, |
| 76 | /// by doing that all interceptors will not be executed |
| 77 | AirlinesApi getAirlinesApi() { |
| 78 | return AirlinesApi(dio, serializers) |
| 79 | } |
| 80 | |
| 81 | /// Get AirportsApi instance, base route and serializer can be overridden by a given but be careful, |
| 82 | /// by doing that all interceptors will not be executed |
| 83 | AirportsApi getAirportsApi() { |
| 84 | return AirportsApi(dio, serializers) |
| 85 | } |
| 86 | |
| 87 | /// Get AppApi instance, base route and serializer can be overridden by a given but be careful, |
| 88 | /// by doing that all interceptors will not be executed |
| 89 | AppApi getAppApi() { |
| 90 | return AppApi(dio, serializers) |
| 91 | } |
| 92 | |
| 93 | /// Get AuthenticationApi instance, base route and serializer can be overridden by a given but be careful, |
| 94 | /// by doing that all interceptors will not be executed |
| 95 | AuthenticationApi getAuthenticationApi() { |
| 96 | return AuthenticationApi(dio, serializers) |
| 97 | } |
| 98 | |
| 99 | /// Get FlightApi instance, base route and serializer can be overridden by a given but be careful, |
| 100 | /// by doing that all interceptors will not be executed |
| 101 | FlightApi getFlightApi() { |
| 102 | return FlightApi(dio, serializers) |
| 103 | } |
| 104 | |
| 105 | /// Get FlightAlertsApi instance, base route and serializer can be overridden by a given but be careful, |
| 106 | /// by doing that all interceptors will not be executed |
| 107 | FlightAlertsApi getFlightAlertsApi() { |
| 108 | return FlightAlertsApi(dio, serializers) |
| 109 | } |
| 110 | |
| 111 | /// Get FlightsApi instance, base route and serializer can be overridden by a given but be careful, |
| 112 | /// by doing that all interceptors will not be executed |
| 113 | FlightsApi getFlightsApi() { |
| 114 | return FlightsApi(dio, serializers) |
| 115 | } |
| 116 | |
| 117 | /// Get ProfileApi instance, base route and serializer can be overridden by a given but be careful, |
| 118 | /// by doing that all interceptors will not be executed |
| 119 | ProfileApi getProfileApi() { |
| 120 | return ProfileApi(dio, serializers) |
| 121 | } |
| 122 | } |