mirror of
https://github.com/immich-app/immich.git
synced 2025-12-21 09:15:44 +03:00
feat: location favorites
This commit is contained in:
@@ -790,6 +790,22 @@ export type ValidateLibraryImportPathResponseDto = {
|
||||
export type ValidateLibraryResponseDto = {
|
||||
importPaths?: ValidateLibraryImportPathResponseDto[];
|
||||
};
|
||||
export type FavoriteLocationResponseDto = {
|
||||
id: string;
|
||||
latitude: number | null;
|
||||
longitude: number | null;
|
||||
name: string;
|
||||
};
|
||||
export type CreateFavoriteLocationDto = {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
name: string;
|
||||
};
|
||||
export type UpdateFavoriteLocationDto = {
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
name?: string;
|
||||
};
|
||||
export type MapMarkerResponseDto = {
|
||||
city: string | null;
|
||||
country: string | null;
|
||||
@@ -3082,6 +3098,59 @@ export function validate({ id, validateLibraryDto }: {
|
||||
body: validateLibraryDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* Get favorite locations
|
||||
*/
|
||||
export function getFavoriteLocations(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: FavoriteLocationResponseDto[];
|
||||
}>("/map/favorite-locations", {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Create favorite location
|
||||
*/
|
||||
export function createFavoriteLocation({ createFavoriteLocationDto }: {
|
||||
createFavoriteLocationDto: CreateFavoriteLocationDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 201;
|
||||
data: FavoriteLocationResponseDto;
|
||||
}>("/map/favorite-locations", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
body: createFavoriteLocationDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* Delete favorite location
|
||||
*/
|
||||
export function deleteFavoriteLocation({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText(`/map/favorite-locations/${encodeURIComponent(id)}`, {
|
||||
...opts,
|
||||
method: "DELETE"
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Update favorite location
|
||||
*/
|
||||
export function updateFavoriteLocation({ id, updateFavoriteLocationDto }: {
|
||||
id: string;
|
||||
updateFavoriteLocationDto: UpdateFavoriteLocationDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: FavoriteLocationResponseDto;
|
||||
}>(`/map/favorite-locations/${encodeURIComponent(id)}`, oazapfts.json({
|
||||
...opts,
|
||||
method: "PUT",
|
||||
body: updateFavoriteLocationDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* Retrieve map markers
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user