The set_thread_subscription() API of the Notification API was supposed to use the PUT method according to the documentation. The implementation was using GET, so I changed it to PUT.
When I used PUT, the Not Found error no longer appeared.
However, the deserialization of the response type ThreadSubscription failed.
The cause was that the reason field was an empty string. (not null)
As a result, I was able to successfully change the thread subscription with the following code:
pub(crate) async fn unsubscribe_thread(&self, id: ThreadId) -> octocrab::Result<()> {
#[derive(serde::Serialize)]
struct Inner {
ignored: bool,
}
#[derive(serde::Deserialize)]
struct Response {}
let thread = id;
let ignored = true;
let route = format!("/notifications/threads/{thread}/subscription");
let body = Inner { ignored };
self.crab
.put::<Response, _, _>(route, Some(&body))
.await?;
Ok(())
}
The
set_thread_subscription()
API of the Notification API was supposed to use the PUT method according to the documentation. The implementation was using GET, so I changed it to PUT.Additional Context
When I used PUT, the Not Found error no longer appeared.
However, the deserialization of the response type
ThreadSubscription
failed.The cause was that the
reason
field was an empty string. (not null)As a result, I was able to successfully change the thread subscription with the following code: