Repository: serenity-rs/serenity (language: rust)

Issue:
The `get_channel_archived_public_threads` method doesn't encode the timestamp well
While using the `Http::get_channel_archived_public_threads` method I got an error due to a miss-encoded `before` argument. The method asks for an `Option<u64>` but should rather ask for an `Option<Timestamp>` and encode it in ISO8601 as [described in the documentation](https://discord.com/developers/docs/resources/channel#list-public-archived-threads).

```
Error: Invalid Form Body (before: Could not parse 1700059153. Should be ISO8601.)

Caused by:
    Invalid Form Body (before: Could not parse 1700059153. Should be ISO8601.)
```


Discussion / hints:

Fix patch:
diff --git a/src/http/client.rs b/src/http/client.rs
index 6e97b68b7bb..51c667d695b 100644
--- a/src/http/client.rs
+++ b/src/http/client.rs
@@ -2799,7 +2799,7 @@ impl Http {
     pub async fn get_channel_archived_public_threads(
         &self,
         channel_id: ChannelId,
-        before: Option<u64>,
+        before: Option<Timestamp>,
         limit: Option<u64>,
     ) -> Result<ThreadsData> {
         let mut params = ArrayVec::<_, 2>::new();
@@ -2827,7 +2827,7 @@ impl Http {
     pub async fn get_channel_archived_private_threads(
         &self,
         channel_id: ChannelId,
-        before: Option<u64>,
+        before: Option<Timestamp>,
         limit: Option<u64>,
     ) -> Result<ThreadsData> {
         let mut params = ArrayVec::<_, 2>::new();
@@ -2855,7 +2855,7 @@ impl Http {
     pub async fn get_channel_joined_archived_private_threads(
         &self,
         channel_id: ChannelId,
-        before: Option<u64>,
+        before: Option<ChannelId>,
         limit: Option<u64>,
     ) -> Result<ThreadsData> {
         let mut params = ArrayVec::<_, 2>::new();
diff --git a/src/model/channel/channel_id.rs b/src/model/channel/channel_id.rs
index 20cd8930f23..8530214dd31 100644
--- a/src/model/channel/channel_id.rs
+++ b/src/model/channel/channel_id.rs
@@ -1022,7 +1022,7 @@ impl ChannelId {
     pub async fn get_archived_private_threads(
         self,
         http: impl AsRef<Http>,
-        before: Option<u64>,
+        before: Option<Timestamp>,
         limit: Option<u64>,
     ) -> Result<ThreadsData> {
         http.as_ref().get_channel_archived_private_threads(self, before, limit).await
@@ -1036,7 +1036,7 @@ impl ChannelId {
     pub async fn get_archived_public_threads(
         self,
         http: impl AsRef<Http>,
-        before: Option<u64>,
+        before: Option<Timestamp>,
         limit: Option<u64>,
     ) -> Result<ThreadsData> {
         http.as_ref().get_channel_archived_public_threads(self, before, limit).await
@@ -1050,7 +1050,7 @@ impl ChannelId {
     pub async fn get_joined_archived_private_threads(
         self,
         http: impl AsRef<Http>,
-        before: Option<u64>,
+        before: Option<ChannelId>,
         limit: Option<u64>,
     ) -> Result<ThreadsData> {
         http.as_ref().get_channel_joined_archived_private_threads(self, before, limit).await


Test patch: