| 1 | // |
| 2 | // AUTO-GENERATED FILE, DO NOT MODIFY! |
| 3 | // |
| 4 | |
| 5 | |
| 6 | import 'package:dio/dio.dart'; |
| 7 | import 'package:openapi/src/auth/auth.dart'; |
| 8 | |
| 9 | class ApiKeyAuthInterceptor extends AuthInterceptor |
| 10 | final Map<String |
| 11 | |
| 12 | @override |
| 13 | void onRequest(RequestOptions |
| 14 | final authInfo = getAuthInfo(options |
| 15 | for (final info in authInfo) { |
| 16 | final authName = info['name'] as |
| 17 | final authKeyName = info['keyName'] as |
| 18 | final authWhere = info['where'] as |
| 19 | final apiKey = apiKeys[authName]; |
| 20 | if (apiKey != null) { |
| 21 | if (authWhere == 'query') { |
| 22 | options.queryParameters[authKeyName] = apiKey; |
| 23 | } else { |
| 24 | options.headers[authKeyName] = apiKey; |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | super.onRequest(options, handler) |
| 29 | } |
| 30 | } |