feat: location favorites

This commit is contained in:
Yaros
2025-12-12 15:19:24 +01:00
parent 33cdea88aa
commit d307843870
20 changed files with 1388 additions and 6 deletions

View File

@@ -5592,6 +5592,216 @@
"x-immich-state": "Stable"
}
},
"/map/favorite-locations": {
"get": {
"description": "Retrieve a list of user's favorite locations.",
"operationId": "getFavoriteLocations",
"parameters": [],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/FavoriteLocationResponseDto"
},
"type": "array"
}
}
},
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"summary": "Get favorite locations",
"tags": [
"Map"
],
"x-immich-history": [
{
"version": "v2",
"state": "Added"
},
{
"version": "v2",
"state": "Stable"
}
],
"x-immich-state": "Stable"
},
"post": {
"description": "Create a new favorite location for the user.",
"operationId": "createFavoriteLocation",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateFavoriteLocationDto"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FavoriteLocationResponseDto"
}
}
},
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"summary": "Create favorite location",
"tags": [
"Map"
],
"x-immich-history": [
{
"version": "v2",
"state": "Added"
},
{
"version": "v2",
"state": "Stable"
}
],
"x-immich-state": "Stable"
}
},
"/map/favorite-locations/{id}": {
"delete": {
"description": "Delete a favorite location by its ID.",
"operationId": "deleteFavoriteLocation",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"204": {
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"summary": "Delete favorite location",
"tags": [
"Map"
],
"x-immich-history": [
{
"version": "v2",
"state": "Added"
},
{
"version": "v2",
"state": "Stable"
}
],
"x-immich-state": "Stable"
},
"put": {
"description": "Update an existing favorite location.",
"operationId": "updateFavoriteLocation",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateFavoriteLocationDto"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FavoriteLocationResponseDto"
}
}
},
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"summary": "Update favorite location",
"tags": [
"Map"
],
"x-immich-history": [
{
"version": "v2",
"state": "Added"
},
{
"version": "v2",
"state": "Stable"
}
],
"x-immich-state": "Stable"
}
},
"/map/markers": {
"get": {
"description": "Retrieve a list of latitude and longitude coordinates for every asset with location data.",
@@ -16150,6 +16360,25 @@
],
"type": "object"
},
"CreateFavoriteLocationDto": {
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
},
"name": {
"type": "string"
}
},
"required": [
"latitude",
"longitude",
"name"
],
"type": "object"
},
"CreateLibraryDto": {
"properties": {
"exclusionPatterns": {
@@ -16554,6 +16783,31 @@
],
"type": "object"
},
"FavoriteLocationResponseDto": {
"properties": {
"id": {
"type": "string"
},
"latitude": {
"nullable": true,
"type": "number"
},
"longitude": {
"nullable": true,
"type": "number"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"latitude",
"longitude",
"name"
],
"type": "object"
},
"FoldersResponse": {
"properties": {
"enabled": {
@@ -22593,6 +22847,20 @@
},
"type": "object"
},
"UpdateFavoriteLocationDto": {
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
},
"name": {
"type": "string"
}
},
"type": "object"
},
"UpdateLibraryDto": {
"properties": {
"exclusionPatterns": {

View File

@@ -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
*/