diff --git a/packages/better_networking/better_networking_example/pubspec.lock b/packages/better_networking/better_networking_example/pubspec.lock index bf796c18..8e46ff9e 100644 --- a/packages/better_networking/better_networking_example/pubspec.lock +++ b/packages/better_networking/better_networking_example/pubspec.lock @@ -9,38 +9,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" - app_links: - dependency: transitive - description: - name: app_links - sha256: "85ed8fc1d25a76475914fff28cc994653bd900bc2c26e4b57a49e097febb54ba" - url: "https://pub.dev" - source: hosted - version: "6.4.0" - app_links_linux: - dependency: transitive - description: - name: app_links_linux - sha256: f5f7173a78609f3dfd4c2ff2c95bd559ab43c80a87dc6a095921d96c05688c81 - url: "https://pub.dev" - source: hosted - version: "1.0.3" - app_links_platform_interface: - dependency: transitive - description: - name: app_links_platform_interface - sha256: "05f5379577c513b534a29ddea68176a4d4802c46180ee8e2e966257158772a3f" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - app_links_web: - dependency: transitive - description: - name: app_links_web - sha256: af060ed76183f9e2b87510a9480e56a5352b6c249778d07bd2c95fc35632a555 - url: "https://pub.dev" - source: hosted - version: "1.0.4" async: dependency: transitive description: @@ -207,14 +175,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.4" - gtk: - dependency: transitive - description: - name: gtk - sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c - url: "https://pub.dev" - source: hosted - version: "2.1.0" http: dependency: transitive description: @@ -303,6 +263,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.16.0" + oauth1: + dependency: transitive + description: + name: oauth1 + sha256: "1d424e3c24017a6c5714acb12e0dd76c2fdff96db6d6ef0aab58c925ffc28ae0" + url: "https://pub.dev" + source: hosted + version: "2.1.0" oauth2: dependency: transitive description: @@ -555,38 +523,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" - webview_flutter: - dependency: transitive - description: - name: webview_flutter - sha256: c3e4fe614b1c814950ad07186007eff2f2e5dd2935eba7b9a9a1af8e5885f1ba - url: "https://pub.dev" - source: hosted - version: "4.13.0" - webview_flutter_android: - dependency: transitive - description: - name: webview_flutter_android - sha256: "9573ad97890d199ac3ab32399aa33a5412163b37feb573eb5b0a76b35e9ffe41" - url: "https://pub.dev" - source: hosted - version: "4.8.2" - webview_flutter_platform_interface: - dependency: transitive - description: - name: webview_flutter_platform_interface - sha256: f0dc2dc3a2b1e3a6abdd6801b9355ebfeb3b8f6cde6b9dc7c9235909c4a1f147 - url: "https://pub.dev" - source: hosted - version: "2.13.1" - webview_flutter_wkwebview: - dependency: transitive - description: - name: webview_flutter_wkwebview - sha256: "71523b9048cf510cfa1fd4e0a3fa5e476a66e0884d5df51d59d5023dba237107" - url: "https://pub.dev" - source: hosted - version: "3.22.1" window_to_front: dependency: transitive description: 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 4b9d3e4c..64ea2f3d 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_oauth1_model.dart'; import 'auth_oauth2_model.dart'; part 'api_auth_model.g.dart'; @@ -20,6 +21,7 @@ class AuthModel with _$AuthModel { AuthBasicAuthModel? basic, AuthJwtModel? jwt, AuthDigestModel? digest, + AuthOAuth1Model? oauth1, AuthOAuth2Model? oauth2, }) = _AuthModel; 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 1a29a056..eb2d6216 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; + AuthOAuth1Model? get oauth1 => throw _privateConstructorUsedError; AuthOAuth2Model? get oauth2 => throw _privateConstructorUsedError; /// Serializes this AuthModel to a JSON map. @@ -51,6 +52,7 @@ abstract class $AuthModelCopyWith<$Res> { AuthBasicAuthModel? basic, AuthJwtModel? jwt, AuthDigestModel? digest, + AuthOAuth1Model? oauth1, AuthOAuth2Model? oauth2, }); @@ -59,6 +61,7 @@ abstract class $AuthModelCopyWith<$Res> { $AuthBasicAuthModelCopyWith<$Res>? get basic; $AuthJwtModelCopyWith<$Res>? get jwt; $AuthDigestModelCopyWith<$Res>? get digest; + $AuthOAuth1ModelCopyWith<$Res>? get oauth1; $AuthOAuth2ModelCopyWith<$Res>? get oauth2; } @@ -83,6 +86,7 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel> Object? basic = freezed, Object? jwt = freezed, Object? digest = freezed, + Object? oauth1 = freezed, Object? oauth2 = freezed, }) { return _then( @@ -111,6 +115,10 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel> ? _value.digest : digest // ignore: cast_nullable_to_non_nullable as AuthDigestModel?, + oauth1: freezed == oauth1 + ? _value.oauth1 + : oauth1 // ignore: cast_nullable_to_non_nullable + as AuthOAuth1Model?, oauth2: freezed == oauth2 ? _value.oauth2 : oauth2 // ignore: cast_nullable_to_non_nullable @@ -190,6 +198,20 @@ class _$AuthModelCopyWithImpl<$Res, $Val extends AuthModel> }); } + /// Create a copy of AuthModel + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $AuthOAuth1ModelCopyWith<$Res>? get oauth1 { + if (_value.oauth1 == null) { + return null; + } + + return $AuthOAuth1ModelCopyWith<$Res>(_value.oauth1!, (value) { + return _then(_value.copyWith(oauth1: value) as $Val); + }); + } + /// Create a copy of AuthModel /// with the given fields replaced by the non-null parameter values. @override @@ -221,6 +243,7 @@ abstract class _$$AuthModelImplCopyWith<$Res> AuthBasicAuthModel? basic, AuthJwtModel? jwt, AuthDigestModel? digest, + AuthOAuth1Model? oauth1, AuthOAuth2Model? oauth2, }); @@ -235,6 +258,8 @@ abstract class _$$AuthModelImplCopyWith<$Res> @override $AuthDigestModelCopyWith<$Res>? get digest; @override + $AuthOAuth1ModelCopyWith<$Res>? get oauth1; + @override $AuthOAuth2ModelCopyWith<$Res>? get oauth2; } @@ -258,6 +283,7 @@ class __$$AuthModelImplCopyWithImpl<$Res> Object? basic = freezed, Object? jwt = freezed, Object? digest = freezed, + Object? oauth1 = freezed, Object? oauth2 = freezed, }) { return _then( @@ -286,6 +312,10 @@ class __$$AuthModelImplCopyWithImpl<$Res> ? _value.digest : digest // ignore: cast_nullable_to_non_nullable as AuthDigestModel?, + oauth1: freezed == oauth1 + ? _value.oauth1 + : oauth1 // ignore: cast_nullable_to_non_nullable + as AuthOAuth1Model?, oauth2: freezed == oauth2 ? _value.oauth2 : oauth2 // ignore: cast_nullable_to_non_nullable @@ -306,6 +336,7 @@ class _$AuthModelImpl implements _AuthModel { this.basic, this.jwt, this.digest, + this.oauth1, this.oauth2, }); @@ -325,11 +356,13 @@ class _$AuthModelImpl implements _AuthModel { @override final AuthDigestModel? digest; @override + final AuthOAuth1Model? oauth1; + @override final AuthOAuth2Model? oauth2; @override String toString() { - return 'AuthModel(type: $type, apikey: $apikey, bearer: $bearer, basic: $basic, jwt: $jwt, digest: $digest, oauth2: $oauth2)'; + return 'AuthModel(type: $type, apikey: $apikey, bearer: $bearer, basic: $basic, jwt: $jwt, digest: $digest, oauth1: $oauth1, oauth2: $oauth2)'; } @override @@ -343,6 +376,7 @@ class _$AuthModelImpl implements _AuthModel { (identical(other.basic, basic) || other.basic == basic) && (identical(other.jwt, jwt) || other.jwt == jwt) && (identical(other.digest, digest) || other.digest == digest) && + (identical(other.oauth1, oauth1) || other.oauth1 == oauth1) && (identical(other.oauth2, oauth2) || other.oauth2 == oauth2)); } @@ -356,6 +390,7 @@ class _$AuthModelImpl implements _AuthModel { basic, jwt, digest, + oauth1, oauth2, ); @@ -381,6 +416,7 @@ abstract class _AuthModel implements AuthModel { final AuthBasicAuthModel? basic, final AuthJwtModel? jwt, final AuthDigestModel? digest, + final AuthOAuth1Model? oauth1, final AuthOAuth2Model? oauth2, }) = _$AuthModelImpl; @@ -400,6 +436,8 @@ abstract class _AuthModel implements AuthModel { @override AuthDigestModel? get digest; @override + AuthOAuth1Model? get oauth1; + @override AuthOAuth2Model? get oauth2; /// Create a copy of AuthModel 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 2cd829f1..92b064d6 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), ), + oauth1: json['oauth1'] == null + ? null + : AuthOAuth1Model.fromJson( + Map.from(json['oauth1'] as Map), + ), oauth2: json['oauth2'] == null ? null : AuthOAuth2Model.fromJson( @@ -46,6 +51,7 @@ Map _$$AuthModelImplToJson(_$AuthModelImpl instance) => 'basic': instance.basic?.toJson(), 'jwt': instance.jwt?.toJson(), 'digest': instance.digest?.toJson(), + 'oauth1': instance.oauth1?.toJson(), 'oauth2': instance.oauth2?.toJson(), }; diff --git a/packages/better_networking/lib/models/auth/auth_oauth1_model.dart b/packages/better_networking/lib/models/auth/auth_oauth1_model.dart new file mode 100644 index 00000000..33d4567e --- /dev/null +++ b/packages/better_networking/lib/models/auth/auth_oauth1_model.dart @@ -0,0 +1,27 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'auth_oauth1_model.g.dart'; + +part 'auth_oauth1_model.freezed.dart'; + +@freezed +class AuthOAuth1Model with _$AuthOAuth1Model { + const factory AuthOAuth1Model({ + required String consumerKey, + required String consumerSecret, + String? accessToken, + String? tokenSecret, + @Default("hmacSha1") String signatureMethod, + @Default("header") String parameterLocation, + @Default('1.0') String version, + String? realm, + String? callbackUrl, + String? verifier, + String? nonce, + String? timestamp, + @Default(false) bool includeBodyHash, + }) = _AuthOAuth1Model; + + factory AuthOAuth1Model.fromJson(Map json) => + _$AuthOAuth1ModelFromJson(json); +} diff --git a/packages/better_networking/lib/models/auth/auth_oauth1_model.freezed.dart b/packages/better_networking/lib/models/auth/auth_oauth1_model.freezed.dart new file mode 100644 index 00000000..811cc121 --- /dev/null +++ b/packages/better_networking/lib/models/auth/auth_oauth1_model.freezed.dart @@ -0,0 +1,451 @@ +// 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_oauth1_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', +); + +AuthOAuth1Model _$AuthOAuth1ModelFromJson(Map json) { + return _AuthOAuth1Model.fromJson(json); +} + +/// @nodoc +mixin _$AuthOAuth1Model { + String get consumerKey => throw _privateConstructorUsedError; + String get consumerSecret => throw _privateConstructorUsedError; + String? get accessToken => throw _privateConstructorUsedError; + String? get tokenSecret => throw _privateConstructorUsedError; + String get signatureMethod => throw _privateConstructorUsedError; + String get parameterLocation => throw _privateConstructorUsedError; + String get version => throw _privateConstructorUsedError; + String? get realm => throw _privateConstructorUsedError; + String? get callbackUrl => throw _privateConstructorUsedError; + String? get verifier => throw _privateConstructorUsedError; + String? get nonce => throw _privateConstructorUsedError; + String? get timestamp => throw _privateConstructorUsedError; + bool get includeBodyHash => throw _privateConstructorUsedError; + + /// Serializes this AuthOAuth1Model to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of AuthOAuth1Model + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $AuthOAuth1ModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AuthOAuth1ModelCopyWith<$Res> { + factory $AuthOAuth1ModelCopyWith( + AuthOAuth1Model value, + $Res Function(AuthOAuth1Model) then, + ) = _$AuthOAuth1ModelCopyWithImpl<$Res, AuthOAuth1Model>; + @useResult + $Res call({ + String consumerKey, + String consumerSecret, + String? accessToken, + String? tokenSecret, + String signatureMethod, + String parameterLocation, + String version, + String? realm, + String? callbackUrl, + String? verifier, + String? nonce, + String? timestamp, + bool includeBodyHash, + }); +} + +/// @nodoc +class _$AuthOAuth1ModelCopyWithImpl<$Res, $Val extends AuthOAuth1Model> + implements $AuthOAuth1ModelCopyWith<$Res> { + _$AuthOAuth1ModelCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of AuthOAuth1Model + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? consumerKey = null, + Object? consumerSecret = null, + Object? accessToken = freezed, + Object? tokenSecret = freezed, + Object? signatureMethod = null, + Object? parameterLocation = null, + Object? version = null, + Object? realm = freezed, + Object? callbackUrl = freezed, + Object? verifier = freezed, + Object? nonce = freezed, + Object? timestamp = freezed, + Object? includeBodyHash = null, + }) { + return _then( + _value.copyWith( + consumerKey: null == consumerKey + ? _value.consumerKey + : consumerKey // ignore: cast_nullable_to_non_nullable + as String, + consumerSecret: null == consumerSecret + ? _value.consumerSecret + : consumerSecret // ignore: cast_nullable_to_non_nullable + as String, + accessToken: freezed == accessToken + ? _value.accessToken + : accessToken // ignore: cast_nullable_to_non_nullable + as String?, + tokenSecret: freezed == tokenSecret + ? _value.tokenSecret + : tokenSecret // ignore: cast_nullable_to_non_nullable + as String?, + signatureMethod: null == signatureMethod + ? _value.signatureMethod + : signatureMethod // ignore: cast_nullable_to_non_nullable + as String, + parameterLocation: null == parameterLocation + ? _value.parameterLocation + : parameterLocation // ignore: cast_nullable_to_non_nullable + as String, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + realm: freezed == realm + ? _value.realm + : realm // ignore: cast_nullable_to_non_nullable + as String?, + callbackUrl: freezed == callbackUrl + ? _value.callbackUrl + : callbackUrl // ignore: cast_nullable_to_non_nullable + as String?, + verifier: freezed == verifier + ? _value.verifier + : verifier // ignore: cast_nullable_to_non_nullable + as String?, + nonce: freezed == nonce + ? _value.nonce + : nonce // ignore: cast_nullable_to_non_nullable + as String?, + timestamp: freezed == timestamp + ? _value.timestamp + : timestamp // ignore: cast_nullable_to_non_nullable + as String?, + includeBodyHash: null == includeBodyHash + ? _value.includeBodyHash + : includeBodyHash // ignore: cast_nullable_to_non_nullable + as bool, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$AuthOAuth1ModelImplCopyWith<$Res> + implements $AuthOAuth1ModelCopyWith<$Res> { + factory _$$AuthOAuth1ModelImplCopyWith( + _$AuthOAuth1ModelImpl value, + $Res Function(_$AuthOAuth1ModelImpl) then, + ) = __$$AuthOAuth1ModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + String consumerKey, + String consumerSecret, + String? accessToken, + String? tokenSecret, + String signatureMethod, + String parameterLocation, + String version, + String? realm, + String? callbackUrl, + String? verifier, + String? nonce, + String? timestamp, + bool includeBodyHash, + }); +} + +/// @nodoc +class __$$AuthOAuth1ModelImplCopyWithImpl<$Res> + extends _$AuthOAuth1ModelCopyWithImpl<$Res, _$AuthOAuth1ModelImpl> + implements _$$AuthOAuth1ModelImplCopyWith<$Res> { + __$$AuthOAuth1ModelImplCopyWithImpl( + _$AuthOAuth1ModelImpl _value, + $Res Function(_$AuthOAuth1ModelImpl) _then, + ) : super(_value, _then); + + /// Create a copy of AuthOAuth1Model + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? consumerKey = null, + Object? consumerSecret = null, + Object? accessToken = freezed, + Object? tokenSecret = freezed, + Object? signatureMethod = null, + Object? parameterLocation = null, + Object? version = null, + Object? realm = freezed, + Object? callbackUrl = freezed, + Object? verifier = freezed, + Object? nonce = freezed, + Object? timestamp = freezed, + Object? includeBodyHash = null, + }) { + return _then( + _$AuthOAuth1ModelImpl( + consumerKey: null == consumerKey + ? _value.consumerKey + : consumerKey // ignore: cast_nullable_to_non_nullable + as String, + consumerSecret: null == consumerSecret + ? _value.consumerSecret + : consumerSecret // ignore: cast_nullable_to_non_nullable + as String, + accessToken: freezed == accessToken + ? _value.accessToken + : accessToken // ignore: cast_nullable_to_non_nullable + as String?, + tokenSecret: freezed == tokenSecret + ? _value.tokenSecret + : tokenSecret // ignore: cast_nullable_to_non_nullable + as String?, + signatureMethod: null == signatureMethod + ? _value.signatureMethod + : signatureMethod // ignore: cast_nullable_to_non_nullable + as String, + parameterLocation: null == parameterLocation + ? _value.parameterLocation + : parameterLocation // ignore: cast_nullable_to_non_nullable + as String, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + realm: freezed == realm + ? _value.realm + : realm // ignore: cast_nullable_to_non_nullable + as String?, + callbackUrl: freezed == callbackUrl + ? _value.callbackUrl + : callbackUrl // ignore: cast_nullable_to_non_nullable + as String?, + verifier: freezed == verifier + ? _value.verifier + : verifier // ignore: cast_nullable_to_non_nullable + as String?, + nonce: freezed == nonce + ? _value.nonce + : nonce // ignore: cast_nullable_to_non_nullable + as String?, + timestamp: freezed == timestamp + ? _value.timestamp + : timestamp // ignore: cast_nullable_to_non_nullable + as String?, + includeBodyHash: null == includeBodyHash + ? _value.includeBodyHash + : includeBodyHash // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} + +/// @nodoc +@JsonSerializable() +class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model { + const _$AuthOAuth1ModelImpl({ + required this.consumerKey, + required this.consumerSecret, + this.accessToken, + this.tokenSecret, + this.signatureMethod = "hmacSha1", + this.parameterLocation = "header", + this.version = '1.0', + this.realm, + this.callbackUrl, + this.verifier, + this.nonce, + this.timestamp, + this.includeBodyHash = false, + }); + + factory _$AuthOAuth1ModelImpl.fromJson(Map json) => + _$$AuthOAuth1ModelImplFromJson(json); + + @override + final String consumerKey; + @override + final String consumerSecret; + @override + final String? accessToken; + @override + final String? tokenSecret; + @override + @JsonKey() + final String signatureMethod; + @override + @JsonKey() + final String parameterLocation; + @override + @JsonKey() + final String version; + @override + final String? realm; + @override + final String? callbackUrl; + @override + final String? verifier; + @override + final String? nonce; + @override + final String? timestamp; + @override + @JsonKey() + final bool includeBodyHash; + + @override + String toString() { + return 'AuthOAuth1Model(consumerKey: $consumerKey, consumerSecret: $consumerSecret, accessToken: $accessToken, tokenSecret: $tokenSecret, signatureMethod: $signatureMethod, parameterLocation: $parameterLocation, version: $version, realm: $realm, callbackUrl: $callbackUrl, verifier: $verifier, nonce: $nonce, timestamp: $timestamp, includeBodyHash: $includeBodyHash)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AuthOAuth1ModelImpl && + (identical(other.consumerKey, consumerKey) || + other.consumerKey == consumerKey) && + (identical(other.consumerSecret, consumerSecret) || + other.consumerSecret == consumerSecret) && + (identical(other.accessToken, accessToken) || + other.accessToken == accessToken) && + (identical(other.tokenSecret, tokenSecret) || + other.tokenSecret == tokenSecret) && + (identical(other.signatureMethod, signatureMethod) || + other.signatureMethod == signatureMethod) && + (identical(other.parameterLocation, parameterLocation) || + other.parameterLocation == parameterLocation) && + (identical(other.version, version) || other.version == version) && + (identical(other.realm, realm) || other.realm == realm) && + (identical(other.callbackUrl, callbackUrl) || + other.callbackUrl == callbackUrl) && + (identical(other.verifier, verifier) || + other.verifier == verifier) && + (identical(other.nonce, nonce) || other.nonce == nonce) && + (identical(other.timestamp, timestamp) || + other.timestamp == timestamp) && + (identical(other.includeBodyHash, includeBodyHash) || + other.includeBodyHash == includeBodyHash)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + consumerKey, + consumerSecret, + accessToken, + tokenSecret, + signatureMethod, + parameterLocation, + version, + realm, + callbackUrl, + verifier, + nonce, + timestamp, + includeBodyHash, + ); + + /// Create a copy of AuthOAuth1Model + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$AuthOAuth1ModelImplCopyWith<_$AuthOAuth1ModelImpl> get copyWith => + __$$AuthOAuth1ModelImplCopyWithImpl<_$AuthOAuth1ModelImpl>( + this, + _$identity, + ); + + @override + Map toJson() { + return _$$AuthOAuth1ModelImplToJson(this); + } +} + +abstract class _AuthOAuth1Model implements AuthOAuth1Model { + const factory _AuthOAuth1Model({ + required final String consumerKey, + required final String consumerSecret, + final String? accessToken, + final String? tokenSecret, + final String signatureMethod, + final String parameterLocation, + final String version, + final String? realm, + final String? callbackUrl, + final String? verifier, + final String? nonce, + final String? timestamp, + final bool includeBodyHash, + }) = _$AuthOAuth1ModelImpl; + + factory _AuthOAuth1Model.fromJson(Map json) = + _$AuthOAuth1ModelImpl.fromJson; + + @override + String get consumerKey; + @override + String get consumerSecret; + @override + String? get accessToken; + @override + String? get tokenSecret; + @override + String get signatureMethod; + @override + String get parameterLocation; + @override + String get version; + @override + String? get realm; + @override + String? get callbackUrl; + @override + String? get verifier; + @override + String? get nonce; + @override + String? get timestamp; + @override + bool get includeBodyHash; + + /// Create a copy of AuthOAuth1Model + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$AuthOAuth1ModelImplCopyWith<_$AuthOAuth1ModelImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/better_networking/lib/models/auth/auth_oauth1_model.g.dart b/packages/better_networking/lib/models/auth/auth_oauth1_model.g.dart new file mode 100644 index 00000000..dd6b66bc --- /dev/null +++ b/packages/better_networking/lib/models/auth/auth_oauth1_model.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'auth_oauth1_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$AuthOAuth1ModelImpl _$$AuthOAuth1ModelImplFromJson( + Map json, +) => _$AuthOAuth1ModelImpl( + consumerKey: json['consumerKey'] as String, + consumerSecret: json['consumerSecret'] as String, + accessToken: json['accessToken'] as String?, + tokenSecret: json['tokenSecret'] as String?, + signatureMethod: json['signatureMethod'] as String? ?? "hmacSha1", + parameterLocation: json['parameterLocation'] as String? ?? "header", + version: json['version'] as String? ?? '1.0', + realm: json['realm'] as String?, + callbackUrl: json['callbackUrl'] as String?, + verifier: json['verifier'] as String?, + nonce: json['nonce'] as String?, + timestamp: json['timestamp'] as String?, + includeBodyHash: json['includeBodyHash'] as bool? ?? false, +); + +Map _$$AuthOAuth1ModelImplToJson( + _$AuthOAuth1ModelImpl instance, +) => { + 'consumerKey': instance.consumerKey, + 'consumerSecret': instance.consumerSecret, + 'accessToken': instance.accessToken, + 'tokenSecret': instance.tokenSecret, + 'signatureMethod': instance.signatureMethod, + 'parameterLocation': instance.parameterLocation, + 'version': instance.version, + 'realm': instance.realm, + 'callbackUrl': instance.callbackUrl, + 'verifier': instance.verifier, + 'nonce': instance.nonce, + 'timestamp': instance.timestamp, + 'includeBodyHash': instance.includeBodyHash, +}; diff --git a/packages/better_networking/pubspec.yaml b/packages/better_networking/pubspec.yaml index 96e4b7bb..7c95f848 100644 --- a/packages/better_networking/pubspec.yaml +++ b/packages/better_networking/pubspec.yaml @@ -28,10 +28,9 @@ dependencies: json_annotation: ^4.9.0 seed: ^0.0.3 xml: ^6.3.0 + oauth1: ^2.1.0 oauth2: ^2.0.3 flutter_web_auth_2: ^4.1.0 - app_links: ^6.4.0 - webview_flutter: ^4.10.0 dev_dependencies: flutter_test: