diff --git a/lib/src/v3/api/api.dart b/lib/src/v3/api/api.dart index 03a95604..ab315a8d 100644 --- a/lib/src/v3/api/api.dart +++ b/lib/src/v3/api/api.dart @@ -10,3 +10,4 @@ export 'resolve_object/resolve_object.dart'; export 'search/search.dart'; export 'site/site.dart'; export 'user/user.dart'; +export 'oauth/oauth.dart'; diff --git a/lib/src/v3/api/oauth/oauth.dart b/lib/src/v3/api/oauth/oauth.dart new file mode 100644 index 00000000..514a41bc --- /dev/null +++ b/lib/src/v3/api/oauth/oauth.dart @@ -0,0 +1,26 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../../../../v3.dart'; +import '../../../utils/serde.dart'; + +part 'oauth.freezed.dart'; +part 'oauth.g.dart'; + +/// Only available in lemmy v0.20.0 and above +/// Authenticate with OAuth. +/// +/// `HTTP.POST /oauth/authenticate` +@freezed +class AuthenticateWithOAuth with _$AuthenticateWithOAuth implements LemmyApiQuery { + @apiSerde + const factory AuthenticateWithOAuth({required String code, required int oauth_provider_id, required String redirect_uri, String? username, String? answer}) = _AuthenticateWithOAuth; + + const AuthenticateWithOAuth._(); + factory AuthenticateWithOAuth.fromJson(Map json) => _$AuthenticateWithOAuthFromJson(json); + + final path = '/oauth/authenticate'; + final httpMethod = HttpMethod.post; + + @override + LoginResponse responseFactory(Map json) => LoginResponse.fromJson(json); +} diff --git a/lib/src/v3/api/oauth/oauth.freezed.dart b/lib/src/v3/api/oauth/oauth.freezed.dart new file mode 100644 index 00000000..8634d55f --- /dev/null +++ b/lib/src/v3/api/oauth/oauth.freezed.dart @@ -0,0 +1,218 @@ +// 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 'oauth.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', +); + +AuthenticateWithOAuth _$AuthenticateWithOAuthFromJson(Map json) { + return _AuthenticateWithOAuth.fromJson(json); +} + +/// @nodoc +mixin _$AuthenticateWithOAuth { + String get code => throw _privateConstructorUsedError; + int get oauth_provider_id => throw _privateConstructorUsedError; + String get redirect_uri => throw _privateConstructorUsedError; + String? get username => throw _privateConstructorUsedError; + String? get answer => throw _privateConstructorUsedError; + + /// Serializes this AuthenticateWithOAuth to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of AuthenticateWithOAuth + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $AuthenticateWithOAuthCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AuthenticateWithOAuthCopyWith<$Res> { + factory $AuthenticateWithOAuthCopyWith(AuthenticateWithOAuth value, $Res Function(AuthenticateWithOAuth) then) = _$AuthenticateWithOAuthCopyWithImpl<$Res, AuthenticateWithOAuth>; + @useResult + $Res call({String code, int oauth_provider_id, String redirect_uri, String? username, String? answer}); +} + +/// @nodoc +class _$AuthenticateWithOAuthCopyWithImpl<$Res, $Val extends AuthenticateWithOAuth> implements $AuthenticateWithOAuthCopyWith<$Res> { + _$AuthenticateWithOAuthCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of AuthenticateWithOAuth + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? code = null, Object? oauth_provider_id = null, Object? redirect_uri = null, Object? username = freezed, Object? answer = freezed}) { + return _then( + _value.copyWith( + code: + null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as String, + oauth_provider_id: + null == oauth_provider_id + ? _value.oauth_provider_id + : oauth_provider_id // ignore: cast_nullable_to_non_nullable + as int, + redirect_uri: + null == redirect_uri + ? _value.redirect_uri + : redirect_uri // ignore: cast_nullable_to_non_nullable + as String, + username: + freezed == username + ? _value.username + : username // ignore: cast_nullable_to_non_nullable + as String?, + answer: + freezed == answer + ? _value.answer + : answer // ignore: cast_nullable_to_non_nullable + as String?, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$AuthenticateWithOAuthImplCopyWith<$Res> implements $AuthenticateWithOAuthCopyWith<$Res> { + factory _$$AuthenticateWithOAuthImplCopyWith(_$AuthenticateWithOAuthImpl value, $Res Function(_$AuthenticateWithOAuthImpl) then) = __$$AuthenticateWithOAuthImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String code, int oauth_provider_id, String redirect_uri, String? username, String? answer}); +} + +/// @nodoc +class __$$AuthenticateWithOAuthImplCopyWithImpl<$Res> extends _$AuthenticateWithOAuthCopyWithImpl<$Res, _$AuthenticateWithOAuthImpl> implements _$$AuthenticateWithOAuthImplCopyWith<$Res> { + __$$AuthenticateWithOAuthImplCopyWithImpl(_$AuthenticateWithOAuthImpl _value, $Res Function(_$AuthenticateWithOAuthImpl) _then) : super(_value, _then); + + /// Create a copy of AuthenticateWithOAuth + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? code = null, Object? oauth_provider_id = null, Object? redirect_uri = null, Object? username = freezed, Object? answer = freezed}) { + return _then( + _$AuthenticateWithOAuthImpl( + code: + null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as String, + oauth_provider_id: + null == oauth_provider_id + ? _value.oauth_provider_id + : oauth_provider_id // ignore: cast_nullable_to_non_nullable + as int, + redirect_uri: + null == redirect_uri + ? _value.redirect_uri + : redirect_uri // ignore: cast_nullable_to_non_nullable + as String, + username: + freezed == username + ? _value.username + : username // ignore: cast_nullable_to_non_nullable + as String?, + answer: + freezed == answer + ? _value.answer + : answer // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} + +/// @nodoc + +@apiSerde +class _$AuthenticateWithOAuthImpl extends _AuthenticateWithOAuth { + const _$AuthenticateWithOAuthImpl({required this.code, required this.oauth_provider_id, required this.redirect_uri, this.username, this.answer}) : super._(); + + factory _$AuthenticateWithOAuthImpl.fromJson(Map json) => _$$AuthenticateWithOAuthImplFromJson(json); + + @override + final String code; + @override + final int oauth_provider_id; + @override + final String redirect_uri; + @override + final String? username; + @override + final String? answer; + + @override + String toString() { + return 'AuthenticateWithOAuth(code: $code, oauth_provider_id: $oauth_provider_id, redirect_uri: $redirect_uri, username: $username, answer: $answer)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AuthenticateWithOAuthImpl && + (identical(other.code, code) || other.code == code) && + (identical(other.oauth_provider_id, oauth_provider_id) || other.oauth_provider_id == oauth_provider_id) && + (identical(other.redirect_uri, redirect_uri) || other.redirect_uri == redirect_uri) && + (identical(other.username, username) || other.username == username) && + (identical(other.answer, answer) || other.answer == answer)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, code, oauth_provider_id, redirect_uri, username, answer); + + /// Create a copy of AuthenticateWithOAuth + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$AuthenticateWithOAuthImplCopyWith<_$AuthenticateWithOAuthImpl> get copyWith => __$$AuthenticateWithOAuthImplCopyWithImpl<_$AuthenticateWithOAuthImpl>(this, _$identity); + + @override + Map toJson() { + return _$$AuthenticateWithOAuthImplToJson(this); + } +} + +abstract class _AuthenticateWithOAuth extends AuthenticateWithOAuth { + const factory _AuthenticateWithOAuth({required final String code, required final int oauth_provider_id, required final String redirect_uri, final String? username, final String? answer}) = + _$AuthenticateWithOAuthImpl; + const _AuthenticateWithOAuth._() : super._(); + + factory _AuthenticateWithOAuth.fromJson(Map json) = _$AuthenticateWithOAuthImpl.fromJson; + + @override + String get code; + @override + int get oauth_provider_id; + @override + String get redirect_uri; + @override + String? get username; + @override + String? get answer; + + /// Create a copy of AuthenticateWithOAuth + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$AuthenticateWithOAuthImplCopyWith<_$AuthenticateWithOAuthImpl> get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/v3/api/oauth/oauth.g.dart b/lib/src/v3/api/oauth/oauth.g.dart new file mode 100644 index 00000000..9194ec22 --- /dev/null +++ b/lib/src/v3/api/oauth/oauth.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'oauth.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$AuthenticateWithOAuthImpl _$$AuthenticateWithOAuthImplFromJson(Map json) => _$AuthenticateWithOAuthImpl( + code: json['code'] as String, + oauth_provider_id: (json['oauth_provider_id'] as num).toInt(), + redirect_uri: json['redirect_uri'] as String, + username: json['username'] as String?, + answer: json['answer'] as String?, +); + +Map _$$AuthenticateWithOAuthImplToJson(_$AuthenticateWithOAuthImpl instance) => { + 'code': instance.code, + 'oauth_provider_id': instance.oauth_provider_id, + 'redirect_uri': instance.redirect_uri, + if (instance.username case final value?) 'username': value, + if (instance.answer case final value?) 'answer': value, +}; diff --git a/lib/src/v3/models/local_user/local_user.dart b/lib/src/v3/models/local_user/local_user.dart index ba6f7460..a9840a7d 100644 --- a/lib/src/v3/models/local_user/local_user.dart +++ b/lib/src/v3/models/local_user/local_user.dart @@ -17,13 +17,15 @@ class LocalUser with _$LocalUser { bool? blurNsfw, // v0.18.3 bool? autoExpand, // v0.18.3 required String theme, // v0.18.0 - required SortType defaultSortType, // v0.18.0 + @deprecated SortType? defaultSortType, // v0.18.0 [deprecated in v0.20.0] + SortType? defaultCommentSortType, // v0.20.0 + SortType? defaultPostSortType, // v0.20.0 required ListingType defaultListingType, // v0.18.0 required String interfaceLanguage, // v0.18.0 required bool showAvatars, // v0.18.0 required bool sendNotificationsToEmail, // v0.18.0 @deprecated String? validatorTime, // v0.18.0 [deprecated in v0.19.0] - required bool showScores, // v0.18.0 + @deprecated bool? showScores, // v0.18.0 [deprecated in v0.20.0] required bool showBotAccounts, // v0.18.0 required bool showReadPosts, // v0.18.0 @deprecated bool? showNewPostNotifs, // v0.18.0 [deprecated in v0.19.0] diff --git a/lib/src/v3/models/local_user/local_user.freezed.dart b/lib/src/v3/models/local_user/local_user.freezed.dart index eeb1f734..69e83a17 100644 --- a/lib/src/v3/models/local_user/local_user.freezed.dart +++ b/lib/src/v3/models/local_user/local_user.freezed.dart @@ -28,14 +28,18 @@ mixin _$LocalUser { bool? get blurNsfw => throw _privateConstructorUsedError; // v0.18.3 bool? get autoExpand => throw _privateConstructorUsedError; // v0.18.3 String get theme => throw _privateConstructorUsedError; // v0.18.0 - SortType get defaultSortType => throw _privateConstructorUsedError; // v0.18.0 + @deprecated + SortType? get defaultSortType => throw _privateConstructorUsedError; // v0.18.0 [deprecated in v0.20.0] + SortType? get defaultCommentSortType => throw _privateConstructorUsedError; // v0.20.0 + SortType? get defaultPostSortType => throw _privateConstructorUsedError; // v0.20.0 ListingType get defaultListingType => throw _privateConstructorUsedError; // v0.18.0 String get interfaceLanguage => throw _privateConstructorUsedError; // v0.18.0 bool get showAvatars => throw _privateConstructorUsedError; // v0.18.0 bool get sendNotificationsToEmail => throw _privateConstructorUsedError; // v0.18.0 @deprecated String? get validatorTime => throw _privateConstructorUsedError; // v0.18.0 [deprecated in v0.19.0] - bool get showScores => throw _privateConstructorUsedError; // v0.18.0 + @deprecated + bool? get showScores => throw _privateConstructorUsedError; // v0.18.0 [deprecated in v0.20.0] bool get showBotAccounts => throw _privateConstructorUsedError; // v0.18.0 bool get showReadPosts => throw _privateConstructorUsedError; // v0.18.0 @deprecated @@ -74,13 +78,15 @@ abstract class $LocalUserCopyWith<$Res> { bool? blurNsfw, bool? autoExpand, String theme, - SortType defaultSortType, + @deprecated SortType? defaultSortType, + SortType? defaultCommentSortType, + SortType? defaultPostSortType, ListingType defaultListingType, String interfaceLanguage, bool showAvatars, bool sendNotificationsToEmail, @deprecated String? validatorTime, - bool showScores, + @deprecated bool? showScores, bool showBotAccounts, bool showReadPosts, @deprecated bool? showNewPostNotifs, @@ -119,13 +125,15 @@ class _$LocalUserCopyWithImpl<$Res, $Val extends LocalUser> implements $LocalUse Object? blurNsfw = freezed, Object? autoExpand = freezed, Object? theme = null, - Object? defaultSortType = null, + Object? defaultSortType = freezed, + Object? defaultCommentSortType = freezed, + Object? defaultPostSortType = freezed, Object? defaultListingType = null, Object? interfaceLanguage = null, Object? showAvatars = null, Object? sendNotificationsToEmail = null, Object? validatorTime = freezed, - Object? showScores = null, + Object? showScores = freezed, Object? showBotAccounts = null, Object? showReadPosts = null, Object? showNewPostNotifs = freezed, @@ -179,10 +187,20 @@ class _$LocalUserCopyWithImpl<$Res, $Val extends LocalUser> implements $LocalUse : theme // ignore: cast_nullable_to_non_nullable as String, defaultSortType: - null == defaultSortType + freezed == defaultSortType ? _value.defaultSortType : defaultSortType // ignore: cast_nullable_to_non_nullable - as SortType, + as SortType?, + defaultCommentSortType: + freezed == defaultCommentSortType + ? _value.defaultCommentSortType + : defaultCommentSortType // ignore: cast_nullable_to_non_nullable + as SortType?, + defaultPostSortType: + freezed == defaultPostSortType + ? _value.defaultPostSortType + : defaultPostSortType // ignore: cast_nullable_to_non_nullable + as SortType?, defaultListingType: null == defaultListingType ? _value.defaultListingType @@ -209,10 +227,10 @@ class _$LocalUserCopyWithImpl<$Res, $Val extends LocalUser> implements $LocalUse : validatorTime // ignore: cast_nullable_to_non_nullable as String?, showScores: - null == showScores + freezed == showScores ? _value.showScores : showScores // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, showBotAccounts: null == showBotAccounts ? _value.showBotAccounts @@ -302,13 +320,15 @@ abstract class _$$LocalUserImplCopyWith<$Res> implements $LocalUserCopyWith<$Res bool? blurNsfw, bool? autoExpand, String theme, - SortType defaultSortType, + @deprecated SortType? defaultSortType, + SortType? defaultCommentSortType, + SortType? defaultPostSortType, ListingType defaultListingType, String interfaceLanguage, bool showAvatars, bool sendNotificationsToEmail, @deprecated String? validatorTime, - bool showScores, + @deprecated bool? showScores, bool showBotAccounts, bool showReadPosts, @deprecated bool? showNewPostNotifs, @@ -342,13 +362,15 @@ class __$$LocalUserImplCopyWithImpl<$Res> extends _$LocalUserCopyWithImpl<$Res, Object? blurNsfw = freezed, Object? autoExpand = freezed, Object? theme = null, - Object? defaultSortType = null, + Object? defaultSortType = freezed, + Object? defaultCommentSortType = freezed, + Object? defaultPostSortType = freezed, Object? defaultListingType = null, Object? interfaceLanguage = null, Object? showAvatars = null, Object? sendNotificationsToEmail = null, Object? validatorTime = freezed, - Object? showScores = null, + Object? showScores = freezed, Object? showBotAccounts = null, Object? showReadPosts = null, Object? showNewPostNotifs = freezed, @@ -402,10 +424,20 @@ class __$$LocalUserImplCopyWithImpl<$Res> extends _$LocalUserCopyWithImpl<$Res, : theme // ignore: cast_nullable_to_non_nullable as String, defaultSortType: - null == defaultSortType + freezed == defaultSortType ? _value.defaultSortType : defaultSortType // ignore: cast_nullable_to_non_nullable - as SortType, + as SortType?, + defaultCommentSortType: + freezed == defaultCommentSortType + ? _value.defaultCommentSortType + : defaultCommentSortType // ignore: cast_nullable_to_non_nullable + as SortType?, + defaultPostSortType: + freezed == defaultPostSortType + ? _value.defaultPostSortType + : defaultPostSortType // ignore: cast_nullable_to_non_nullable + as SortType?, defaultListingType: null == defaultListingType ? _value.defaultListingType @@ -432,10 +464,10 @@ class __$$LocalUserImplCopyWithImpl<$Res> extends _$LocalUserCopyWithImpl<$Res, : validatorTime // ignore: cast_nullable_to_non_nullable as String?, showScores: - null == showScores + freezed == showScores ? _value.showScores : showScores // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, showBotAccounts: null == showBotAccounts ? _value.showBotAccounts @@ -523,13 +555,15 @@ class _$LocalUserImpl extends _LocalUser { this.blurNsfw, this.autoExpand, required this.theme, - required this.defaultSortType, + @deprecated this.defaultSortType, + this.defaultCommentSortType, + this.defaultPostSortType, required this.defaultListingType, required this.interfaceLanguage, required this.showAvatars, required this.sendNotificationsToEmail, @deprecated this.validatorTime, - required this.showScores, + @deprecated this.showScores, required this.showBotAccounts, required this.showReadPosts, @deprecated this.showNewPostNotifs, @@ -570,8 +604,15 @@ class _$LocalUserImpl extends _LocalUser { final String theme; // v0.18.0 @override - final SortType defaultSortType; - // v0.18.0 + @deprecated + final SortType? defaultSortType; + // v0.18.0 [deprecated in v0.20.0] + @override + final SortType? defaultCommentSortType; + // v0.20.0 + @override + final SortType? defaultPostSortType; + // v0.20.0 @override final ListingType defaultListingType; // v0.18.0 @@ -589,8 +630,9 @@ class _$LocalUserImpl extends _LocalUser { final String? validatorTime; // v0.18.0 [deprecated in v0.19.0] @override - final bool showScores; - // v0.18.0 + @deprecated + final bool? showScores; + // v0.18.0 [deprecated in v0.20.0] @override final bool showBotAccounts; // v0.18.0 @@ -637,7 +679,7 @@ class _$LocalUserImpl extends _LocalUser { @override String toString() { - return 'LocalUser(id: $id, personId: $personId, email: $email, showNsfw: $showNsfw, blurNsfw: $blurNsfw, autoExpand: $autoExpand, theme: $theme, defaultSortType: $defaultSortType, defaultListingType: $defaultListingType, interfaceLanguage: $interfaceLanguage, showAvatars: $showAvatars, sendNotificationsToEmail: $sendNotificationsToEmail, validatorTime: $validatorTime, showScores: $showScores, showBotAccounts: $showBotAccounts, showReadPosts: $showReadPosts, showNewPostNotifs: $showNewPostNotifs, emailVerified: $emailVerified, acceptedApplication: $acceptedApplication, totp2faUrl: $totp2faUrl, openLinksInNewTab: $openLinksInNewTab, infiniteScrollEnabled: $infiniteScrollEnabled, admin: $admin, postListingMode: $postListingMode, totp2faEnabled: $totp2faEnabled, enableKeyboardNavigation: $enableKeyboardNavigation, enableAnimatedImages: $enableAnimatedImages, collapseBotComments: $collapseBotComments)'; + return 'LocalUser(id: $id, personId: $personId, email: $email, showNsfw: $showNsfw, blurNsfw: $blurNsfw, autoExpand: $autoExpand, theme: $theme, defaultSortType: $defaultSortType, defaultCommentSortType: $defaultCommentSortType, defaultPostSortType: $defaultPostSortType, defaultListingType: $defaultListingType, interfaceLanguage: $interfaceLanguage, showAvatars: $showAvatars, sendNotificationsToEmail: $sendNotificationsToEmail, validatorTime: $validatorTime, showScores: $showScores, showBotAccounts: $showBotAccounts, showReadPosts: $showReadPosts, showNewPostNotifs: $showNewPostNotifs, emailVerified: $emailVerified, acceptedApplication: $acceptedApplication, totp2faUrl: $totp2faUrl, openLinksInNewTab: $openLinksInNewTab, infiniteScrollEnabled: $infiniteScrollEnabled, admin: $admin, postListingMode: $postListingMode, totp2faEnabled: $totp2faEnabled, enableKeyboardNavigation: $enableKeyboardNavigation, enableAnimatedImages: $enableAnimatedImages, collapseBotComments: $collapseBotComments)'; } @override @@ -653,6 +695,8 @@ class _$LocalUserImpl extends _LocalUser { (identical(other.autoExpand, autoExpand) || other.autoExpand == autoExpand) && (identical(other.theme, theme) || other.theme == theme) && (identical(other.defaultSortType, defaultSortType) || other.defaultSortType == defaultSortType) && + (identical(other.defaultCommentSortType, defaultCommentSortType) || other.defaultCommentSortType == defaultCommentSortType) && + (identical(other.defaultPostSortType, defaultPostSortType) || other.defaultPostSortType == defaultPostSortType) && (identical(other.defaultListingType, defaultListingType) || other.defaultListingType == defaultListingType) && (identical(other.interfaceLanguage, interfaceLanguage) || other.interfaceLanguage == interfaceLanguage) && (identical(other.showAvatars, showAvatars) || other.showAvatars == showAvatars) && @@ -687,6 +731,8 @@ class _$LocalUserImpl extends _LocalUser { autoExpand, theme, defaultSortType, + defaultCommentSortType, + defaultPostSortType, defaultListingType, interfaceLanguage, showAvatars, @@ -731,13 +777,15 @@ abstract class _LocalUser extends LocalUser { final bool? blurNsfw, final bool? autoExpand, required final String theme, - required final SortType defaultSortType, + @deprecated final SortType? defaultSortType, + final SortType? defaultCommentSortType, + final SortType? defaultPostSortType, required final ListingType defaultListingType, required final String interfaceLanguage, required final bool showAvatars, required final bool sendNotificationsToEmail, @deprecated final String? validatorTime, - required final bool showScores, + @deprecated final bool? showScores, required final bool showBotAccounts, required final bool showReadPosts, @deprecated final bool? showNewPostNotifs, @@ -772,7 +820,12 @@ abstract class _LocalUser extends LocalUser { @override String get theme; // v0.18.0 @override - SortType get defaultSortType; // v0.18.0 + @deprecated + SortType? get defaultSortType; // v0.18.0 [deprecated in v0.20.0] + @override + SortType? get defaultCommentSortType; // v0.20.0 + @override + SortType? get defaultPostSortType; // v0.20.0 @override ListingType get defaultListingType; // v0.18.0 @override @@ -785,7 +838,8 @@ abstract class _LocalUser extends LocalUser { @deprecated String? get validatorTime; // v0.18.0 [deprecated in v0.19.0] @override - bool get showScores; // v0.18.0 + @deprecated + bool? get showScores; // v0.18.0 [deprecated in v0.20.0] @override bool get showBotAccounts; // v0.18.0 @override diff --git a/lib/src/v3/models/local_user/local_user.g.dart b/lib/src/v3/models/local_user/local_user.g.dart index c7095d31..58328f3d 100644 --- a/lib/src/v3/models/local_user/local_user.g.dart +++ b/lib/src/v3/models/local_user/local_user.g.dart @@ -14,13 +14,15 @@ _$LocalUserImpl _$$LocalUserImplFromJson(Map json) => _$LocalUs blurNsfw: json['blur_nsfw'] as bool?, autoExpand: json['auto_expand'] as bool?, theme: json['theme'] as String, - defaultSortType: SortType.fromJson(json['default_sort_type']), + defaultSortType: json['default_sort_type'] == null ? null : SortType.fromJson(json['default_sort_type']), + defaultCommentSortType: json['default_comment_sort_type'] == null ? null : SortType.fromJson(json['default_comment_sort_type']), + defaultPostSortType: json['default_post_sort_type'] == null ? null : SortType.fromJson(json['default_post_sort_type']), defaultListingType: ListingType.fromJson(json['default_listing_type']), interfaceLanguage: json['interface_language'] as String, showAvatars: json['show_avatars'] as bool, sendNotificationsToEmail: json['send_notifications_to_email'] as bool, validatorTime: json['validator_time'] as String?, - showScores: json['show_scores'] as bool, + showScores: json['show_scores'] as bool?, showBotAccounts: json['show_bot_accounts'] as bool, showReadPosts: json['show_read_posts'] as bool, showNewPostNotifs: json['show_new_post_notifs'] as bool?, @@ -45,7 +47,9 @@ Map _$$LocalUserImplToJson(_$LocalUserImpl instance) => discussionLanguages, // v0.18.0 required List taglines, // v0.18.0 required List customEmojis, // v0.18.0 + List? oauthProviders, // v0.20.0 List? blockedUrls, // v0.19.4 (required) }) = _GetSiteResponse; diff --git a/lib/src/v3/models/site/get_site_response.freezed.dart b/lib/src/v3/models/site/get_site_response.freezed.dart index d4b8336f..5b01b4e8 100644 --- a/lib/src/v3/models/site/get_site_response.freezed.dart +++ b/lib/src/v3/models/site/get_site_response.freezed.dart @@ -29,6 +29,7 @@ mixin _$GetSiteResponse { List get discussionLanguages => throw _privateConstructorUsedError; // v0.18.0 List get taglines => throw _privateConstructorUsedError; // v0.18.0 List get customEmojis => throw _privateConstructorUsedError; // v0.18.0 + List? get oauthProviders => throw _privateConstructorUsedError; // v0.20.0 List? get blockedUrls => throw _privateConstructorUsedError; /// Serializes this GetSiteResponse to a JSON map. @@ -53,6 +54,7 @@ abstract class $GetSiteResponseCopyWith<$Res> { List discussionLanguages, List taglines, List customEmojis, + List? oauthProviders, List? blockedUrls, }); @@ -82,6 +84,7 @@ class _$GetSiteResponseCopyWithImpl<$Res, $Val extends GetSiteResponse> implemen Object? discussionLanguages = null, Object? taglines = null, Object? customEmojis = null, + Object? oauthProviders = freezed, Object? blockedUrls = freezed, }) { return _then( @@ -126,6 +129,11 @@ class _$GetSiteResponseCopyWithImpl<$Res, $Val extends GetSiteResponse> implemen ? _value.customEmojis : customEmojis // ignore: cast_nullable_to_non_nullable as List, + oauthProviders: + freezed == oauthProviders + ? _value.oauthProviders + : oauthProviders // ignore: cast_nullable_to_non_nullable + as List?, blockedUrls: freezed == blockedUrls ? _value.blockedUrls @@ -175,6 +183,7 @@ abstract class _$$GetSiteResponseImplCopyWith<$Res> implements $GetSiteResponseC List discussionLanguages, List taglines, List customEmojis, + List? oauthProviders, List? blockedUrls, }); @@ -201,6 +210,7 @@ class __$$GetSiteResponseImplCopyWithImpl<$Res> extends _$GetSiteResponseCopyWit Object? discussionLanguages = null, Object? taglines = null, Object? customEmojis = null, + Object? oauthProviders = freezed, Object? blockedUrls = freezed, }) { return _then( @@ -245,6 +255,11 @@ class __$$GetSiteResponseImplCopyWithImpl<$Res> extends _$GetSiteResponseCopyWit ? _value._customEmojis : customEmojis // ignore: cast_nullable_to_non_nullable as List, + oauthProviders: + freezed == oauthProviders + ? _value._oauthProviders + : oauthProviders // ignore: cast_nullable_to_non_nullable + as List?, blockedUrls: freezed == blockedUrls ? _value._blockedUrls @@ -268,12 +283,14 @@ class _$GetSiteResponseImpl extends _GetSiteResponse { required final List discussionLanguages, required final List taglines, required final List customEmojis, + final List? oauthProviders, final List? blockedUrls, }) : _admins = admins, _allLanguages = allLanguages, _discussionLanguages = discussionLanguages, _taglines = taglines, _customEmojis = customEmojis, + _oauthProviders = oauthProviders, _blockedUrls = blockedUrls, super._(); @@ -338,9 +355,21 @@ class _$GetSiteResponseImpl extends _GetSiteResponse { } // v0.18.0 - final List? _blockedUrls; + final List? _oauthProviders; // v0.18.0 @override + List? get oauthProviders { + final value = _oauthProviders; + if (value == null) return null; + if (_oauthProviders is EqualUnmodifiableListView) return _oauthProviders; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + // v0.20.0 + final List? _blockedUrls; + // v0.20.0 + @override List? get blockedUrls { final value = _blockedUrls; if (value == null) return null; @@ -351,7 +380,7 @@ class _$GetSiteResponseImpl extends _GetSiteResponse { @override String toString() { - return 'GetSiteResponse(siteView: $siteView, admins: $admins, version: $version, myUser: $myUser, allLanguages: $allLanguages, discussionLanguages: $discussionLanguages, taglines: $taglines, customEmojis: $customEmojis, blockedUrls: $blockedUrls)'; + return 'GetSiteResponse(siteView: $siteView, admins: $admins, version: $version, myUser: $myUser, allLanguages: $allLanguages, discussionLanguages: $discussionLanguages, taglines: $taglines, customEmojis: $customEmojis, oauthProviders: $oauthProviders, blockedUrls: $blockedUrls)'; } @override @@ -367,6 +396,7 @@ class _$GetSiteResponseImpl extends _GetSiteResponse { const DeepCollectionEquality().equals(other._discussionLanguages, _discussionLanguages) && const DeepCollectionEquality().equals(other._taglines, _taglines) && const DeepCollectionEquality().equals(other._customEmojis, _customEmojis) && + const DeepCollectionEquality().equals(other._oauthProviders, _oauthProviders) && const DeepCollectionEquality().equals(other._blockedUrls, _blockedUrls)); } @@ -382,6 +412,7 @@ class _$GetSiteResponseImpl extends _GetSiteResponse { const DeepCollectionEquality().hash(_discussionLanguages), const DeepCollectionEquality().hash(_taglines), const DeepCollectionEquality().hash(_customEmojis), + const DeepCollectionEquality().hash(_oauthProviders), const DeepCollectionEquality().hash(_blockedUrls), ); @@ -408,6 +439,7 @@ abstract class _GetSiteResponse extends GetSiteResponse { required final List discussionLanguages, required final List taglines, required final List customEmojis, + final List? oauthProviders, final List? blockedUrls, }) = _$GetSiteResponseImpl; const _GetSiteResponse._() : super._(); @@ -431,6 +463,8 @@ abstract class _GetSiteResponse extends GetSiteResponse { @override List get customEmojis; // v0.18.0 @override + List? get oauthProviders; // v0.20.0 + @override List? get blockedUrls; /// Create a copy of GetSiteResponse diff --git a/lib/src/v3/models/site/get_site_response.g.dart b/lib/src/v3/models/site/get_site_response.g.dart index 785eecce..3b01116d 100644 --- a/lib/src/v3/models/site/get_site_response.g.dart +++ b/lib/src/v3/models/site/get_site_response.g.dart @@ -15,6 +15,7 @@ _$GetSiteResponseImpl _$$GetSiteResponseImplFromJson(Map json) discussionLanguages: (json['discussion_languages'] as List).map((e) => (e as num).toInt()).toList(), taglines: (json['taglines'] as List).map((e) => Tagline.fromJson(e as Map)).toList(), customEmojis: (json['custom_emojis'] as List).map((e) => CustomEmojiView.fromJson(e as Map)).toList(), + oauthProviders: (json['oauth_providers'] as List?)?.map((e) => ProviderView.fromJson(e as Map)).toList(), blockedUrls: (json['blocked_urls'] as List?)?.map((e) => LocalSiteUrlBlocklist.fromJson(e as Map)).toList(), ); @@ -27,5 +28,6 @@ Map _$$GetSiteResponseImplToJson(_$GetSiteResponseImpl instance 'discussion_languages': instance.discussionLanguages, 'taglines': instance.taglines.map((e) => e.toJson()).toList(), 'custom_emojis': instance.customEmojis.map((e) => e.toJson()).toList(), + 'oauth_providers': instance.oauthProviders?.map((e) => e.toJson()).toList(), 'blocked_urls': instance.blockedUrls?.map((e) => e.toJson()).toList(), }; diff --git a/lib/src/v3/models/site/local_site.dart b/lib/src/v3/models/site/local_site.dart index 41426cad..789e3b93 100644 --- a/lib/src/v3/models/site/local_site.dart +++ b/lib/src/v3/models/site/local_site.dart @@ -14,8 +14,8 @@ class LocalSite with _$LocalSite { required int id, // v0.18.0 required int siteId, // v0.18.0 required bool siteSetup, // v0.18.0 - required bool enableDownvotes, // v0.18.0 - required bool enableNsfw, // v0.18.0 + @deprecated bool? enableDownvotes, // v0.18.0 [deprecated in v0.20.0] + @deprecated bool? enableNsfw, // v0.18.0 [deprecated in v0.20.0] required bool communityCreationAdminOnly, // v0.18.0 required bool requireEmailVerification, // v0.18.0 String? applicationQuestion, // v0.18.0 diff --git a/lib/src/v3/models/site/local_site.freezed.dart b/lib/src/v3/models/site/local_site.freezed.dart index bfb36515..43ba4fac 100644 --- a/lib/src/v3/models/site/local_site.freezed.dart +++ b/lib/src/v3/models/site/local_site.freezed.dart @@ -24,8 +24,10 @@ mixin _$LocalSite { int get id => throw _privateConstructorUsedError; // v0.18.0 int get siteId => throw _privateConstructorUsedError; // v0.18.0 bool get siteSetup => throw _privateConstructorUsedError; // v0.18.0 - bool get enableDownvotes => throw _privateConstructorUsedError; // v0.18.0 - bool get enableNsfw => throw _privateConstructorUsedError; // v0.18.0 + @deprecated + bool? get enableDownvotes => throw _privateConstructorUsedError; // v0.18.0 [deprecated in v0.20.0] + @deprecated + bool? get enableNsfw => throw _privateConstructorUsedError; // v0.18.0 [deprecated in v0.20.0] bool get communityCreationAdminOnly => throw _privateConstructorUsedError; // v0.18.0 bool get requireEmailVerification => throw _privateConstructorUsedError; // v0.18.0 String? get applicationQuestion => throw _privateConstructorUsedError; // v0.18.0 @@ -67,8 +69,8 @@ abstract class $LocalSiteCopyWith<$Res> { int id, int siteId, bool siteSetup, - bool enableDownvotes, - bool enableNsfw, + @deprecated bool? enableDownvotes, + @deprecated bool? enableNsfw, bool communityCreationAdminOnly, bool requireEmailVerification, String? applicationQuestion, @@ -111,8 +113,8 @@ class _$LocalSiteCopyWithImpl<$Res, $Val extends LocalSite> implements $LocalSit Object? id = null, Object? siteId = null, Object? siteSetup = null, - Object? enableDownvotes = null, - Object? enableNsfw = null, + Object? enableDownvotes = freezed, + Object? enableNsfw = freezed, Object? communityCreationAdminOnly = null, Object? requireEmailVerification = null, Object? applicationQuestion = freezed, @@ -154,15 +156,15 @@ class _$LocalSiteCopyWithImpl<$Res, $Val extends LocalSite> implements $LocalSit : siteSetup // ignore: cast_nullable_to_non_nullable as bool, enableDownvotes: - null == enableDownvotes + freezed == enableDownvotes ? _value.enableDownvotes : enableDownvotes // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, enableNsfw: - null == enableNsfw + freezed == enableNsfw ? _value.enableNsfw : enableNsfw // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, communityCreationAdminOnly: null == communityCreationAdminOnly ? _value.communityCreationAdminOnly @@ -288,8 +290,8 @@ abstract class _$$LocalSiteImplCopyWith<$Res> implements $LocalSiteCopyWith<$Res int id, int siteId, bool siteSetup, - bool enableDownvotes, - bool enableNsfw, + @deprecated bool? enableDownvotes, + @deprecated bool? enableNsfw, bool communityCreationAdminOnly, bool requireEmailVerification, String? applicationQuestion, @@ -327,8 +329,8 @@ class __$$LocalSiteImplCopyWithImpl<$Res> extends _$LocalSiteCopyWithImpl<$Res, Object? id = null, Object? siteId = null, Object? siteSetup = null, - Object? enableDownvotes = null, - Object? enableNsfw = null, + Object? enableDownvotes = freezed, + Object? enableNsfw = freezed, Object? communityCreationAdminOnly = null, Object? requireEmailVerification = null, Object? applicationQuestion = freezed, @@ -370,15 +372,15 @@ class __$$LocalSiteImplCopyWithImpl<$Res> extends _$LocalSiteCopyWithImpl<$Res, : siteSetup // ignore: cast_nullable_to_non_nullable as bool, enableDownvotes: - null == enableDownvotes + freezed == enableDownvotes ? _value.enableDownvotes : enableDownvotes // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, enableNsfw: - null == enableNsfw + freezed == enableNsfw ? _value.enableNsfw : enableNsfw // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, communityCreationAdminOnly: null == communityCreationAdminOnly ? _value.communityCreationAdminOnly @@ -502,8 +504,8 @@ class _$LocalSiteImpl extends _LocalSite { required this.id, required this.siteId, required this.siteSetup, - required this.enableDownvotes, - required this.enableNsfw, + @deprecated this.enableDownvotes, + @deprecated this.enableNsfw, required this.communityCreationAdminOnly, required this.requireEmailVerification, this.applicationQuestion, @@ -540,11 +542,13 @@ class _$LocalSiteImpl extends _LocalSite { final bool siteSetup; // v0.18.0 @override - final bool enableDownvotes; - // v0.18.0 + @deprecated + final bool? enableDownvotes; + // v0.18.0 [deprecated in v0.20.0] @override - final bool enableNsfw; - // v0.18.0 + @deprecated + final bool? enableNsfw; + // v0.18.0 [deprecated in v0.20.0] @override final bool communityCreationAdminOnly; // v0.18.0 @@ -702,8 +706,8 @@ abstract class _LocalSite extends LocalSite { required final int id, required final int siteId, required final bool siteSetup, - required final bool enableDownvotes, - required final bool enableNsfw, + @deprecated final bool? enableDownvotes, + @deprecated final bool? enableNsfw, required final bool communityCreationAdminOnly, required final bool requireEmailVerification, final String? applicationQuestion, @@ -738,9 +742,11 @@ abstract class _LocalSite extends LocalSite { @override bool get siteSetup; // v0.18.0 @override - bool get enableDownvotes; // v0.18.0 + @deprecated + bool? get enableDownvotes; // v0.18.0 [deprecated in v0.20.0] @override - bool get enableNsfw; // v0.18.0 + @deprecated + bool? get enableNsfw; // v0.18.0 [deprecated in v0.20.0] @override bool get communityCreationAdminOnly; // v0.18.0 @override diff --git a/lib/src/v3/models/site/local_site.g.dart b/lib/src/v3/models/site/local_site.g.dart index 1345f828..d9d88444 100644 --- a/lib/src/v3/models/site/local_site.g.dart +++ b/lib/src/v3/models/site/local_site.g.dart @@ -10,8 +10,8 @@ _$LocalSiteImpl _$$LocalSiteImplFromJson(Map json) => _$LocalSi id: (json['id'] as num).toInt(), siteId: (json['site_id'] as num).toInt(), siteSetup: json['site_setup'] as bool, - enableDownvotes: json['enable_downvotes'] as bool, - enableNsfw: json['enable_nsfw'] as bool, + enableDownvotes: json['enable_downvotes'] as bool?, + enableNsfw: json['enable_nsfw'] as bool?, communityCreationAdminOnly: json['community_creation_admin_only'] as bool, requireEmailVerification: json['require_email_verification'] as bool, applicationQuestion: json['application_question'] as String?, diff --git a/lib/src/v3/views/provider_view.dart b/lib/src/v3/views/provider_view.dart new file mode 100644 index 00000000..635fe8f6 --- /dev/null +++ b/lib/src/v3/views/provider_view.dart @@ -0,0 +1,22 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../../utils/serde.dart'; +import '../models/models.dart'; + +part 'provider_view.freezed.dart'; +part 'provider_view.g.dart'; + +@freezed +class ProviderView with _$ProviderView { + @modelSerde + const factory ProviderView({ + required int id, // v0.20.0 + required String displayName, // v0.20.0 + required String authorizationEndpoint, // v0.20.0 + required String clientId, // v0.20.0 + required String scopes, // v0.20.0 + }) = _ProviderView; + + const ProviderView._(); + factory ProviderView.fromJson(Map json) => _$ProviderViewFromJson(json); +} diff --git a/lib/src/v3/views/provider_view.freezed.dart b/lib/src/v3/views/provider_view.freezed.dart new file mode 100644 index 00000000..ea4824ff --- /dev/null +++ b/lib/src/v3/views/provider_view.freezed.dart @@ -0,0 +1,222 @@ +// 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 'provider_view.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', +); + +ProviderView _$ProviderViewFromJson(Map json) { + return _ProviderView.fromJson(json); +} + +/// @nodoc +mixin _$ProviderView { + int get id => throw _privateConstructorUsedError; // v0.20.0 + String get displayName => throw _privateConstructorUsedError; // v0.20.0 + String get authorizationEndpoint => throw _privateConstructorUsedError; // v0.20.0 + String get clientId => throw _privateConstructorUsedError; // v0.20.0 + String get scopes => throw _privateConstructorUsedError; + + /// Serializes this ProviderView to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ProviderView + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ProviderViewCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProviderViewCopyWith<$Res> { + factory $ProviderViewCopyWith(ProviderView value, $Res Function(ProviderView) then) = _$ProviderViewCopyWithImpl<$Res, ProviderView>; + @useResult + $Res call({int id, String displayName, String authorizationEndpoint, String clientId, String scopes}); +} + +/// @nodoc +class _$ProviderViewCopyWithImpl<$Res, $Val extends ProviderView> implements $ProviderViewCopyWith<$Res> { + _$ProviderViewCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ProviderView + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? id = null, Object? displayName = null, Object? authorizationEndpoint = null, Object? clientId = null, Object? scopes = null}) { + return _then( + _value.copyWith( + id: + null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + displayName: + null == displayName + ? _value.displayName + : displayName // ignore: cast_nullable_to_non_nullable + as String, + authorizationEndpoint: + null == authorizationEndpoint + ? _value.authorizationEndpoint + : authorizationEndpoint // ignore: cast_nullable_to_non_nullable + as String, + clientId: + null == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String, + scopes: + null == scopes + ? _value.scopes + : scopes // ignore: cast_nullable_to_non_nullable + as String, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$ProviderViewImplCopyWith<$Res> implements $ProviderViewCopyWith<$Res> { + factory _$$ProviderViewImplCopyWith(_$ProviderViewImpl value, $Res Function(_$ProviderViewImpl) then) = __$$ProviderViewImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int id, String displayName, String authorizationEndpoint, String clientId, String scopes}); +} + +/// @nodoc +class __$$ProviderViewImplCopyWithImpl<$Res> extends _$ProviderViewCopyWithImpl<$Res, _$ProviderViewImpl> implements _$$ProviderViewImplCopyWith<$Res> { + __$$ProviderViewImplCopyWithImpl(_$ProviderViewImpl _value, $Res Function(_$ProviderViewImpl) _then) : super(_value, _then); + + /// Create a copy of ProviderView + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? id = null, Object? displayName = null, Object? authorizationEndpoint = null, Object? clientId = null, Object? scopes = null}) { + return _then( + _$ProviderViewImpl( + id: + null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + displayName: + null == displayName + ? _value.displayName + : displayName // ignore: cast_nullable_to_non_nullable + as String, + authorizationEndpoint: + null == authorizationEndpoint + ? _value.authorizationEndpoint + : authorizationEndpoint // ignore: cast_nullable_to_non_nullable + as String, + clientId: + null == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String, + scopes: + null == scopes + ? _value.scopes + : scopes // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} + +/// @nodoc + +@modelSerde +class _$ProviderViewImpl extends _ProviderView { + const _$ProviderViewImpl({required this.id, required this.displayName, required this.authorizationEndpoint, required this.clientId, required this.scopes}) : super._(); + + factory _$ProviderViewImpl.fromJson(Map json) => _$$ProviderViewImplFromJson(json); + + @override + final int id; + // v0.20.0 + @override + final String displayName; + // v0.20.0 + @override + final String authorizationEndpoint; + // v0.20.0 + @override + final String clientId; + // v0.20.0 + @override + final String scopes; + + @override + String toString() { + return 'ProviderView(id: $id, displayName: $displayName, authorizationEndpoint: $authorizationEndpoint, clientId: $clientId, scopes: $scopes)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ProviderViewImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.displayName, displayName) || other.displayName == displayName) && + (identical(other.authorizationEndpoint, authorizationEndpoint) || other.authorizationEndpoint == authorizationEndpoint) && + (identical(other.clientId, clientId) || other.clientId == clientId) && + (identical(other.scopes, scopes) || other.scopes == scopes)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, displayName, authorizationEndpoint, clientId, scopes); + + /// Create a copy of ProviderView + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ProviderViewImplCopyWith<_$ProviderViewImpl> get copyWith => __$$ProviderViewImplCopyWithImpl<_$ProviderViewImpl>(this, _$identity); + + @override + Map toJson() { + return _$$ProviderViewImplToJson(this); + } +} + +abstract class _ProviderView extends ProviderView { + const factory _ProviderView({required final int id, required final String displayName, required final String authorizationEndpoint, required final String clientId, required final String scopes}) = + _$ProviderViewImpl; + const _ProviderView._() : super._(); + + factory _ProviderView.fromJson(Map json) = _$ProviderViewImpl.fromJson; + + @override + int get id; // v0.20.0 + @override + String get displayName; // v0.20.0 + @override + String get authorizationEndpoint; // v0.20.0 + @override + String get clientId; // v0.20.0 + @override + String get scopes; + + /// Create a copy of ProviderView + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ProviderViewImplCopyWith<_$ProviderViewImpl> get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/v3/views/provider_view.g.dart b/lib/src/v3/views/provider_view.g.dart new file mode 100644 index 00000000..1e5c7037 --- /dev/null +++ b/lib/src/v3/views/provider_view.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'provider_view.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$ProviderViewImpl _$$ProviderViewImplFromJson(Map json) => _$ProviderViewImpl( + id: (json['id'] as num).toInt(), + displayName: json['display_name'] as String, + authorizationEndpoint: json['authorization_endpoint'] as String, + clientId: json['client_id'] as String, + scopes: json['scopes'] as String, +); + +Map _$$ProviderViewImplToJson(_$ProviderViewImpl instance) => { + 'id': instance.id, + 'display_name': instance.displayName, + 'authorization_endpoint': instance.authorizationEndpoint, + 'client_id': instance.clientId, + 'scopes': instance.scopes, +}; diff --git a/lib/src/v3/views/views.dart b/lib/src/v3/views/views.dart index 05f1a7a2..13ef7ded 100644 --- a/lib/src/v3/views/views.dart +++ b/lib/src/v3/views/views.dart @@ -30,5 +30,6 @@ export 'post_report_view.dart'; export 'post_view.dart'; export 'private_message_report_view.dart'; export 'private_message_view.dart'; +export 'provider_view.dart'; export 'registration_application_view.dart'; export 'vote_view.dart';