feat(readarr): refresh all Readarr authors and expose the command on the CLI

Posts the RefreshAuthor command to the command endpoint with no author ID, which is how Readarr distinguishes a library wide refresh from a single author refresh. The response is returned verbatim and no app state is mutated.
This commit is contained in:
Dark-Alex-17 committed 2026-08-27 10:50:53 -06:00
1 parent c82006862e
commit 9572b68f97
6 files changed
+101

No files matched your search

@@ -362,6 +362,23 @@ impl Network<'_, '_> {
.await
}
pub(in crate::network::readarr_network) async fn update_all_authors(&mut self) -> Result<Value> {
info!("Updating all authors");
let event = ReadarrEvent::UpdateAllAuthors;
let body = ReadarrCommandBody {
name: "RefreshAuthor".to_owned(),
..ReadarrCommandBody::default()
};
let request_props = self
.request_props_from(event, RequestMethod::Post, Some(body), None, None)
.await;
self
.handle_request::<ReadarrCommandBody, Value>(request_props, |_, _| ())
.await
}
pub(in crate::network::readarr_network) async fn update_and_scan_author(
&mut self,
author_id: i64,
@@ -843,4 +843,45 @@ mod tests {
mock.assert_async().await;
assert_err!(result);
}
#[tokio::test]
async fn test_handle_update_all_authors_event() {
let (mock, app, _server) = MockServarrApi::post()
.with_request_body(json!({
"name": "RefreshAuthor"
}))
.returns(json!({}))
.build_for(ReadarrEvent::UpdateAllAuthors)
.await;
app.lock().await.server_tabs.set_index(3);
let mut network = test_network(&app);
let result = network
.handle_readarr_event(ReadarrEvent::UpdateAllAuthors)
.await;
mock.assert_async().await;
assert_ok!(result);
}
#[tokio::test]
async fn test_handle_update_all_authors_event_failure() {
let (mock, app, _server) = MockServarrApi::post()
.with_request_body(json!({
"name": "RefreshAuthor"
}))
.returns(json!({"name": "RefreshAuthor", "status": "queued"}))
.status(500)
.build_for(ReadarrEvent::UpdateAllAuthors)
.await;
app.lock().await.server_tabs.set_index(3);
let mut network = test_network(&app);
let result = network
.handle_readarr_event(ReadarrEvent::UpdateAllAuthors)
.await;
mock.assert_async().await;
assert_err!(result);
}
}