feat: Added stuff
Some checks failed
build / checks-matrix (push) Has been cancelled
build / codecov (push) Has been cancelled
docs / docs (push) Has been cancelled
build / checks-build (push) Has been cancelled

This commit is contained in:
uttarayan21
2025-11-19 17:01:14 +05:30
parent 29674df85e
commit f41625e0ed
10 changed files with 271 additions and 151 deletions

View File

@@ -185,6 +185,39 @@ impl JellyfinClient {
let out: jellyfin::BaseItemDtoQueryResult = serde_json::from_str(&text)?;
Ok(out.items)
}
pub async fn search(&self, query: impl AsRef<str>) -> Result<Vec<jellyfin::BaseItemDto>> {
let text = &self
.request_builder(Method::GET, "Items/Search")
.query(&[("searchTerm", query.as_ref()), ("recursive", "true")])
.send()
.await?
.error_for_status()?
.text()
.await?;
let out: jellyfin::BaseItemDtoQueryResult = serde_json::from_str(&text)?;
Ok(out.items)
}
pub async fn thumbnail(
&self,
item: uuid::Uuid,
image_type: jellyfin::ImageType,
) -> Result<bytes::Bytes> {
let uri = format!(
"Items/{}/Images/{}",
item,
serde_json::to_string(&image_type).expect("Failed to serialize image type")
);
let bytes = self
.request_builder(Method::GET, uri)
.send()
.await?
.error_for_status()?
.bytes()
.await?;
Ok(bytes)
}
}
// pub trait Item {