mirror of
https://github.com/foss42/apidash.git
synced 2025-12-03 11:27:50 +08:00
refactor: rename ApiAuthModel to AuthModel and authData to authModel
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import 'package:apidash_core/apidash_core.dart';
|
import 'package:apidash_core/apidash_core.dart';
|
||||||
import 'package:apidash_core/models/auth/api_auth_model.dart';
|
|
||||||
|
|
||||||
part 'request_model.freezed.dart';
|
part 'request_model.freezed.dart';
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ class RequestModel with _$RequestModel {
|
|||||||
@Default(APIType.rest) APIType apiType,
|
@Default(APIType.rest) APIType apiType,
|
||||||
@Default("") String name,
|
@Default("") String name,
|
||||||
@Default("") String description,
|
@Default("") String description,
|
||||||
@Default(ApiAuthModel(type: APIAuthType.none)) ApiAuthModel? authData,
|
@Default(AuthModel(type: APIAuthType.none)) AuthModel? authModel,
|
||||||
@JsonKey(includeToJson: false) @Default(0) requestTabIndex,
|
@JsonKey(includeToJson: false) @Default(0) requestTabIndex,
|
||||||
HttpRequestModel? httpRequestModel,
|
HttpRequestModel? httpRequestModel,
|
||||||
int? responseStatus,
|
int? responseStatus,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ mixin _$RequestModel {
|
|||||||
APIType get apiType => throw _privateConstructorUsedError;
|
APIType get apiType => throw _privateConstructorUsedError;
|
||||||
String get name => throw _privateConstructorUsedError;
|
String get name => throw _privateConstructorUsedError;
|
||||||
String get description => throw _privateConstructorUsedError;
|
String get description => throw _privateConstructorUsedError;
|
||||||
ApiAuthModel? get authData => throw _privateConstructorUsedError;
|
AuthModel? get authModel => throw _privateConstructorUsedError;
|
||||||
@JsonKey(includeToJson: false)
|
@JsonKey(includeToJson: false)
|
||||||
dynamic get requestTabIndex => throw _privateConstructorUsedError;
|
dynamic get requestTabIndex => throw _privateConstructorUsedError;
|
||||||
HttpRequestModel? get httpRequestModel => throw _privateConstructorUsedError;
|
HttpRequestModel? get httpRequestModel => throw _privateConstructorUsedError;
|
||||||
@@ -60,7 +60,7 @@ abstract class $RequestModelCopyWith<$Res> {
|
|||||||
APIType apiType,
|
APIType apiType,
|
||||||
String name,
|
String name,
|
||||||
String description,
|
String description,
|
||||||
ApiAuthModel? authData,
|
AuthModel? authModel,
|
||||||
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
||||||
HttpRequestModel? httpRequestModel,
|
HttpRequestModel? httpRequestModel,
|
||||||
int? responseStatus,
|
int? responseStatus,
|
||||||
@@ -71,7 +71,7 @@ abstract class $RequestModelCopyWith<$Res> {
|
|||||||
String? preRequestScript,
|
String? preRequestScript,
|
||||||
String? postRequestScript});
|
String? postRequestScript});
|
||||||
|
|
||||||
$ApiAuthModelCopyWith<$Res>? get authData;
|
$AuthModelCopyWith<$Res>? get authModel;
|
||||||
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
||||||
$HttpResponseModelCopyWith<$Res>? get httpResponseModel;
|
$HttpResponseModelCopyWith<$Res>? get httpResponseModel;
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
|||||||
Object? apiType = null,
|
Object? apiType = null,
|
||||||
Object? name = null,
|
Object? name = null,
|
||||||
Object? description = null,
|
Object? description = null,
|
||||||
Object? authData = freezed,
|
Object? authModel = freezed,
|
||||||
Object? requestTabIndex = freezed,
|
Object? requestTabIndex = freezed,
|
||||||
Object? httpRequestModel = freezed,
|
Object? httpRequestModel = freezed,
|
||||||
Object? responseStatus = freezed,
|
Object? responseStatus = freezed,
|
||||||
@@ -123,10 +123,10 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
|||||||
? _value.description
|
? _value.description
|
||||||
: description // ignore: cast_nullable_to_non_nullable
|
: description // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
authData: freezed == authData
|
authModel: freezed == authModel
|
||||||
? _value.authData
|
? _value.authModel
|
||||||
: authData // ignore: cast_nullable_to_non_nullable
|
: authModel // ignore: cast_nullable_to_non_nullable
|
||||||
as ApiAuthModel?,
|
as AuthModel?,
|
||||||
requestTabIndex: freezed == requestTabIndex
|
requestTabIndex: freezed == requestTabIndex
|
||||||
? _value.requestTabIndex
|
? _value.requestTabIndex
|
||||||
: requestTabIndex // ignore: cast_nullable_to_non_nullable
|
: requestTabIndex // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -170,13 +170,13 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$ApiAuthModelCopyWith<$Res>? get authData {
|
$AuthModelCopyWith<$Res>? get authModel {
|
||||||
if (_value.authData == null) {
|
if (_value.authModel == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ApiAuthModelCopyWith<$Res>(_value.authData!, (value) {
|
return $AuthModelCopyWith<$Res>(_value.authModel!, (value) {
|
||||||
return _then(_value.copyWith(authData: value) as $Val);
|
return _then(_value.copyWith(authModel: value) as $Val);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ abstract class _$$RequestModelImplCopyWith<$Res>
|
|||||||
APIType apiType,
|
APIType apiType,
|
||||||
String name,
|
String name,
|
||||||
String description,
|
String description,
|
||||||
ApiAuthModel? authData,
|
AuthModel? authModel,
|
||||||
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
@JsonKey(includeToJson: false) dynamic requestTabIndex,
|
||||||
HttpRequestModel? httpRequestModel,
|
HttpRequestModel? httpRequestModel,
|
||||||
int? responseStatus,
|
int? responseStatus,
|
||||||
@@ -234,7 +234,7 @@ abstract class _$$RequestModelImplCopyWith<$Res>
|
|||||||
String? postRequestScript});
|
String? postRequestScript});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
$ApiAuthModelCopyWith<$Res>? get authData;
|
$AuthModelCopyWith<$Res>? get authModel;
|
||||||
@override
|
@override
|
||||||
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
$HttpRequestModelCopyWith<$Res>? get httpRequestModel;
|
||||||
@override
|
@override
|
||||||
@@ -258,7 +258,7 @@ class __$$RequestModelImplCopyWithImpl<$Res>
|
|||||||
Object? apiType = null,
|
Object? apiType = null,
|
||||||
Object? name = null,
|
Object? name = null,
|
||||||
Object? description = null,
|
Object? description = null,
|
||||||
Object? authData = freezed,
|
Object? authModel = freezed,
|
||||||
Object? requestTabIndex = freezed,
|
Object? requestTabIndex = freezed,
|
||||||
Object? httpRequestModel = freezed,
|
Object? httpRequestModel = freezed,
|
||||||
Object? responseStatus = freezed,
|
Object? responseStatus = freezed,
|
||||||
@@ -286,10 +286,10 @@ class __$$RequestModelImplCopyWithImpl<$Res>
|
|||||||
? _value.description
|
? _value.description
|
||||||
: description // ignore: cast_nullable_to_non_nullable
|
: description // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
authData: freezed == authData
|
authModel: freezed == authModel
|
||||||
? _value.authData
|
? _value.authModel
|
||||||
: authData // ignore: cast_nullable_to_non_nullable
|
: authModel // ignore: cast_nullable_to_non_nullable
|
||||||
as ApiAuthModel?,
|
as AuthModel?,
|
||||||
requestTabIndex: freezed == requestTabIndex
|
requestTabIndex: freezed == requestTabIndex
|
||||||
? _value.requestTabIndex!
|
? _value.requestTabIndex!
|
||||||
: requestTabIndex,
|
: requestTabIndex,
|
||||||
@@ -338,7 +338,7 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
this.apiType = APIType.rest,
|
this.apiType = APIType.rest,
|
||||||
this.name = "",
|
this.name = "",
|
||||||
this.description = "",
|
this.description = "",
|
||||||
this.authData = const ApiAuthModel(type: APIAuthType.none),
|
this.authModel = const AuthModel(type: APIAuthType.none),
|
||||||
@JsonKey(includeToJson: false) this.requestTabIndex = 0,
|
@JsonKey(includeToJson: false) this.requestTabIndex = 0,
|
||||||
this.httpRequestModel,
|
this.httpRequestModel,
|
||||||
this.responseStatus,
|
this.responseStatus,
|
||||||
@@ -365,7 +365,7 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
final String description;
|
final String description;
|
||||||
@override
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
final ApiAuthModel? authData;
|
final AuthModel? authModel;
|
||||||
@override
|
@override
|
||||||
@JsonKey(includeToJson: false)
|
@JsonKey(includeToJson: false)
|
||||||
final dynamic requestTabIndex;
|
final dynamic requestTabIndex;
|
||||||
@@ -390,7 +390,7 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'RequestModel(id: $id, apiType: $apiType, name: $name, description: $description, authData: $authData, requestTabIndex: $requestTabIndex, httpRequestModel: $httpRequestModel, responseStatus: $responseStatus, message: $message, httpResponseModel: $httpResponseModel, isWorking: $isWorking, sendingTime: $sendingTime)';
|
return 'RequestModel(id: $id, apiType: $apiType, name: $name, description: $description, authModel: $authModel, requestTabIndex: $requestTabIndex, httpRequestModel: $httpRequestModel, responseStatus: $responseStatus, message: $message, httpResponseModel: $httpResponseModel, isWorking: $isWorking, sendingTime: $sendingTime)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -403,8 +403,8 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
(identical(other.name, name) || other.name == name) &&
|
(identical(other.name, name) || other.name == name) &&
|
||||||
(identical(other.description, description) ||
|
(identical(other.description, description) ||
|
||||||
other.description == description) &&
|
other.description == description) &&
|
||||||
(identical(other.authData, authData) ||
|
(identical(other.authModel, authModel) ||
|
||||||
other.authData == authData) &&
|
other.authModel == authModel) &&
|
||||||
const DeepCollectionEquality()
|
const DeepCollectionEquality()
|
||||||
.equals(other.requestTabIndex, requestTabIndex) &&
|
.equals(other.requestTabIndex, requestTabIndex) &&
|
||||||
(identical(other.httpRequestModel, httpRequestModel) ||
|
(identical(other.httpRequestModel, httpRequestModel) ||
|
||||||
@@ -432,7 +432,7 @@ class _$RequestModelImpl implements _RequestModel {
|
|||||||
apiType,
|
apiType,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
authData,
|
authModel,
|
||||||
const DeepCollectionEquality().hash(requestTabIndex),
|
const DeepCollectionEquality().hash(requestTabIndex),
|
||||||
httpRequestModel,
|
httpRequestModel,
|
||||||
responseStatus,
|
responseStatus,
|
||||||
@@ -465,7 +465,7 @@ abstract class _RequestModel implements RequestModel {
|
|||||||
final APIType apiType,
|
final APIType apiType,
|
||||||
final String name,
|
final String name,
|
||||||
final String description,
|
final String description,
|
||||||
final ApiAuthModel? authData,
|
final AuthModel? authModel,
|
||||||
@JsonKey(includeToJson: false) final dynamic requestTabIndex,
|
@JsonKey(includeToJson: false) final dynamic requestTabIndex,
|
||||||
final HttpRequestModel? httpRequestModel,
|
final HttpRequestModel? httpRequestModel,
|
||||||
final int? responseStatus,
|
final int? responseStatus,
|
||||||
@@ -487,7 +487,7 @@ abstract class _RequestModel implements RequestModel {
|
|||||||
@override
|
@override
|
||||||
String get description;
|
String get description;
|
||||||
@override
|
@override
|
||||||
ApiAuthModel? get authData;
|
AuthModel? get authModel;
|
||||||
@override
|
@override
|
||||||
@JsonKey(includeToJson: false)
|
@JsonKey(includeToJson: false)
|
||||||
dynamic get requestTabIndex;
|
dynamic get requestTabIndex;
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ _$RequestModelImpl _$$RequestModelImplFromJson(Map json) => _$RequestModelImpl(
|
|||||||
APIType.rest,
|
APIType.rest,
|
||||||
name: json['name'] as String? ?? "",
|
name: json['name'] as String? ?? "",
|
||||||
description: json['description'] as String? ?? "",
|
description: json['description'] as String? ?? "",
|
||||||
authData: json['authData'] == null
|
authModel: json['authModel'] == null
|
||||||
? const ApiAuthModel(type: APIAuthType.none)
|
? const AuthModel(type: APIAuthType.none)
|
||||||
: ApiAuthModel.fromJson(
|
: AuthModel.fromJson(
|
||||||
Map<String, dynamic>.from(json['authData'] as Map)),
|
Map<String, dynamic>.from(json['authModel'] as Map)),
|
||||||
requestTabIndex: json['requestTabIndex'] ?? 0,
|
requestTabIndex: json['requestTabIndex'] ?? 0,
|
||||||
httpRequestModel: json['httpRequestModel'] == null
|
httpRequestModel: json['httpRequestModel'] == null
|
||||||
? null
|
? null
|
||||||
@@ -41,7 +41,7 @@ Map<String, dynamic> _$$RequestModelImplToJson(_$RequestModelImpl instance) =>
|
|||||||
'apiType': _$APITypeEnumMap[instance.apiType]!,
|
'apiType': _$APITypeEnumMap[instance.apiType]!,
|
||||||
'name': instance.name,
|
'name': instance.name,
|
||||||
'description': instance.description,
|
'description': instance.description,
|
||||||
'authData': instance.authData?.toJson(),
|
'authModel': instance.authModel?.toJson(),
|
||||||
'httpRequestModel': instance.httpRequestModel?.toJson(),
|
'httpRequestModel': instance.httpRequestModel?.toJson(),
|
||||||
'responseStatus': instance.responseStatus,
|
'responseStatus': instance.responseStatus,
|
||||||
'message': instance.message,
|
'message': instance.message,
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
|
|
||||||
final currentAuthType = ref.watch(
|
final currentAuthType = ref.watch(
|
||||||
selectedRequestModelProvider
|
selectedRequestModelProvider
|
||||||
.select((request) => request?.authData?.type ?? APIAuthType.none),
|
.select((request) => request?.authModel?.type ?? APIAuthType.none),
|
||||||
);
|
);
|
||||||
final currentAuthData = selectedRequest.authData;
|
final currentAuthData = selectedRequest.authModel;
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -53,9 +53,9 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
final selectedRequest = ref.read(selectedRequestModelProvider);
|
final selectedRequest = ref.read(selectedRequestModelProvider);
|
||||||
if (newType != null) {
|
if (newType != null) {
|
||||||
ref.read(collectionStateNotifierProvider.notifier).update(
|
ref.read(collectionStateNotifierProvider.notifier).update(
|
||||||
authData: selectedRequest?.authData
|
authData: selectedRequest?.authModel
|
||||||
?.copyWith(type: newType) ??
|
?.copyWith(type: newType) ??
|
||||||
ApiAuthModel(type: newType),
|
AuthModel(type: newType),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -71,9 +71,9 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
Widget _buildAuthFields(
|
Widget _buildAuthFields(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
WidgetRef ref,
|
WidgetRef ref,
|
||||||
ApiAuthModel? authData,
|
AuthModel? authData,
|
||||||
) {
|
) {
|
||||||
void updateAuth(ApiAuthModel? model) {
|
void updateAuth(AuthModel? model) {
|
||||||
ref.read(collectionStateNotifierProvider.notifier).update(
|
ref.read(collectionStateNotifierProvider.notifier).update(
|
||||||
authData: model,
|
authData: model,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class EditRestRequestPane extends ConsumerWidget {
|
|||||||
false;
|
false;
|
||||||
|
|
||||||
final hasAuth = ref.watch(selectedRequestModelProvider
|
final hasAuth = ref.watch(selectedRequestModelProvider
|
||||||
.select((value) => value?.authData?.type != APIAuthType.none));
|
.select((value) => value?.authModel?.type != APIAuthType.none));
|
||||||
false;
|
false;
|
||||||
|
|
||||||
return RequestPane(
|
return RequestPane(
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ part 'api_auth_model.g.dart';
|
|||||||
part 'api_auth_model.freezed.dart';
|
part 'api_auth_model.freezed.dart';
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class ApiAuthModel with _$ApiAuthModel {
|
class AuthModel with _$AuthModel {
|
||||||
const factory ApiAuthModel({
|
const factory AuthModel({
|
||||||
required APIAuthType type,
|
required APIAuthType type,
|
||||||
AuthApiKeyModel? apikey,
|
AuthApiKeyModel? apikey,
|
||||||
AuthBearerModel? bearer,
|
AuthBearerModel? bearer,
|
||||||
AuthBasicAuthModel? basic,
|
AuthBasicAuthModel? basic,
|
||||||
AuthJwtModel? jwt,
|
AuthJwtModel? jwt,
|
||||||
}) = _ApiAuthModel;
|
}) = _AuthModel;
|
||||||
|
|
||||||
factory ApiAuthModel.fromJson(Map<String, dynamic> json) =>
|
factory AuthModel.fromJson(Map<String, dynamic> json) =>
|
||||||
_$ApiAuthModelFromJson(json);
|
_$AuthModelFromJson(json);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,33 +14,32 @@ T _$identity<T>(T value) => value;
|
|||||||
final _privateConstructorUsedError = UnsupportedError(
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||||
|
|
||||||
ApiAuthModel _$ApiAuthModelFromJson(Map<String, dynamic> json) {
|
AuthModel _$AuthModelFromJson(Map<String, dynamic> json) {
|
||||||
return _ApiAuthModel.fromJson(json);
|
return _AuthModel.fromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$ApiAuthModel {
|
mixin _$AuthModel {
|
||||||
APIAuthType get type => throw _privateConstructorUsedError;
|
APIAuthType get type => throw _privateConstructorUsedError;
|
||||||
AuthApiKeyModel? get apikey => throw _privateConstructorUsedError;
|
AuthApiKeyModel? get apikey => throw _privateConstructorUsedError;
|
||||||
AuthBearerModel? get bearer => throw _privateConstructorUsedError;
|
AuthBearerModel? get bearer => throw _privateConstructorUsedError;
|
||||||
AuthBasicAuthModel? get basic => throw _privateConstructorUsedError;
|
AuthBasicAuthModel? get basic => throw _privateConstructorUsedError;
|
||||||
AuthJwtModel? get jwt => throw _privateConstructorUsedError;
|
AuthJwtModel? get jwt => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Serializes this ApiAuthModel to a JSON map.
|
/// Serializes this AuthModel to a JSON map.
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Create a copy of ApiAuthModel
|
/// Create a copy of AuthModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
$ApiAuthModelCopyWith<ApiAuthModel> get copyWith =>
|
$AuthModelCopyWith<AuthModel> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class $ApiAuthModelCopyWith<$Res> {
|
abstract class $AuthModelCopyWith<$Res> {
|
||||||
factory $ApiAuthModelCopyWith(
|
factory $AuthModelCopyWith(AuthModel value, $Res Function(AuthModel) then) =
|
||||||
ApiAuthModel value, $Res Function(ApiAuthModel) then) =
|
_$AuthModelCopyWithImpl<$Res, AuthModel>;
|
||||||
_$ApiAuthModelCopyWithImpl<$Res, ApiAuthModel>;
|
|
||||||
@useResult
|
@useResult
|
||||||
$Res call(
|
$Res call(
|
||||||
{APIAuthType type,
|
{APIAuthType type,
|
||||||
@@ -56,16 +55,16 @@ abstract class $ApiAuthModelCopyWith<$Res> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel>
|
||||||
implements $ApiAuthModelCopyWith<$Res> {
|
implements $AuthModelCopyWith<$Res> {
|
||||||
_$ApiAuthModelCopyWithImpl(this._value, this._then);
|
_$AuthModelCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
// ignore: unused_field
|
// ignore: unused_field
|
||||||
final $Val _value;
|
final $Val _value;
|
||||||
// ignore: unused_field
|
// ignore: unused_field
|
||||||
final $Res Function($Val) _then;
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
/// Create a copy of ApiAuthModel
|
/// Create a copy of AuthModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
@@ -100,7 +99,7 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
|||||||
) as $Val);
|
) as $Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a copy of ApiAuthModel
|
/// Create a copy of AuthModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@@ -114,7 +113,7 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a copy of ApiAuthModel
|
/// Create a copy of AuthModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@@ -128,7 +127,7 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a copy of ApiAuthModel
|
/// Create a copy of AuthModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@@ -142,7 +141,7 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a copy of ApiAuthModel
|
/// Create a copy of AuthModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@@ -158,11 +157,11 @@ class _$ApiAuthModelCopyWithImpl<$Res, $Val extends ApiAuthModel>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class _$$ApiAuthModelImplCopyWith<$Res>
|
abstract class _$$AuthModelImplCopyWith<$Res>
|
||||||
implements $ApiAuthModelCopyWith<$Res> {
|
implements $AuthModelCopyWith<$Res> {
|
||||||
factory _$$ApiAuthModelImplCopyWith(
|
factory _$$AuthModelImplCopyWith(
|
||||||
_$ApiAuthModelImpl value, $Res Function(_$ApiAuthModelImpl) then) =
|
_$AuthModelImpl value, $Res Function(_$AuthModelImpl) then) =
|
||||||
__$$ApiAuthModelImplCopyWithImpl<$Res>;
|
__$$AuthModelImplCopyWithImpl<$Res>;
|
||||||
@override
|
@override
|
||||||
@useResult
|
@useResult
|
||||||
$Res call(
|
$Res call(
|
||||||
@@ -183,14 +182,14 @@ abstract class _$$ApiAuthModelImplCopyWith<$Res>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class __$$ApiAuthModelImplCopyWithImpl<$Res>
|
class __$$AuthModelImplCopyWithImpl<$Res>
|
||||||
extends _$ApiAuthModelCopyWithImpl<$Res, _$ApiAuthModelImpl>
|
extends _$AuthModelCopyWithImpl<$Res, _$AuthModelImpl>
|
||||||
implements _$$ApiAuthModelImplCopyWith<$Res> {
|
implements _$$AuthModelImplCopyWith<$Res> {
|
||||||
__$$ApiAuthModelImplCopyWithImpl(
|
__$$AuthModelImplCopyWithImpl(
|
||||||
_$ApiAuthModelImpl _value, $Res Function(_$ApiAuthModelImpl) _then)
|
_$AuthModelImpl _value, $Res Function(_$AuthModelImpl) _then)
|
||||||
: super(_value, _then);
|
: super(_value, _then);
|
||||||
|
|
||||||
/// Create a copy of ApiAuthModel
|
/// Create a copy of AuthModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
@@ -201,7 +200,7 @@ class __$$ApiAuthModelImplCopyWithImpl<$Res>
|
|||||||
Object? basic = freezed,
|
Object? basic = freezed,
|
||||||
Object? jwt = freezed,
|
Object? jwt = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$ApiAuthModelImpl(
|
return _then(_$AuthModelImpl(
|
||||||
type: null == type
|
type: null == type
|
||||||
? _value.type
|
? _value.type
|
||||||
: type // ignore: cast_nullable_to_non_nullable
|
: type // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -228,12 +227,12 @@ class __$$ApiAuthModelImplCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class _$ApiAuthModelImpl implements _ApiAuthModel {
|
class _$AuthModelImpl implements _AuthModel {
|
||||||
const _$ApiAuthModelImpl(
|
const _$AuthModelImpl(
|
||||||
{required this.type, this.apikey, this.bearer, this.basic, this.jwt});
|
{required this.type, this.apikey, this.bearer, this.basic, this.jwt});
|
||||||
|
|
||||||
factory _$ApiAuthModelImpl.fromJson(Map<String, dynamic> json) =>
|
factory _$AuthModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
_$$ApiAuthModelImplFromJson(json);
|
_$$AuthModelImplFromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final APIAuthType type;
|
final APIAuthType type;
|
||||||
@@ -248,14 +247,14 @@ class _$ApiAuthModelImpl implements _ApiAuthModel {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ApiAuthModel(type: $type, apikey: $apikey, bearer: $bearer, basic: $basic, jwt: $jwt)';
|
return 'AuthModel(type: $type, apikey: $apikey, bearer: $bearer, basic: $basic, jwt: $jwt)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) ||
|
return identical(this, other) ||
|
||||||
(other.runtimeType == runtimeType &&
|
(other.runtimeType == runtimeType &&
|
||||||
other is _$ApiAuthModelImpl &&
|
other is _$AuthModelImpl &&
|
||||||
(identical(other.type, type) || other.type == type) &&
|
(identical(other.type, type) || other.type == type) &&
|
||||||
(identical(other.apikey, apikey) || other.apikey == apikey) &&
|
(identical(other.apikey, apikey) || other.apikey == apikey) &&
|
||||||
(identical(other.bearer, bearer) || other.bearer == bearer) &&
|
(identical(other.bearer, bearer) || other.bearer == bearer) &&
|
||||||
@@ -268,32 +267,32 @@ class _$ApiAuthModelImpl implements _ApiAuthModel {
|
|||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
Object.hash(runtimeType, type, apikey, bearer, basic, jwt);
|
Object.hash(runtimeType, type, apikey, bearer, basic, jwt);
|
||||||
|
|
||||||
/// Create a copy of ApiAuthModel
|
/// Create a copy of AuthModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
_$$ApiAuthModelImplCopyWith<_$ApiAuthModelImpl> get copyWith =>
|
_$$AuthModelImplCopyWith<_$AuthModelImpl> get copyWith =>
|
||||||
__$$ApiAuthModelImplCopyWithImpl<_$ApiAuthModelImpl>(this, _$identity);
|
__$$AuthModelImplCopyWithImpl<_$AuthModelImpl>(this, _$identity);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return _$$ApiAuthModelImplToJson(
|
return _$$AuthModelImplToJson(
|
||||||
this,
|
this,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _ApiAuthModel implements ApiAuthModel {
|
abstract class _AuthModel implements AuthModel {
|
||||||
const factory _ApiAuthModel(
|
const factory _AuthModel(
|
||||||
{required final APIAuthType type,
|
{required final APIAuthType type,
|
||||||
final AuthApiKeyModel? apikey,
|
final AuthApiKeyModel? apikey,
|
||||||
final AuthBearerModel? bearer,
|
final AuthBearerModel? bearer,
|
||||||
final AuthBasicAuthModel? basic,
|
final AuthBasicAuthModel? basic,
|
||||||
final AuthJwtModel? jwt}) = _$ApiAuthModelImpl;
|
final AuthJwtModel? jwt}) = _$AuthModelImpl;
|
||||||
|
|
||||||
factory _ApiAuthModel.fromJson(Map<String, dynamic> json) =
|
factory _AuthModel.fromJson(Map<String, dynamic> json) =
|
||||||
_$ApiAuthModelImpl.fromJson;
|
_$AuthModelImpl.fromJson;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
APIAuthType get type;
|
APIAuthType get type;
|
||||||
@@ -306,10 +305,10 @@ abstract class _ApiAuthModel implements ApiAuthModel {
|
|||||||
@override
|
@override
|
||||||
AuthJwtModel? get jwt;
|
AuthJwtModel? get jwt;
|
||||||
|
|
||||||
/// Create a copy of ApiAuthModel
|
/// Create a copy of AuthModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
_$$ApiAuthModelImplCopyWith<_$ApiAuthModelImpl> get copyWith =>
|
_$$AuthModelImplCopyWith<_$AuthModelImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ part of 'api_auth_model.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_$ApiAuthModelImpl _$$ApiAuthModelImplFromJson(Map<String, dynamic> json) =>
|
_$AuthModelImpl _$$AuthModelImplFromJson(Map<String, dynamic> json) =>
|
||||||
_$ApiAuthModelImpl(
|
_$AuthModelImpl(
|
||||||
type: $enumDecode(_$APIAuthTypeEnumMap, json['type']),
|
type: $enumDecode(_$APIAuthTypeEnumMap, json['type']),
|
||||||
apikey: json['apikey'] == null
|
apikey: json['apikey'] == null
|
||||||
? null
|
? null
|
||||||
@@ -23,7 +23,7 @@ _$ApiAuthModelImpl _$$ApiAuthModelImplFromJson(Map<String, dynamic> json) =>
|
|||||||
: AuthJwtModel.fromJson(json['jwt'] as Map<String, dynamic>),
|
: AuthJwtModel.fromJson(json['jwt'] as Map<String, dynamic>),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$ApiAuthModelImplToJson(_$ApiAuthModelImpl instance) =>
|
Map<String, dynamic> _$$AuthModelImplToJson(_$AuthModelImpl instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'type': _$APIAuthTypeEnumMap[instance.type]!,
|
'type': _$APIAuthTypeEnumMap[instance.type]!,
|
||||||
'apikey': instance.apikey,
|
'apikey': instance.apikey,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'package:apidash_core/utils/auth_utils.dart';
|
|||||||
import 'package:seed/seed.dart';
|
import 'package:seed/seed.dart';
|
||||||
|
|
||||||
HttpRequestModel handleAuth(
|
HttpRequestModel handleAuth(
|
||||||
HttpRequestModel httpRequestModel, ApiAuthModel? auth) {
|
HttpRequestModel httpRequestModel, AuthModel? auth) {
|
||||||
if (auth == null || auth.type == APIAuthType.none) {
|
if (auth == null || auth.type == APIAuthType.none) {
|
||||||
return httpRequestModel;
|
return httpRequestModel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ final httpClientManager = HttpClientManager();
|
|||||||
Future<(HttpResponse?, Duration?, String?)> sendHttpRequest(
|
Future<(HttpResponse?, Duration?, String?)> sendHttpRequest(
|
||||||
String requestId,
|
String requestId,
|
||||||
APIType apiType,
|
APIType apiType,
|
||||||
ApiAuthModel? authData,
|
AuthModel? authData,
|
||||||
HttpRequestModel requestModel, {
|
HttpRequestModel requestModel, {
|
||||||
SupportedUriSchemes defaultUriScheme = kDefaultUriScheme,
|
SupportedUriSchemes defaultUriScheme = kDefaultUriScheme,
|
||||||
bool noSSL = false,
|
bool noSSL = false,
|
||||||
|
|||||||
Reference in New Issue
Block a user