feat: Immich API client with album, asset, and download support
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
41
src/immich_client.h
Normal file
41
src/immich_client.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <vector>
|
||||
#include "settings.h"
|
||||
|
||||
struct AlbumInfo {
|
||||
String id;
|
||||
String title;
|
||||
int assetCount;
|
||||
};
|
||||
|
||||
struct AssetInfo {
|
||||
String id;
|
||||
String originalFileName;
|
||||
String dateTime;
|
||||
String city;
|
||||
String camera;
|
||||
bool isFavorite;
|
||||
bool isPortrait;
|
||||
std::vector<String> people;
|
||||
};
|
||||
|
||||
class ImmichClient {
|
||||
public:
|
||||
void begin(const String& baseUrl, const String& apiKey);
|
||||
std::vector<AlbumInfo> fetchAlbums();
|
||||
std::vector<String> fetchAlbumAssetIds(const String& albumId);
|
||||
std::vector<String> fetchFavoriteAssetIds();
|
||||
AssetInfo fetchAssetInfo(const String& assetId);
|
||||
bool downloadAsset(const String& assetId, ImageQuality quality,
|
||||
uint8_t** outBuffer, size_t* outSize);
|
||||
|
||||
private:
|
||||
String _baseUrl;
|
||||
String _apiKey;
|
||||
|
||||
String buildUrl(const String& path);
|
||||
String httpGet(const String& url);
|
||||
bool httpGetBinary(const String& url, uint8_t** outBuffer, size_t* outSize);
|
||||
};
|
||||
Reference in New Issue
Block a user