2024-03-12 18:01:12 +02: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-28 04:16:53 +02:00
|
|
|
import { getAllAlbums, getMyUser, init } from "@immich/sdk";
|
2024-03-12 18:01:12 +02: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 18:01:12 +02:00
|
|
|
|
2024-05-27 00:15:52 +02:00
|
|
|
const user = await getMyUser();
|
2024-03-12 18:01:12 +02:00
|
|
|
const albums = await getAllAlbums({});
|
|
|
|
|
2024-05-25 03:02:22 +02:00
|
|
|
console.log({ user, albums });
|
2024-03-12 18:01:12 +02:00
|
|
|
```
|