From 6d47fd1f69fc36d3244041af0815b52cd672ef11 Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Fri, 15 Nov 2024 18:27:43 -0500 Subject: [PATCH 01/13] defaultCommentSortType and defaultPostSortType --- lib/src/v3/models/local_user/local_user.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/v3/models/local_user/local_user.dart b/lib/src/v3/models/local_user/local_user.dart index 6bd420b1..b134f4ca 100644 --- a/lib/src/v3/models/local_user/local_user.dart +++ b/lib/src/v3/models/local_user/local_user.dart @@ -17,7 +17,9 @@ 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] + required SortType defaultCommentSortType, // v0.20.0 + required SortType defaultPostSortType, // v0.20.0 required ListingType defaultListingType, // v0.18.0 required String interfaceLanguage, // v0.18.0 required bool showAvatars, // v0.18.0 From a5c113c88306f651feede96c2da560ad35f5ad02 Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Fri, 15 Nov 2024 18:28:45 -0500 Subject: [PATCH 02/13] run build runner --- .../models/local_user/local_user.freezed.dart | 78 +++++++++++++++---- .../v3/models/local_user/local_user.g.dart | 11 ++- 2 files changed, 74 insertions(+), 15 deletions(-) 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 b0885438..01adbb24 100644 --- a/lib/src/v3/models/local_user/local_user.freezed.dart +++ b/lib/src/v3/models/local_user/local_user.freezed.dart @@ -27,7 +27,13 @@ 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 @@ -85,7 +91,9 @@ 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, @@ -130,7 +138,9 @@ class _$LocalUserCopyWithImpl<$Res, $Val extends LocalUser> Object? blurNsfw = freezed, Object? autoExpand = freezed, Object? theme = null, - Object? defaultSortType = null, + Object? defaultSortType = freezed, + Object? defaultCommentSortType = null, + Object? defaultPostSortType = null, Object? defaultListingType = null, Object? interfaceLanguage = null, Object? showAvatars = null, @@ -181,9 +191,17 @@ class _$LocalUserCopyWithImpl<$Res, $Val extends LocalUser> ? _value.theme : theme // ignore: cast_nullable_to_non_nullable as String, - defaultSortType: null == defaultSortType + defaultSortType: freezed == defaultSortType ? _value.defaultSortType : defaultSortType // ignore: cast_nullable_to_non_nullable + as SortType?, + defaultCommentSortType: null == defaultCommentSortType + ? _value.defaultCommentSortType + : defaultCommentSortType // ignore: cast_nullable_to_non_nullable + as SortType, + defaultPostSortType: null == defaultPostSortType + ? _value.defaultPostSortType + : defaultPostSortType // ignore: cast_nullable_to_non_nullable as SortType, defaultListingType: null == defaultListingType ? _value.defaultListingType @@ -285,7 +303,9 @@ abstract class _$$LocalUserImplCopyWith<$Res> bool? blurNsfw, bool? autoExpand, String theme, - SortType defaultSortType, + @deprecated SortType? defaultSortType, + SortType defaultCommentSortType, + SortType defaultPostSortType, ListingType defaultListingType, String interfaceLanguage, bool showAvatars, @@ -328,7 +348,9 @@ class __$$LocalUserImplCopyWithImpl<$Res> Object? blurNsfw = freezed, Object? autoExpand = freezed, Object? theme = null, - Object? defaultSortType = null, + Object? defaultSortType = freezed, + Object? defaultCommentSortType = null, + Object? defaultPostSortType = null, Object? defaultListingType = null, Object? interfaceLanguage = null, Object? showAvatars = null, @@ -379,9 +401,17 @@ class __$$LocalUserImplCopyWithImpl<$Res> ? _value.theme : theme // ignore: cast_nullable_to_non_nullable as String, - defaultSortType: null == defaultSortType + defaultSortType: freezed == defaultSortType ? _value.defaultSortType : defaultSortType // ignore: cast_nullable_to_non_nullable + as SortType?, + defaultCommentSortType: null == defaultCommentSortType + ? _value.defaultCommentSortType + : defaultCommentSortType // ignore: cast_nullable_to_non_nullable + as SortType, + defaultPostSortType: null == defaultPostSortType + ? _value.defaultPostSortType + : defaultPostSortType // ignore: cast_nullable_to_non_nullable as SortType, defaultListingType: null == defaultListingType ? _value.defaultListingType @@ -479,7 +509,9 @@ class _$LocalUserImpl extends _LocalUser { this.blurNsfw, this.autoExpand, required this.theme, - required this.defaultSortType, + @deprecated this.defaultSortType, + required this.defaultCommentSortType, + required this.defaultPostSortType, required this.defaultListingType, required this.interfaceLanguage, required this.showAvatars, @@ -527,8 +559,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 @@ -594,7 +633,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 @@ -615,6 +654,10 @@ class _$LocalUserImpl extends _LocalUser { (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) || @@ -670,6 +713,8 @@ class _$LocalUserImpl extends _LocalUser { autoExpand, theme, defaultSortType, + defaultCommentSortType, + defaultPostSortType, defaultListingType, interfaceLanguage, showAvatars, @@ -717,7 +762,9 @@ abstract class _LocalUser extends LocalUser { final bool? blurNsfw, final bool? autoExpand, required final String theme, - required final SortType defaultSortType, + @deprecated final SortType? defaultSortType, + required final SortType defaultCommentSortType, + required final SortType defaultPostSortType, required final ListingType defaultListingType, required final String interfaceLanguage, required final bool showAvatars, @@ -758,7 +805,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 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 6a1aba0e..e4b74789 100644 --- a/lib/src/v3/models/local_user/local_user.g.dart +++ b/lib/src/v3/models/local_user/local_user.g.dart @@ -15,7 +15,12 @@ _$LocalUserImpl _$$LocalUserImplFromJson(Map json) => 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: + SortType.fromJson(json['default_comment_sort_type']), + defaultPostSortType: 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, @@ -47,7 +52,9 @@ Map _$$LocalUserImplToJson(_$LocalUserImpl instance) => 'blur_nsfw': instance.blurNsfw, 'auto_expand': instance.autoExpand, 'theme': instance.theme, - 'default_sort_type': instance.defaultSortType.toJson(), + 'default_sort_type': instance.defaultSortType?.toJson(), + 'default_comment_sort_type': instance.defaultCommentSortType.toJson(), + 'default_post_sort_type': instance.defaultPostSortType.toJson(), 'default_listing_type': instance.defaultListingType.toJson(), 'interface_language': instance.interfaceLanguage, 'show_avatars': instance.showAvatars, From 61b5d4d7f7b08426f64cab0eaf91066f63b093fc Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Fri, 15 Nov 2024 18:31:40 -0500 Subject: [PATCH 03/13] deprecate local_user.showScores --- lib/src/v3/models/local_user/local_user.dart | 2 +- .../models/local_user/local_user.freezed.dart | 32 +++++++++++-------- .../v3/models/local_user/local_user.g.dart | 2 +- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/src/v3/models/local_user/local_user.dart b/lib/src/v3/models/local_user/local_user.dart index b134f4ca..fa3cc255 100644 --- a/lib/src/v3/models/local_user/local_user.dart +++ b/lib/src/v3/models/local_user/local_user.dart @@ -25,7 +25,7 @@ class LocalUser with _$LocalUser { 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 01adbb24..013c8f81 100644 --- a/lib/src/v3/models/local_user/local_user.freezed.dart +++ b/lib/src/v3/models/local_user/local_user.freezed.dart @@ -43,7 +43,9 @@ mixin _$LocalUser { @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 @@ -99,7 +101,7 @@ abstract class $LocalUserCopyWith<$Res> { bool showAvatars, bool sendNotificationsToEmail, @deprecated String? validatorTime, - bool showScores, + @deprecated bool? showScores, bool showBotAccounts, bool showReadPosts, @deprecated bool? showNewPostNotifs, @@ -146,7 +148,7 @@ class _$LocalUserCopyWithImpl<$Res, $Val extends LocalUser> Object? showAvatars = null, Object? sendNotificationsToEmail = null, Object? validatorTime = freezed, - Object? showScores = null, + Object? showScores = freezed, Object? showBotAccounts = null, Object? showReadPosts = null, Object? showNewPostNotifs = freezed, @@ -223,10 +225,10 @@ class _$LocalUserCopyWithImpl<$Res, $Val extends LocalUser> ? _value.validatorTime : validatorTime // ignore: cast_nullable_to_non_nullable as String?, - showScores: null == showScores + showScores: freezed == showScores ? _value.showScores : showScores // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, showBotAccounts: null == showBotAccounts ? _value.showBotAccounts : showBotAccounts // ignore: cast_nullable_to_non_nullable @@ -311,7 +313,7 @@ abstract class _$$LocalUserImplCopyWith<$Res> bool showAvatars, bool sendNotificationsToEmail, @deprecated String? validatorTime, - bool showScores, + @deprecated bool? showScores, bool showBotAccounts, bool showReadPosts, @deprecated bool? showNewPostNotifs, @@ -356,7 +358,7 @@ class __$$LocalUserImplCopyWithImpl<$Res> Object? showAvatars = null, Object? sendNotificationsToEmail = null, Object? validatorTime = freezed, - Object? showScores = null, + Object? showScores = freezed, Object? showBotAccounts = null, Object? showReadPosts = null, Object? showNewPostNotifs = freezed, @@ -433,10 +435,10 @@ class __$$LocalUserImplCopyWithImpl<$Res> ? _value.validatorTime : validatorTime // ignore: cast_nullable_to_non_nullable as String?, - showScores: null == showScores + showScores: freezed == showScores ? _value.showScores : showScores // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, showBotAccounts: null == showBotAccounts ? _value.showBotAccounts : showBotAccounts // ignore: cast_nullable_to_non_nullable @@ -517,7 +519,7 @@ class _$LocalUserImpl extends _LocalUser { required this.showAvatars, required this.sendNotificationsToEmail, @deprecated this.validatorTime, - required this.showScores, + @deprecated this.showScores, required this.showBotAccounts, required this.showReadPosts, @deprecated this.showNewPostNotifs, @@ -585,8 +587,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 @@ -770,7 +773,7 @@ abstract class _LocalUser extends LocalUser { 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, @@ -823,7 +826,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 e4b74789..4b7b7ad5 100644 --- a/lib/src/v3/models/local_user/local_user.g.dart +++ b/lib/src/v3/models/local_user/local_user.g.dart @@ -26,7 +26,7 @@ _$LocalUserImpl _$$LocalUserImplFromJson(Map json) => 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?, From e43442dfe6c82c55ff5e9a633a7bfbfbef27d6a7 Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Fri, 15 Nov 2024 18:34:31 -0500 Subject: [PATCH 04/13] deprecate enableDownvotes and enableNsfw --- lib/src/v3/models/site/local_site.dart | 4 +- .../v3/models/site/local_site.freezed.dart | 64 +++++++++++-------- lib/src/v3/models/site/local_site.g.dart | 4 +- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/lib/src/v3/models/site/local_site.dart b/lib/src/v3/models/site/local_site.dart index 5f4c785e..c2dd23a3 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 f17de1fa..6798ad5d 100644 --- a/lib/src/v3/models/site/local_site.freezed.dart +++ b/lib/src/v3/models/site/local_site.freezed.dart @@ -23,8 +23,12 @@ 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 => @@ -77,8 +81,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, @@ -121,8 +125,8 @@ class _$LocalSiteCopyWithImpl<$Res, $Val extends LocalSite> 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, @@ -159,14 +163,14 @@ class _$LocalSiteCopyWithImpl<$Res, $Val extends LocalSite> ? _value.siteSetup : siteSetup // ignore: cast_nullable_to_non_nullable as bool, - enableDownvotes: null == enableDownvotes + enableDownvotes: freezed == enableDownvotes ? _value.enableDownvotes : enableDownvotes // ignore: cast_nullable_to_non_nullable - as bool, - enableNsfw: null == enableNsfw + as bool?, + enableNsfw: freezed == enableNsfw ? _value.enableNsfw : enableNsfw // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, communityCreationAdminOnly: null == communityCreationAdminOnly ? _value.communityCreationAdminOnly : communityCreationAdminOnly // ignore: cast_nullable_to_non_nullable @@ -271,8 +275,8 @@ abstract class _$$LocalSiteImplCopyWith<$Res> {int id, int siteId, bool siteSetup, - bool enableDownvotes, - bool enableNsfw, + @deprecated bool? enableDownvotes, + @deprecated bool? enableNsfw, bool communityCreationAdminOnly, bool requireEmailVerification, String? applicationQuestion, @@ -313,8 +317,8 @@ class __$$LocalSiteImplCopyWithImpl<$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, @@ -351,14 +355,14 @@ class __$$LocalSiteImplCopyWithImpl<$Res> ? _value.siteSetup : siteSetup // ignore: cast_nullable_to_non_nullable as bool, - enableDownvotes: null == enableDownvotes + enableDownvotes: freezed == enableDownvotes ? _value.enableDownvotes : enableDownvotes // ignore: cast_nullable_to_non_nullable - as bool, - enableNsfw: null == enableNsfw + as bool?, + enableNsfw: freezed == enableNsfw ? _value.enableNsfw : enableNsfw // ignore: cast_nullable_to_non_nullable - as bool, + as bool?, communityCreationAdminOnly: null == communityCreationAdminOnly ? _value.communityCreationAdminOnly : communityCreationAdminOnly // ignore: cast_nullable_to_non_nullable @@ -459,8 +463,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, @@ -498,11 +502,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 @@ -689,8 +695,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, @@ -725,9 +731,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 950c9ef7..4fca2bba 100644 --- a/lib/src/v3/models/site/local_site.g.dart +++ b/lib/src/v3/models/site/local_site.g.dart @@ -11,8 +11,8 @@ _$LocalSiteImpl _$$LocalSiteImplFromJson(Map json) => 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?, From 58c57190606468f77f264b97da28dc37dc9f05ef Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Fri, 15 Nov 2024 21:03:22 -0500 Subject: [PATCH 05/13] add AuthenticateWithOAuth api --- lib/src/v3/api/oauth/oauth.dart | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/src/v3/api/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..0d51a253 --- /dev/null +++ b/lib/src/v3/api/oauth/oauth.dart @@ -0,0 +1,32 @@ +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 String 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; +} From f30e374b25dc95e51333829085aa7f6f8909eb5a Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Fri, 15 Nov 2024 21:04:35 -0500 Subject: [PATCH 06/13] run builder for AuthenticateWithOAuth --- lib/src/v3/api/oauth/oauth.freezed.dart | 260 ++++++++++++++++++++++++ lib/src/v3/api/oauth/oauth.g.dart | 36 ++++ 2 files changed, 296 insertions(+) create mode 100644 lib/src/v3/api/oauth/oauth.freezed.dart create mode 100644 lib/src/v3/api/oauth/oauth.g.dart 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..a49608b7 --- /dev/null +++ b/lib/src/v3/api/oauth/oauth.freezed.dart @@ -0,0 +1,260 @@ +// 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; + String 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, + String 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 String, + 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, + String 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 String, + 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 String 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 String 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 + String 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..7ddac6d6 --- /dev/null +++ b/lib/src/v3/api/oauth/oauth.g.dart @@ -0,0 +1,36 @@ +// 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 String, + redirect_uri: json['redirect_uri'] as String, + username: json['username'] as String?, + answer: json['answer'] as String?, + ); + +Map _$$AuthenticateWithOAuthImplToJson( + _$AuthenticateWithOAuthImpl instance) { + final val = { + 'code': instance.code, + 'oauth_provider_id': instance.oauth_provider_id, + 'redirect_uri': instance.redirect_uri, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('username', instance.username); + writeNotNull('answer', instance.answer); + return val; +} From d927f38b77a3fdd9b61bb6616aa63467455b63ba Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Fri, 15 Nov 2024 21:07:28 -0500 Subject: [PATCH 07/13] add response factory --- lib/src/v3/api/oauth/oauth.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/src/v3/api/oauth/oauth.dart b/lib/src/v3/api/oauth/oauth.dart index 0d51a253..c5f1469c 100644 --- a/lib/src/v3/api/oauth/oauth.dart +++ b/lib/src/v3/api/oauth/oauth.dart @@ -29,4 +29,12 @@ class AuthenticateWithOAuth final path = '/oauth/authenticate'; final httpMethod = HttpMethod.post; + + @override + LoginResponse responseFactory(Map json) { + // TODO: Check if this needs to be implemented. + // At this point I don't think so, I don't think this returns anything. + // Instead, I think the OAuth provider hits the redirect_uri route. + throw UnimplementedError(); + } } From 30e0cf0a2c4af04011220ab1aabcacac820acd56 Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Sat, 16 Nov 2024 13:36:29 -0500 Subject: [PATCH 08/13] Override AuthenticateWithOAuth response factory Co-authored-by: William --- lib/src/v3/api/oauth/oauth.dart | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/src/v3/api/oauth/oauth.dart b/lib/src/v3/api/oauth/oauth.dart index c5f1469c..bf9f7061 100644 --- a/lib/src/v3/api/oauth/oauth.dart +++ b/lib/src/v3/api/oauth/oauth.dart @@ -31,10 +31,6 @@ class AuthenticateWithOAuth final httpMethod = HttpMethod.post; @override - LoginResponse responseFactory(Map json) { - // TODO: Check if this needs to be implemented. - // At this point I don't think so, I don't think this returns anything. - // Instead, I think the OAuth provider hits the redirect_uri route. - throw UnimplementedError(); - } + LoginResponse responseFactory(Map json) => + LoginResponse.fromJson(json); } From a944853a16703c275fff80c9aab0758f5d91876a Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Fri, 22 Nov 2024 18:15:18 -0500 Subject: [PATCH 09/13] make defaultCommentSortType and defaultPostSortType optional --- lib/src/v3/api/api.dart | 1 + lib/src/v3/models/local_user/local_user.dart | 4 +- .../models/local_user/local_user.freezed.dart | 52 +++++++++---------- .../v3/models/local_user/local_user.g.dart | 13 +++-- 4 files changed, 37 insertions(+), 33 deletions(-) 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/models/local_user/local_user.dart b/lib/src/v3/models/local_user/local_user.dart index fa3cc255..5adf0f1f 100644 --- a/lib/src/v3/models/local_user/local_user.dart +++ b/lib/src/v3/models/local_user/local_user.dart @@ -18,8 +18,8 @@ class LocalUser with _$LocalUser { bool? autoExpand, // v0.18.3 required String theme, // v0.18.0 @deprecated SortType? defaultSortType, // v0.18.0 [deprecated in v0.20.0] - required SortType defaultCommentSortType, // v0.20.0 - required SortType defaultPostSortType, // 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 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 013c8f81..cdfdf941 100644 --- a/lib/src/v3/models/local_user/local_user.freezed.dart +++ b/lib/src/v3/models/local_user/local_user.freezed.dart @@ -30,9 +30,9 @@ mixin _$LocalUser { @deprecated SortType? get defaultSortType => throw _privateConstructorUsedError; // v0.18.0 [deprecated in v0.20.0] - SortType get defaultCommentSortType => + SortType? get defaultCommentSortType => throw _privateConstructorUsedError; // v0.20.0 - SortType get defaultPostSortType => + SortType? get defaultPostSortType => throw _privateConstructorUsedError; // v0.20.0 ListingType get defaultListingType => throw _privateConstructorUsedError; // v0.18.0 @@ -94,8 +94,8 @@ abstract class $LocalUserCopyWith<$Res> { bool? autoExpand, String theme, @deprecated SortType? defaultSortType, - SortType defaultCommentSortType, - SortType defaultPostSortType, + SortType? defaultCommentSortType, + SortType? defaultPostSortType, ListingType defaultListingType, String interfaceLanguage, bool showAvatars, @@ -141,8 +141,8 @@ class _$LocalUserCopyWithImpl<$Res, $Val extends LocalUser> Object? autoExpand = freezed, Object? theme = null, Object? defaultSortType = freezed, - Object? defaultCommentSortType = null, - Object? defaultPostSortType = null, + Object? defaultCommentSortType = freezed, + Object? defaultPostSortType = freezed, Object? defaultListingType = null, Object? interfaceLanguage = null, Object? showAvatars = null, @@ -197,14 +197,14 @@ class _$LocalUserCopyWithImpl<$Res, $Val extends LocalUser> ? _value.defaultSortType : defaultSortType // ignore: cast_nullable_to_non_nullable as SortType?, - defaultCommentSortType: null == defaultCommentSortType + defaultCommentSortType: freezed == defaultCommentSortType ? _value.defaultCommentSortType : defaultCommentSortType // ignore: cast_nullable_to_non_nullable - as SortType, - defaultPostSortType: null == defaultPostSortType + as SortType?, + defaultPostSortType: freezed == defaultPostSortType ? _value.defaultPostSortType : defaultPostSortType // ignore: cast_nullable_to_non_nullable - as SortType, + as SortType?, defaultListingType: null == defaultListingType ? _value.defaultListingType : defaultListingType // ignore: cast_nullable_to_non_nullable @@ -306,8 +306,8 @@ abstract class _$$LocalUserImplCopyWith<$Res> bool? autoExpand, String theme, @deprecated SortType? defaultSortType, - SortType defaultCommentSortType, - SortType defaultPostSortType, + SortType? defaultCommentSortType, + SortType? defaultPostSortType, ListingType defaultListingType, String interfaceLanguage, bool showAvatars, @@ -351,8 +351,8 @@ class __$$LocalUserImplCopyWithImpl<$Res> Object? autoExpand = freezed, Object? theme = null, Object? defaultSortType = freezed, - Object? defaultCommentSortType = null, - Object? defaultPostSortType = null, + Object? defaultCommentSortType = freezed, + Object? defaultPostSortType = freezed, Object? defaultListingType = null, Object? interfaceLanguage = null, Object? showAvatars = null, @@ -407,14 +407,14 @@ class __$$LocalUserImplCopyWithImpl<$Res> ? _value.defaultSortType : defaultSortType // ignore: cast_nullable_to_non_nullable as SortType?, - defaultCommentSortType: null == defaultCommentSortType + defaultCommentSortType: freezed == defaultCommentSortType ? _value.defaultCommentSortType : defaultCommentSortType // ignore: cast_nullable_to_non_nullable - as SortType, - defaultPostSortType: null == defaultPostSortType + as SortType?, + defaultPostSortType: freezed == defaultPostSortType ? _value.defaultPostSortType : defaultPostSortType // ignore: cast_nullable_to_non_nullable - as SortType, + as SortType?, defaultListingType: null == defaultListingType ? _value.defaultListingType : defaultListingType // ignore: cast_nullable_to_non_nullable @@ -512,8 +512,8 @@ class _$LocalUserImpl extends _LocalUser { this.autoExpand, required this.theme, @deprecated this.defaultSortType, - required this.defaultCommentSortType, - required this.defaultPostSortType, + this.defaultCommentSortType, + this.defaultPostSortType, required this.defaultListingType, required this.interfaceLanguage, required this.showAvatars, @@ -565,10 +565,10 @@ class _$LocalUserImpl extends _LocalUser { final SortType? defaultSortType; // v0.18.0 [deprecated in v0.20.0] @override - final SortType defaultCommentSortType; + final SortType? defaultCommentSortType; // v0.20.0 @override - final SortType defaultPostSortType; + final SortType? defaultPostSortType; // v0.20.0 @override final ListingType defaultListingType; @@ -766,8 +766,8 @@ abstract class _LocalUser extends LocalUser { final bool? autoExpand, required final String theme, @deprecated final SortType? defaultSortType, - required final SortType defaultCommentSortType, - required final SortType defaultPostSortType, + final SortType? defaultCommentSortType, + final SortType? defaultPostSortType, required final ListingType defaultListingType, required final String interfaceLanguage, required final bool showAvatars, @@ -811,9 +811,9 @@ abstract class _LocalUser extends LocalUser { @deprecated SortType? get defaultSortType; // v0.18.0 [deprecated in v0.20.0] @override - SortType get defaultCommentSortType; // v0.20.0 + SortType? get defaultCommentSortType; // v0.20.0 @override - SortType get defaultPostSortType; // v0.20.0 + SortType? get defaultPostSortType; // v0.20.0 @override ListingType get defaultListingType; // 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 4b7b7ad5..87253402 100644 --- a/lib/src/v3/models/local_user/local_user.g.dart +++ b/lib/src/v3/models/local_user/local_user.g.dart @@ -18,9 +18,12 @@ _$LocalUserImpl _$$LocalUserImplFromJson(Map json) => defaultSortType: json['default_sort_type'] == null ? null : SortType.fromJson(json['default_sort_type']), - defaultCommentSortType: - SortType.fromJson(json['default_comment_sort_type']), - defaultPostSortType: SortType.fromJson(json['default_post_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, @@ -53,8 +56,8 @@ Map _$$LocalUserImplToJson(_$LocalUserImpl instance) => 'auto_expand': instance.autoExpand, 'theme': instance.theme, 'default_sort_type': instance.defaultSortType?.toJson(), - 'default_comment_sort_type': instance.defaultCommentSortType.toJson(), - 'default_post_sort_type': instance.defaultPostSortType.toJson(), + 'default_comment_sort_type': instance.defaultCommentSortType?.toJson(), + 'default_post_sort_type': instance.defaultPostSortType?.toJson(), 'default_listing_type': instance.defaultListingType.toJson(), 'interface_language': instance.interfaceLanguage, 'show_avatars': instance.showAvatars, From a344297881180d55ff8fb55084dcef902a69bf3a Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Sat, 30 Nov 2024 19:22:31 -0500 Subject: [PATCH 10/13] change oauth_prover_is to int --- lib/src/v3/api/oauth/oauth.dart | 12 ++++-------- lib/src/v3/api/oauth/oauth.freezed.dart | 16 ++++++++-------- lib/src/v3/api/oauth/oauth.g.dart | 2 +- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/lib/src/v3/api/oauth/oauth.dart b/lib/src/v3/api/oauth/oauth.dart index bf9f7061..12ed7cdd 100644 --- a/lib/src/v3/api/oauth/oauth.dart +++ b/lib/src/v3/api/oauth/oauth.dart @@ -11,26 +11,22 @@ part 'oauth.g.dart'; /// /// `HTTP.POST /oauth/authenticate` @freezed -class AuthenticateWithOAuth - with _$AuthenticateWithOAuth - implements LemmyApiQuery { +class AuthenticateWithOAuth with _$AuthenticateWithOAuth implements LemmyApiQuery { @apiSerde const factory AuthenticateWithOAuth({ required String code, - required String oauth_provider_id, + required int oauth_provider_id, required String redirect_uri, String? username, String? answer, }) = _AuthenticateWithOAuth; const AuthenticateWithOAuth._(); - factory AuthenticateWithOAuth.fromJson(Map json) => - _$AuthenticateWithOAuthFromJson(json); + factory AuthenticateWithOAuth.fromJson(Map json) => _$AuthenticateWithOAuthFromJson(json); final path = '/oauth/authenticate'; final httpMethod = HttpMethod.post; @override - LoginResponse responseFactory(Map json) => - LoginResponse.fromJson(json); + 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 index a49608b7..862eaa51 100644 --- a/lib/src/v3/api/oauth/oauth.freezed.dart +++ b/lib/src/v3/api/oauth/oauth.freezed.dart @@ -22,7 +22,7 @@ AuthenticateWithOAuth _$AuthenticateWithOAuthFromJson( /// @nodoc mixin _$AuthenticateWithOAuth { String get code => throw _privateConstructorUsedError; - String get oauth_provider_id => 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; @@ -45,7 +45,7 @@ abstract class $AuthenticateWithOAuthCopyWith<$Res> { @useResult $Res call( {String code, - String oauth_provider_id, + int oauth_provider_id, String redirect_uri, String? username, String? answer}); @@ -81,7 +81,7 @@ class _$AuthenticateWithOAuthCopyWithImpl<$Res, oauth_provider_id: null == oauth_provider_id ? _value.oauth_provider_id : oauth_provider_id // ignore: cast_nullable_to_non_nullable - as String, + as int, redirect_uri: null == redirect_uri ? _value.redirect_uri : redirect_uri // ignore: cast_nullable_to_non_nullable @@ -109,7 +109,7 @@ abstract class _$$AuthenticateWithOAuthImplCopyWith<$Res> @useResult $Res call( {String code, - String oauth_provider_id, + int oauth_provider_id, String redirect_uri, String? username, String? answer}); @@ -143,7 +143,7 @@ class __$$AuthenticateWithOAuthImplCopyWithImpl<$Res> oauth_provider_id: null == oauth_provider_id ? _value.oauth_provider_id : oauth_provider_id // ignore: cast_nullable_to_non_nullable - as String, + as int, redirect_uri: null == redirect_uri ? _value.redirect_uri : redirect_uri // ignore: cast_nullable_to_non_nullable @@ -178,7 +178,7 @@ class _$AuthenticateWithOAuthImpl extends _AuthenticateWithOAuth { @override final String code; @override - final String oauth_provider_id; + final int oauth_provider_id; @override final String redirect_uri; @override @@ -231,7 +231,7 @@ class _$AuthenticateWithOAuthImpl extends _AuthenticateWithOAuth { abstract class _AuthenticateWithOAuth extends AuthenticateWithOAuth { const factory _AuthenticateWithOAuth( {required final String code, - required final String oauth_provider_id, + required final int oauth_provider_id, required final String redirect_uri, final String? username, final String? answer}) = _$AuthenticateWithOAuthImpl; @@ -243,7 +243,7 @@ abstract class _AuthenticateWithOAuth extends AuthenticateWithOAuth { @override String get code; @override - String get oauth_provider_id; + int get oauth_provider_id; @override String get redirect_uri; @override diff --git a/lib/src/v3/api/oauth/oauth.g.dart b/lib/src/v3/api/oauth/oauth.g.dart index 7ddac6d6..4d44b438 100644 --- a/lib/src/v3/api/oauth/oauth.g.dart +++ b/lib/src/v3/api/oauth/oauth.g.dart @@ -10,7 +10,7 @@ _$AuthenticateWithOAuthImpl _$$AuthenticateWithOAuthImplFromJson( Map json) => _$AuthenticateWithOAuthImpl( code: json['code'] as String, - oauth_provider_id: json['oauth_provider_id'] 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?, From ce1608333b15e5c3be35dfb9092090bf60f1ee5d Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Wed, 11 Dec 2024 20:08:19 -0500 Subject: [PATCH 11/13] add provider_view to get_site_response --- .../models/site/.get_site_response.dart.swp | Bin 0 -> 12288 bytes lib/src/v3/models/site/get_site_response.dart | 4 +- .../site/get_site_response.freezed.dart | 38 ++- .../v3/models/site/get_site_response.g.dart | 5 + lib/src/v3/views/.provider_view.dart.swp | Bin 0 -> 12288 bytes lib/src/v3/views/provider_view.dart | 24 ++ lib/src/v3/views/provider_view.freezed.dart | 260 ++++++++++++++++++ lib/src/v3/views/provider_view.g.dart | 25 ++ lib/src/v3/views/views.dart | 1 + 9 files changed, 353 insertions(+), 4 deletions(-) create mode 100644 lib/src/v3/models/site/.get_site_response.dart.swp create mode 100644 lib/src/v3/views/.provider_view.dart.swp create mode 100644 lib/src/v3/views/provider_view.dart create mode 100644 lib/src/v3/views/provider_view.freezed.dart create mode 100644 lib/src/v3/views/provider_view.g.dart diff --git a/lib/src/v3/models/site/.get_site_response.dart.swp b/lib/src/v3/models/site/.get_site_response.dart.swp new file mode 100644 index 0000000000000000000000000000000000000000..ff2b83e7d700545af52ac528d04c6780543be8cf GIT binary patch literal 12288 zcmeI2J#P~+7{^@}hEiTPK*FU+O{H>|HXyaMqy+@1sFf;8JFuJ_pL2D4X9wF!6{^Al zVqs%q0SUeVGZTCT#EkePJWg^c$_pJ4=&|(AIrj5n|LhE>JeA_s${L*yiUiteLVjF- zoV+>ydgR3|LXwKKd|Oxj)Sp_iR|z<)q#`g}1zcxCjGyHJL#|^HrXtIl5v$3Fr&1^v zrm_-R!^1`?%)lVEp_NXAiExqcL`K+}R#pTtGj2!@97Y02U;u%-t6rTOBc<7y)=z!n z@;E(rc5{Fs4j};~fCP{L58iADaaD7c`ju^( z^meNGZVIF2C0g-)5yPmRreR1M#b9PWxJC;`JgG|~;;F+J>qa+ZEXIvgJi~#@u literal 0 HcmV?d00001 diff --git a/lib/src/v3/models/site/get_site_response.dart b/lib/src/v3/models/site/get_site_response.dart index 4d4dac56..6e575f9a 100644 --- a/lib/src/v3/models/site/get_site_response.dart +++ b/lib/src/v3/models/site/get_site_response.dart @@ -19,10 +19,10 @@ class GetSiteResponse with _$GetSiteResponse { required List 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; const GetSiteResponse._(); - factory GetSiteResponse.fromJson(Map json) => - _$GetSiteResponseFromJson(json); + factory GetSiteResponse.fromJson(Map json) => _$GetSiteResponseFromJson(json); } 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 dba23d92..8957f3d5 100644 --- a/lib/src/v3/models/site/get_site_response.freezed.dart +++ b/lib/src/v3/models/site/get_site_response.freezed.dart @@ -31,6 +31,8 @@ mixin _$GetSiteResponse { 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; @@ -59,6 +61,7 @@ abstract class $GetSiteResponseCopyWith<$Res> { List discussionLanguages, List taglines, List customEmojis, + List? oauthProviders, List? blockedUrls}); $SiteViewCopyWith<$Res> get siteView; @@ -88,6 +91,7 @@ class _$GetSiteResponseCopyWithImpl<$Res, $Val extends GetSiteResponse> Object? discussionLanguages = null, Object? taglines = null, Object? customEmojis = null, + Object? oauthProviders = freezed, Object? blockedUrls = freezed, }) { return _then(_value.copyWith( @@ -123,6 +127,10 @@ class _$GetSiteResponseCopyWithImpl<$Res, $Val extends GetSiteResponse> ? _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 : blockedUrls // ignore: cast_nullable_to_non_nullable @@ -172,6 +180,7 @@ abstract class _$$GetSiteResponseImplCopyWith<$Res> List discussionLanguages, List taglines, List customEmojis, + List? oauthProviders, List? blockedUrls}); @override @@ -201,6 +210,7 @@ class __$$GetSiteResponseImplCopyWithImpl<$Res> Object? discussionLanguages = null, Object? taglines = null, Object? customEmojis = null, + Object? oauthProviders = freezed, Object? blockedUrls = freezed, }) { return _then(_$GetSiteResponseImpl( @@ -236,6 +246,10 @@ class __$$GetSiteResponseImplCopyWithImpl<$Res> ? _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 : blockedUrls // ignore: cast_nullable_to_non_nullable @@ -257,12 +271,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._(); @@ -329,8 +345,20 @@ 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; @@ -342,7 +370,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 @@ -362,6 +390,8 @@ class _$GetSiteResponseImpl extends _GetSiteResponse { const DeepCollectionEquality().equals(other._taglines, _taglines) && const DeepCollectionEquality() .equals(other._customEmojis, _customEmojis) && + const DeepCollectionEquality() + .equals(other._oauthProviders, _oauthProviders) && const DeepCollectionEquality() .equals(other._blockedUrls, _blockedUrls)); } @@ -378,6 +408,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)); /// Create a copy of GetSiteResponse @@ -407,6 +438,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._(); @@ -430,6 +462,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 9ab4b327..dfc02baa 100644 --- a/lib/src/v3/models/site/get_site_response.g.dart +++ b/lib/src/v3/models/site/get_site_response.g.dart @@ -29,6 +29,9 @@ _$GetSiteResponseImpl _$$GetSiteResponseImplFromJson( 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)) @@ -46,5 +49,7 @@ Map _$$GetSiteResponseImplToJson( '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/views/.provider_view.dart.swp b/lib/src/v3/views/.provider_view.dart.swp new file mode 100644 index 0000000000000000000000000000000000000000..6b26d4050a094d14a998c723f9bf098a46f45255 GIT binary patch literal 12288 zcmeI2O>fgM7{^_%tbpLc(Y#3Oq!E`+;%#i}1tgFrAx-RnK#}XXsUfk0?Y4B&c)4@q zijepw2)+d;J_H;QJV_JOvbGb)p~uocR^tEj`0+35A?nj22-979nv*InguSd}+~$hn+z1P9g& z5ganWP5Y!hz2>Ay3 z1bPR03~GT+f_^~G@1U=s_n;S`0Vv2l$X9nncw(5-CSJiEQ)tDaIVd12{bg>KMrGHt#crB*)gD=Q;9&P$yznRKg^F*;}lttRw|&$5jh zxI+~k>EwOiGgj?!uZ#|*jxwXPKQb&*E=%|*ghR^tX2?Vj)i9GE`=dR(-sFR#yBEF&umQE6uK6hXj> qN?bWrhKY5s^u0 literal 0 HcmV?d00001 diff --git a/lib/src/v3/views/provider_view.dart b/lib/src/v3/views/provider_view.dart new file mode 100644 index 00000000..f817c114 --- /dev/null +++ b/lib/src/v3/views/provider_view.dart @@ -0,0 +1,24 @@ +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 display_name, // v0.20.0 + required String authorization_endpoint, // v0.20.0 + required String client_id, // 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..1ebf3ed9 --- /dev/null +++ b/lib/src/v3/views/provider_view.freezed.dart @@ -0,0 +1,260 @@ +// 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 display_name => throw _privateConstructorUsedError; // v0.20.0 + String get authorization_endpoint => + throw _privateConstructorUsedError; // v0.20.0 + String get client_id => 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 display_name, + String authorization_endpoint, + String client_id, + 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? display_name = null, + Object? authorization_endpoint = null, + Object? client_id = null, + Object? scopes = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + display_name: null == display_name + ? _value.display_name + : display_name // ignore: cast_nullable_to_non_nullable + as String, + authorization_endpoint: null == authorization_endpoint + ? _value.authorization_endpoint + : authorization_endpoint // ignore: cast_nullable_to_non_nullable + as String, + client_id: null == client_id + ? _value.client_id + : client_id // 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 display_name, + String authorization_endpoint, + String client_id, + 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? display_name = null, + Object? authorization_endpoint = null, + Object? client_id = null, + Object? scopes = null, + }) { + return _then(_$ProviderViewImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + display_name: null == display_name + ? _value.display_name + : display_name // ignore: cast_nullable_to_non_nullable + as String, + authorization_endpoint: null == authorization_endpoint + ? _value.authorization_endpoint + : authorization_endpoint // ignore: cast_nullable_to_non_nullable + as String, + client_id: null == client_id + ? _value.client_id + : client_id // 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.display_name, + required this.authorization_endpoint, + required this.client_id, + required this.scopes}) + : super._(); + + factory _$ProviderViewImpl.fromJson(Map json) => + _$$ProviderViewImplFromJson(json); + + @override + final int id; +// v0.20.0 + @override + final String display_name; +// v0.20.0 + @override + final String authorization_endpoint; +// v0.20.0 + @override + final String client_id; +// v0.20.0 + @override + final String scopes; + + @override + String toString() { + return 'ProviderView(id: $id, display_name: $display_name, authorization_endpoint: $authorization_endpoint, client_id: $client_id, 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.display_name, display_name) || + other.display_name == display_name) && + (identical(other.authorization_endpoint, authorization_endpoint) || + other.authorization_endpoint == authorization_endpoint) && + (identical(other.client_id, client_id) || + other.client_id == client_id) && + (identical(other.scopes, scopes) || other.scopes == scopes)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, id, display_name, authorization_endpoint, client_id, 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 display_name, + required final String authorization_endpoint, + required final String client_id, + 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 display_name; // v0.20.0 + @override + String get authorization_endpoint; // v0.20.0 + @override + String get client_id; // 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..b9dab988 --- /dev/null +++ b/lib/src/v3/views/provider_view.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'provider_view.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$ProviderViewImpl _$$ProviderViewImplFromJson(Map json) => + _$ProviderViewImpl( + id: (json['id'] as num).toInt(), + display_name: json['display_name'] as String, + authorization_endpoint: json['authorization_endpoint'] as String, + client_id: json['client_id'] as String, + scopes: json['scopes'] as String, + ); + +Map _$$ProviderViewImplToJson(_$ProviderViewImpl instance) => + { + 'id': instance.id, + 'display_name': instance.display_name, + 'authorization_endpoint': instance.authorization_endpoint, + 'client_id': instance.client_id, + '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'; From 2886218a71c75d14cb21d2079bfb3666603d3221 Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Wed, 11 Dec 2024 20:43:14 -0500 Subject: [PATCH 12/13] camel case fix --- lib/src/v3/views/.provider_view.dart.swp | Bin 12288 -> 12288 bytes lib/src/v3/views/provider_view.dart | 6 +- lib/src/v3/views/provider_view.freezed.dart | 106 ++++++++++---------- lib/src/v3/views/provider_view.g.dart | 12 +-- 4 files changed, 62 insertions(+), 62 deletions(-) diff --git a/lib/src/v3/views/.provider_view.dart.swp b/lib/src/v3/views/.provider_view.dart.swp index 6b26d4050a094d14a998c723f9bf098a46f45255..8186a61d6bd37e8658bd64e1d22b17f03d974dda 100644 GIT binary patch delta 116 zcmZojXh;xCG6?hZRj|}EU;qLE1_mwrsB|mKjbiWQSs8d47%C=nDmd#+;bUNk17cGk z<^$p%K$-7Ad>4r4193GFR|0Vb5SQ|9RuuTpGr3In8l&fAKRta$*U9xj(r@zyy#Pi4 Df json) { /// @nodoc mixin _$ProviderView { int get id => throw _privateConstructorUsedError; // v0.20.0 - String get display_name => throw _privateConstructorUsedError; // v0.20.0 - String get authorization_endpoint => + String get displayName => throw _privateConstructorUsedError; // v0.20.0 + String get authorizationEndpoint => throw _privateConstructorUsedError; // v0.20.0 - String get client_id => 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. @@ -45,9 +45,9 @@ abstract class $ProviderViewCopyWith<$Res> { @useResult $Res call( {int id, - String display_name, - String authorization_endpoint, - String client_id, + String displayName, + String authorizationEndpoint, + String clientId, String scopes}); } @@ -67,9 +67,9 @@ class _$ProviderViewCopyWithImpl<$Res, $Val extends ProviderView> @override $Res call({ Object? id = null, - Object? display_name = null, - Object? authorization_endpoint = null, - Object? client_id = null, + Object? displayName = null, + Object? authorizationEndpoint = null, + Object? clientId = null, Object? scopes = null, }) { return _then(_value.copyWith( @@ -77,17 +77,17 @@ class _$ProviderViewCopyWithImpl<$Res, $Val extends ProviderView> ? _value.id : id // ignore: cast_nullable_to_non_nullable as int, - display_name: null == display_name - ? _value.display_name - : display_name // ignore: cast_nullable_to_non_nullable + displayName: null == displayName + ? _value.displayName + : displayName // ignore: cast_nullable_to_non_nullable as String, - authorization_endpoint: null == authorization_endpoint - ? _value.authorization_endpoint - : authorization_endpoint // ignore: cast_nullable_to_non_nullable + authorizationEndpoint: null == authorizationEndpoint + ? _value.authorizationEndpoint + : authorizationEndpoint // ignore: cast_nullable_to_non_nullable as String, - client_id: null == client_id - ? _value.client_id - : client_id // ignore: cast_nullable_to_non_nullable + clientId: null == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable as String, scopes: null == scopes ? _value.scopes @@ -107,9 +107,9 @@ abstract class _$$ProviderViewImplCopyWith<$Res> @useResult $Res call( {int id, - String display_name, - String authorization_endpoint, - String client_id, + String displayName, + String authorizationEndpoint, + String clientId, String scopes}); } @@ -127,9 +127,9 @@ class __$$ProviderViewImplCopyWithImpl<$Res> @override $Res call({ Object? id = null, - Object? display_name = null, - Object? authorization_endpoint = null, - Object? client_id = null, + Object? displayName = null, + Object? authorizationEndpoint = null, + Object? clientId = null, Object? scopes = null, }) { return _then(_$ProviderViewImpl( @@ -137,17 +137,17 @@ class __$$ProviderViewImplCopyWithImpl<$Res> ? _value.id : id // ignore: cast_nullable_to_non_nullable as int, - display_name: null == display_name - ? _value.display_name - : display_name // ignore: cast_nullable_to_non_nullable + displayName: null == displayName + ? _value.displayName + : displayName // ignore: cast_nullable_to_non_nullable as String, - authorization_endpoint: null == authorization_endpoint - ? _value.authorization_endpoint - : authorization_endpoint // ignore: cast_nullable_to_non_nullable + authorizationEndpoint: null == authorizationEndpoint + ? _value.authorizationEndpoint + : authorizationEndpoint // ignore: cast_nullable_to_non_nullable as String, - client_id: null == client_id - ? _value.client_id - : client_id // ignore: cast_nullable_to_non_nullable + clientId: null == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable as String, scopes: null == scopes ? _value.scopes @@ -163,9 +163,9 @@ class __$$ProviderViewImplCopyWithImpl<$Res> class _$ProviderViewImpl extends _ProviderView { const _$ProviderViewImpl( {required this.id, - required this.display_name, - required this.authorization_endpoint, - required this.client_id, + required this.displayName, + required this.authorizationEndpoint, + required this.clientId, required this.scopes}) : super._(); @@ -176,20 +176,20 @@ class _$ProviderViewImpl extends _ProviderView { final int id; // v0.20.0 @override - final String display_name; + final String displayName; // v0.20.0 @override - final String authorization_endpoint; + final String authorizationEndpoint; // v0.20.0 @override - final String client_id; + final String clientId; // v0.20.0 @override final String scopes; @override String toString() { - return 'ProviderView(id: $id, display_name: $display_name, authorization_endpoint: $authorization_endpoint, client_id: $client_id, scopes: $scopes)'; + return 'ProviderView(id: $id, displayName: $displayName, authorizationEndpoint: $authorizationEndpoint, clientId: $clientId, scopes: $scopes)'; } @override @@ -198,19 +198,19 @@ class _$ProviderViewImpl extends _ProviderView { (other.runtimeType == runtimeType && other is _$ProviderViewImpl && (identical(other.id, id) || other.id == id) && - (identical(other.display_name, display_name) || - other.display_name == display_name) && - (identical(other.authorization_endpoint, authorization_endpoint) || - other.authorization_endpoint == authorization_endpoint) && - (identical(other.client_id, client_id) || - other.client_id == client_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, display_name, authorization_endpoint, client_id, scopes); + runtimeType, id, displayName, authorizationEndpoint, clientId, scopes); /// Create a copy of ProviderView /// with the given fields replaced by the non-null parameter values. @@ -231,9 +231,9 @@ class _$ProviderViewImpl extends _ProviderView { abstract class _ProviderView extends ProviderView { const factory _ProviderView( {required final int id, - required final String display_name, - required final String authorization_endpoint, - required final String client_id, + required final String displayName, + required final String authorizationEndpoint, + required final String clientId, required final String scopes}) = _$ProviderViewImpl; const _ProviderView._() : super._(); @@ -243,11 +243,11 @@ abstract class _ProviderView extends ProviderView { @override int get id; // v0.20.0 @override - String get display_name; // v0.20.0 + String get displayName; // v0.20.0 @override - String get authorization_endpoint; // v0.20.0 + String get authorizationEndpoint; // v0.20.0 @override - String get client_id; // v0.20.0 + String get clientId; // v0.20.0 @override String get scopes; diff --git a/lib/src/v3/views/provider_view.g.dart b/lib/src/v3/views/provider_view.g.dart index b9dab988..5a210bc4 100644 --- a/lib/src/v3/views/provider_view.g.dart +++ b/lib/src/v3/views/provider_view.g.dart @@ -9,17 +9,17 @@ part of 'provider_view.dart'; _$ProviderViewImpl _$$ProviderViewImplFromJson(Map json) => _$ProviderViewImpl( id: (json['id'] as num).toInt(), - display_name: json['display_name'] as String, - authorization_endpoint: json['authorization_endpoint'] as String, - client_id: json['client_id'] as String, + 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.display_name, - 'authorization_endpoint': instance.authorization_endpoint, - 'client_id': instance.client_id, + 'display_name': instance.displayName, + 'authorization_endpoint': instance.authorizationEndpoint, + 'client_id': instance.clientId, 'scopes': instance.scopes, }; From 14a5a092c55f0c4fd73a3b4c21461aa453a81318 Mon Sep 17 00:00:00 2001 From: Hamlet Jiang Su Date: Mon, 17 Feb 2025 01:07:58 -0800 Subject: [PATCH 13/13] chore: remove .swp files --- .../v3/models/site/.get_site_response.dart.swp | Bin 12288 -> 0 bytes lib/src/v3/views/.provider_view.dart.swp | Bin 12288 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 lib/src/v3/models/site/.get_site_response.dart.swp delete mode 100644 lib/src/v3/views/.provider_view.dart.swp diff --git a/lib/src/v3/models/site/.get_site_response.dart.swp b/lib/src/v3/models/site/.get_site_response.dart.swp deleted file mode 100644 index ff2b83e7d700545af52ac528d04c6780543be8cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2J#P~+7{^@}hEiTPK*FU+O{H>|HXyaMqy+@1sFf;8JFuJ_pL2D4X9wF!6{^Al zVqs%q0SUeVGZTCT#EkePJWg^c$_pJ4=&|(AIrj5n|LhE>JeA_s${L*yiUiteLVjF- zoV+>ydgR3|LXwKKd|Oxj)Sp_iR|z<)q#`g}1zcxCjGyHJL#|^HrXtIl5v$3Fr&1^v zrm_-R!^1`?%)lVEp_NXAiExqcL`K+}R#pTtGj2!@97Y02U;u%-t6rTOBc<7y)=z!n z@;E(rc5{Fs4j};~fCP{L58iADaaD7c`ju^( z^meNGZVIF2C0g-)5yPmRreR1M#b9PWxJC;`JgG|~;;F+J>qa+ZEXIvgJi~#@u diff --git a/lib/src/v3/views/.provider_view.dart.swp b/lib/src/v3/views/.provider_view.dart.swp deleted file mode 100644 index 8186a61d6bd37e8658bd64e1d22b17f03d974dda..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2PjAyO6u@2X9SANQ%^ztU8gbbKVjEj~0cl7>NE16CLF71YYDnVDc3Zk?{JC@F z4C0$0_#8-l3%J2cnxJ;H-5Ge6ezg+6_w4+t9-_XWd9b@jH@qf+agLB{t;f;k#@pKa z79mlftmx`azO-mWgTNC!h^1#l>It3934U1>WI~6M#WG2TKF^ddVkJ|@VihoJ1naM} zzLEpWGNbz{l*Z35y^tF>r!w9~1888Ofu8GJzg;KmYd4CY`jyL<=!Nr-7N+1L8bAYR z01co4G=K)s02)98|CRxl)yOM&q%-AXT`cF?iMhPQ2@RkDG=K)s02)98XaEhM0W^RH z&;T0v3k~oP4qYeY1(5&$U%mf-IZMcA;3Mz`cnv%O+CU4q1=N9`ON4v_J^}B5r@&2M z3HSjuzXM-^55Nc*0{LD&00$aC184vZpaC?12G9T+Km%ytzc6r2Xfgb&56dp+188!- zXLNGk>a_6;K329Mro)BPW=JQayiOIi$Fn>8&Zsn6rQtB;i4r@s$fesmkS%m--E^+s zfV!}Byh69BKUp^4j#48Jd&HC>f{N=3TA0+jNnPy3G|}J`_hDxh?rYDWs44! z>(c4(h>l3RW28Ki@a~*JQ#xIqZd8woR`unrnTus+6+%>!>AZyJvEn4QoT`9{bqMJ> h6