refactor: move auth models to better_networking package

This commit is contained in:
Udhay-Adithya
2025-07-02 22:07:47 +05:30
parent 3903277aa9
commit a11c833822
28 changed files with 452 additions and 560 deletions

View File

@ -1,7 +1,5 @@
import 'package:apidash/screens/common_widgets/auth_textfield.dart'; import 'package:apidash/screens/common_widgets/auth_textfield.dart';
import 'package:apidash_core/consts.dart'; import 'package:apidash_core/apidash_core.dart';
import 'package:apidash_core/models/auth/api_auth_model.dart';
import 'package:apidash_core/models/auth/auth_api_key_model.dart';
import 'package:apidash_design_system/apidash_design_system.dart'; import 'package:apidash_design_system/apidash_design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -10,12 +8,11 @@ class ApiKeyAuthFields extends StatefulWidget {
final bool readOnly; final bool readOnly;
final Function(AuthModel?) updateAuth; final Function(AuthModel?) updateAuth;
const ApiKeyAuthFields({ const ApiKeyAuthFields(
super.key, {super.key,
required this.authData, required this.authData,
required this.updateAuth, required this.updateAuth,
this.readOnly = false this.readOnly = false});
});
@override @override
State<ApiKeyAuthFields> createState() => _ApiKeyAuthFieldsState(); State<ApiKeyAuthFields> createState() => _ApiKeyAuthFieldsState();

View File

@ -1,6 +1,6 @@
import 'package:apidash/consts.dart'; import 'package:apidash/consts.dart';
import 'package:apidash/screens/home_page/editor_pane/details_card/request_pane/request_auth.dart'; import 'package:apidash/screens/home_page/editor_pane/details_card/request_pane/request_auth.dart';
import 'package:apidash_core/consts.dart'; import 'package:apidash_core/apidash_core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:apidash/providers/providers.dart'; import 'package:apidash/providers/providers.dart';
@ -25,8 +25,8 @@ class EditGraphQLRequestPane extends ConsumerWidget {
.select((value) => value?.httpRequestModel?.hasQuery)) ?? .select((value) => value?.httpRequestModel?.hasQuery)) ??
false; false;
final hasAuth = ref.watch(selectedRequestModelProvider.select((value) => final hasAuth = ref.watch(selectedRequestModelProvider
value?.authModel?.type != APIAuthType.none)); .select((value) => value?.authModel?.type != APIAuthType.none));
final scriptsLength = ref.watch(selectedHistoryRequestModelProvider final scriptsLength = ref.watch(selectedHistoryRequestModelProvider
.select((value) => value?.preRequestScript?.length)) ?? .select((value) => value?.preRequestScript?.length)) ??

View File

@ -1,12 +1 @@
enum APIAuthType {
none,
basic,
apiKey,
bearer,
jwt,
digest,
oauth1,
oauth2,
}
enum EnvironmentVariableType { variable, secret } enum EnvironmentVariableType { variable, secret }

View File

@ -1,23 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'auth_api_key_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$AuthApiKeyModelImpl _$$AuthApiKeyModelImplFromJson(
Map<String, dynamic> json) =>
_$AuthApiKeyModelImpl(
key: json['key'] as String,
location: json['location'] as String? ?? 'header',
name: json['name'] as String? ?? 'x-api-key',
);
Map<String, dynamic> _$$AuthApiKeyModelImplToJson(
_$AuthApiKeyModelImpl instance) =>
<String, dynamic>{
'key': instance.key,
'location': instance.location,
'name': instance.name,
};

View File

@ -1,6 +1 @@
export 'environment_model.dart'; export 'environment_model.dart';
export 'auth/api_auth_model.dart';
export 'auth/auth_api_key_model.dart';
export 'auth/auth_basic_model.dart';
export 'auth/auth_bearer_model.dart';
export 'auth/auth_jwt_model.dart';

View File

@ -54,6 +54,7 @@ class _BetterNetworkingExampleState extends State<BetterNetworkingExample> {
final (resp, duration, err) = await sendHttpRequest( final (resp, duration, err) = await sendHttpRequest(
'G1', 'G1',
APIType.rest, APIType.rest,
AuthModel(type: APIAuthType.none),
HttpRequestModel( HttpRequestModel(
url: 'https://reqres.in/api/users/2', url: 'https://reqres.in/api/users/2',
method: HTTPVerb.get, method: HTTPVerb.get,
@ -80,6 +81,7 @@ class _BetterNetworkingExampleState extends State<BetterNetworkingExample> {
final (resp, duration, err) = await sendHttpRequest( final (resp, duration, err) = await sendHttpRequest(
'P1', 'P1',
APIType.rest, APIType.rest,
AuthModel(type: APIAuthType.none),
HttpRequestModel( HttpRequestModel(
url: 'https://reqres.in/api/users', url: 'https://reqres.in/api/users',
method: HTTPVerb.post, method: HTTPVerb.post,

View File

@ -9,6 +9,8 @@ enum APIType {
final String abbr; final String abbr;
} }
enum APIAuthType { none, basic, apiKey, bearer, jwt, digest, oauth1, oauth2}
enum HTTPVerb { enum HTTPVerb {
get("GET"), get("GET"),
head("HEAD"), head("HEAD"),

View File

@ -12,7 +12,8 @@ part of 'api_auth_model.dart';
T _$identity<T>(T value) => value; 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',
);
AuthModel _$AuthModelFromJson(Map<String, dynamic> json) { AuthModel _$AuthModelFromJson(Map<String, dynamic> json) {
return _AuthModel.fromJson(json); return _AuthModel.fromJson(json);
@ -41,12 +42,13 @@ abstract class $AuthModelCopyWith<$Res> {
factory $AuthModelCopyWith(AuthModel value, $Res Function(AuthModel) then) = factory $AuthModelCopyWith(AuthModel value, $Res Function(AuthModel) then) =
_$AuthModelCopyWithImpl<$Res, AuthModel>; _$AuthModelCopyWithImpl<$Res, AuthModel>;
@useResult @useResult
$Res call( $Res call({
{APIAuthType type, APIAuthType type,
AuthApiKeyModel? apikey, AuthApiKeyModel? apikey,
AuthBearerModel? bearer, AuthBearerModel? bearer,
AuthBasicAuthModel? basic, AuthBasicAuthModel? basic,
AuthJwtModel? jwt}); AuthJwtModel? jwt,
});
$AuthApiKeyModelCopyWith<$Res>? get apikey; $AuthApiKeyModelCopyWith<$Res>? get apikey;
$AuthBearerModelCopyWith<$Res>? get bearer; $AuthBearerModelCopyWith<$Res>? get bearer;
@ -75,7 +77,8 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel>
Object? basic = freezed, Object? basic = freezed,
Object? jwt = freezed, Object? jwt = freezed,
}) { }) {
return _then(_value.copyWith( return _then(
_value.copyWith(
type: null == type type: null == type
? _value.type ? _value.type
: type // ignore: cast_nullable_to_non_nullable : type // ignore: cast_nullable_to_non_nullable
@ -96,7 +99,9 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel>
? _value.jwt ? _value.jwt
: jwt // ignore: cast_nullable_to_non_nullable : jwt // ignore: cast_nullable_to_non_nullable
as AuthJwtModel?, as AuthJwtModel?,
) as $Val); )
as $Val,
);
} }
/// Create a copy of AuthModel /// Create a copy of AuthModel
@ -160,16 +165,18 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel>
abstract class _$$AuthModelImplCopyWith<$Res> abstract class _$$AuthModelImplCopyWith<$Res>
implements $AuthModelCopyWith<$Res> { implements $AuthModelCopyWith<$Res> {
factory _$$AuthModelImplCopyWith( factory _$$AuthModelImplCopyWith(
_$AuthModelImpl value, $Res Function(_$AuthModelImpl) then) = _$AuthModelImpl value,
__$$AuthModelImplCopyWithImpl<$Res>; $Res Function(_$AuthModelImpl) then,
) = __$$AuthModelImplCopyWithImpl<$Res>;
@override @override
@useResult @useResult
$Res call( $Res call({
{APIAuthType type, APIAuthType type,
AuthApiKeyModel? apikey, AuthApiKeyModel? apikey,
AuthBearerModel? bearer, AuthBearerModel? bearer,
AuthBasicAuthModel? basic, AuthBasicAuthModel? basic,
AuthJwtModel? jwt}); AuthJwtModel? jwt,
});
@override @override
$AuthApiKeyModelCopyWith<$Res>? get apikey; $AuthApiKeyModelCopyWith<$Res>? get apikey;
@ -186,8 +193,9 @@ class __$$AuthModelImplCopyWithImpl<$Res>
extends _$AuthModelCopyWithImpl<$Res, _$AuthModelImpl> extends _$AuthModelCopyWithImpl<$Res, _$AuthModelImpl>
implements _$$AuthModelImplCopyWith<$Res> { implements _$$AuthModelImplCopyWith<$Res> {
__$$AuthModelImplCopyWithImpl( __$$AuthModelImplCopyWithImpl(
_$AuthModelImpl _value, $Res Function(_$AuthModelImpl) _then) _$AuthModelImpl _value,
: super(_value, _then); $Res Function(_$AuthModelImpl) _then,
) : super(_value, _then);
/// Create a copy of AuthModel /// 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.
@ -200,7 +208,8 @@ class __$$AuthModelImplCopyWithImpl<$Res>
Object? basic = freezed, Object? basic = freezed,
Object? jwt = freezed, Object? jwt = freezed,
}) { }) {
return _then(_$AuthModelImpl( 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
@ -221,7 +230,8 @@ class __$$AuthModelImplCopyWithImpl<$Res>
? _value.jwt ? _value.jwt
: jwt // ignore: cast_nullable_to_non_nullable : jwt // ignore: cast_nullable_to_non_nullable
as AuthJwtModel?, as AuthJwtModel?,
)); ),
);
} }
} }
@ -229,8 +239,13 @@ class __$$AuthModelImplCopyWithImpl<$Res>
@JsonSerializable(explicitToJson: true, anyMap: true) @JsonSerializable(explicitToJson: true, anyMap: true)
class _$AuthModelImpl implements _AuthModel { class _$AuthModelImpl implements _AuthModel {
const _$AuthModelImpl( 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 _$AuthModelImpl.fromJson(Map<String, dynamic> json) => factory _$AuthModelImpl.fromJson(Map<String, dynamic> json) =>
_$$AuthModelImplFromJson(json); _$$AuthModelImplFromJson(json);
@ -278,19 +293,18 @@ class _$AuthModelImpl implements _AuthModel {
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$AuthModelImplToJson( return _$$AuthModelImplToJson(this);
this,
);
} }
} }
abstract class _AuthModel implements AuthModel { abstract class _AuthModel implements AuthModel {
const factory _AuthModel( 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}) = _$AuthModelImpl; final AuthJwtModel? jwt,
}) = _$AuthModelImpl;
factory _AuthModel.fromJson(Map<String, dynamic> json) = factory _AuthModel.fromJson(Map<String, dynamic> json) =
_$AuthModelImpl.fromJson; _$AuthModelImpl.fromJson;

View File

@ -11,19 +11,21 @@ _$AuthModelImpl _$$AuthModelImplFromJson(Map json) => _$AuthModelImpl(
apikey: json['apikey'] == null apikey: json['apikey'] == null
? null ? null
: AuthApiKeyModel.fromJson( : AuthApiKeyModel.fromJson(
Map<String, dynamic>.from(json['apikey'] as Map)), Map<String, dynamic>.from(json['apikey'] as Map),
),
bearer: json['bearer'] == null bearer: json['bearer'] == null
? null ? null
: AuthBearerModel.fromJson( : AuthBearerModel.fromJson(
Map<String, dynamic>.from(json['bearer'] as Map)), Map<String, dynamic>.from(json['bearer'] as Map),
),
basic: json['basic'] == null basic: json['basic'] == null
? null ? null
: AuthBasicAuthModel.fromJson( : AuthBasicAuthModel.fromJson(
Map<String, dynamic>.from(json['basic'] as Map)), Map<String, dynamic>.from(json['basic'] as Map),
),
jwt: json['jwt'] == null jwt: json['jwt'] == null
? null ? null
: AuthJwtModel.fromJson( : AuthJwtModel.fromJson(Map<String, dynamic>.from(json['jwt'] as Map)),
Map<String, dynamic>.from(json['jwt'] as Map)),
); );
Map<String, dynamic> _$$AuthModelImplToJson(_$AuthModelImpl instance) => Map<String, dynamic> _$$AuthModelImplToJson(_$AuthModelImpl instance) =>

View File

@ -12,7 +12,8 @@ part of 'auth_api_key_model.dart';
T _$identity<T>(T value) => value; 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',
);
AuthApiKeyModel _$AuthApiKeyModelFromJson(Map<String, dynamic> json) { AuthApiKeyModel _$AuthApiKeyModelFromJson(Map<String, dynamic> json) {
return _AuthApiKeyModel.fromJson(json); return _AuthApiKeyModel.fromJson(json);
@ -38,8 +39,9 @@ mixin _$AuthApiKeyModel {
/// @nodoc /// @nodoc
abstract class $AuthApiKeyModelCopyWith<$Res> { abstract class $AuthApiKeyModelCopyWith<$Res> {
factory $AuthApiKeyModelCopyWith( factory $AuthApiKeyModelCopyWith(
AuthApiKeyModel value, $Res Function(AuthApiKeyModel) then) = AuthApiKeyModel value,
_$AuthApiKeyModelCopyWithImpl<$Res, AuthApiKeyModel>; $Res Function(AuthApiKeyModel) then,
) = _$AuthApiKeyModelCopyWithImpl<$Res, AuthApiKeyModel>;
@useResult @useResult
$Res call({String key, String location, String name}); $Res call({String key, String location, String name});
} }
@ -63,7 +65,8 @@ class _$AuthApiKeyModelCopyWithImpl<$Res, $Val extends AuthApiKeyModel>
Object? location = null, Object? location = null,
Object? name = null, Object? name = null,
}) { }) {
return _then(_value.copyWith( return _then(
_value.copyWith(
key: null == key key: null == key
? _value.key ? _value.key
: key // ignore: cast_nullable_to_non_nullable : key // ignore: cast_nullable_to_non_nullable
@ -76,16 +79,19 @@ class _$AuthApiKeyModelCopyWithImpl<$Res, $Val extends AuthApiKeyModel>
? _value.name ? _value.name
: name // ignore: cast_nullable_to_non_nullable : name // ignore: cast_nullable_to_non_nullable
as String, as String,
) as $Val); )
as $Val,
);
} }
} }
/// @nodoc /// @nodoc
abstract class _$$AuthApiKeyModelImplCopyWith<$Res> abstract class _$$AuthApiKeyModelImplCopyWith<$Res>
implements $AuthApiKeyModelCopyWith<$Res> { implements $AuthApiKeyModelCopyWith<$Res> {
factory _$$AuthApiKeyModelImplCopyWith(_$AuthApiKeyModelImpl value, factory _$$AuthApiKeyModelImplCopyWith(
$Res Function(_$AuthApiKeyModelImpl) then) = _$AuthApiKeyModelImpl value,
__$$AuthApiKeyModelImplCopyWithImpl<$Res>; $Res Function(_$AuthApiKeyModelImpl) then,
) = __$$AuthApiKeyModelImplCopyWithImpl<$Res>;
@override @override
@useResult @useResult
$Res call({String key, String location, String name}); $Res call({String key, String location, String name});
@ -96,8 +102,9 @@ class __$$AuthApiKeyModelImplCopyWithImpl<$Res>
extends _$AuthApiKeyModelCopyWithImpl<$Res, _$AuthApiKeyModelImpl> extends _$AuthApiKeyModelCopyWithImpl<$Res, _$AuthApiKeyModelImpl>
implements _$$AuthApiKeyModelImplCopyWith<$Res> { implements _$$AuthApiKeyModelImplCopyWith<$Res> {
__$$AuthApiKeyModelImplCopyWithImpl( __$$AuthApiKeyModelImplCopyWithImpl(
_$AuthApiKeyModelImpl _value, $Res Function(_$AuthApiKeyModelImpl) _then) _$AuthApiKeyModelImpl _value,
: super(_value, _then); $Res Function(_$AuthApiKeyModelImpl) _then,
) : super(_value, _then);
/// Create a copy of AuthApiKeyModel /// Create a copy of AuthApiKeyModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -108,7 +115,8 @@ class __$$AuthApiKeyModelImplCopyWithImpl<$Res>
Object? location = null, Object? location = null,
Object? name = null, Object? name = null,
}) { }) {
return _then(_$AuthApiKeyModelImpl( return _then(
_$AuthApiKeyModelImpl(
key: null == key key: null == key
? _value.key ? _value.key
: key // ignore: cast_nullable_to_non_nullable : key // ignore: cast_nullable_to_non_nullable
@ -121,15 +129,19 @@ class __$$AuthApiKeyModelImplCopyWithImpl<$Res>
? _value.name ? _value.name
: name // ignore: cast_nullable_to_non_nullable : name // ignore: cast_nullable_to_non_nullable
as String, as String,
)); ),
);
} }
} }
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _$AuthApiKeyModelImpl implements _AuthApiKeyModel { class _$AuthApiKeyModelImpl implements _AuthApiKeyModel {
const _$AuthApiKeyModelImpl( const _$AuthApiKeyModelImpl({
{required this.key, this.location = 'header', this.name = 'x-api-key'}); required this.key,
this.location = 'header',
this.name = 'x-api-key',
});
factory _$AuthApiKeyModelImpl.fromJson(Map<String, dynamic> json) => factory _$AuthApiKeyModelImpl.fromJson(Map<String, dynamic> json) =>
_$$AuthApiKeyModelImplFromJson(json); _$$AuthApiKeyModelImplFromJson(json);
@ -171,21 +183,22 @@ class _$AuthApiKeyModelImpl implements _AuthApiKeyModel {
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$AuthApiKeyModelImplCopyWith<_$AuthApiKeyModelImpl> get copyWith => _$$AuthApiKeyModelImplCopyWith<_$AuthApiKeyModelImpl> get copyWith =>
__$$AuthApiKeyModelImplCopyWithImpl<_$AuthApiKeyModelImpl>( __$$AuthApiKeyModelImplCopyWithImpl<_$AuthApiKeyModelImpl>(
this, _$identity); this,
_$identity,
);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$AuthApiKeyModelImplToJson( return _$$AuthApiKeyModelImplToJson(this);
this,
);
} }
} }
abstract class _AuthApiKeyModel implements AuthApiKeyModel { abstract class _AuthApiKeyModel implements AuthApiKeyModel {
const factory _AuthApiKeyModel( const factory _AuthApiKeyModel({
{required final String key, required final String key,
final String location, final String location,
final String name}) = _$AuthApiKeyModelImpl; final String name,
}) = _$AuthApiKeyModelImpl;
factory _AuthApiKeyModel.fromJson(Map<String, dynamic> json) = factory _AuthApiKeyModel.fromJson(Map<String, dynamic> json) =
_$AuthApiKeyModelImpl.fromJson; _$AuthApiKeyModelImpl.fromJson;

View File

@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'auth_api_key_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$AuthApiKeyModelImpl _$$AuthApiKeyModelImplFromJson(
Map<String, dynamic> json,
) => _$AuthApiKeyModelImpl(
key: json['key'] as String,
location: json['location'] as String? ?? 'header',
name: json['name'] as String? ?? 'x-api-key',
);
Map<String, dynamic> _$$AuthApiKeyModelImplToJson(
_$AuthApiKeyModelImpl instance,
) => <String, dynamic>{
'key': instance.key,
'location': instance.location,
'name': instance.name,
};

View File

@ -12,7 +12,8 @@ part of 'auth_basic_model.dart';
T _$identity<T>(T value) => value; 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',
);
AuthBasicAuthModel _$AuthBasicAuthModelFromJson(Map<String, dynamic> json) { AuthBasicAuthModel _$AuthBasicAuthModelFromJson(Map<String, dynamic> json) {
return _AuthBasicAuthModel.fromJson(json); return _AuthBasicAuthModel.fromJson(json);
@ -36,8 +37,9 @@ mixin _$AuthBasicAuthModel {
/// @nodoc /// @nodoc
abstract class $AuthBasicAuthModelCopyWith<$Res> { abstract class $AuthBasicAuthModelCopyWith<$Res> {
factory $AuthBasicAuthModelCopyWith( factory $AuthBasicAuthModelCopyWith(
AuthBasicAuthModel value, $Res Function(AuthBasicAuthModel) then) = AuthBasicAuthModel value,
_$AuthBasicAuthModelCopyWithImpl<$Res, AuthBasicAuthModel>; $Res Function(AuthBasicAuthModel) then,
) = _$AuthBasicAuthModelCopyWithImpl<$Res, AuthBasicAuthModel>;
@useResult @useResult
$Res call({String username, String password}); $Res call({String username, String password});
} }
@ -56,11 +58,9 @@ class _$AuthBasicAuthModelCopyWithImpl<$Res, $Val extends AuthBasicAuthModel>
/// 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
$Res call({ $Res call({Object? username = null, Object? password = null}) {
Object? username = null, return _then(
Object? password = null, _value.copyWith(
}) {
return _then(_value.copyWith(
username: null == username username: null == username
? _value.username ? _value.username
: username // ignore: cast_nullable_to_non_nullable : username // ignore: cast_nullable_to_non_nullable
@ -69,16 +69,19 @@ class _$AuthBasicAuthModelCopyWithImpl<$Res, $Val extends AuthBasicAuthModel>
? _value.password ? _value.password
: password // ignore: cast_nullable_to_non_nullable : password // ignore: cast_nullable_to_non_nullable
as String, as String,
) as $Val); )
as $Val,
);
} }
} }
/// @nodoc /// @nodoc
abstract class _$$AuthBasicAuthModelImplCopyWith<$Res> abstract class _$$AuthBasicAuthModelImplCopyWith<$Res>
implements $AuthBasicAuthModelCopyWith<$Res> { implements $AuthBasicAuthModelCopyWith<$Res> {
factory _$$AuthBasicAuthModelImplCopyWith(_$AuthBasicAuthModelImpl value, factory _$$AuthBasicAuthModelImplCopyWith(
$Res Function(_$AuthBasicAuthModelImpl) then) = _$AuthBasicAuthModelImpl value,
__$$AuthBasicAuthModelImplCopyWithImpl<$Res>; $Res Function(_$AuthBasicAuthModelImpl) then,
) = __$$AuthBasicAuthModelImplCopyWithImpl<$Res>;
@override @override
@useResult @useResult
$Res call({String username, String password}); $Res call({String username, String password});
@ -88,19 +91,18 @@ abstract class _$$AuthBasicAuthModelImplCopyWith<$Res>
class __$$AuthBasicAuthModelImplCopyWithImpl<$Res> class __$$AuthBasicAuthModelImplCopyWithImpl<$Res>
extends _$AuthBasicAuthModelCopyWithImpl<$Res, _$AuthBasicAuthModelImpl> extends _$AuthBasicAuthModelCopyWithImpl<$Res, _$AuthBasicAuthModelImpl>
implements _$$AuthBasicAuthModelImplCopyWith<$Res> { implements _$$AuthBasicAuthModelImplCopyWith<$Res> {
__$$AuthBasicAuthModelImplCopyWithImpl(_$AuthBasicAuthModelImpl _value, __$$AuthBasicAuthModelImplCopyWithImpl(
$Res Function(_$AuthBasicAuthModelImpl) _then) _$AuthBasicAuthModelImpl _value,
: super(_value, _then); $Res Function(_$AuthBasicAuthModelImpl) _then,
) : super(_value, _then);
/// Create a copy of AuthBasicAuthModel /// Create a copy of AuthBasicAuthModel
/// 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
$Res call({ $Res call({Object? username = null, Object? password = null}) {
Object? username = null, return _then(
Object? password = null, _$AuthBasicAuthModelImpl(
}) {
return _then(_$AuthBasicAuthModelImpl(
username: null == username username: null == username
? _value.username ? _value.username
: username // ignore: cast_nullable_to_non_nullable : username // ignore: cast_nullable_to_non_nullable
@ -109,15 +111,18 @@ class __$$AuthBasicAuthModelImplCopyWithImpl<$Res>
? _value.password ? _value.password
: password // ignore: cast_nullable_to_non_nullable : password // ignore: cast_nullable_to_non_nullable
as String, as String,
)); ),
);
} }
} }
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _$AuthBasicAuthModelImpl implements _AuthBasicAuthModel { class _$AuthBasicAuthModelImpl implements _AuthBasicAuthModel {
const _$AuthBasicAuthModelImpl( const _$AuthBasicAuthModelImpl({
{required this.username, required this.password}); required this.username,
required this.password,
});
factory _$AuthBasicAuthModelImpl.fromJson(Map<String, dynamic> json) => factory _$AuthBasicAuthModelImpl.fromJson(Map<String, dynamic> json) =>
_$$AuthBasicAuthModelImplFromJson(json); _$$AuthBasicAuthModelImplFromJson(json);
@ -154,20 +159,21 @@ class _$AuthBasicAuthModelImpl implements _AuthBasicAuthModel {
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$AuthBasicAuthModelImplCopyWith<_$AuthBasicAuthModelImpl> get copyWith => _$$AuthBasicAuthModelImplCopyWith<_$AuthBasicAuthModelImpl> get copyWith =>
__$$AuthBasicAuthModelImplCopyWithImpl<_$AuthBasicAuthModelImpl>( __$$AuthBasicAuthModelImplCopyWithImpl<_$AuthBasicAuthModelImpl>(
this, _$identity); this,
_$identity,
);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$AuthBasicAuthModelImplToJson( return _$$AuthBasicAuthModelImplToJson(this);
this,
);
} }
} }
abstract class _AuthBasicAuthModel implements AuthBasicAuthModel { abstract class _AuthBasicAuthModel implements AuthBasicAuthModel {
const factory _AuthBasicAuthModel( const factory _AuthBasicAuthModel({
{required final String username, required final String username,
required final String password}) = _$AuthBasicAuthModelImpl; required final String password,
}) = _$AuthBasicAuthModelImpl;
factory _AuthBasicAuthModel.fromJson(Map<String, dynamic> json) = factory _AuthBasicAuthModel.fromJson(Map<String, dynamic> json) =
_$AuthBasicAuthModelImpl.fromJson; _$AuthBasicAuthModelImpl.fromJson;

View File

@ -7,15 +7,15 @@ part of 'auth_basic_model.dart';
// ************************************************************************** // **************************************************************************
_$AuthBasicAuthModelImpl _$$AuthBasicAuthModelImplFromJson( _$AuthBasicAuthModelImpl _$$AuthBasicAuthModelImplFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_$AuthBasicAuthModelImpl( ) => _$AuthBasicAuthModelImpl(
username: json['username'] as String, username: json['username'] as String,
password: json['password'] as String, password: json['password'] as String,
); );
Map<String, dynamic> _$$AuthBasicAuthModelImplToJson( Map<String, dynamic> _$$AuthBasicAuthModelImplToJson(
_$AuthBasicAuthModelImpl instance) => _$AuthBasicAuthModelImpl instance,
<String, dynamic>{ ) => <String, dynamic>{
'username': instance.username, 'username': instance.username,
'password': instance.password, 'password': instance.password,
}; };

View File

@ -12,7 +12,8 @@ part of 'auth_bearer_model.dart';
T _$identity<T>(T value) => value; 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',
);
AuthBearerModel _$AuthBearerModelFromJson(Map<String, dynamic> json) { AuthBearerModel _$AuthBearerModelFromJson(Map<String, dynamic> json) {
return _AuthBearerModel.fromJson(json); return _AuthBearerModel.fromJson(json);
@ -35,8 +36,9 @@ mixin _$AuthBearerModel {
/// @nodoc /// @nodoc
abstract class $AuthBearerModelCopyWith<$Res> { abstract class $AuthBearerModelCopyWith<$Res> {
factory $AuthBearerModelCopyWith( factory $AuthBearerModelCopyWith(
AuthBearerModel value, $Res Function(AuthBearerModel) then) = AuthBearerModel value,
_$AuthBearerModelCopyWithImpl<$Res, AuthBearerModel>; $Res Function(AuthBearerModel) then,
) = _$AuthBearerModelCopyWithImpl<$Res, AuthBearerModel>;
@useResult @useResult
$Res call({String token}); $Res call({String token});
} }
@ -55,24 +57,26 @@ class _$AuthBearerModelCopyWithImpl<$Res, $Val extends AuthBearerModel>
/// 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
$Res call({ $Res call({Object? token = null}) {
Object? token = null, return _then(
}) { _value.copyWith(
return _then(_value.copyWith(
token: null == token token: null == token
? _value.token ? _value.token
: token // ignore: cast_nullable_to_non_nullable : token // ignore: cast_nullable_to_non_nullable
as String, as String,
) as $Val); )
as $Val,
);
} }
} }
/// @nodoc /// @nodoc
abstract class _$$AuthBearerModelImplCopyWith<$Res> abstract class _$$AuthBearerModelImplCopyWith<$Res>
implements $AuthBearerModelCopyWith<$Res> { implements $AuthBearerModelCopyWith<$Res> {
factory _$$AuthBearerModelImplCopyWith(_$AuthBearerModelImpl value, factory _$$AuthBearerModelImplCopyWith(
$Res Function(_$AuthBearerModelImpl) then) = _$AuthBearerModelImpl value,
__$$AuthBearerModelImplCopyWithImpl<$Res>; $Res Function(_$AuthBearerModelImpl) then,
) = __$$AuthBearerModelImplCopyWithImpl<$Res>;
@override @override
@useResult @useResult
$Res call({String token}); $Res call({String token});
@ -83,22 +87,23 @@ class __$$AuthBearerModelImplCopyWithImpl<$Res>
extends _$AuthBearerModelCopyWithImpl<$Res, _$AuthBearerModelImpl> extends _$AuthBearerModelCopyWithImpl<$Res, _$AuthBearerModelImpl>
implements _$$AuthBearerModelImplCopyWith<$Res> { implements _$$AuthBearerModelImplCopyWith<$Res> {
__$$AuthBearerModelImplCopyWithImpl( __$$AuthBearerModelImplCopyWithImpl(
_$AuthBearerModelImpl _value, $Res Function(_$AuthBearerModelImpl) _then) _$AuthBearerModelImpl _value,
: super(_value, _then); $Res Function(_$AuthBearerModelImpl) _then,
) : super(_value, _then);
/// Create a copy of AuthBearerModel /// Create a copy of AuthBearerModel
/// 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
$Res call({ $Res call({Object? token = null}) {
Object? token = null, return _then(
}) { _$AuthBearerModelImpl(
return _then(_$AuthBearerModelImpl(
token: null == token token: null == token
? _value.token ? _value.token
: token // ignore: cast_nullable_to_non_nullable : token // ignore: cast_nullable_to_non_nullable
as String, as String,
)); ),
);
} }
} }
@ -137,13 +142,13 @@ class _$AuthBearerModelImpl implements _AuthBearerModel {
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$AuthBearerModelImplCopyWith<_$AuthBearerModelImpl> get copyWith => _$$AuthBearerModelImplCopyWith<_$AuthBearerModelImpl> get copyWith =>
__$$AuthBearerModelImplCopyWithImpl<_$AuthBearerModelImpl>( __$$AuthBearerModelImplCopyWithImpl<_$AuthBearerModelImpl>(
this, _$identity); this,
_$identity,
);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$AuthBearerModelImplToJson( return _$$AuthBearerModelImplToJson(this);
this,
);
} }
} }

View File

@ -7,13 +7,9 @@ part of 'auth_bearer_model.dart';
// ************************************************************************** // **************************************************************************
_$AuthBearerModelImpl _$$AuthBearerModelImplFromJson( _$AuthBearerModelImpl _$$AuthBearerModelImplFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_$AuthBearerModelImpl( ) => _$AuthBearerModelImpl(token: json['token'] as String);
token: json['token'] as String,
);
Map<String, dynamic> _$$AuthBearerModelImplToJson( Map<String, dynamic> _$$AuthBearerModelImplToJson(
_$AuthBearerModelImpl instance) => _$AuthBearerModelImpl instance,
<String, dynamic>{ ) => <String, dynamic>{'token': instance.token};
'token': instance.token,
};

View File

@ -12,7 +12,8 @@ part of 'auth_jwt_model.dart';
T _$identity<T>(T value) => value; 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',
);
AuthJwtModel _$AuthJwtModelFromJson(Map<String, dynamic> json) { AuthJwtModel _$AuthJwtModelFromJson(Map<String, dynamic> json) {
return _AuthJwtModel.fromJson(json); return _AuthJwtModel.fromJson(json);
@ -42,18 +43,20 @@ mixin _$AuthJwtModel {
/// @nodoc /// @nodoc
abstract class $AuthJwtModelCopyWith<$Res> { abstract class $AuthJwtModelCopyWith<$Res> {
factory $AuthJwtModelCopyWith( factory $AuthJwtModelCopyWith(
AuthJwtModel value, $Res Function(AuthJwtModel) then) = AuthJwtModel value,
_$AuthJwtModelCopyWithImpl<$Res, AuthJwtModel>; $Res Function(AuthJwtModel) then,
) = _$AuthJwtModelCopyWithImpl<$Res, AuthJwtModel>;
@useResult @useResult
$Res call( $Res call({
{String secret, String secret,
String payload, String payload,
String addTokenTo, String addTokenTo,
String algorithm, String algorithm,
bool isSecretBase64Encoded, bool isSecretBase64Encoded,
String headerPrefix, String headerPrefix,
String queryParamKey, String queryParamKey,
String header}); String header,
});
} }
/// @nodoc /// @nodoc
@ -80,7 +83,8 @@ class _$AuthJwtModelCopyWithImpl<$Res, $Val extends AuthJwtModel>
Object? queryParamKey = null, Object? queryParamKey = null,
Object? header = null, Object? header = null,
}) { }) {
return _then(_value.copyWith( return _then(
_value.copyWith(
secret: null == secret secret: null == secret
? _value.secret ? _value.secret
: secret // ignore: cast_nullable_to_non_nullable : secret // ignore: cast_nullable_to_non_nullable
@ -113,7 +117,9 @@ class _$AuthJwtModelCopyWithImpl<$Res, $Val extends AuthJwtModel>
? _value.header ? _value.header
: header // ignore: cast_nullable_to_non_nullable : header // ignore: cast_nullable_to_non_nullable
as String, as String,
) as $Val); )
as $Val,
);
} }
} }
@ -121,19 +127,21 @@ class _$AuthJwtModelCopyWithImpl<$Res, $Val extends AuthJwtModel>
abstract class _$$AuthJwtModelImplCopyWith<$Res> abstract class _$$AuthJwtModelImplCopyWith<$Res>
implements $AuthJwtModelCopyWith<$Res> { implements $AuthJwtModelCopyWith<$Res> {
factory _$$AuthJwtModelImplCopyWith( factory _$$AuthJwtModelImplCopyWith(
_$AuthJwtModelImpl value, $Res Function(_$AuthJwtModelImpl) then) = _$AuthJwtModelImpl value,
__$$AuthJwtModelImplCopyWithImpl<$Res>; $Res Function(_$AuthJwtModelImpl) then,
) = __$$AuthJwtModelImplCopyWithImpl<$Res>;
@override @override
@useResult @useResult
$Res call( $Res call({
{String secret, String secret,
String payload, String payload,
String addTokenTo, String addTokenTo,
String algorithm, String algorithm,
bool isSecretBase64Encoded, bool isSecretBase64Encoded,
String headerPrefix, String headerPrefix,
String queryParamKey, String queryParamKey,
String header}); String header,
});
} }
/// @nodoc /// @nodoc
@ -141,8 +149,9 @@ class __$$AuthJwtModelImplCopyWithImpl<$Res>
extends _$AuthJwtModelCopyWithImpl<$Res, _$AuthJwtModelImpl> extends _$AuthJwtModelCopyWithImpl<$Res, _$AuthJwtModelImpl>
implements _$$AuthJwtModelImplCopyWith<$Res> { implements _$$AuthJwtModelImplCopyWith<$Res> {
__$$AuthJwtModelImplCopyWithImpl( __$$AuthJwtModelImplCopyWithImpl(
_$AuthJwtModelImpl _value, $Res Function(_$AuthJwtModelImpl) _then) _$AuthJwtModelImpl _value,
: super(_value, _then); $Res Function(_$AuthJwtModelImpl) _then,
) : super(_value, _then);
/// Create a copy of AuthJwtModel /// Create a copy of AuthJwtModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -158,7 +167,8 @@ class __$$AuthJwtModelImplCopyWithImpl<$Res>
Object? queryParamKey = null, Object? queryParamKey = null,
Object? header = null, Object? header = null,
}) { }) {
return _then(_$AuthJwtModelImpl( return _then(
_$AuthJwtModelImpl(
secret: null == secret secret: null == secret
? _value.secret ? _value.secret
: secret // ignore: cast_nullable_to_non_nullable : secret // ignore: cast_nullable_to_non_nullable
@ -191,22 +201,24 @@ class __$$AuthJwtModelImplCopyWithImpl<$Res>
? _value.header ? _value.header
: header // ignore: cast_nullable_to_non_nullable : header // ignore: cast_nullable_to_non_nullable
as String, as String,
)); ),
);
} }
} }
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _$AuthJwtModelImpl implements _AuthJwtModel { class _$AuthJwtModelImpl implements _AuthJwtModel {
const _$AuthJwtModelImpl( const _$AuthJwtModelImpl({
{required this.secret, required this.secret,
required this.payload, required this.payload,
required this.addTokenTo, required this.addTokenTo,
required this.algorithm, required this.algorithm,
required this.isSecretBase64Encoded, required this.isSecretBase64Encoded,
required this.headerPrefix, required this.headerPrefix,
required this.queryParamKey, required this.queryParamKey,
required this.header}); required this.header,
});
factory _$AuthJwtModelImpl.fromJson(Map<String, dynamic> json) => factory _$AuthJwtModelImpl.fromJson(Map<String, dynamic> json) =>
_$$AuthJwtModelImplFromJson(json); _$$AuthJwtModelImplFromJson(json);
@ -255,8 +267,17 @@ class _$AuthJwtModelImpl implements _AuthJwtModel {
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType, secret, payload, addTokenTo, int get hashCode => Object.hash(
algorithm, isSecretBase64Encoded, headerPrefix, queryParamKey, header); runtimeType,
secret,
payload,
addTokenTo,
algorithm,
isSecretBase64Encoded,
headerPrefix,
queryParamKey,
header,
);
/// Create a copy of AuthJwtModel /// Create a copy of AuthJwtModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -268,22 +289,21 @@ class _$AuthJwtModelImpl implements _AuthJwtModel {
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$AuthJwtModelImplToJson( return _$$AuthJwtModelImplToJson(this);
this,
);
} }
} }
abstract class _AuthJwtModel implements AuthJwtModel { abstract class _AuthJwtModel implements AuthJwtModel {
const factory _AuthJwtModel( const factory _AuthJwtModel({
{required final String secret, required final String secret,
required final String payload, required final String payload,
required final String addTokenTo, required final String addTokenTo,
required final String algorithm, required final String algorithm,
required final bool isSecretBase64Encoded, required final bool isSecretBase64Encoded,
required final String headerPrefix, required final String headerPrefix,
required final String queryParamKey, required final String queryParamKey,
required final String header}) = _$AuthJwtModelImpl; required final String header,
}) = _$AuthJwtModelImpl;
factory _AuthJwtModel.fromJson(Map<String, dynamic> json) = factory _AuthJwtModel.fromJson(Map<String, dynamic> json) =
_$AuthJwtModelImpl.fromJson; _$AuthJwtModelImpl.fromJson;

View File

@ -61,17 +61,6 @@ abstract class $HttpRequestModelCopyWith<$Res> {
String? query, String? query,
List<FormDataModel>? formData, List<FormDataModel>? formData,
}); });
$Res call(
{HTTPVerb method,
String url,
List<NameValueModel>? headers,
List<NameValueModel>? params,
List<bool>? isHeaderEnabledList,
List<bool>? isParamEnabledList,
ContentType bodyContentType,
String? body,
String? query,
List<FormDataModel>? formData});
} }
/// @nodoc /// @nodoc
@ -146,49 +135,6 @@ class _$HttpRequestModelCopyWithImpl<$Res, $Val extends HttpRequestModel>
as $Val, as $Val,
); );
} }
return _then(_value.copyWith(
method: null == method
? _value.method
: method // ignore: cast_nullable_to_non_nullable
as HTTPVerb,
url: null == url
? _value.url
: url // ignore: cast_nullable_to_non_nullable
as String,
headers: freezed == headers
? _value.headers
: headers // ignore: cast_nullable_to_non_nullable
as List<NameValueModel>?,
params: freezed == params
? _value.params
: params // ignore: cast_nullable_to_non_nullable
as List<NameValueModel>?,
isHeaderEnabledList: freezed == isHeaderEnabledList
? _value.isHeaderEnabledList
: isHeaderEnabledList // ignore: cast_nullable_to_non_nullable
as List<bool>?,
isParamEnabledList: freezed == isParamEnabledList
? _value.isParamEnabledList
: isParamEnabledList // ignore: cast_nullable_to_non_nullable
as List<bool>?,
bodyContentType: null == bodyContentType
? _value.bodyContentType
: bodyContentType // ignore: cast_nullable_to_non_nullable
as ContentType,
body: freezed == body
? _value.body
: body // ignore: cast_nullable_to_non_nullable
as String?,
query: freezed == query
? _value.query
: query // ignore: cast_nullable_to_non_nullable
as String?,
formData: freezed == formData
? _value.formData
: formData // ignore: cast_nullable_to_non_nullable
as List<FormDataModel>?,
) as $Val);
}
} }
/// @nodoc /// @nodoc
@ -212,17 +158,6 @@ abstract class _$$HttpRequestModelImplCopyWith<$Res>
String? query, String? query,
List<FormDataModel>? formData, List<FormDataModel>? formData,
}); });
$Res call(
{HTTPVerb method,
String url,
List<NameValueModel>? headers,
List<NameValueModel>? params,
List<bool>? isHeaderEnabledList,
List<bool>? isParamEnabledList,
ContentType bodyContentType,
String? body,
String? query,
List<FormDataModel>? formData});
} }
/// @nodoc /// @nodoc
@ -294,48 +229,6 @@ class __$$HttpRequestModelImplCopyWithImpl<$Res>
as List<FormDataModel>?, as List<FormDataModel>?,
), ),
); );
return _then(_$HttpRequestModelImpl(
method: null == method
? _value.method
: method // ignore: cast_nullable_to_non_nullable
as HTTPVerb,
url: null == url
? _value.url
: url // ignore: cast_nullable_to_non_nullable
as String,
headers: freezed == headers
? _value._headers
: headers // ignore: cast_nullable_to_non_nullable
as List<NameValueModel>?,
params: freezed == params
? _value._params
: params // ignore: cast_nullable_to_non_nullable
as List<NameValueModel>?,
isHeaderEnabledList: freezed == isHeaderEnabledList
? _value._isHeaderEnabledList
: isHeaderEnabledList // ignore: cast_nullable_to_non_nullable
as List<bool>?,
isParamEnabledList: freezed == isParamEnabledList
? _value._isParamEnabledList
: isParamEnabledList // ignore: cast_nullable_to_non_nullable
as List<bool>?,
bodyContentType: null == bodyContentType
? _value.bodyContentType
: bodyContentType // ignore: cast_nullable_to_non_nullable
as ContentType,
body: freezed == body
? _value.body
: body // ignore: cast_nullable_to_non_nullable
as String?,
query: freezed == query
? _value.query
: query // ignore: cast_nullable_to_non_nullable
as String?,
formData: freezed == formData
? _value._formData
: formData // ignore: cast_nullable_to_non_nullable
as List<FormDataModel>?,
));
} }
} }
@ -360,23 +253,6 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
_isParamEnabledList = isParamEnabledList, _isParamEnabledList = isParamEnabledList,
_formData = formData, _formData = formData,
super._(); super._();
const _$HttpRequestModelImpl(
{this.method = HTTPVerb.get,
this.url = "",
final List<NameValueModel>? headers,
final List<NameValueModel>? params,
final List<bool>? isHeaderEnabledList,
final List<bool>? isParamEnabledList,
this.bodyContentType = ContentType.json,
this.body,
this.query,
final List<FormDataModel>? formData})
: _headers = headers,
_params = params,
_isHeaderEnabledList = isHeaderEnabledList,
_isParamEnabledList = isParamEnabledList,
_formData = formData,
super._();
factory _$HttpRequestModelImpl.fromJson(Map<String, dynamic> json) => factory _$HttpRequestModelImpl.fromJson(Map<String, dynamic> json) =>
_$$HttpRequestModelImplFromJson(json); _$$HttpRequestModelImplFromJson(json);
@ -449,7 +325,6 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
@override @override
String toString() { String toString() {
return 'HttpRequestModel(method: $method, url: $url, headers: $headers, params: $params, isHeaderEnabledList: $isHeaderEnabledList, isParamEnabledList: $isParamEnabledList, bodyContentType: $bodyContentType, body: $body, query: $query, formData: $formData)'; return 'HttpRequestModel(method: $method, url: $url, headers: $headers, params: $params, isHeaderEnabledList: $isHeaderEnabledList, isParamEnabledList: $isParamEnabledList, bodyContentType: $bodyContentType, body: $body, query: $query, formData: $formData)';
return 'HttpRequestModel(method: $method, url: $url, headers: $headers, params: $params, isHeaderEnabledList: $isHeaderEnabledList, isParamEnabledList: $isParamEnabledList, bodyContentType: $bodyContentType, body: $body, query: $query, formData: $formData)';
} }
@override @override
@ -469,10 +344,6 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
other._isParamEnabledList, other._isParamEnabledList,
_isParamEnabledList, _isParamEnabledList,
) && ) &&
const DeepCollectionEquality()
.equals(other._isHeaderEnabledList, _isHeaderEnabledList) &&
const DeepCollectionEquality()
.equals(other._isParamEnabledList, _isParamEnabledList) &&
(identical(other.bodyContentType, bodyContentType) || (identical(other.bodyContentType, bodyContentType) ||
other.bodyContentType == bodyContentType) && other.bodyContentType == bodyContentType) &&
(identical(other.body, body) || other.body == body) && (identical(other.body, body) || other.body == body) &&
@ -495,17 +366,6 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
query, query,
const DeepCollectionEquality().hash(_formData), const DeepCollectionEquality().hash(_formData),
); );
runtimeType,
method,
url,
const DeepCollectionEquality().hash(_headers),
const DeepCollectionEquality().hash(_params),
const DeepCollectionEquality().hash(_isHeaderEnabledList),
const DeepCollectionEquality().hash(_isParamEnabledList),
bodyContentType,
body,
query,
const DeepCollectionEquality().hash(_formData));
/// Create a copy of HttpRequestModel /// Create a copy of HttpRequestModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -537,17 +397,6 @@ abstract class _HttpRequestModel extends HttpRequestModel {
final String? query, final String? query,
final List<FormDataModel>? formData, final List<FormDataModel>? formData,
}) = _$HttpRequestModelImpl; }) = _$HttpRequestModelImpl;
const factory _HttpRequestModel(
{final HTTPVerb method,
final String url,
final List<NameValueModel>? headers,
final List<NameValueModel>? params,
final List<bool>? isHeaderEnabledList,
final List<bool>? isParamEnabledList,
final ContentType bodyContentType,
final String? body,
final String? query,
final List<FormDataModel>? formData}) = _$HttpRequestModelImpl;
const _HttpRequestModel._() : super._(); const _HttpRequestModel._() : super._();
factory _HttpRequestModel.fromJson(Map<String, dynamic> json) = factory _HttpRequestModel.fromJson(Map<String, dynamic> json) =

View File

@ -1,2 +1,7 @@
export 'http_request_model.dart'; export 'http_request_model.dart';
export 'http_response_model.dart'; export 'http_response_model.dart';
export 'auth/api_auth_model.dart';
export 'auth/auth_api_key_model.dart';
export 'auth/auth_basic_model.dart';
export 'auth/auth_bearer_model.dart';
export 'auth/auth_jwt_model.dart';

View File

@ -7,7 +7,6 @@ import '../consts.dart';
import '../extensions/extensions.dart'; import '../extensions/extensions.dart';
import '../models/models.dart'; import '../models/models.dart';
import '../utils/utils.dart'; import '../utils/utils.dart';
import '../utils/handle_auth.dart';
import 'http_client_manager.dart'; import 'http_client_manager.dart';
typedef HttpResponse = http.Response; typedef HttpResponse = http.Response;
@ -28,11 +27,7 @@ Future<(HttpResponse?, Duration?, String?)> sendHttpRequest(
final client = httpClientManager.createClient(requestId, noSSL: noSSL); final client = httpClientManager.createClient(requestId, noSSL: noSSL);
// Handle authentication // Handle authentication
<<<<<<< HEAD:packages/better_networking/lib/services/http_service.dart
final authenticatedRequestModel = handleAuth(requestModel, authModel);
=======
final authenticatedRequestModel = handleAuth(requestModel, authData); final authenticatedRequestModel = handleAuth(requestModel, authData);
>>>>>>> f24eb4e6 (feat: remove AuthModel from HttpRequestModel and integrate into HistoryRequestModel and RequestModel):packages/apidash_core/lib/services/http_service.dart
(Uri?, String?) uriRec = getValidRequestUri( (Uri?, String?) uriRec = getValidRequestUri(
authenticatedRequestModel.url, authenticatedRequestModel.url,

View File

@ -1,6 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:apidash_core/models/auth/auth_jwt_model.dart'; import 'package:better_networking/models/auth/auth_jwt_model.dart';
import 'package:crypto/crypto.dart'; import 'package:crypto/crypto.dart';
String generateJWT(AuthJwtModel jwtAuth) { String generateJWT(AuthJwtModel jwtAuth) {

View File

@ -1,7 +1,8 @@
import 'dart:convert'; import 'dart:convert';
import 'package:apidash_core/consts.dart'; import 'package:better_networking/utils/auth_utils.dart';
import 'package:apidash_core/models/auth/api_auth_model.dart'; import 'package:better_networking/better_networking.dart';
import 'package:apidash_core/utils/auth_utils.dart';
import '../models/auth/api_auth_model.dart';
HttpRequestModel handleAuth(HttpRequestModel httpRequestModel,AuthModel? authData) { HttpRequestModel handleAuth(HttpRequestModel httpRequestModel,AuthModel? authData) {
if (authData == null || authData.type == APIAuthType.none) { if (authData == null || authData.type == APIAuthType.none) {

View File

@ -4,3 +4,4 @@ export 'http_request_utils.dart';
export 'http_response_utils.dart'; export 'http_response_utils.dart';
export 'string_utils.dart' hide RandomStringGenerator; export 'string_utils.dart' hide RandomStringGenerator;
export 'uri_utils.dart'; export 'uri_utils.dart';
export 'handle_auth.dart';