2024-03-12 17:01:12 +01:00
|
|
|
# @immich/sdk
|
|
|
|
|
|
|
|
A TypeScript SDK for interfacing with the [Immich](https://immich.app/) API.
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm i --save @immich/sdk
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
For a more detailed example, check out the [`@immich/cli`](https://github.com/immich-app/immich/tree/main/cli).
|
|
|
|
|
|
|
|
```typescript
|
2024-05-27 00:15:52 +02:00
|
|
|
<<<<<<< HEAD
|
|
|
|
import { getAllAlbums, getAllAssets, getMyUser, init } from "@immich/sdk";
|
|
|
|
=======
|
2024-05-25 03:02:22 +02:00
|
|
|
import { getAllAlbums, getMyUserInfo, init } from "@immich/sdk";
|
2024-05-27 00:15:52 +02:00
|
|
|
>>>>>>> e7c8501930a988dfb6c23ce1c48b0beb076a58c2
|
2024-03-12 17:01:12 +01:00
|
|
|
|
|
|
|
const API_KEY = "<API_KEY>"; // process.env.IMMICH_API_KEY
|
|
|
|
|
2024-05-17 22:48:29 +02:00
|
|
|
init({ baseUrl: "https://demo.immich.app/api", apiKey: API_KEY });
|
2024-03-12 17:01:12 +01:00
|
|
|
|
2024-05-27 00:15:52 +02:00
|
|
|
<<<<<<< HEAD
|
|
|
|
const user = await getMyUser();
|
|
|
|
const assets = await getAllAssets({ take: 1000 });
|
|
|
|
=======
|
2024-03-12 17:01:12 +01:00
|
|
|
const user = await getMyUserInfo();
|
2024-05-27 00:15:52 +02:00
|
|
|
>>>>>>> e7c8501930a988dfb6c23ce1c48b0beb076a58c2
|
2024-03-12 17:01:12 +01:00
|
|
|
const albums = await getAllAlbums({});
|
|
|
|
|
2024-05-25 03:02:22 +02:00
|
|
|
console.log({ user, albums });
|
2024-03-12 17:01:12 +01:00
|
|
|
```
|