refactor: sdk init ()

This commit is contained in:
Jason Rasmussen 2024-05-17 16:48:29 -04:00 committed by GitHub
commit 136bb69bd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 40 additions and 19 deletions
open-api/typescript-sdk

View file

@ -13,12 +13,11 @@ npm i --save @immich/sdk
For a more detailed example, check out the [`@immich/cli`](https://github.com/immich-app/immich/tree/main/cli).
```typescript
import { defaults, getAllAlbums, getAllAssets, getMyUserInfo } from "@immich/sdk";
import { getAllAlbums, getAllAssets, getMyUserInfo, init } from "@immich/sdk";
const API_KEY = "<API_KEY>"; // process.env.IMMICH_API_KEY
defaults.baseUrl = "https://demo.immich.app/api";
defaults.headers = { "x-api-key": API_KEY };
init({ baseUrl: "https://demo.immich.app/api", apiKey: API_KEY });
const user = await getMyUserInfo();
const assets = await getAllAssets({ take: 1000 });