Add basic album list
This commit is contained in:
19
src/api.rs
19
src/api.rs
@@ -10,7 +10,7 @@ use image::{
|
||||
DynamicImage, EncodableLayout,
|
||||
codecs::webp::{WebPDecoder, WebPEncoder},
|
||||
};
|
||||
use immich_sdk::{AssetId, AssetVisibility};
|
||||
use immich_sdk::{AlbumResponse, AssetId, AssetVisibility};
|
||||
use slint::{Rgba8Pixel, SharedPixelBuffer};
|
||||
|
||||
use crate::{
|
||||
@@ -180,7 +180,7 @@ impl Api {
|
||||
.buckets()
|
||||
.execute()
|
||||
.await
|
||||
.context(anyhow!("Failed to fetch list of time buckets",))
|
||||
.context(anyhow!("Failed to fetch list of time buckets"))
|
||||
.inspect_err(|e| {
|
||||
tracing::error!("{e:?}");
|
||||
})?;
|
||||
@@ -267,4 +267,19 @@ impl Api {
|
||||
.await
|
||||
.context(anyhow!("Failed to fetch asset {asset_id:?}"))
|
||||
}
|
||||
|
||||
pub async fn get_album_list(&self) -> anyhow::Result<Vec<AlbumResponse>> {
|
||||
let albums = self
|
||||
.client
|
||||
.albums()
|
||||
.list()
|
||||
.execute()
|
||||
.await
|
||||
.context(anyhow!("Failed to fetch album list"))
|
||||
.inspect_err(|e| {
|
||||
tracing::error!("{e:?}");
|
||||
})?;
|
||||
|
||||
Ok(albums)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user