mirror of
https://github.com/immich-app/immich.git
synced 2025-12-24 01:11:32 +03:00
feat(server): reverse geocoding endpoint (#11430)
* feat(server): reverse geocoding endpoint * chore: rename error message
This commit is contained in:
@@ -3109,6 +3109,60 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/map/reverse-geocode": {
|
||||
"get": {
|
||||
"operationId": "reverseGeocode",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "lat",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "lon",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/MapReverseGeocodeResponseDto"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Map"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/map/style.json": {
|
||||
"get": {
|
||||
"operationId": "getMapStyle",
|
||||
@@ -9128,6 +9182,28 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"MapReverseGeocodeResponseDto": {
|
||||
"properties": {
|
||||
"city": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"city",
|
||||
"country",
|
||||
"state"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"MapTheme": {
|
||||
"enum": [
|
||||
"light",
|
||||
|
||||
@@ -554,6 +554,11 @@ export type MapMarkerResponseDto = {
|
||||
lon: number;
|
||||
state: string | null;
|
||||
};
|
||||
export type MapReverseGeocodeResponseDto = {
|
||||
city: string | null;
|
||||
country: string | null;
|
||||
state: string | null;
|
||||
};
|
||||
export type OnThisDayDto = {
|
||||
year: number;
|
||||
};
|
||||
@@ -1991,6 +1996,20 @@ export function getMapMarkers({ fileCreatedAfter, fileCreatedBefore, isArchived,
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function reverseGeocode({ lat, lon }: {
|
||||
lat: number;
|
||||
lon: number;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: MapReverseGeocodeResponseDto[];
|
||||
}>(`/map/reverse-geocode${QS.query(QS.explode({
|
||||
lat,
|
||||
lon
|
||||
}))}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function getMapStyle({ key, theme }: {
|
||||
key?: string;
|
||||
theme: MapTheme;
|
||||
|
||||
Reference in New Issue
Block a user