feat: make credentialsFilePath nullable in OAuth models and update related logic

This commit is contained in:
Udhay-Adithya
2025-08-06 11:43:56 +05:30
parent 71a98cd2e5
commit c0bb09fd35
10 changed files with 68 additions and 60 deletions

View File

@@ -10,10 +10,11 @@ class AuthOAuth1Model with _$AuthOAuth1Model {
const factory AuthOAuth1Model({
required String consumerKey,
required String consumerSecret,
required String credentialsFilePath,
String? credentialsFilePath,
String? accessToken,
String? tokenSecret,
@Default(OAuth1SignatureMethod.hmacSha1) OAuth1SignatureMethod signatureMethod,
@Default(OAuth1SignatureMethod.hmacSha1)
OAuth1SignatureMethod signatureMethod,
@Default("header") String parameterLocation,
@Default('1.0') String version,
String? realm,

View File

@@ -23,7 +23,7 @@ AuthOAuth1Model _$AuthOAuth1ModelFromJson(Map<String, dynamic> json) {
mixin _$AuthOAuth1Model {
String get consumerKey => throw _privateConstructorUsedError;
String get consumerSecret => throw _privateConstructorUsedError;
String get credentialsFilePath => throw _privateConstructorUsedError;
String? get credentialsFilePath => throw _privateConstructorUsedError;
String? get accessToken => throw _privateConstructorUsedError;
String? get tokenSecret => throw _privateConstructorUsedError;
OAuth1SignatureMethod get signatureMethod =>
@@ -57,7 +57,7 @@ abstract class $AuthOAuth1ModelCopyWith<$Res> {
$Res call({
String consumerKey,
String consumerSecret,
String credentialsFilePath,
String? credentialsFilePath,
String? accessToken,
String? tokenSecret,
OAuth1SignatureMethod signatureMethod,
@@ -89,7 +89,7 @@ class _$AuthOAuth1ModelCopyWithImpl<$Res, $Val extends AuthOAuth1Model>
$Res call({
Object? consumerKey = null,
Object? consumerSecret = null,
Object? credentialsFilePath = null,
Object? credentialsFilePath = freezed,
Object? accessToken = freezed,
Object? tokenSecret = freezed,
Object? signatureMethod = null,
@@ -112,10 +112,10 @@ class _$AuthOAuth1ModelCopyWithImpl<$Res, $Val extends AuthOAuth1Model>
? _value.consumerSecret
: consumerSecret // ignore: cast_nullable_to_non_nullable
as String,
credentialsFilePath: null == credentialsFilePath
credentialsFilePath: freezed == credentialsFilePath
? _value.credentialsFilePath
: credentialsFilePath // ignore: cast_nullable_to_non_nullable
as String,
as String?,
accessToken: freezed == accessToken
? _value.accessToken
: accessToken // ignore: cast_nullable_to_non_nullable
@@ -178,7 +178,7 @@ abstract class _$$AuthOAuth1ModelImplCopyWith<$Res>
$Res call({
String consumerKey,
String consumerSecret,
String credentialsFilePath,
String? credentialsFilePath,
String? accessToken,
String? tokenSecret,
OAuth1SignatureMethod signatureMethod,
@@ -209,7 +209,7 @@ class __$$AuthOAuth1ModelImplCopyWithImpl<$Res>
$Res call({
Object? consumerKey = null,
Object? consumerSecret = null,
Object? credentialsFilePath = null,
Object? credentialsFilePath = freezed,
Object? accessToken = freezed,
Object? tokenSecret = freezed,
Object? signatureMethod = null,
@@ -232,10 +232,10 @@ class __$$AuthOAuth1ModelImplCopyWithImpl<$Res>
? _value.consumerSecret
: consumerSecret // ignore: cast_nullable_to_non_nullable
as String,
credentialsFilePath: null == credentialsFilePath
credentialsFilePath: freezed == credentialsFilePath
? _value.credentialsFilePath
: credentialsFilePath // ignore: cast_nullable_to_non_nullable
as String,
as String?,
accessToken: freezed == accessToken
? _value.accessToken
: accessToken // ignore: cast_nullable_to_non_nullable
@@ -291,7 +291,7 @@ class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model {
const _$AuthOAuth1ModelImpl({
required this.consumerKey,
required this.consumerSecret,
required this.credentialsFilePath,
this.credentialsFilePath,
this.accessToken,
this.tokenSecret,
this.signatureMethod = OAuth1SignatureMethod.hmacSha1,
@@ -313,7 +313,7 @@ class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model {
@override
final String consumerSecret;
@override
final String credentialsFilePath;
final String? credentialsFilePath;
@override
final String? accessToken;
@override
@@ -419,7 +419,7 @@ abstract class _AuthOAuth1Model implements AuthOAuth1Model {
const factory _AuthOAuth1Model({
required final String consumerKey,
required final String consumerSecret,
required final String credentialsFilePath,
final String? credentialsFilePath,
final String? accessToken,
final String? tokenSecret,
final OAuth1SignatureMethod signatureMethod,
@@ -441,7 +441,7 @@ abstract class _AuthOAuth1Model implements AuthOAuth1Model {
@override
String get consumerSecret;
@override
String get credentialsFilePath;
String? get credentialsFilePath;
@override
String? get accessToken;
@override

View File

@@ -11,7 +11,7 @@ _$AuthOAuth1ModelImpl _$$AuthOAuth1ModelImplFromJson(
) => _$AuthOAuth1ModelImpl(
consumerKey: json['consumerKey'] as String,
consumerSecret: json['consumerSecret'] as String,
credentialsFilePath: json['credentialsFilePath'] as String,
credentialsFilePath: json['credentialsFilePath'] as String?,
accessToken: json['accessToken'] as String?,
tokenSecret: json['tokenSecret'] as String?,
signatureMethod:

View File

@@ -13,7 +13,7 @@ class AuthOAuth2Model with _$AuthOAuth2Model {
required String accessTokenUrl,
required String clientId,
required String clientSecret,
required String credentialsFilePath,
String? credentialsFilePath,
String? redirectUrl,
String? scope,
String? state,

View File

@@ -26,7 +26,7 @@ mixin _$AuthOAuth2Model {
String get accessTokenUrl => throw _privateConstructorUsedError;
String get clientId => throw _privateConstructorUsedError;
String get clientSecret => throw _privateConstructorUsedError;
String get credentialsFilePath => throw _privateConstructorUsedError;
String? get credentialsFilePath => throw _privateConstructorUsedError;
String? get redirectUrl => throw _privateConstructorUsedError;
String? get scope => throw _privateConstructorUsedError;
String? get state => throw _privateConstructorUsedError;
@@ -62,7 +62,7 @@ abstract class $AuthOAuth2ModelCopyWith<$Res> {
String accessTokenUrl,
String clientId,
String clientSecret,
String credentialsFilePath,
String? credentialsFilePath,
String? redirectUrl,
String? scope,
String? state,
@@ -97,7 +97,7 @@ class _$AuthOAuth2ModelCopyWithImpl<$Res, $Val extends AuthOAuth2Model>
Object? accessTokenUrl = null,
Object? clientId = null,
Object? clientSecret = null,
Object? credentialsFilePath = null,
Object? credentialsFilePath = freezed,
Object? redirectUrl = freezed,
Object? scope = freezed,
Object? state = freezed,
@@ -132,10 +132,10 @@ class _$AuthOAuth2ModelCopyWithImpl<$Res, $Val extends AuthOAuth2Model>
? _value.clientSecret
: clientSecret // ignore: cast_nullable_to_non_nullable
as String,
credentialsFilePath: null == credentialsFilePath
credentialsFilePath: freezed == credentialsFilePath
? _value.credentialsFilePath
: credentialsFilePath // ignore: cast_nullable_to_non_nullable
as String,
as String?,
redirectUrl: freezed == redirectUrl
? _value.redirectUrl
: redirectUrl // ignore: cast_nullable_to_non_nullable
@@ -201,7 +201,7 @@ abstract class _$$AuthOAuth2ModelImplCopyWith<$Res>
String accessTokenUrl,
String clientId,
String clientSecret,
String credentialsFilePath,
String? credentialsFilePath,
String? redirectUrl,
String? scope,
String? state,
@@ -235,7 +235,7 @@ class __$$AuthOAuth2ModelImplCopyWithImpl<$Res>
Object? accessTokenUrl = null,
Object? clientId = null,
Object? clientSecret = null,
Object? credentialsFilePath = null,
Object? credentialsFilePath = freezed,
Object? redirectUrl = freezed,
Object? scope = freezed,
Object? state = freezed,
@@ -270,10 +270,10 @@ class __$$AuthOAuth2ModelImplCopyWithImpl<$Res>
? _value.clientSecret
: clientSecret // ignore: cast_nullable_to_non_nullable
as String,
credentialsFilePath: null == credentialsFilePath
credentialsFilePath: freezed == credentialsFilePath
? _value.credentialsFilePath
: credentialsFilePath // ignore: cast_nullable_to_non_nullable
as String,
as String?,
redirectUrl: freezed == redirectUrl
? _value.redirectUrl
: redirectUrl // ignore: cast_nullable_to_non_nullable
@@ -332,7 +332,7 @@ class _$AuthOAuth2ModelImpl implements _AuthOAuth2Model {
required this.accessTokenUrl,
required this.clientId,
required this.clientSecret,
required this.credentialsFilePath,
this.credentialsFilePath,
this.redirectUrl,
this.scope,
this.state,
@@ -361,7 +361,7 @@ class _$AuthOAuth2ModelImpl implements _AuthOAuth2Model {
@override
final String clientSecret;
@override
final String credentialsFilePath;
final String? credentialsFilePath;
@override
final String? redirectUrl;
@override
@@ -477,7 +477,7 @@ abstract class _AuthOAuth2Model implements AuthOAuth2Model {
required final String accessTokenUrl,
required final String clientId,
required final String clientSecret,
required final String credentialsFilePath,
final String? credentialsFilePath,
final String? redirectUrl,
final String? scope,
final String? state,
@@ -505,7 +505,7 @@ abstract class _AuthOAuth2Model implements AuthOAuth2Model {
@override
String get clientSecret;
@override
String get credentialsFilePath;
String? get credentialsFilePath;
@override
String? get redirectUrl;
@override

View File

@@ -16,7 +16,7 @@ _$AuthOAuth2ModelImpl _$$AuthOAuth2ModelImplFromJson(
accessTokenUrl: json['accessTokenUrl'] as String,
clientId: json['clientId'] as String,
clientSecret: json['clientSecret'] as String,
credentialsFilePath: json['credentialsFilePath'] as String,
credentialsFilePath: json['credentialsFilePath'] as String?,
redirectUrl: json['redirectUrl'] as String?,
scope: json['scope'] as String?,
state: json['state'] as String?,