Skip to content

Commit

Permalink
Refactor listJoinedPrivateArchivedThreads method signature, before
Browse files Browse the repository at this point in the history
…is deprecated and it's replacement is `beforeSnowflake`.

See: https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads
  • Loading branch information
Lexedia committed Oct 12, 2024
1 parent 57dc328 commit ec7c8c9
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
9 changes: 7 additions & 2 deletions lib/src/http/managers/channel_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,12 @@ class ChannelManager extends ReadOnlyManager<Channel> {
}

/// List the private archived threads the current user has joined in a channel.
Future<ThreadList> listJoinedPrivateArchivedThreads(Snowflake id, {DateTime? before, int? limit}) async {
Future<ThreadList> listJoinedPrivateArchivedThreads(
Snowflake id, {
@Deprecated('Use beforeSnowflake instead') DateTime? before,
int? limit,
Snowflake? beforeSnowflake,
}) async {
final route = HttpRoute()
..channels(id: id.toString())
..users(id: '@me')
Expand All @@ -764,7 +769,7 @@ class ChannelManager extends ReadOnlyManager<Channel> {
final request = BasicRequest(
route,
queryParameters: {
if (before != null) 'before': before.toIso8601String(),
if (before != null) 'before': beforeSnowflake.toString(),
if (limit != null) 'limit': limit.toString(),
},
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/channel/has_threads_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ abstract class HasThreadsChannel implements GuildChannel {
/// External references:
/// * [ChannelManager.listJoinedPrivateArchivedThreads]
/// * Discord API Reference: https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads
Future<ThreadList> listJoinedPrivateArchivedThreads({DateTime? before, int? limit});
Future<ThreadList> listJoinedPrivateArchivedThreads({@Deprecated('Use beforeSnowflake instead') DateTime? before, int? limit, Snowflake beforeSnowflake});
}
5 changes: 3 additions & 2 deletions lib/src/models/channel/types/forum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ class ForumChannel extends Channel implements GuildChannel, ThreadsOnlyChannel {
Future<ThreadList> listPublicArchivedThreads({DateTime? before, int? limit}) => manager.listPublicArchivedThreads(id, before: before, limit: limit);

@override
Future<ThreadList> listJoinedPrivateArchivedThreads({DateTime? before, int? limit}) =>
manager.listJoinedPrivateArchivedThreads(id, before: before, limit: limit);
Future<ThreadList> listJoinedPrivateArchivedThreads({@Deprecated('Use beforeSnowflake instead') DateTime? before, int? limit, Snowflake? beforeSnowflake}) =>
// ignore: deprecated_member_use_from_same_package
manager.listJoinedPrivateArchivedThreads(id, before: before, limit: limit, beforeSnowflake: beforeSnowflake);

@override
Future<void> updatePermissionOverwrite(PermissionOverwriteBuilder builder) => manager.updatePermissionOverwrite(id, builder);
Expand Down
5 changes: 3 additions & 2 deletions lib/src/models/channel/types/guild_announcement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ class GuildAnnouncementChannel extends TextChannel implements GuildChannel, HasT
Future<ThreadList> listPublicArchivedThreads({DateTime? before, int? limit}) => manager.listPublicArchivedThreads(id, before: before, limit: limit);

@override
Future<ThreadList> listJoinedPrivateArchivedThreads({DateTime? before, int? limit}) =>
manager.listJoinedPrivateArchivedThreads(id, before: before, limit: limit);
Future<ThreadList> listJoinedPrivateArchivedThreads({@Deprecated('Use beforeSnowflake instead') DateTime? before, int? limit, Snowflake? beforeSnowflake}) =>
// ignore: deprecated_member_use_from_same_package
manager.listJoinedPrivateArchivedThreads(id, before: before, limit: limit, beforeSnowflake: beforeSnowflake);

@override
Future<void> updatePermissionOverwrite(PermissionOverwriteBuilder builder) => manager.updatePermissionOverwrite(id, builder);
Expand Down
5 changes: 3 additions & 2 deletions lib/src/models/channel/types/guild_media.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ class GuildMediaChannel extends Channel implements GuildChannel, ThreadsOnlyChan
Future<ThreadList> listPublicArchivedThreads({DateTime? before, int? limit}) => manager.listPublicArchivedThreads(id, before: before, limit: limit);

@override
Future<ThreadList> listJoinedPrivateArchivedThreads({DateTime? before, int? limit}) =>
manager.listJoinedPrivateArchivedThreads(id, before: before, limit: limit);
Future<ThreadList> listJoinedPrivateArchivedThreads({@Deprecated('Use beforeSnowflake instead') DateTime? before, int? limit, Snowflake? beforeSnowflake}) =>
// ignore: deprecated_member_use_from_same_package
manager.listJoinedPrivateArchivedThreads(id, before: before, limit: limit, beforeSnowflake: beforeSnowflake);

@override
Future<void> updatePermissionOverwrite(PermissionOverwriteBuilder builder) => manager.updatePermissionOverwrite(id, builder);
Expand Down
5 changes: 3 additions & 2 deletions lib/src/models/channel/types/guild_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ class GuildTextChannel extends TextChannel implements GuildChannel, HasThreadsCh
Future<ThreadList> listPublicArchivedThreads({DateTime? before, int? limit}) => manager.listPublicArchivedThreads(id, before: before, limit: limit);

@override
Future<ThreadList> listJoinedPrivateArchivedThreads({DateTime? before, int? limit}) =>
manager.listJoinedPrivateArchivedThreads(id, before: before, limit: limit);
Future<ThreadList> listJoinedPrivateArchivedThreads({@Deprecated('Use beforeSnowflake instead') DateTime? before, int? limit, Snowflake? beforeSnowflake}) =>
// ignore: deprecated_member_use_from_same_package
manager.listJoinedPrivateArchivedThreads(id, before: before, limit: limit, beforeSnowflake: beforeSnowflake);

@override
Future<void> updatePermissionOverwrite(PermissionOverwriteBuilder builder) => manager.updatePermissionOverwrite(id, builder);
Expand Down

0 comments on commit ec7c8c9

Please sign in to comment.