diff options
Diffstat (limited to 'bundles/immich/files/immich-api-tool')
| -rwxr-xr-x | bundles/immich/files/immich-api-tool | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/bundles/immich/files/immich-api-tool b/bundles/immich/files/immich-api-tool deleted file mode 100755 index d0a1a41..0000000 --- a/bundles/immich/files/immich-api-tool +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -set -eu - -API_URL=https://photos.gzr.im/api -API_KEY=zaJUJGHpFqY9OA6kAhuauTj9tC1YVfA8umtZc6ls8U - -request() { - ENDPOINT=${1:?} - shift 1 - - curl -sSfL "${API_URL}${ENDPOINT}" \ - -H "x-api-key: $API_KEY" \ - -H 'Content-Type: application/json' \ - "$@" -} - -validateAccessToken() { - request '/auth/validateToken' -X POST >/dev/null -} - -# returns full json response -searchFavorites() { - request '/search/metadata' \ - -H 'Accept: application/json' \ - -d '{"isFavorite": true}' -} - -# requires '{"assetIds":["list","of","ids",...]}' on stdin -# downloads to PWD -downloadArchive() { - request '/download/archive' \ - -H 'Accept: application/octet-stream' \ - -d @- \ - -o "archive.zip" \ - --no-silent -} - -main() { - validateAccessToken || exit 1 - - # download favorites as archive - searchFavorites | - jq '[.assets.items[].id] | {assetIds:.}' -rc | - downloadArchive -} - -test -n "${DEBUG:-}" && set -x -main -exit 0 |