mirror of
https://github.com/immich-app/immich.git
synced 2026-02-15 05:18:37 +03:00
merge main
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
OPENAPI_GENERATOR_VERSION=v7.2.0
|
||||
OPENAPI_GENERATOR_VERSION=v7.5.0
|
||||
|
||||
# usage: ./bin/generate-open-api.sh
|
||||
|
||||
@@ -24,7 +24,8 @@ function typescript {
|
||||
npm --prefix typescript-sdk ci && npm --prefix typescript-sdk run build
|
||||
}
|
||||
|
||||
node ./bin/sync-spec-version.js
|
||||
# requires server to be built
|
||||
npm run sync:open-api --prefix=../server
|
||||
|
||||
if [[ $1 == 'dart' ]]; then
|
||||
dart
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
const spec = require('../immich-openapi-specs.json');
|
||||
const pkg = require('../../server/package.json');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
spec.info.version = pkg.version;
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname, '../immich-openapi-specs.json'),
|
||||
JSON.stringify(spec, null, 2)
|
||||
);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,6 @@
|
||||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||
"spaces": 2,
|
||||
"generator-cli": {
|
||||
"version": "7.2.0"
|
||||
"version": "7.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,14 @@ 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, 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 });
|
||||
const albums = await getAllAlbums({});
|
||||
|
||||
console.log({ user, assets, albums });
|
||||
console.log({ user, albums });
|
||||
```
|
||||
|
||||
11
open-api/typescript-sdk/package-lock.json
generated
11
open-api/typescript-sdk/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@immich/sdk",
|
||||
"version": "1.103.1",
|
||||
"version": "1.105.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@immich/sdk",
|
||||
"version": "1.103.1",
|
||||
"version": "1.105.1",
|
||||
"license": "GNU Affero General Public License version 3",
|
||||
"dependencies": {
|
||||
"@oazapfts/runtime": "^1.0.2"
|
||||
@@ -22,10 +22,11 @@
|
||||
"integrity": "sha512-8tKiYffhwTGHSHYGnZ3oneLGCjX0po/XAXQ5Ng9fqKkvIdl/xz8+Vh8i+6xjzZqvZ2pLVpUcuSfnvNI/x67L0g=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.12.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz",
|
||||
"integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==",
|
||||
"version": "20.12.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz",
|
||||
"integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@immich/sdk",
|
||||
"version": "1.103.1",
|
||||
"version": "1.105.1",
|
||||
"description": "Auto-generated TypeScript SDK for the Immich API",
|
||||
"type": "module",
|
||||
"main": "./build/index.js",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,25 @@
|
||||
import { defaults } from './fetch-client.js';
|
||||
|
||||
export * from './fetch-client.js';
|
||||
export * from './fetch-errors.js';
|
||||
|
||||
export interface InitOptions {
|
||||
baseUrl: string;
|
||||
apiKey: string;
|
||||
}
|
||||
|
||||
export const init = ({ baseUrl, apiKey }: InitOptions) => {
|
||||
setBaseUrl(baseUrl);
|
||||
setApiKey(apiKey);
|
||||
};
|
||||
|
||||
export const getBaseUrl = () => defaults.baseUrl;
|
||||
|
||||
export const setBaseUrl = (baseUrl: string) => {
|
||||
defaults.baseUrl = baseUrl;
|
||||
};
|
||||
|
||||
export const setApiKey = (apiKey: string) => {
|
||||
defaults.headers = defaults.headers || {};
|
||||
defaults.headers['x-api-key'] = apiKey;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user