feat: add authentication support with APIAuthType and APIAuthModel

- Introduced APIAuthType enum for various authentication methods.
- Created APIAuthModel with basic authentication fields.
- Updated RequestModel to include authType and authData.
- Implemented EditAuthType widget for selecting and managing authentication.
- Enhanced CollectionStateNotifier to handle authentication updates.

:wq
This commit is contained in:
Udhay-Adithya
2025-06-07 15:30:20 +05:30
parent e5b22a24fc
commit 171a118d38
15 changed files with 700 additions and 48 deletions

View File

@@ -12,6 +12,12 @@ _$RequestModelImpl _$$RequestModelImplFromJson(Map json) => _$RequestModelImpl(
APIType.rest,
name: json['name'] as String? ?? "",
description: json['description'] as String? ?? "",
authType: $enumDecodeNullable(_$APIAuthTypeEnumMap, json['authType']) ??
APIAuthType.none,
authData: json['authData'] == null
? null
: APIAuthModel.fromJson(
Map<String, dynamic>.from(json['authData'] as Map)),
requestTabIndex: json['requestTabIndex'] ?? 0,
httpRequestModel: json['httpRequestModel'] == null
? null
@@ -37,6 +43,8 @@ Map<String, dynamic> _$$RequestModelImplToJson(_$RequestModelImpl instance) =>
'apiType': _$APITypeEnumMap[instance.apiType]!,
'name': instance.name,
'description': instance.description,
'authType': _$APIAuthTypeEnumMap[instance.authType]!,
'authData': instance.authData?.toJson(),
'httpRequestModel': instance.httpRequestModel?.toJson(),
'responseStatus': instance.responseStatus,
'message': instance.message,
@@ -49,3 +57,14 @@ const _$APITypeEnumMap = {
APIType.rest: 'rest',
APIType.graphql: 'graphql',
};
const _$APIAuthTypeEnumMap = {
APIAuthType.none: 'none',
APIAuthType.basic: 'basic',
APIAuthType.apiKey: 'apiKey',
APIAuthType.bearerToken: 'bearerToken',
APIAuthType.jwtBearer: 'jwtBearer',
APIAuthType.digest: 'digest',
APIAuthType.oauth1: 'oauth1',
APIAuthType.oauth2: 'oauth2',
};