From 38eb5277038ef3bbfbbf82aac9863a1e5b5b731c Mon Sep 17 00:00:00 2001 From: Udhay-Adithya Date: Mon, 7 Jul 2025 22:41:25 +0530 Subject: [PATCH] feat: update APIAuthType enum to include display types for authentication options --- .../details_card/request_pane/request_auth.dart | 16 +++++----------- packages/better_networking/lib/consts.dart | 14 +++++++++++++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/screens/home_page/editor_pane/details_card/request_pane/request_auth.dart b/lib/screens/home_page/editor_pane/details_card/request_pane/request_auth.dart index fd3e6362..0d73f099 100644 --- a/lib/screens/home_page/editor_pane/details_card/request_pane/request_auth.dart +++ b/lib/screens/home_page/editor_pane/details_card/request_pane/request_auth.dart @@ -55,17 +55,10 @@ class EditAuthType extends ConsumerWidget { height: 8, ), ADPopupMenu( - value: currentAuthType.name.capitalize(), - values: const [ - (APIAuthType.none, 'None'), - (APIAuthType.basic, 'Basic'), - (APIAuthType.apiKey, 'API Key'), - (APIAuthType.bearer, 'Bearer'), - (APIAuthType.jwt, 'JWT'), - (APIAuthType.digest, 'Digest'), - (APIAuthType.oauth1, 'OAuth 1.0'), - (APIAuthType.oauth2, 'OAuth 2.0'), - ], + value: currentAuthType.displayType, + values: APIAuthType.values + .map((type) => (type, type.displayType)) + .toList(), tooltip: "Select Authentication Type", isOutlined: true, onChanged: readOnly @@ -92,6 +85,7 @@ class EditAuthType extends ConsumerWidget { ), ); } + Widget _buildAuthFields( BuildContext context, WidgetRef ref, diff --git a/packages/better_networking/lib/consts.dart b/packages/better_networking/lib/consts.dart index 23038c7e..8e5c1472 100644 --- a/packages/better_networking/lib/consts.dart +++ b/packages/better_networking/lib/consts.dart @@ -9,7 +9,19 @@ enum APIType { final String abbr; } -enum APIAuthType { none, basic, apiKey, bearer, jwt, digest, oauth1, oauth2 } +enum APIAuthType { + none("None"), + basic("Basic Auth"), + apiKey("API Key"), + bearer("Bearer Token"), + jwt("JWT Bearer"), + digest("Digest Auth"), + oauth1("OAuth 1.0"), + oauth2("OAuth 2.0"); + + const APIAuthType(this.displayType); + final String displayType; +} enum HTTPVerb { get("GET"),