diff --git a/lib/screens/common_widgets/auth/api_key_auth_fields.dart b/lib/screens/common_widgets/auth/api_key_auth_fields.dart index 1412cdcc..a32e3d42 100644 --- a/lib/screens/common_widgets/auth/api_key_auth_fields.dart +++ b/lib/screens/common_widgets/auth/api_key_auth_fields.dart @@ -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 createState() => _ApiKeyAuthFieldsState(); @@ -76,7 +73,7 @@ class _ApiKeyAuthFieldsState extends State { ), const SizedBox(height: 16), AuthTextField( - readOnly: widget.readOnly, + readOnly: widget.readOnly, controller: _keyController, hintText: "API Key", isObscureText: true, diff --git a/lib/screens/home_page/editor_pane/details_card/request_pane/request_pane_graphql.dart b/lib/screens/home_page/editor_pane/details_card/request_pane/request_pane_graphql.dart index 66dac8fd..f9e18078 100644 --- a/lib/screens/home_page/editor_pane/details_card/request_pane/request_pane_graphql.dart +++ b/lib/screens/home_page/editor_pane/details_card/request_pane/request_pane_graphql.dart @@ -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)) ?? diff --git a/packages/apidash_core/lib/consts.dart b/packages/apidash_core/lib/consts.dart index 09cd3f65..3d5d19c8 100644 --- a/packages/apidash_core/lib/consts.dart +++ b/packages/apidash_core/lib/consts.dart @@ -1,12 +1 @@ -enum APIAuthType { - none, - basic, - apiKey, - bearer, - jwt, - digest, - oauth1, - oauth2, -} - enum EnvironmentVariableType { variable, secret } diff --git a/packages/apidash_core/lib/models/auth/auth_api_key_model.g.dart b/packages/apidash_core/lib/models/auth/auth_api_key_model.g.dart deleted file mode 100644 index f04e5c84..00000000 --- a/packages/apidash_core/lib/models/auth/auth_api_key_model.g.dart +++ /dev/null @@ -1,23 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'auth_api_key_model.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_$AuthApiKeyModelImpl _$$AuthApiKeyModelImplFromJson( - Map json) => - _$AuthApiKeyModelImpl( - key: json['key'] as String, - location: json['location'] as String? ?? 'header', - name: json['name'] as String? ?? 'x-api-key', - ); - -Map _$$AuthApiKeyModelImplToJson( - _$AuthApiKeyModelImpl instance) => - { - 'key': instance.key, - 'location': instance.location, - 'name': instance.name, - }; diff --git a/packages/apidash_core/lib/models/models.dart b/packages/apidash_core/lib/models/models.dart index dd91ed39..5bfff79e 100644 --- a/packages/apidash_core/lib/models/models.dart +++ b/packages/apidash_core/lib/models/models.dart @@ -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'; \ No newline at end of file diff --git a/packages/better_networking/better_networking_example/lib/main.dart b/packages/better_networking/better_networking_example/lib/main.dart index 61bb42bb..996867e4 100644 --- a/packages/better_networking/better_networking_example/lib/main.dart +++ b/packages/better_networking/better_networking_example/lib/main.dart @@ -54,6 +54,7 @@ class _BetterNetworkingExampleState extends State { 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 { final (resp, duration, err) = await sendHttpRequest( 'P1', APIType.rest, + AuthModel(type: APIAuthType.none), HttpRequestModel( url: 'https://reqres.in/api/users', method: HTTPVerb.post, diff --git a/packages/better_networking/lib/consts.dart b/packages/better_networking/lib/consts.dart index 61fe1e50..493561ad 100644 --- a/packages/better_networking/lib/consts.dart +++ b/packages/better_networking/lib/consts.dart @@ -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"), diff --git a/packages/apidash_core/lib/models/auth/api_auth_model.dart b/packages/better_networking/lib/models/auth/api_auth_model.dart similarity index 100% rename from packages/apidash_core/lib/models/auth/api_auth_model.dart rename to packages/better_networking/lib/models/auth/api_auth_model.dart diff --git a/packages/apidash_core/lib/models/auth/api_auth_model.freezed.dart b/packages/better_networking/lib/models/auth/api_auth_model.freezed.dart similarity index 70% rename from packages/apidash_core/lib/models/auth/api_auth_model.freezed.dart rename to packages/better_networking/lib/models/auth/api_auth_model.freezed.dart index 28ceaec6..44fa1cb2 100644 --- a/packages/apidash_core/lib/models/auth/api_auth_model.freezed.dart +++ b/packages/better_networking/lib/models/auth/api_auth_model.freezed.dart @@ -12,7 +12,8 @@ part of 'api_auth_model.dart'; T _$identity(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 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 json) => _$$AuthModelImplFromJson(json); @@ -278,19 +293,18 @@ class _$AuthModelImpl implements _AuthModel { @override Map 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 json) = _$AuthModelImpl.fromJson; diff --git a/packages/apidash_core/lib/models/auth/api_auth_model.g.dart b/packages/better_networking/lib/models/auth/api_auth_model.g.dart similarity index 57% rename from packages/apidash_core/lib/models/auth/api_auth_model.g.dart rename to packages/better_networking/lib/models/auth/api_auth_model.g.dart index fdbd6e09..fd867324 100644 --- a/packages/apidash_core/lib/models/auth/api_auth_model.g.dart +++ b/packages/better_networking/lib/models/auth/api_auth_model.g.dart @@ -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.from(json['apikey'] as Map)), - bearer: json['bearer'] == null - ? null - : AuthBearerModel.fromJson( - Map.from(json['bearer'] as Map)), - basic: json['basic'] == null - ? null - : AuthBasicAuthModel.fromJson( - Map.from(json['basic'] as Map)), - jwt: json['jwt'] == null - ? null - : AuthJwtModel.fromJson( - Map.from(json['jwt'] as Map)), - ); + type: $enumDecode(_$APIAuthTypeEnumMap, json['type']), + apikey: json['apikey'] == null + ? null + : AuthApiKeyModel.fromJson( + Map.from(json['apikey'] as Map), + ), + bearer: json['bearer'] == null + ? null + : AuthBearerModel.fromJson( + Map.from(json['bearer'] as Map), + ), + basic: json['basic'] == null + ? null + : AuthBasicAuthModel.fromJson( + Map.from(json['basic'] as Map), + ), + jwt: json['jwt'] == null + ? null + : AuthJwtModel.fromJson(Map.from(json['jwt'] as Map)), +); Map _$$AuthModelImplToJson(_$AuthModelImpl instance) => { diff --git a/packages/apidash_core/lib/models/auth/auth_api_key_model.dart b/packages/better_networking/lib/models/auth/auth_api_key_model.dart similarity index 100% rename from packages/apidash_core/lib/models/auth/auth_api_key_model.dart rename to packages/better_networking/lib/models/auth/auth_api_key_model.dart diff --git a/packages/apidash_core/lib/models/auth/auth_api_key_model.freezed.dart b/packages/better_networking/lib/models/auth/auth_api_key_model.freezed.dart similarity index 69% rename from packages/apidash_core/lib/models/auth/auth_api_key_model.freezed.dart rename to packages/better_networking/lib/models/auth/auth_api_key_model.freezed.dart index 3b9b272f..525e0091 100644 --- a/packages/apidash_core/lib/models/auth/auth_api_key_model.freezed.dart +++ b/packages/better_networking/lib/models/auth/auth_api_key_model.freezed.dart @@ -12,7 +12,8 @@ part of 'auth_api_key_model.dart'; T _$identity(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 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 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 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 json) = _$AuthApiKeyModelImpl.fromJson; diff --git a/packages/better_networking/lib/models/auth/auth_api_key_model.g.dart b/packages/better_networking/lib/models/auth/auth_api_key_model.g.dart new file mode 100644 index 00000000..a88f104c --- /dev/null +++ b/packages/better_networking/lib/models/auth/auth_api_key_model.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'auth_api_key_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$AuthApiKeyModelImpl _$$AuthApiKeyModelImplFromJson( + Map json, +) => _$AuthApiKeyModelImpl( + key: json['key'] as String, + location: json['location'] as String? ?? 'header', + name: json['name'] as String? ?? 'x-api-key', +); + +Map _$$AuthApiKeyModelImplToJson( + _$AuthApiKeyModelImpl instance, +) => { + 'key': instance.key, + 'location': instance.location, + 'name': instance.name, +}; diff --git a/packages/apidash_core/lib/models/auth/auth_basic_model.dart b/packages/better_networking/lib/models/auth/auth_basic_model.dart similarity index 100% rename from packages/apidash_core/lib/models/auth/auth_basic_model.dart rename to packages/better_networking/lib/models/auth/auth_basic_model.dart diff --git a/packages/apidash_core/lib/models/auth/auth_basic_model.freezed.dart b/packages/better_networking/lib/models/auth/auth_basic_model.freezed.dart similarity index 68% rename from packages/apidash_core/lib/models/auth/auth_basic_model.freezed.dart rename to packages/better_networking/lib/models/auth/auth_basic_model.freezed.dart index d5c1a07f..62e2399d 100644 --- a/packages/apidash_core/lib/models/auth/auth_basic_model.freezed.dart +++ b/packages/better_networking/lib/models/auth/auth_basic_model.freezed.dart @@ -12,7 +12,8 @@ part of 'auth_basic_model.dart'; T _$identity(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 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 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 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 json) = _$AuthBasicAuthModelImpl.fromJson; diff --git a/packages/apidash_core/lib/models/auth/auth_basic_model.g.dart b/packages/better_networking/lib/models/auth/auth_basic_model.g.dart similarity index 54% rename from packages/apidash_core/lib/models/auth/auth_basic_model.g.dart rename to packages/better_networking/lib/models/auth/auth_basic_model.g.dart index d093c2fe..6291328b 100644 --- a/packages/apidash_core/lib/models/auth/auth_basic_model.g.dart +++ b/packages/better_networking/lib/models/auth/auth_basic_model.g.dart @@ -7,15 +7,15 @@ part of 'auth_basic_model.dart'; // ************************************************************************** _$AuthBasicAuthModelImpl _$$AuthBasicAuthModelImplFromJson( - Map json) => - _$AuthBasicAuthModelImpl( - username: json['username'] as String, - password: json['password'] as String, - ); + Map json, +) => _$AuthBasicAuthModelImpl( + username: json['username'] as String, + password: json['password'] as String, +); Map _$$AuthBasicAuthModelImplToJson( - _$AuthBasicAuthModelImpl instance) => - { - 'username': instance.username, - 'password': instance.password, - }; + _$AuthBasicAuthModelImpl instance, +) => { + 'username': instance.username, + 'password': instance.password, +}; diff --git a/packages/apidash_core/lib/models/auth/auth_bearer_model.dart b/packages/better_networking/lib/models/auth/auth_bearer_model.dart similarity index 100% rename from packages/apidash_core/lib/models/auth/auth_bearer_model.dart rename to packages/better_networking/lib/models/auth/auth_bearer_model.dart diff --git a/packages/apidash_core/lib/models/auth/auth_bearer_model.freezed.dart b/packages/better_networking/lib/models/auth/auth_bearer_model.freezed.dart similarity index 76% rename from packages/apidash_core/lib/models/auth/auth_bearer_model.freezed.dart rename to packages/better_networking/lib/models/auth/auth_bearer_model.freezed.dart index b94aa413..a590fcce 100644 --- a/packages/apidash_core/lib/models/auth/auth_bearer_model.freezed.dart +++ b/packages/better_networking/lib/models/auth/auth_bearer_model.freezed.dart @@ -12,7 +12,8 @@ part of 'auth_bearer_model.dart'; T _$identity(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 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 toJson() { - return _$$AuthBearerModelImplToJson( - this, - ); + return _$$AuthBearerModelImplToJson(this); } } diff --git a/packages/apidash_core/lib/models/auth/auth_bearer_model.g.dart b/packages/better_networking/lib/models/auth/auth_bearer_model.g.dart similarity index 63% rename from packages/apidash_core/lib/models/auth/auth_bearer_model.g.dart rename to packages/better_networking/lib/models/auth/auth_bearer_model.g.dart index a986b911..34c150d8 100644 --- a/packages/apidash_core/lib/models/auth/auth_bearer_model.g.dart +++ b/packages/better_networking/lib/models/auth/auth_bearer_model.g.dart @@ -7,13 +7,9 @@ part of 'auth_bearer_model.dart'; // ************************************************************************** _$AuthBearerModelImpl _$$AuthBearerModelImplFromJson( - Map json) => - _$AuthBearerModelImpl( - token: json['token'] as String, - ); + Map json, +) => _$AuthBearerModelImpl(token: json['token'] as String); Map _$$AuthBearerModelImplToJson( - _$AuthBearerModelImpl instance) => - { - 'token': instance.token, - }; + _$AuthBearerModelImpl instance, +) => {'token': instance.token}; diff --git a/packages/apidash_core/lib/models/auth/auth_jwt_model.dart b/packages/better_networking/lib/models/auth/auth_jwt_model.dart similarity index 100% rename from packages/apidash_core/lib/models/auth/auth_jwt_model.dart rename to packages/better_networking/lib/models/auth/auth_jwt_model.dart diff --git a/packages/apidash_core/lib/models/auth/auth_jwt_model.freezed.dart b/packages/better_networking/lib/models/auth/auth_jwt_model.freezed.dart similarity index 56% rename from packages/apidash_core/lib/models/auth/auth_jwt_model.freezed.dart rename to packages/better_networking/lib/models/auth/auth_jwt_model.freezed.dart index cf35ed41..c6d5fbf6 100644 --- a/packages/apidash_core/lib/models/auth/auth_jwt_model.freezed.dart +++ b/packages/better_networking/lib/models/auth/auth_jwt_model.freezed.dart @@ -12,7 +12,8 @@ part of 'auth_jwt_model.dart'; T _$identity(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 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 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 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 json) = _$AuthJwtModelImpl.fromJson; diff --git a/packages/apidash_core/lib/models/auth/auth_jwt_model.g.dart b/packages/better_networking/lib/models/auth/auth_jwt_model.g.dart similarity index 100% rename from packages/apidash_core/lib/models/auth/auth_jwt_model.g.dart rename to packages/better_networking/lib/models/auth/auth_jwt_model.g.dart diff --git a/packages/better_networking/lib/models/http_request_model.freezed.dart b/packages/better_networking/lib/models/http_request_model.freezed.dart index 73ef7423..864ae7e0 100644 --- a/packages/better_networking/lib/models/http_request_model.freezed.dart +++ b/packages/better_networking/lib/models/http_request_model.freezed.dart @@ -61,17 +61,6 @@ abstract class $HttpRequestModelCopyWith<$Res> { String? query, List? formData, }); - $Res call( - {HTTPVerb method, - String url, - List? headers, - List? params, - List? isHeaderEnabledList, - List? isParamEnabledList, - ContentType bodyContentType, - String? body, - String? query, - List? 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?, - params: freezed == params - ? _value.params - : params // ignore: cast_nullable_to_non_nullable - as List?, - isHeaderEnabledList: freezed == isHeaderEnabledList - ? _value.isHeaderEnabledList - : isHeaderEnabledList // ignore: cast_nullable_to_non_nullable - as List?, - isParamEnabledList: freezed == isParamEnabledList - ? _value.isParamEnabledList - : isParamEnabledList // ignore: cast_nullable_to_non_nullable - as List?, - 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?, - ) as $Val); - } } /// @nodoc @@ -212,17 +158,6 @@ abstract class _$$HttpRequestModelImplCopyWith<$Res> String? query, List? formData, }); - $Res call( - {HTTPVerb method, - String url, - List? headers, - List? params, - List? isHeaderEnabledList, - List? isParamEnabledList, - ContentType bodyContentType, - String? body, - String? query, - List? formData}); } /// @nodoc @@ -294,48 +229,6 @@ class __$$HttpRequestModelImplCopyWithImpl<$Res> as List?, ), ); - 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?, - params: freezed == params - ? _value._params - : params // ignore: cast_nullable_to_non_nullable - as List?, - isHeaderEnabledList: freezed == isHeaderEnabledList - ? _value._isHeaderEnabledList - : isHeaderEnabledList // ignore: cast_nullable_to_non_nullable - as List?, - isParamEnabledList: freezed == isParamEnabledList - ? _value._isParamEnabledList - : isParamEnabledList // ignore: cast_nullable_to_non_nullable - as List?, - 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?, - )); } } @@ -360,23 +253,6 @@ class _$HttpRequestModelImpl extends _HttpRequestModel { _isParamEnabledList = isParamEnabledList, _formData = formData, super._(); - const _$HttpRequestModelImpl( - {this.method = HTTPVerb.get, - this.url = "", - final List? headers, - final List? params, - final List? isHeaderEnabledList, - final List? isParamEnabledList, - this.bodyContentType = ContentType.json, - this.body, - this.query, - final List? formData}) - : _headers = headers, - _params = params, - _isHeaderEnabledList = isHeaderEnabledList, - _isParamEnabledList = isParamEnabledList, - _formData = formData, - super._(); factory _$HttpRequestModelImpl.fromJson(Map 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? formData, }) = _$HttpRequestModelImpl; - const factory _HttpRequestModel( - {final HTTPVerb method, - final String url, - final List? headers, - final List? params, - final List? isHeaderEnabledList, - final List? isParamEnabledList, - final ContentType bodyContentType, - final String? body, - final String? query, - final List? formData}) = _$HttpRequestModelImpl; const _HttpRequestModel._() : super._(); factory _HttpRequestModel.fromJson(Map json) = diff --git a/packages/better_networking/lib/models/models.dart b/packages/better_networking/lib/models/models.dart index a33c6fdd..f5ac6b1f 100644 --- a/packages/better_networking/lib/models/models.dart +++ b/packages/better_networking/lib/models/models.dart @@ -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'; diff --git a/packages/better_networking/lib/services/http_service.dart b/packages/better_networking/lib/services/http_service.dart index 047d83af..78c75f50 100644 --- a/packages/better_networking/lib/services/http_service.dart +++ b/packages/better_networking/lib/services/http_service.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, diff --git a/packages/apidash_core/lib/utils/auth_utils.dart b/packages/better_networking/lib/utils/auth_utils.dart similarity index 97% rename from packages/apidash_core/lib/utils/auth_utils.dart rename to packages/better_networking/lib/utils/auth_utils.dart index df6bf864..303a3e90 100644 --- a/packages/apidash_core/lib/utils/auth_utils.dart +++ b/packages/better_networking/lib/utils/auth_utils.dart @@ -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) { diff --git a/packages/apidash_core/lib/utils/handle_auth.dart b/packages/better_networking/lib/utils/handle_auth.dart similarity index 95% rename from packages/apidash_core/lib/utils/handle_auth.dart rename to packages/better_networking/lib/utils/handle_auth.dart index 2922b81c..45a3f08c 100644 --- a/packages/apidash_core/lib/utils/handle_auth.dart +++ b/packages/better_networking/lib/utils/handle_auth.dart @@ -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) { diff --git a/packages/better_networking/lib/utils/utils.dart b/packages/better_networking/lib/utils/utils.dart index d334a022..95bfa931 100644 --- a/packages/better_networking/lib/utils/utils.dart +++ b/packages/better_networking/lib/utils/utils.dart @@ -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';