mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
refactor: move auth models to better_networking package
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
import 'package:apidash/screens/common_widgets/auth_textfield.dart';
|
||||
import 'package:apidash_core/consts.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_core/apidash_core.dart';
|
||||
import 'package:apidash_design_system/apidash_design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -10,12 +8,11 @@ class ApiKeyAuthFields extends StatefulWidget {
|
||||
final bool readOnly;
|
||||
final Function(AuthModel?) updateAuth;
|
||||
|
||||
const ApiKeyAuthFields({
|
||||
super.key,
|
||||
required this.authData,
|
||||
required this.updateAuth,
|
||||
this.readOnly = false
|
||||
});
|
||||
const ApiKeyAuthFields(
|
||||
{super.key,
|
||||
required this.authData,
|
||||
required this.updateAuth,
|
||||
this.readOnly = false});
|
||||
|
||||
@override
|
||||
State<ApiKeyAuthFields> createState() => _ApiKeyAuthFieldsState();
|
||||
@ -76,7 +73,7 @@ class _ApiKeyAuthFieldsState extends State<ApiKeyAuthFields> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
AuthTextField(
|
||||
readOnly: widget.readOnly,
|
||||
readOnly: widget.readOnly,
|
||||
controller: _keyController,
|
||||
hintText: "API Key",
|
||||
isObscureText: true,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:apidash/consts.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_riverpod/flutter_riverpod.dart';
|
||||
import 'package:apidash/providers/providers.dart';
|
||||
@ -25,8 +25,8 @@ class EditGraphQLRequestPane extends ConsumerWidget {
|
||||
.select((value) => value?.httpRequestModel?.hasQuery)) ??
|
||||
false;
|
||||
|
||||
final hasAuth = ref.watch(selectedRequestModelProvider.select((value) =>
|
||||
value?.authModel?.type != APIAuthType.none));
|
||||
final hasAuth = ref.watch(selectedRequestModelProvider
|
||||
.select((value) => value?.authModel?.type != APIAuthType.none));
|
||||
|
||||
final scriptsLength = ref.watch(selectedHistoryRequestModelProvider
|
||||
.select((value) => value?.preRequestScript?.length)) ??
|
||||
|
@ -1,12 +1 @@
|
||||
enum APIAuthType {
|
||||
none,
|
||||
basic,
|
||||
apiKey,
|
||||
bearer,
|
||||
jwt,
|
||||
digest,
|
||||
oauth1,
|
||||
oauth2,
|
||||
}
|
||||
|
||||
enum EnvironmentVariableType { variable, secret }
|
||||
|
@ -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,
|
||||
};
|
@ -1,6 +1 @@
|
||||
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';
|
||||
export 'environment_model.dart';
|
@ -54,6 +54,7 @@ class _BetterNetworkingExampleState extends State<BetterNetworkingExample> {
|
||||
final (resp, duration, err) = await sendHttpRequest(
|
||||
'G1',
|
||||
APIType.rest,
|
||||
AuthModel(type: APIAuthType.none),
|
||||
HttpRequestModel(
|
||||
url: 'https://reqres.in/api/users/2',
|
||||
method: HTTPVerb.get,
|
||||
@ -80,6 +81,7 @@ class _BetterNetworkingExampleState extends State<BetterNetworkingExample> {
|
||||
final (resp, duration, err) = await sendHttpRequest(
|
||||
'P1',
|
||||
APIType.rest,
|
||||
AuthModel(type: APIAuthType.none),
|
||||
HttpRequestModel(
|
||||
url: 'https://reqres.in/api/users',
|
||||
method: HTTPVerb.post,
|
||||
|
@ -9,6 +9,8 @@ enum APIType {
|
||||
final String abbr;
|
||||
}
|
||||
|
||||
enum APIAuthType { none, basic, apiKey, bearer, jwt, digest, oauth1, oauth2}
|
||||
|
||||
enum HTTPVerb {
|
||||
get("GET"),
|
||||
head("HEAD"),
|
||||
|
@ -12,7 +12,8 @@ part of 'api_auth_model.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
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) {
|
||||
return _AuthModel.fromJson(json);
|
||||
@ -41,12 +42,13 @@ abstract class $AuthModelCopyWith<$Res> {
|
||||
factory $AuthModelCopyWith(AuthModel value, $Res Function(AuthModel) then) =
|
||||
_$AuthModelCopyWithImpl<$Res, AuthModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{APIAuthType type,
|
||||
AuthApiKeyModel? apikey,
|
||||
AuthBearerModel? bearer,
|
||||
AuthBasicAuthModel? basic,
|
||||
AuthJwtModel? jwt});
|
||||
$Res call({
|
||||
APIAuthType type,
|
||||
AuthApiKeyModel? apikey,
|
||||
AuthBearerModel? bearer,
|
||||
AuthBasicAuthModel? basic,
|
||||
AuthJwtModel? jwt,
|
||||
});
|
||||
|
||||
$AuthApiKeyModelCopyWith<$Res>? get apikey;
|
||||
$AuthBearerModelCopyWith<$Res>? get bearer;
|
||||
@ -75,28 +77,31 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel>
|
||||
Object? basic = freezed,
|
||||
Object? jwt = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as APIAuthType,
|
||||
apikey: freezed == apikey
|
||||
? _value.apikey
|
||||
: apikey // ignore: cast_nullable_to_non_nullable
|
||||
as AuthApiKeyModel?,
|
||||
bearer: freezed == bearer
|
||||
? _value.bearer
|
||||
: bearer // ignore: cast_nullable_to_non_nullable
|
||||
as AuthBearerModel?,
|
||||
basic: freezed == basic
|
||||
? _value.basic
|
||||
: basic // ignore: cast_nullable_to_non_nullable
|
||||
as AuthBasicAuthModel?,
|
||||
jwt: freezed == jwt
|
||||
? _value.jwt
|
||||
: jwt // ignore: cast_nullable_to_non_nullable
|
||||
as AuthJwtModel?,
|
||||
) as $Val);
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as APIAuthType,
|
||||
apikey: freezed == apikey
|
||||
? _value.apikey
|
||||
: apikey // ignore: cast_nullable_to_non_nullable
|
||||
as AuthApiKeyModel?,
|
||||
bearer: freezed == bearer
|
||||
? _value.bearer
|
||||
: bearer // ignore: cast_nullable_to_non_nullable
|
||||
as AuthBearerModel?,
|
||||
basic: freezed == basic
|
||||
? _value.basic
|
||||
: basic // ignore: cast_nullable_to_non_nullable
|
||||
as AuthBasicAuthModel?,
|
||||
jwt: freezed == jwt
|
||||
? _value.jwt
|
||||
: jwt // ignore: cast_nullable_to_non_nullable
|
||||
as AuthJwtModel?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of AuthModel
|
||||
@ -160,16 +165,18 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel>
|
||||
abstract class _$$AuthModelImplCopyWith<$Res>
|
||||
implements $AuthModelCopyWith<$Res> {
|
||||
factory _$$AuthModelImplCopyWith(
|
||||
_$AuthModelImpl value, $Res Function(_$AuthModelImpl) then) =
|
||||
__$$AuthModelImplCopyWithImpl<$Res>;
|
||||
_$AuthModelImpl value,
|
||||
$Res Function(_$AuthModelImpl) then,
|
||||
) = __$$AuthModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{APIAuthType type,
|
||||
AuthApiKeyModel? apikey,
|
||||
AuthBearerModel? bearer,
|
||||
AuthBasicAuthModel? basic,
|
||||
AuthJwtModel? jwt});
|
||||
$Res call({
|
||||
APIAuthType type,
|
||||
AuthApiKeyModel? apikey,
|
||||
AuthBearerModel? bearer,
|
||||
AuthBasicAuthModel? basic,
|
||||
AuthJwtModel? jwt,
|
||||
});
|
||||
|
||||
@override
|
||||
$AuthApiKeyModelCopyWith<$Res>? get apikey;
|
||||
@ -186,8 +193,9 @@ class __$$AuthModelImplCopyWithImpl<$Res>
|
||||
extends _$AuthModelCopyWithImpl<$Res, _$AuthModelImpl>
|
||||
implements _$$AuthModelImplCopyWith<$Res> {
|
||||
__$$AuthModelImplCopyWithImpl(
|
||||
_$AuthModelImpl _value, $Res Function(_$AuthModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
_$AuthModelImpl _value,
|
||||
$Res Function(_$AuthModelImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -200,28 +208,30 @@ class __$$AuthModelImplCopyWithImpl<$Res>
|
||||
Object? basic = freezed,
|
||||
Object? jwt = freezed,
|
||||
}) {
|
||||
return _then(_$AuthModelImpl(
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as APIAuthType,
|
||||
apikey: freezed == apikey
|
||||
? _value.apikey
|
||||
: apikey // ignore: cast_nullable_to_non_nullable
|
||||
as AuthApiKeyModel?,
|
||||
bearer: freezed == bearer
|
||||
? _value.bearer
|
||||
: bearer // ignore: cast_nullable_to_non_nullable
|
||||
as AuthBearerModel?,
|
||||
basic: freezed == basic
|
||||
? _value.basic
|
||||
: basic // ignore: cast_nullable_to_non_nullable
|
||||
as AuthBasicAuthModel?,
|
||||
jwt: freezed == jwt
|
||||
? _value.jwt
|
||||
: jwt // ignore: cast_nullable_to_non_nullable
|
||||
as AuthJwtModel?,
|
||||
));
|
||||
return _then(
|
||||
_$AuthModelImpl(
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as APIAuthType,
|
||||
apikey: freezed == apikey
|
||||
? _value.apikey
|
||||
: apikey // ignore: cast_nullable_to_non_nullable
|
||||
as AuthApiKeyModel?,
|
||||
bearer: freezed == bearer
|
||||
? _value.bearer
|
||||
: bearer // ignore: cast_nullable_to_non_nullable
|
||||
as AuthBearerModel?,
|
||||
basic: freezed == basic
|
||||
? _value.basic
|
||||
: basic // ignore: cast_nullable_to_non_nullable
|
||||
as AuthBasicAuthModel?,
|
||||
jwt: freezed == jwt
|
||||
? _value.jwt
|
||||
: jwt // ignore: cast_nullable_to_non_nullable
|
||||
as AuthJwtModel?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,8 +239,13 @@ class __$$AuthModelImplCopyWithImpl<$Res>
|
||||
|
||||
@JsonSerializable(explicitToJson: true, anyMap: true)
|
||||
class _$AuthModelImpl implements _AuthModel {
|
||||
const _$AuthModelImpl(
|
||||
{required this.type, this.apikey, this.bearer, this.basic, this.jwt});
|
||||
const _$AuthModelImpl({
|
||||
required this.type,
|
||||
this.apikey,
|
||||
this.bearer,
|
||||
this.basic,
|
||||
this.jwt,
|
||||
});
|
||||
|
||||
factory _$AuthModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AuthModelImplFromJson(json);
|
||||
@ -278,19 +293,18 @@ class _$AuthModelImpl implements _AuthModel {
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AuthModelImplToJson(
|
||||
this,
|
||||
);
|
||||
return _$$AuthModelImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AuthModel implements AuthModel {
|
||||
const factory _AuthModel(
|
||||
{required final APIAuthType type,
|
||||
final AuthApiKeyModel? apikey,
|
||||
final AuthBearerModel? bearer,
|
||||
final AuthBasicAuthModel? basic,
|
||||
final AuthJwtModel? jwt}) = _$AuthModelImpl;
|
||||
const factory _AuthModel({
|
||||
required final APIAuthType type,
|
||||
final AuthApiKeyModel? apikey,
|
||||
final AuthBearerModel? bearer,
|
||||
final AuthBasicAuthModel? basic,
|
||||
final AuthJwtModel? jwt,
|
||||
}) = _$AuthModelImpl;
|
||||
|
||||
factory _AuthModel.fromJson(Map<String, dynamic> json) =
|
||||
_$AuthModelImpl.fromJson;
|
@ -7,24 +7,26 @@ part of 'api_auth_model.dart';
|
||||
// **************************************************************************
|
||||
|
||||
_$AuthModelImpl _$$AuthModelImplFromJson(Map json) => _$AuthModelImpl(
|
||||
type: $enumDecode(_$APIAuthTypeEnumMap, json['type']),
|
||||
apikey: json['apikey'] == null
|
||||
? null
|
||||
: AuthApiKeyModel.fromJson(
|
||||
Map<String, dynamic>.from(json['apikey'] as Map)),
|
||||
bearer: json['bearer'] == null
|
||||
? null
|
||||
: AuthBearerModel.fromJson(
|
||||
Map<String, dynamic>.from(json['bearer'] as Map)),
|
||||
basic: json['basic'] == null
|
||||
? null
|
||||
: AuthBasicAuthModel.fromJson(
|
||||
Map<String, dynamic>.from(json['basic'] as Map)),
|
||||
jwt: json['jwt'] == null
|
||||
? null
|
||||
: AuthJwtModel.fromJson(
|
||||
Map<String, dynamic>.from(json['jwt'] as Map)),
|
||||
);
|
||||
type: $enumDecode(_$APIAuthTypeEnumMap, json['type']),
|
||||
apikey: json['apikey'] == null
|
||||
? null
|
||||
: AuthApiKeyModel.fromJson(
|
||||
Map<String, dynamic>.from(json['apikey'] as Map),
|
||||
),
|
||||
bearer: json['bearer'] == null
|
||||
? null
|
||||
: AuthBearerModel.fromJson(
|
||||
Map<String, dynamic>.from(json['bearer'] as Map),
|
||||
),
|
||||
basic: json['basic'] == null
|
||||
? null
|
||||
: AuthBasicAuthModel.fromJson(
|
||||
Map<String, dynamic>.from(json['basic'] as Map),
|
||||
),
|
||||
jwt: json['jwt'] == null
|
||||
? null
|
||||
: AuthJwtModel.fromJson(Map<String, dynamic>.from(json['jwt'] as Map)),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$AuthModelImplToJson(_$AuthModelImpl instance) =>
|
||||
<String, dynamic>{
|
@ -12,7 +12,8 @@ part of 'auth_api_key_model.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
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) {
|
||||
return _AuthApiKeyModel.fromJson(json);
|
||||
@ -38,8 +39,9 @@ mixin _$AuthApiKeyModel {
|
||||
/// @nodoc
|
||||
abstract class $AuthApiKeyModelCopyWith<$Res> {
|
||||
factory $AuthApiKeyModelCopyWith(
|
||||
AuthApiKeyModel value, $Res Function(AuthApiKeyModel) then) =
|
||||
_$AuthApiKeyModelCopyWithImpl<$Res, AuthApiKeyModel>;
|
||||
AuthApiKeyModel value,
|
||||
$Res Function(AuthApiKeyModel) then,
|
||||
) = _$AuthApiKeyModelCopyWithImpl<$Res, AuthApiKeyModel>;
|
||||
@useResult
|
||||
$Res call({String key, String location, String name});
|
||||
}
|
||||
@ -63,29 +65,33 @@ class _$AuthApiKeyModelCopyWithImpl<$Res, $Val extends AuthApiKeyModel>
|
||||
Object? location = null,
|
||||
Object? name = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
key: null == key
|
||||
? _value.key
|
||||
: key // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
location: null == location
|
||||
? _value.location
|
||||
: location // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
key: null == key
|
||||
? _value.key
|
||||
: key // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
location: null == location
|
||||
? _value.location
|
||||
: location // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthApiKeyModelImplCopyWith<$Res>
|
||||
implements $AuthApiKeyModelCopyWith<$Res> {
|
||||
factory _$$AuthApiKeyModelImplCopyWith(_$AuthApiKeyModelImpl value,
|
||||
$Res Function(_$AuthApiKeyModelImpl) then) =
|
||||
__$$AuthApiKeyModelImplCopyWithImpl<$Res>;
|
||||
factory _$$AuthApiKeyModelImplCopyWith(
|
||||
_$AuthApiKeyModelImpl value,
|
||||
$Res Function(_$AuthApiKeyModelImpl) then,
|
||||
) = __$$AuthApiKeyModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String key, String location, String name});
|
||||
@ -96,8 +102,9 @@ class __$$AuthApiKeyModelImplCopyWithImpl<$Res>
|
||||
extends _$AuthApiKeyModelCopyWithImpl<$Res, _$AuthApiKeyModelImpl>
|
||||
implements _$$AuthApiKeyModelImplCopyWith<$Res> {
|
||||
__$$AuthApiKeyModelImplCopyWithImpl(
|
||||
_$AuthApiKeyModelImpl _value, $Res Function(_$AuthApiKeyModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
_$AuthApiKeyModelImpl _value,
|
||||
$Res Function(_$AuthApiKeyModelImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthApiKeyModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -108,28 +115,33 @@ class __$$AuthApiKeyModelImplCopyWithImpl<$Res>
|
||||
Object? location = null,
|
||||
Object? name = null,
|
||||
}) {
|
||||
return _then(_$AuthApiKeyModelImpl(
|
||||
key: null == key
|
||||
? _value.key
|
||||
: key // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
location: null == location
|
||||
? _value.location
|
||||
: location // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
return _then(
|
||||
_$AuthApiKeyModelImpl(
|
||||
key: null == key
|
||||
? _value.key
|
||||
: key // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
location: null == location
|
||||
? _value.location
|
||||
: location // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$AuthApiKeyModelImpl implements _AuthApiKeyModel {
|
||||
const _$AuthApiKeyModelImpl(
|
||||
{required this.key, this.location = 'header', this.name = 'x-api-key'});
|
||||
const _$AuthApiKeyModelImpl({
|
||||
required this.key,
|
||||
this.location = 'header',
|
||||
this.name = 'x-api-key',
|
||||
});
|
||||
|
||||
factory _$AuthApiKeyModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AuthApiKeyModelImplFromJson(json);
|
||||
@ -139,7 +151,7 @@ class _$AuthApiKeyModelImpl implements _AuthApiKeyModel {
|
||||
@override
|
||||
@JsonKey()
|
||||
final String location;
|
||||
// 'header' or 'query'
|
||||
// 'header' or 'query'
|
||||
@override
|
||||
@JsonKey()
|
||||
final String name;
|
||||
@ -171,21 +183,22 @@ class _$AuthApiKeyModelImpl implements _AuthApiKeyModel {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AuthApiKeyModelImplCopyWith<_$AuthApiKeyModelImpl> get copyWith =>
|
||||
__$$AuthApiKeyModelImplCopyWithImpl<_$AuthApiKeyModelImpl>(
|
||||
this, _$identity);
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AuthApiKeyModelImplToJson(
|
||||
this,
|
||||
);
|
||||
return _$$AuthApiKeyModelImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AuthApiKeyModel implements AuthApiKeyModel {
|
||||
const factory _AuthApiKeyModel(
|
||||
{required final String key,
|
||||
final String location,
|
||||
final String name}) = _$AuthApiKeyModelImpl;
|
||||
const factory _AuthApiKeyModel({
|
||||
required final String key,
|
||||
final String location,
|
||||
final String name,
|
||||
}) = _$AuthApiKeyModelImpl;
|
||||
|
||||
factory _AuthApiKeyModel.fromJson(Map<String, dynamic> json) =
|
||||
_$AuthApiKeyModelImpl.fromJson;
|
@ -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,
|
||||
};
|
@ -12,7 +12,8 @@ part of 'auth_basic_model.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
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) {
|
||||
return _AuthBasicAuthModel.fromJson(json);
|
||||
@ -36,8 +37,9 @@ mixin _$AuthBasicAuthModel {
|
||||
/// @nodoc
|
||||
abstract class $AuthBasicAuthModelCopyWith<$Res> {
|
||||
factory $AuthBasicAuthModelCopyWith(
|
||||
AuthBasicAuthModel value, $Res Function(AuthBasicAuthModel) then) =
|
||||
_$AuthBasicAuthModelCopyWithImpl<$Res, AuthBasicAuthModel>;
|
||||
AuthBasicAuthModel value,
|
||||
$Res Function(AuthBasicAuthModel) then,
|
||||
) = _$AuthBasicAuthModelCopyWithImpl<$Res, AuthBasicAuthModel>;
|
||||
@useResult
|
||||
$Res call({String username, String password});
|
||||
}
|
||||
@ -56,29 +58,30 @@ class _$AuthBasicAuthModelCopyWithImpl<$Res, $Val extends AuthBasicAuthModel>
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? username = null,
|
||||
Object? password = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
username: null == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
$Res call({Object? username = null, Object? password = null}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
username: null == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthBasicAuthModelImplCopyWith<$Res>
|
||||
implements $AuthBasicAuthModelCopyWith<$Res> {
|
||||
factory _$$AuthBasicAuthModelImplCopyWith(_$AuthBasicAuthModelImpl value,
|
||||
$Res Function(_$AuthBasicAuthModelImpl) then) =
|
||||
__$$AuthBasicAuthModelImplCopyWithImpl<$Res>;
|
||||
factory _$$AuthBasicAuthModelImplCopyWith(
|
||||
_$AuthBasicAuthModelImpl value,
|
||||
$Res Function(_$AuthBasicAuthModelImpl) then,
|
||||
) = __$$AuthBasicAuthModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String username, String password});
|
||||
@ -88,36 +91,38 @@ abstract class _$$AuthBasicAuthModelImplCopyWith<$Res>
|
||||
class __$$AuthBasicAuthModelImplCopyWithImpl<$Res>
|
||||
extends _$AuthBasicAuthModelCopyWithImpl<$Res, _$AuthBasicAuthModelImpl>
|
||||
implements _$$AuthBasicAuthModelImplCopyWith<$Res> {
|
||||
__$$AuthBasicAuthModelImplCopyWithImpl(_$AuthBasicAuthModelImpl _value,
|
||||
$Res Function(_$AuthBasicAuthModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
__$$AuthBasicAuthModelImplCopyWithImpl(
|
||||
_$AuthBasicAuthModelImpl _value,
|
||||
$Res Function(_$AuthBasicAuthModelImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthBasicAuthModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? username = null,
|
||||
Object? password = null,
|
||||
}) {
|
||||
return _then(_$AuthBasicAuthModelImpl(
|
||||
username: null == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
$Res call({Object? username = null, Object? password = null}) {
|
||||
return _then(
|
||||
_$AuthBasicAuthModelImpl(
|
||||
username: null == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$AuthBasicAuthModelImpl implements _AuthBasicAuthModel {
|
||||
const _$AuthBasicAuthModelImpl(
|
||||
{required this.username, required this.password});
|
||||
const _$AuthBasicAuthModelImpl({
|
||||
required this.username,
|
||||
required this.password,
|
||||
});
|
||||
|
||||
factory _$AuthBasicAuthModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AuthBasicAuthModelImplFromJson(json);
|
||||
@ -154,20 +159,21 @@ class _$AuthBasicAuthModelImpl implements _AuthBasicAuthModel {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AuthBasicAuthModelImplCopyWith<_$AuthBasicAuthModelImpl> get copyWith =>
|
||||
__$$AuthBasicAuthModelImplCopyWithImpl<_$AuthBasicAuthModelImpl>(
|
||||
this, _$identity);
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AuthBasicAuthModelImplToJson(
|
||||
this,
|
||||
);
|
||||
return _$$AuthBasicAuthModelImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AuthBasicAuthModel implements AuthBasicAuthModel {
|
||||
const factory _AuthBasicAuthModel(
|
||||
{required final String username,
|
||||
required final String password}) = _$AuthBasicAuthModelImpl;
|
||||
const factory _AuthBasicAuthModel({
|
||||
required final String username,
|
||||
required final String password,
|
||||
}) = _$AuthBasicAuthModelImpl;
|
||||
|
||||
factory _AuthBasicAuthModel.fromJson(Map<String, dynamic> json) =
|
||||
_$AuthBasicAuthModelImpl.fromJson;
|
@ -7,15 +7,15 @@ part of 'auth_basic_model.dart';
|
||||
// **************************************************************************
|
||||
|
||||
_$AuthBasicAuthModelImpl _$$AuthBasicAuthModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$AuthBasicAuthModelImpl(
|
||||
username: json['username'] as String,
|
||||
password: json['password'] as String,
|
||||
);
|
||||
Map<String, dynamic> json,
|
||||
) => _$AuthBasicAuthModelImpl(
|
||||
username: json['username'] as String,
|
||||
password: json['password'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$AuthBasicAuthModelImplToJson(
|
||||
_$AuthBasicAuthModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'username': instance.username,
|
||||
'password': instance.password,
|
||||
};
|
||||
_$AuthBasicAuthModelImpl instance,
|
||||
) => <String, dynamic>{
|
||||
'username': instance.username,
|
||||
'password': instance.password,
|
||||
};
|
@ -12,7 +12,8 @@ part of 'auth_bearer_model.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
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) {
|
||||
return _AuthBearerModel.fromJson(json);
|
||||
@ -35,8 +36,9 @@ mixin _$AuthBearerModel {
|
||||
/// @nodoc
|
||||
abstract class $AuthBearerModelCopyWith<$Res> {
|
||||
factory $AuthBearerModelCopyWith(
|
||||
AuthBearerModel value, $Res Function(AuthBearerModel) then) =
|
||||
_$AuthBearerModelCopyWithImpl<$Res, AuthBearerModel>;
|
||||
AuthBearerModel value,
|
||||
$Res Function(AuthBearerModel) then,
|
||||
) = _$AuthBearerModelCopyWithImpl<$Res, AuthBearerModel>;
|
||||
@useResult
|
||||
$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.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? token = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
token: null == token
|
||||
? _value.token
|
||||
: token // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
$Res call({Object? token = null}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
token: null == token
|
||||
? _value.token
|
||||
: token // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthBearerModelImplCopyWith<$Res>
|
||||
implements $AuthBearerModelCopyWith<$Res> {
|
||||
factory _$$AuthBearerModelImplCopyWith(_$AuthBearerModelImpl value,
|
||||
$Res Function(_$AuthBearerModelImpl) then) =
|
||||
__$$AuthBearerModelImplCopyWithImpl<$Res>;
|
||||
factory _$$AuthBearerModelImplCopyWith(
|
||||
_$AuthBearerModelImpl value,
|
||||
$Res Function(_$AuthBearerModelImpl) then,
|
||||
) = __$$AuthBearerModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String token});
|
||||
@ -83,22 +87,23 @@ class __$$AuthBearerModelImplCopyWithImpl<$Res>
|
||||
extends _$AuthBearerModelCopyWithImpl<$Res, _$AuthBearerModelImpl>
|
||||
implements _$$AuthBearerModelImplCopyWith<$Res> {
|
||||
__$$AuthBearerModelImplCopyWithImpl(
|
||||
_$AuthBearerModelImpl _value, $Res Function(_$AuthBearerModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
_$AuthBearerModelImpl _value,
|
||||
$Res Function(_$AuthBearerModelImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthBearerModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? token = null,
|
||||
}) {
|
||||
return _then(_$AuthBearerModelImpl(
|
||||
token: null == token
|
||||
? _value.token
|
||||
: token // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
$Res call({Object? token = null}) {
|
||||
return _then(
|
||||
_$AuthBearerModelImpl(
|
||||
token: null == token
|
||||
? _value.token
|
||||
: token // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,13 +142,13 @@ class _$AuthBearerModelImpl implements _AuthBearerModel {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AuthBearerModelImplCopyWith<_$AuthBearerModelImpl> get copyWith =>
|
||||
__$$AuthBearerModelImplCopyWithImpl<_$AuthBearerModelImpl>(
|
||||
this, _$identity);
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AuthBearerModelImplToJson(
|
||||
this,
|
||||
);
|
||||
return _$$AuthBearerModelImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,9 @@ part of 'auth_bearer_model.dart';
|
||||
// **************************************************************************
|
||||
|
||||
_$AuthBearerModelImpl _$$AuthBearerModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$AuthBearerModelImpl(
|
||||
token: json['token'] as String,
|
||||
);
|
||||
Map<String, dynamic> json,
|
||||
) => _$AuthBearerModelImpl(token: json['token'] as String);
|
||||
|
||||
Map<String, dynamic> _$$AuthBearerModelImplToJson(
|
||||
_$AuthBearerModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'token': instance.token,
|
||||
};
|
||||
_$AuthBearerModelImpl instance,
|
||||
) => <String, dynamic>{'token': instance.token};
|
@ -12,7 +12,8 @@ part of 'auth_jwt_model.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
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) {
|
||||
return _AuthJwtModel.fromJson(json);
|
||||
@ -42,18 +43,20 @@ mixin _$AuthJwtModel {
|
||||
/// @nodoc
|
||||
abstract class $AuthJwtModelCopyWith<$Res> {
|
||||
factory $AuthJwtModelCopyWith(
|
||||
AuthJwtModel value, $Res Function(AuthJwtModel) then) =
|
||||
_$AuthJwtModelCopyWithImpl<$Res, AuthJwtModel>;
|
||||
AuthJwtModel value,
|
||||
$Res Function(AuthJwtModel) then,
|
||||
) = _$AuthJwtModelCopyWithImpl<$Res, AuthJwtModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String secret,
|
||||
String payload,
|
||||
String addTokenTo,
|
||||
String algorithm,
|
||||
bool isSecretBase64Encoded,
|
||||
String headerPrefix,
|
||||
String queryParamKey,
|
||||
String header});
|
||||
$Res call({
|
||||
String secret,
|
||||
String payload,
|
||||
String addTokenTo,
|
||||
String algorithm,
|
||||
bool isSecretBase64Encoded,
|
||||
String headerPrefix,
|
||||
String queryParamKey,
|
||||
String header,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -80,40 +83,43 @@ class _$AuthJwtModelCopyWithImpl<$Res, $Val extends AuthJwtModel>
|
||||
Object? queryParamKey = null,
|
||||
Object? header = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
secret: null == secret
|
||||
? _value.secret
|
||||
: secret // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
payload: null == payload
|
||||
? _value.payload
|
||||
: payload // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
addTokenTo: null == addTokenTo
|
||||
? _value.addTokenTo
|
||||
: addTokenTo // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
algorithm: null == algorithm
|
||||
? _value.algorithm
|
||||
: algorithm // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
isSecretBase64Encoded: null == isSecretBase64Encoded
|
||||
? _value.isSecretBase64Encoded
|
||||
: isSecretBase64Encoded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
headerPrefix: null == headerPrefix
|
||||
? _value.headerPrefix
|
||||
: headerPrefix // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
queryParamKey: null == queryParamKey
|
||||
? _value.queryParamKey
|
||||
: queryParamKey // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
header: null == header
|
||||
? _value.header
|
||||
: header // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
secret: null == secret
|
||||
? _value.secret
|
||||
: secret // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
payload: null == payload
|
||||
? _value.payload
|
||||
: payload // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
addTokenTo: null == addTokenTo
|
||||
? _value.addTokenTo
|
||||
: addTokenTo // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
algorithm: null == algorithm
|
||||
? _value.algorithm
|
||||
: algorithm // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
isSecretBase64Encoded: null == isSecretBase64Encoded
|
||||
? _value.isSecretBase64Encoded
|
||||
: isSecretBase64Encoded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
headerPrefix: null == headerPrefix
|
||||
? _value.headerPrefix
|
||||
: headerPrefix // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
queryParamKey: null == queryParamKey
|
||||
? _value.queryParamKey
|
||||
: queryParamKey // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
header: null == header
|
||||
? _value.header
|
||||
: header // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,19 +127,21 @@ class _$AuthJwtModelCopyWithImpl<$Res, $Val extends AuthJwtModel>
|
||||
abstract class _$$AuthJwtModelImplCopyWith<$Res>
|
||||
implements $AuthJwtModelCopyWith<$Res> {
|
||||
factory _$$AuthJwtModelImplCopyWith(
|
||||
_$AuthJwtModelImpl value, $Res Function(_$AuthJwtModelImpl) then) =
|
||||
__$$AuthJwtModelImplCopyWithImpl<$Res>;
|
||||
_$AuthJwtModelImpl value,
|
||||
$Res Function(_$AuthJwtModelImpl) then,
|
||||
) = __$$AuthJwtModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String secret,
|
||||
String payload,
|
||||
String addTokenTo,
|
||||
String algorithm,
|
||||
bool isSecretBase64Encoded,
|
||||
String headerPrefix,
|
||||
String queryParamKey,
|
||||
String header});
|
||||
$Res call({
|
||||
String secret,
|
||||
String payload,
|
||||
String addTokenTo,
|
||||
String algorithm,
|
||||
bool isSecretBase64Encoded,
|
||||
String headerPrefix,
|
||||
String queryParamKey,
|
||||
String header,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -141,8 +149,9 @@ class __$$AuthJwtModelImplCopyWithImpl<$Res>
|
||||
extends _$AuthJwtModelCopyWithImpl<$Res, _$AuthJwtModelImpl>
|
||||
implements _$$AuthJwtModelImplCopyWith<$Res> {
|
||||
__$$AuthJwtModelImplCopyWithImpl(
|
||||
_$AuthJwtModelImpl _value, $Res Function(_$AuthJwtModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
_$AuthJwtModelImpl _value,
|
||||
$Res Function(_$AuthJwtModelImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthJwtModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -158,55 +167,58 @@ class __$$AuthJwtModelImplCopyWithImpl<$Res>
|
||||
Object? queryParamKey = null,
|
||||
Object? header = null,
|
||||
}) {
|
||||
return _then(_$AuthJwtModelImpl(
|
||||
secret: null == secret
|
||||
? _value.secret
|
||||
: secret // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
payload: null == payload
|
||||
? _value.payload
|
||||
: payload // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
addTokenTo: null == addTokenTo
|
||||
? _value.addTokenTo
|
||||
: addTokenTo // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
algorithm: null == algorithm
|
||||
? _value.algorithm
|
||||
: algorithm // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
isSecretBase64Encoded: null == isSecretBase64Encoded
|
||||
? _value.isSecretBase64Encoded
|
||||
: isSecretBase64Encoded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
headerPrefix: null == headerPrefix
|
||||
? _value.headerPrefix
|
||||
: headerPrefix // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
queryParamKey: null == queryParamKey
|
||||
? _value.queryParamKey
|
||||
: queryParamKey // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
header: null == header
|
||||
? _value.header
|
||||
: header // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
return _then(
|
||||
_$AuthJwtModelImpl(
|
||||
secret: null == secret
|
||||
? _value.secret
|
||||
: secret // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
payload: null == payload
|
||||
? _value.payload
|
||||
: payload // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
addTokenTo: null == addTokenTo
|
||||
? _value.addTokenTo
|
||||
: addTokenTo // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
algorithm: null == algorithm
|
||||
? _value.algorithm
|
||||
: algorithm // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
isSecretBase64Encoded: null == isSecretBase64Encoded
|
||||
? _value.isSecretBase64Encoded
|
||||
: isSecretBase64Encoded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
headerPrefix: null == headerPrefix
|
||||
? _value.headerPrefix
|
||||
: headerPrefix // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
queryParamKey: null == queryParamKey
|
||||
? _value.queryParamKey
|
||||
: queryParamKey // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
header: null == header
|
||||
? _value.header
|
||||
: header // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$AuthJwtModelImpl implements _AuthJwtModel {
|
||||
const _$AuthJwtModelImpl(
|
||||
{required this.secret,
|
||||
required this.payload,
|
||||
required this.addTokenTo,
|
||||
required this.algorithm,
|
||||
required this.isSecretBase64Encoded,
|
||||
required this.headerPrefix,
|
||||
required this.queryParamKey,
|
||||
required this.header});
|
||||
const _$AuthJwtModelImpl({
|
||||
required this.secret,
|
||||
required this.payload,
|
||||
required this.addTokenTo,
|
||||
required this.algorithm,
|
||||
required this.isSecretBase64Encoded,
|
||||
required this.headerPrefix,
|
||||
required this.queryParamKey,
|
||||
required this.header,
|
||||
});
|
||||
|
||||
factory _$AuthJwtModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AuthJwtModelImplFromJson(json);
|
||||
@ -255,8 +267,17 @@ class _$AuthJwtModelImpl implements _AuthJwtModel {
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, secret, payload, addTokenTo,
|
||||
algorithm, isSecretBase64Encoded, headerPrefix, queryParamKey, header);
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
secret,
|
||||
payload,
|
||||
addTokenTo,
|
||||
algorithm,
|
||||
isSecretBase64Encoded,
|
||||
headerPrefix,
|
||||
queryParamKey,
|
||||
header,
|
||||
);
|
||||
|
||||
/// Create a copy of AuthJwtModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -268,22 +289,21 @@ class _$AuthJwtModelImpl implements _AuthJwtModel {
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AuthJwtModelImplToJson(
|
||||
this,
|
||||
);
|
||||
return _$$AuthJwtModelImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AuthJwtModel implements AuthJwtModel {
|
||||
const factory _AuthJwtModel(
|
||||
{required final String secret,
|
||||
required final String payload,
|
||||
required final String addTokenTo,
|
||||
required final String algorithm,
|
||||
required final bool isSecretBase64Encoded,
|
||||
required final String headerPrefix,
|
||||
required final String queryParamKey,
|
||||
required final String header}) = _$AuthJwtModelImpl;
|
||||
const factory _AuthJwtModel({
|
||||
required final String secret,
|
||||
required final String payload,
|
||||
required final String addTokenTo,
|
||||
required final String algorithm,
|
||||
required final bool isSecretBase64Encoded,
|
||||
required final String headerPrefix,
|
||||
required final String queryParamKey,
|
||||
required final String header,
|
||||
}) = _$AuthJwtModelImpl;
|
||||
|
||||
factory _AuthJwtModel.fromJson(Map<String, dynamic> json) =
|
||||
_$AuthJwtModelImpl.fromJson;
|
@ -61,17 +61,6 @@ abstract class $HttpRequestModelCopyWith<$Res> {
|
||||
String? query,
|
||||
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
|
||||
@ -146,49 +135,6 @@ class _$HttpRequestModelCopyWithImpl<$Res, $Val extends HttpRequestModel>
|
||||
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
|
||||
@ -212,17 +158,6 @@ abstract class _$$HttpRequestModelImplCopyWith<$Res>
|
||||
String? query,
|
||||
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
|
||||
@ -294,48 +229,6 @@ class __$$HttpRequestModelImplCopyWithImpl<$Res>
|
||||
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,
|
||||
_formData = formData,
|
||||
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) =>
|
||||
_$$HttpRequestModelImplFromJson(json);
|
||||
@ -449,7 +325,6 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
|
||||
@override
|
||||
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)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -469,10 +344,6 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
|
||||
other._isParamEnabledList,
|
||||
_isParamEnabledList,
|
||||
) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._isHeaderEnabledList, _isHeaderEnabledList) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._isParamEnabledList, _isParamEnabledList) &&
|
||||
(identical(other.bodyContentType, bodyContentType) ||
|
||||
other.bodyContentType == bodyContentType) &&
|
||||
(identical(other.body, body) || other.body == body) &&
|
||||
@ -495,17 +366,6 @@ class _$HttpRequestModelImpl extends _HttpRequestModel {
|
||||
query,
|
||||
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
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -537,17 +397,6 @@ abstract class _HttpRequestModel extends HttpRequestModel {
|
||||
final String? query,
|
||||
final List<FormDataModel>? formData,
|
||||
}) = _$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._();
|
||||
|
||||
factory _HttpRequestModel.fromJson(Map<String, dynamic> json) =
|
||||
|
@ -1,2 +1,7 @@
|
||||
export 'http_request_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';
|
||||
|
@ -7,7 +7,6 @@ import '../consts.dart';
|
||||
import '../extensions/extensions.dart';
|
||||
import '../models/models.dart';
|
||||
import '../utils/utils.dart';
|
||||
import '../utils/handle_auth.dart';
|
||||
import 'http_client_manager.dart';
|
||||
|
||||
typedef HttpResponse = http.Response;
|
||||
@ -28,11 +27,7 @@ Future<(HttpResponse?, Duration?, String?)> sendHttpRequest(
|
||||
final client = httpClientManager.createClient(requestId, noSSL: noSSL);
|
||||
|
||||
// Handle authentication
|
||||
<<<<<<< HEAD:packages/better_networking/lib/services/http_service.dart
|
||||
final authenticatedRequestModel = handleAuth(requestModel, authModel);
|
||||
=======
|
||||
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(
|
||||
authenticatedRequestModel.url,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:convert';
|
||||
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';
|
||||
|
||||
String generateJWT(AuthJwtModel jwtAuth) {
|
@ -1,7 +1,8 @@
|
||||
import 'dart:convert';
|
||||
import 'package:apidash_core/consts.dart';
|
||||
import 'package:apidash_core/models/auth/api_auth_model.dart';
|
||||
import 'package:apidash_core/utils/auth_utils.dart';
|
||||
import 'package:better_networking/utils/auth_utils.dart';
|
||||
import 'package:better_networking/better_networking.dart';
|
||||
|
||||
import '../models/auth/api_auth_model.dart';
|
||||
|
||||
HttpRequestModel handleAuth(HttpRequestModel httpRequestModel,AuthModel? authData) {
|
||||
if (authData == null || authData.type == APIAuthType.none) {
|
@ -4,3 +4,4 @@ export 'http_request_utils.dart';
|
||||
export 'http_response_utils.dart';
|
||||
export 'string_utils.dart' hide RandomStringGenerator;
|
||||
export 'uri_utils.dart';
|
||||
export 'handle_auth.dart';
|
||||
|
Reference in New Issue
Block a user