diff --git a/packages/better_networking/lib/models/auth/api_auth_model.dart b/packages/better_networking/lib/models/auth/api_auth_model.dart index 824ab543..4b9d3e4c 100644 --- a/packages/better_networking/lib/models/auth/api_auth_model.dart +++ b/packages/better_networking/lib/models/auth/api_auth_model.dart @@ -5,6 +5,7 @@ import 'auth_basic_model.dart'; import 'auth_bearer_model.dart'; import 'auth_jwt_model.dart'; import 'auth_digest_model.dart'; +import 'auth_oauth2_model.dart'; part 'api_auth_model.g.dart'; part 'api_auth_model.freezed.dart'; @@ -19,6 +20,7 @@ class AuthModel with _$AuthModel { AuthBasicAuthModel? basic, AuthJwtModel? jwt, AuthDigestModel? digest, + AuthOAuth2Model? oauth2, }) = _AuthModel; factory AuthModel.fromJson(Map json) => diff --git a/packages/better_networking/lib/models/auth/api_auth_model.freezed.dart b/packages/better_networking/lib/models/auth/api_auth_model.freezed.dart index 4e592fcc..1a29a056 100644 --- a/packages/better_networking/lib/models/auth/api_auth_model.freezed.dart +++ b/packages/better_networking/lib/models/auth/api_auth_model.freezed.dart @@ -27,6 +27,7 @@ mixin _$AuthModel { AuthBasicAuthModel? get basic => throw _privateConstructorUsedError; AuthJwtModel? get jwt => throw _privateConstructorUsedError; AuthDigestModel? get digest => throw _privateConstructorUsedError; + AuthOAuth2Model? get oauth2 => throw _privateConstructorUsedError; /// Serializes this AuthModel to a JSON map. Map toJson() => throw _privateConstructorUsedError; @@ -50,6 +51,7 @@ abstract class $AuthModelCopyWith<$Res> { AuthBasicAuthModel? basic, AuthJwtModel? jwt, AuthDigestModel? digest, + AuthOAuth2Model? oauth2, }); $AuthApiKeyModelCopyWith<$Res>? get apikey; @@ -57,6 +59,7 @@ abstract class $AuthModelCopyWith<$Res> { $AuthBasicAuthModelCopyWith<$Res>? get basic; $AuthJwtModelCopyWith<$Res>? get jwt; $AuthDigestModelCopyWith<$Res>? get digest; + $AuthOAuth2ModelCopyWith<$Res>? get oauth2; } /// @nodoc @@ -80,6 +83,7 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel> Object? basic = freezed, Object? jwt = freezed, Object? digest = freezed, + Object? oauth2 = freezed, }) { return _then( _value.copyWith( @@ -107,6 +111,10 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel> ? _value.digest : digest // ignore: cast_nullable_to_non_nullable as AuthDigestModel?, + oauth2: freezed == oauth2 + ? _value.oauth2 + : oauth2 // ignore: cast_nullable_to_non_nullable + as AuthOAuth2Model?, ) as $Val, ); @@ -181,6 +189,20 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel> return _then(_value.copyWith(digest: value) as $Val); }); } + + /// Create a copy of AuthModel + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $AuthOAuth2ModelCopyWith<$Res>? get oauth2 { + if (_value.oauth2 == null) { + return null; + } + + return $AuthOAuth2ModelCopyWith<$Res>(_value.oauth2!, (value) { + return _then(_value.copyWith(oauth2: value) as $Val); + }); + } } /// @nodoc @@ -199,6 +221,7 @@ abstract class _$$AuthModelImplCopyWith<$Res> AuthBasicAuthModel? basic, AuthJwtModel? jwt, AuthDigestModel? digest, + AuthOAuth2Model? oauth2, }); @override @@ -211,6 +234,8 @@ abstract class _$$AuthModelImplCopyWith<$Res> $AuthJwtModelCopyWith<$Res>? get jwt; @override $AuthDigestModelCopyWith<$Res>? get digest; + @override + $AuthOAuth2ModelCopyWith<$Res>? get oauth2; } /// @nodoc @@ -233,6 +258,7 @@ class __$$AuthModelImplCopyWithImpl<$Res> Object? basic = freezed, Object? jwt = freezed, Object? digest = freezed, + Object? oauth2 = freezed, }) { return _then( _$AuthModelImpl( @@ -260,6 +286,10 @@ class __$$AuthModelImplCopyWithImpl<$Res> ? _value.digest : digest // ignore: cast_nullable_to_non_nullable as AuthDigestModel?, + oauth2: freezed == oauth2 + ? _value.oauth2 + : oauth2 // ignore: cast_nullable_to_non_nullable + as AuthOAuth2Model?, ), ); } @@ -276,6 +306,7 @@ class _$AuthModelImpl implements _AuthModel { this.basic, this.jwt, this.digest, + this.oauth2, }); factory _$AuthModelImpl.fromJson(Map json) => @@ -293,10 +324,12 @@ class _$AuthModelImpl implements _AuthModel { final AuthJwtModel? jwt; @override final AuthDigestModel? digest; + @override + final AuthOAuth2Model? oauth2; @override String toString() { - return 'AuthModel(type: $type, apikey: $apikey, bearer: $bearer, basic: $basic, jwt: $jwt, digest: $digest)'; + return 'AuthModel(type: $type, apikey: $apikey, bearer: $bearer, basic: $basic, jwt: $jwt, digest: $digest, oauth2: $oauth2)'; } @override @@ -309,13 +342,22 @@ class _$AuthModelImpl implements _AuthModel { (identical(other.bearer, bearer) || other.bearer == bearer) && (identical(other.basic, basic) || other.basic == basic) && (identical(other.jwt, jwt) || other.jwt == jwt) && - (identical(other.digest, digest) || other.digest == digest)); + (identical(other.digest, digest) || other.digest == digest) && + (identical(other.oauth2, oauth2) || other.oauth2 == oauth2)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => - Object.hash(runtimeType, type, apikey, bearer, basic, jwt, digest); + int get hashCode => Object.hash( + runtimeType, + type, + apikey, + bearer, + basic, + jwt, + digest, + oauth2, + ); /// Create a copy of AuthModel /// with the given fields replaced by the non-null parameter values. @@ -339,6 +381,7 @@ abstract class _AuthModel implements AuthModel { final AuthBasicAuthModel? basic, final AuthJwtModel? jwt, final AuthDigestModel? digest, + final AuthOAuth2Model? oauth2, }) = _$AuthModelImpl; factory _AuthModel.fromJson(Map json) = @@ -356,6 +399,8 @@ abstract class _AuthModel implements AuthModel { AuthJwtModel? get jwt; @override AuthDigestModel? get digest; + @override + AuthOAuth2Model? get oauth2; /// Create a copy of AuthModel /// with the given fields replaced by the non-null parameter values. diff --git a/packages/better_networking/lib/models/auth/api_auth_model.g.dart b/packages/better_networking/lib/models/auth/api_auth_model.g.dart index 7b6ac418..2cd829f1 100644 --- a/packages/better_networking/lib/models/auth/api_auth_model.g.dart +++ b/packages/better_networking/lib/models/auth/api_auth_model.g.dart @@ -31,6 +31,11 @@ _$AuthModelImpl _$$AuthModelImplFromJson(Map json) => _$AuthModelImpl( : AuthDigestModel.fromJson( Map.from(json['digest'] as Map), ), + oauth2: json['oauth2'] == null + ? null + : AuthOAuth2Model.fromJson( + Map.from(json['oauth2'] as Map), + ), ); Map _$$AuthModelImplToJson(_$AuthModelImpl instance) => @@ -41,6 +46,7 @@ Map _$$AuthModelImplToJson(_$AuthModelImpl instance) => 'basic': instance.basic?.toJson(), 'jwt': instance.jwt?.toJson(), 'digest': instance.digest?.toJson(), + 'oauth2': instance.oauth2?.toJson(), }; const _$APIAuthTypeEnumMap = { diff --git a/packages/better_networking/lib/models/auth/auth_oauth2_model.dart b/packages/better_networking/lib/models/auth/auth_oauth2_model.dart new file mode 100644 index 00000000..fd5335bd --- /dev/null +++ b/packages/better_networking/lib/models/auth/auth_oauth2_model.dart @@ -0,0 +1,45 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'auth_oauth2_model.g.dart'; + +part 'auth_oauth2_model.freezed.dart'; + +@freezed +class AuthOAuth2Model with _$AuthOAuth2Model { + const factory AuthOAuth2Model({ + @Default("authorization_code") String grantType, + + required String authorizationUrl, + + required String accessTokenUrl, + + required String clientId, + + required String clientSecret, + + String? redirectUrl, + + String? scope, + + String? state, + + @Default("sha-256") String codeChallengeMethod, + + String? codeVerifier, + + String? codeChallenge, + + String? username, + + String? password, + + String? refreshToken, + + String? identityToken, + + String? accessToken, + }) = _AuthOAuth2Model; + + factory AuthOAuth2Model.fromJson(Map json) => + _$AuthOAuth2ModelFromJson(json); +} diff --git a/packages/better_networking/lib/models/auth/auth_oauth2_model.freezed.dart b/packages/better_networking/lib/models/auth/auth_oauth2_model.freezed.dart new file mode 100644 index 00000000..c48c5853 --- /dev/null +++ b/packages/better_networking/lib/models/auth/auth_oauth2_model.freezed.dart @@ -0,0 +1,516 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'auth_oauth2_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +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', +); + +AuthOAuth2Model _$AuthOAuth2ModelFromJson(Map json) { + return _AuthOAuth2Model.fromJson(json); +} + +/// @nodoc +mixin _$AuthOAuth2Model { + String get grantType => throw _privateConstructorUsedError; + String get authorizationUrl => throw _privateConstructorUsedError; + String get accessTokenUrl => throw _privateConstructorUsedError; + String get clientId => throw _privateConstructorUsedError; + String get clientSecret => throw _privateConstructorUsedError; + String? get redirectUrl => throw _privateConstructorUsedError; + String? get scope => throw _privateConstructorUsedError; + String? get state => throw _privateConstructorUsedError; + String get codeChallengeMethod => throw _privateConstructorUsedError; + String? get codeVerifier => throw _privateConstructorUsedError; + String? get codeChallenge => throw _privateConstructorUsedError; + String? get username => throw _privateConstructorUsedError; + String? get password => throw _privateConstructorUsedError; + String? get refreshToken => throw _privateConstructorUsedError; + String? get identityToken => throw _privateConstructorUsedError; + String? get accessToken => throw _privateConstructorUsedError; + + /// Serializes this AuthOAuth2Model to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of AuthOAuth2Model + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $AuthOAuth2ModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AuthOAuth2ModelCopyWith<$Res> { + factory $AuthOAuth2ModelCopyWith( + AuthOAuth2Model value, + $Res Function(AuthOAuth2Model) then, + ) = _$AuthOAuth2ModelCopyWithImpl<$Res, AuthOAuth2Model>; + @useResult + $Res call({ + String grantType, + String authorizationUrl, + String accessTokenUrl, + String clientId, + String clientSecret, + String? redirectUrl, + String? scope, + String? state, + String codeChallengeMethod, + String? codeVerifier, + String? codeChallenge, + String? username, + String? password, + String? refreshToken, + String? identityToken, + String? accessToken, + }); +} + +/// @nodoc +class _$AuthOAuth2ModelCopyWithImpl<$Res, $Val extends AuthOAuth2Model> + implements $AuthOAuth2ModelCopyWith<$Res> { + _$AuthOAuth2ModelCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of AuthOAuth2Model + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? grantType = null, + Object? authorizationUrl = null, + Object? accessTokenUrl = null, + Object? clientId = null, + Object? clientSecret = null, + Object? redirectUrl = freezed, + Object? scope = freezed, + Object? state = freezed, + Object? codeChallengeMethod = null, + Object? codeVerifier = freezed, + Object? codeChallenge = freezed, + Object? username = freezed, + Object? password = freezed, + Object? refreshToken = freezed, + Object? identityToken = freezed, + Object? accessToken = freezed, + }) { + return _then( + _value.copyWith( + grantType: null == grantType + ? _value.grantType + : grantType // ignore: cast_nullable_to_non_nullable + as String, + authorizationUrl: null == authorizationUrl + ? _value.authorizationUrl + : authorizationUrl // ignore: cast_nullable_to_non_nullable + as String, + accessTokenUrl: null == accessTokenUrl + ? _value.accessTokenUrl + : accessTokenUrl // ignore: cast_nullable_to_non_nullable + as String, + clientId: null == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String, + clientSecret: null == clientSecret + ? _value.clientSecret + : clientSecret // ignore: cast_nullable_to_non_nullable + as String, + redirectUrl: freezed == redirectUrl + ? _value.redirectUrl + : redirectUrl // ignore: cast_nullable_to_non_nullable + as String?, + scope: freezed == scope + ? _value.scope + : scope // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + codeChallengeMethod: null == codeChallengeMethod + ? _value.codeChallengeMethod + : codeChallengeMethod // ignore: cast_nullable_to_non_nullable + as String, + codeVerifier: freezed == codeVerifier + ? _value.codeVerifier + : codeVerifier // ignore: cast_nullable_to_non_nullable + as String?, + codeChallenge: freezed == codeChallenge + ? _value.codeChallenge + : codeChallenge // ignore: cast_nullable_to_non_nullable + as String?, + username: freezed == username + ? _value.username + : username // ignore: cast_nullable_to_non_nullable + as String?, + password: freezed == password + ? _value.password + : password // ignore: cast_nullable_to_non_nullable + as String?, + refreshToken: freezed == refreshToken + ? _value.refreshToken + : refreshToken // ignore: cast_nullable_to_non_nullable + as String?, + identityToken: freezed == identityToken + ? _value.identityToken + : identityToken // ignore: cast_nullable_to_non_nullable + as String?, + accessToken: freezed == accessToken + ? _value.accessToken + : accessToken // ignore: cast_nullable_to_non_nullable + as String?, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$AuthOAuth2ModelImplCopyWith<$Res> + implements $AuthOAuth2ModelCopyWith<$Res> { + factory _$$AuthOAuth2ModelImplCopyWith( + _$AuthOAuth2ModelImpl value, + $Res Function(_$AuthOAuth2ModelImpl) then, + ) = __$$AuthOAuth2ModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + String grantType, + String authorizationUrl, + String accessTokenUrl, + String clientId, + String clientSecret, + String? redirectUrl, + String? scope, + String? state, + String codeChallengeMethod, + String? codeVerifier, + String? codeChallenge, + String? username, + String? password, + String? refreshToken, + String? identityToken, + String? accessToken, + }); +} + +/// @nodoc +class __$$AuthOAuth2ModelImplCopyWithImpl<$Res> + extends _$AuthOAuth2ModelCopyWithImpl<$Res, _$AuthOAuth2ModelImpl> + implements _$$AuthOAuth2ModelImplCopyWith<$Res> { + __$$AuthOAuth2ModelImplCopyWithImpl( + _$AuthOAuth2ModelImpl _value, + $Res Function(_$AuthOAuth2ModelImpl) _then, + ) : super(_value, _then); + + /// Create a copy of AuthOAuth2Model + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? grantType = null, + Object? authorizationUrl = null, + Object? accessTokenUrl = null, + Object? clientId = null, + Object? clientSecret = null, + Object? redirectUrl = freezed, + Object? scope = freezed, + Object? state = freezed, + Object? codeChallengeMethod = null, + Object? codeVerifier = freezed, + Object? codeChallenge = freezed, + Object? username = freezed, + Object? password = freezed, + Object? refreshToken = freezed, + Object? identityToken = freezed, + Object? accessToken = freezed, + }) { + return _then( + _$AuthOAuth2ModelImpl( + grantType: null == grantType + ? _value.grantType + : grantType // ignore: cast_nullable_to_non_nullable + as String, + authorizationUrl: null == authorizationUrl + ? _value.authorizationUrl + : authorizationUrl // ignore: cast_nullable_to_non_nullable + as String, + accessTokenUrl: null == accessTokenUrl + ? _value.accessTokenUrl + : accessTokenUrl // ignore: cast_nullable_to_non_nullable + as String, + clientId: null == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String, + clientSecret: null == clientSecret + ? _value.clientSecret + : clientSecret // ignore: cast_nullable_to_non_nullable + as String, + redirectUrl: freezed == redirectUrl + ? _value.redirectUrl + : redirectUrl // ignore: cast_nullable_to_non_nullable + as String?, + scope: freezed == scope + ? _value.scope + : scope // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + codeChallengeMethod: null == codeChallengeMethod + ? _value.codeChallengeMethod + : codeChallengeMethod // ignore: cast_nullable_to_non_nullable + as String, + codeVerifier: freezed == codeVerifier + ? _value.codeVerifier + : codeVerifier // ignore: cast_nullable_to_non_nullable + as String?, + codeChallenge: freezed == codeChallenge + ? _value.codeChallenge + : codeChallenge // ignore: cast_nullable_to_non_nullable + as String?, + username: freezed == username + ? _value.username + : username // ignore: cast_nullable_to_non_nullable + as String?, + password: freezed == password + ? _value.password + : password // ignore: cast_nullable_to_non_nullable + as String?, + refreshToken: freezed == refreshToken + ? _value.refreshToken + : refreshToken // ignore: cast_nullable_to_non_nullable + as String?, + identityToken: freezed == identityToken + ? _value.identityToken + : identityToken // ignore: cast_nullable_to_non_nullable + as String?, + accessToken: freezed == accessToken + ? _value.accessToken + : accessToken // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} + +/// @nodoc +@JsonSerializable() +class _$AuthOAuth2ModelImpl implements _AuthOAuth2Model { + const _$AuthOAuth2ModelImpl({ + this.grantType = "authorization_code", + required this.authorizationUrl, + required this.accessTokenUrl, + required this.clientId, + required this.clientSecret, + this.redirectUrl, + this.scope, + this.state, + this.codeChallengeMethod = "sha-256", + this.codeVerifier, + this.codeChallenge, + this.username, + this.password, + this.refreshToken, + this.identityToken, + this.accessToken, + }); + + factory _$AuthOAuth2ModelImpl.fromJson(Map json) => + _$$AuthOAuth2ModelImplFromJson(json); + + @override + @JsonKey() + final String grantType; + @override + final String authorizationUrl; + @override + final String accessTokenUrl; + @override + final String clientId; + @override + final String clientSecret; + @override + final String? redirectUrl; + @override + final String? scope; + @override + final String? state; + @override + @JsonKey() + final String codeChallengeMethod; + @override + final String? codeVerifier; + @override + final String? codeChallenge; + @override + final String? username; + @override + final String? password; + @override + final String? refreshToken; + @override + final String? identityToken; + @override + final String? accessToken; + + @override + String toString() { + return 'AuthOAuth2Model(grantType: $grantType, authorizationUrl: $authorizationUrl, accessTokenUrl: $accessTokenUrl, clientId: $clientId, clientSecret: $clientSecret, redirectUrl: $redirectUrl, scope: $scope, state: $state, codeChallengeMethod: $codeChallengeMethod, codeVerifier: $codeVerifier, codeChallenge: $codeChallenge, username: $username, password: $password, refreshToken: $refreshToken, identityToken: $identityToken, accessToken: $accessToken)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AuthOAuth2ModelImpl && + (identical(other.grantType, grantType) || + other.grantType == grantType) && + (identical(other.authorizationUrl, authorizationUrl) || + other.authorizationUrl == authorizationUrl) && + (identical(other.accessTokenUrl, accessTokenUrl) || + other.accessTokenUrl == accessTokenUrl) && + (identical(other.clientId, clientId) || + other.clientId == clientId) && + (identical(other.clientSecret, clientSecret) || + other.clientSecret == clientSecret) && + (identical(other.redirectUrl, redirectUrl) || + other.redirectUrl == redirectUrl) && + (identical(other.scope, scope) || other.scope == scope) && + (identical(other.state, state) || other.state == state) && + (identical(other.codeChallengeMethod, codeChallengeMethod) || + other.codeChallengeMethod == codeChallengeMethod) && + (identical(other.codeVerifier, codeVerifier) || + other.codeVerifier == codeVerifier) && + (identical(other.codeChallenge, codeChallenge) || + other.codeChallenge == codeChallenge) && + (identical(other.username, username) || + other.username == username) && + (identical(other.password, password) || + other.password == password) && + (identical(other.refreshToken, refreshToken) || + other.refreshToken == refreshToken) && + (identical(other.identityToken, identityToken) || + other.identityToken == identityToken) && + (identical(other.accessToken, accessToken) || + other.accessToken == accessToken)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + grantType, + authorizationUrl, + accessTokenUrl, + clientId, + clientSecret, + redirectUrl, + scope, + state, + codeChallengeMethod, + codeVerifier, + codeChallenge, + username, + password, + refreshToken, + identityToken, + accessToken, + ); + + /// Create a copy of AuthOAuth2Model + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$AuthOAuth2ModelImplCopyWith<_$AuthOAuth2ModelImpl> get copyWith => + __$$AuthOAuth2ModelImplCopyWithImpl<_$AuthOAuth2ModelImpl>( + this, + _$identity, + ); + + @override + Map toJson() { + return _$$AuthOAuth2ModelImplToJson(this); + } +} + +abstract class _AuthOAuth2Model implements AuthOAuth2Model { + const factory _AuthOAuth2Model({ + final String grantType, + required final String authorizationUrl, + required final String accessTokenUrl, + required final String clientId, + required final String clientSecret, + final String? redirectUrl, + final String? scope, + final String? state, + final String codeChallengeMethod, + final String? codeVerifier, + final String? codeChallenge, + final String? username, + final String? password, + final String? refreshToken, + final String? identityToken, + final String? accessToken, + }) = _$AuthOAuth2ModelImpl; + + factory _AuthOAuth2Model.fromJson(Map json) = + _$AuthOAuth2ModelImpl.fromJson; + + @override + String get grantType; + @override + String get authorizationUrl; + @override + String get accessTokenUrl; + @override + String get clientId; + @override + String get clientSecret; + @override + String? get redirectUrl; + @override + String? get scope; + @override + String? get state; + @override + String get codeChallengeMethod; + @override + String? get codeVerifier; + @override + String? get codeChallenge; + @override + String? get username; + @override + String? get password; + @override + String? get refreshToken; + @override + String? get identityToken; + @override + String? get accessToken; + + /// Create a copy of AuthOAuth2Model + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$AuthOAuth2ModelImplCopyWith<_$AuthOAuth2ModelImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/better_networking/lib/models/auth/auth_oauth2_model.g.dart b/packages/better_networking/lib/models/auth/auth_oauth2_model.g.dart new file mode 100644 index 00000000..79b7e0ad --- /dev/null +++ b/packages/better_networking/lib/models/auth/auth_oauth2_model.g.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'auth_oauth2_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$AuthOAuth2ModelImpl _$$AuthOAuth2ModelImplFromJson( + Map json, +) => _$AuthOAuth2ModelImpl( + grantType: json['grantType'] as String? ?? "authorization_code", + authorizationUrl: json['authorizationUrl'] as String, + accessTokenUrl: json['accessTokenUrl'] as String, + clientId: json['clientId'] as String, + clientSecret: json['clientSecret'] as String, + redirectUrl: json['redirectUrl'] as String?, + scope: json['scope'] as String?, + state: json['state'] as String?, + codeChallengeMethod: json['codeChallengeMethod'] as String? ?? "sha-256", + codeVerifier: json['codeVerifier'] as String?, + codeChallenge: json['codeChallenge'] as String?, + username: json['username'] as String?, + password: json['password'] as String?, + refreshToken: json['refreshToken'] as String?, + identityToken: json['identityToken'] as String?, + accessToken: json['accessToken'] as String?, +); + +Map _$$AuthOAuth2ModelImplToJson( + _$AuthOAuth2ModelImpl instance, +) => { + 'grantType': instance.grantType, + 'authorizationUrl': instance.authorizationUrl, + 'accessTokenUrl': instance.accessTokenUrl, + 'clientId': instance.clientId, + 'clientSecret': instance.clientSecret, + 'redirectUrl': instance.redirectUrl, + 'scope': instance.scope, + 'state': instance.state, + 'codeChallengeMethod': instance.codeChallengeMethod, + 'codeVerifier': instance.codeVerifier, + 'codeChallenge': instance.codeChallenge, + 'username': instance.username, + 'password': instance.password, + 'refreshToken': instance.refreshToken, + 'identityToken': instance.identityToken, + 'accessToken': instance.accessToken, +}; diff --git a/packages/better_networking/lib/models/models.dart b/packages/better_networking/lib/models/models.dart index 2987393d..6f559000 100644 --- a/packages/better_networking/lib/models/models.dart +++ b/packages/better_networking/lib/models/models.dart @@ -6,3 +6,4 @@ export 'auth/auth_basic_model.dart'; export 'auth/auth_bearer_model.dart'; export 'auth/auth_jwt_model.dart'; export 'auth/auth_digest_model.dart'; +export 'auth/auth_oauth2_model.dart'; \ No newline at end of file