mirror of
https://github.com/immich-app/immich.git
synced 2025-01-02 12:48:35 +02:00
refactor: open api (#6334)
This commit is contained in:
parent
a1523a9af0
commit
2439c5ab57
@ -8,7 +8,7 @@ machine-learning/
|
|||||||
misc/
|
misc/
|
||||||
mobile/
|
mobile/
|
||||||
|
|
||||||
server/node_modules
|
server/node_modules/
|
||||||
server/coverage/
|
server/coverage/
|
||||||
server/.reverse-geocoding-dump/
|
server/.reverse-geocoding-dump/
|
||||||
server/upload/
|
server/upload/
|
||||||
@ -19,7 +19,10 @@ web/coverage/
|
|||||||
web/.svelte-kit
|
web/.svelte-kit
|
||||||
web/build/
|
web/build/
|
||||||
|
|
||||||
cli/node_modules
|
cli/node_modules/
|
||||||
cli/.reverse-geocoding-dump/
|
cli/.reverse-geocoding-dump/
|
||||||
cli/upload/
|
cli/upload/
|
||||||
cli/dist/
|
cli/dist/
|
||||||
|
|
||||||
|
open-api/typescript-sdk/node_modules/
|
||||||
|
open-api/typescript-sdk/build/
|
||||||
|
13
.gitattributes
vendored
13
.gitattributes
vendored
@ -8,14 +8,9 @@ mobile/openapi/.openapi-generator/FILES linguist-generated=true
|
|||||||
mobile/lib/**/*.g.dart -diff -merge
|
mobile/lib/**/*.g.dart -diff -merge
|
||||||
mobile/lib/**/*.g.dart linguist-generated=true
|
mobile/lib/**/*.g.dart linguist-generated=true
|
||||||
|
|
||||||
cli/src/api/open-api/**/*.md -diff -merge
|
open-api/typescript-sdk/client/**/*.md -diff -merge
|
||||||
cli/src/api/open-api/**/*.md linguist-generated=true
|
open-api/typescript-sdk/client/**/*.md linguist-generated=true
|
||||||
cli/src/api/open-api/**/*.ts -diff -merge
|
open-api/typescript-sdk/client/**/*.ts -diff -merge
|
||||||
cli/src/api/open-api/**/*.ts linguist-generated=true
|
open-api/typescript-sdk/client/**/*.ts linguist-generated=true
|
||||||
|
|
||||||
web/src/api/open-api/**/*.md -diff -merge
|
|
||||||
web/src/api/open-api/**/*.md linguist-generated=true
|
|
||||||
web/src/api/open-api/**/*.ts -diff -merge
|
|
||||||
web/src/api/open-api/**/*.ts linguist-generated=true
|
|
||||||
|
|
||||||
*.sh text eol=lf
|
*.sh text eol=lf
|
||||||
|
24
.github/workflows/test.yml
vendored
24
.github/workflows/test.yml
vendored
@ -107,10 +107,14 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run npm install in cli
|
- name: Run setup typescript-sdk
|
||||||
|
run: npm ci && npm run build
|
||||||
|
working-directory: ./open-api/typescript-sdk
|
||||||
|
|
||||||
|
- name: Run npm install (cli)
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Run npm install in server
|
- name: Run npm install (server)
|
||||||
run: npm ci
|
run: npm ci
|
||||||
working-directory: ./server
|
working-directory: ./server
|
||||||
|
|
||||||
@ -143,10 +147,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
|
|
||||||
- name: Run npm install in cli
|
- name: Run setup typescript-sdk
|
||||||
|
run: npm ci && npm run build
|
||||||
|
working-directory: ./open-api/typescript-sdk
|
||||||
|
|
||||||
|
- name: Run npm install (cli)
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Run npm install in server
|
- name: Run npm install (server)
|
||||||
run: npm ci
|
run: npm ci
|
||||||
working-directory: ./server
|
working-directory: ./server
|
||||||
|
|
||||||
@ -164,6 +172,10 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run setup typescript-sdk
|
||||||
|
run: npm ci && npm run build
|
||||||
|
working-directory: ./open-api/typescript-sdk
|
||||||
|
|
||||||
- name: Run npm install
|
- name: Run npm install
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
@ -237,14 +249,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Run API generation
|
- name: Run API generation
|
||||||
run: npm --prefix server run api:generate
|
run: make open-api
|
||||||
- name: Find file changes
|
- name: Find file changes
|
||||||
uses: tj-actions/verify-changed-files@v13.1
|
uses: tj-actions/verify-changed-files@v13.1
|
||||||
id: verify-changed-files
|
id: verify-changed-files
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
mobile/openapi
|
mobile/openapi
|
||||||
web/src/api/open-api
|
open-api/typescript-sdk
|
||||||
- name: Verify files have not changed
|
- name: Verify files have not changed
|
||||||
if: steps.verify-changed-files.outputs.files_changed == 'true'
|
if: steps.verify-changed-files.outputs.files_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
**/node_modules/**
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
@ -12,3 +14,5 @@ mobile/gradle.properties
|
|||||||
mobile/openapi/pubspec.lock
|
mobile/openapi/pubspec.lock
|
||||||
mobile/*.jks
|
mobile/*.jks
|
||||||
mobile/libisar.dylib
|
mobile/libisar.dylib
|
||||||
|
|
||||||
|
open-api/typescript-sdk/build
|
||||||
|
11
Makefile
11
Makefile
@ -25,8 +25,15 @@ prod:
|
|||||||
prod-scale:
|
prod-scale:
|
||||||
docker compose -f ./docker/docker-compose.prod.yml up --build -V --scale immich-server=3 --scale immich-microservices=3 --remove-orphans
|
docker compose -f ./docker/docker-compose.prod.yml up --build -V --scale immich-server=3 --scale immich-microservices=3 --remove-orphans
|
||||||
|
|
||||||
api:
|
.PHONY: open-api
|
||||||
npm --prefix server run api:generate
|
open-api:
|
||||||
|
cd ./open-api && bash ./bin/generate-open-api.sh
|
||||||
|
|
||||||
|
open-api-dart:
|
||||||
|
cd ./open-api && bash ./bin/generate-open-api.sh dart
|
||||||
|
|
||||||
|
open-api-typescript:
|
||||||
|
cd ./open-api && bash ./bin/generate-open-api.sh typescript
|
||||||
|
|
||||||
sql:
|
sql:
|
||||||
npm --prefix server run sql:generate
|
npm --prefix server run sql:generate
|
||||||
|
@ -5,7 +5,6 @@ node_modules
|
|||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
src/api/open-api
|
|
||||||
*.md
|
*.md
|
||||||
*.json
|
*.json
|
||||||
coverage
|
coverage
|
||||||
|
35
cli/package-lock.json
generated
35
cli/package-lock.json
generated
@ -9,6 +9,7 @@
|
|||||||
"version": "2.0.6",
|
"version": "2.0.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@immich/sdk": "file:../open-api/typescript-sdk",
|
||||||
"axios": "^1.6.2",
|
"axios": "^1.6.2",
|
||||||
"byte-size": "^8.1.1",
|
"byte-size": "^8.1.1",
|
||||||
"cli-progress": "^3.12.0",
|
"cli-progress": "^3.12.0",
|
||||||
@ -48,9 +49,21 @@
|
|||||||
"typescript": "^5.0.0"
|
"typescript": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"../open-api/typescript-sdk": {
|
||||||
|
"name": "@immich/sdk",
|
||||||
|
"version": "1.92.1",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.27.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.11.0",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"../server": {
|
"../server": {
|
||||||
"name": "immich",
|
"name": "immich",
|
||||||
"version": "1.91.4",
|
"version": "1.92.1",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -75,8 +88,8 @@
|
|||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"class-validator": "^0.14.0",
|
"class-validator": "^0.14.0",
|
||||||
"cookie-parser": "^1.4.6",
|
"cookie-parser": "^1.4.6",
|
||||||
"exiftool-vendored": "~23.5.0",
|
"exiftool-vendored": "~24.3.0",
|
||||||
"exiftool-vendored.pl": "12.70",
|
"exiftool-vendored.pl": "12.72",
|
||||||
"fluent-ffmpeg": "^2.1.2",
|
"fluent-ffmpeg": "^2.1.2",
|
||||||
"geo-tz": "^7.0.7",
|
"geo-tz": "^7.0.7",
|
||||||
"glob": "^10.3.3",
|
"glob": "^10.3.3",
|
||||||
@ -944,6 +957,10 @@
|
|||||||
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
|
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@immich/sdk": {
|
||||||
|
"resolved": "../open-api/typescript-sdk",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
"node_modules/@isaacs/cliui": {
|
"node_modules/@isaacs/cliui": {
|
||||||
"version": "8.0.2",
|
"version": "8.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
||||||
@ -8081,6 +8098,14 @@
|
|||||||
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
|
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@immich/sdk": {
|
||||||
|
"version": "file:../open-api/typescript-sdk",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "^20.11.0",
|
||||||
|
"axios": "^0.27.2",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@isaacs/cliui": {
|
"@isaacs/cliui": {
|
||||||
"version": "8.0.2",
|
"version": "8.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
||||||
@ -10545,8 +10570,8 @@
|
|||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"eslint-config-prettier": "^9.0.0",
|
"eslint-config-prettier": "^9.0.0",
|
||||||
"eslint-plugin-prettier": "^5.0.0",
|
"eslint-plugin-prettier": "^5.0.0",
|
||||||
"exiftool-vendored": "~23.5.0",
|
"exiftool-vendored": "~24.3.0",
|
||||||
"exiftool-vendored.pl": "12.70",
|
"exiftool-vendored.pl": "12.72",
|
||||||
"fluent-ffmpeg": "^2.1.2",
|
"fluent-ffmpeg": "^2.1.2",
|
||||||
"geo-tz": "^7.0.7",
|
"geo-tz": "^7.0.7",
|
||||||
"glob": "^10.3.3",
|
"glob": "^10.3.3",
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
"cli"
|
"cli"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@immich/sdk": "file:../open-api/typescript-sdk",
|
||||||
"axios": "^1.6.2",
|
"axios": "^1.6.2",
|
||||||
"byte-size": "^8.1.1",
|
"byte-size": "^8.1.1",
|
||||||
"cli-progress": "^3.12.0",
|
"cli-progress": "^3.12.0",
|
||||||
@ -57,7 +58,7 @@
|
|||||||
"format": "prettier --check .",
|
"format": "prettier --check .",
|
||||||
"format:fix": "prettier --write .",
|
"format:fix": "prettier --write .",
|
||||||
"check": "tsc --noEmit",
|
"check": "tsc --noEmit",
|
||||||
"test:e2e": "NODE_OPTIONS='--experimental-vm-modules' jest --config test/e2e/jest-e2e.json --runInBand"
|
"test:e2e": "jest --config test/e2e/jest-e2e.json --runInBand"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"clearMocks": true,
|
"clearMocks": true,
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
ServerInfoApi,
|
ServerInfoApi,
|
||||||
SystemConfigApi,
|
SystemConfigApi,
|
||||||
UserApi,
|
UserApi,
|
||||||
} from './open-api';
|
} from '@immich/sdk';
|
||||||
import { ApiConfiguration } from '../cores/api-configuration';
|
import { ApiConfiguration } from '../cores/api-configuration';
|
||||||
import FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { ImmichApi } from '../api/client';
|
|||||||
import { SessionService } from '../services/session.service';
|
import { SessionService } from '../services/session.service';
|
||||||
import { LoginError } from '../cores/errors/login-error';
|
import { LoginError } from '../cores/errors/login-error';
|
||||||
import { exit } from 'node:process';
|
import { exit } from 'node:process';
|
||||||
import { ServerVersionResponseDto, UserResponseDto } from 'src/api/open-api';
|
import { ServerVersionResponseDto, UserResponseDto } from '@immich/sdk';
|
||||||
import { BaseOptionsDto } from 'src/cores/dto/base-options-dto';
|
import { BaseOptionsDto } from 'src/cores/dto/base-options-dto';
|
||||||
|
|
||||||
export abstract class BaseCommand {
|
export abstract class BaseCommand {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { BaseCommand } from '../../cli/base-command';
|
import { BaseCommand } from '../../cli/base-command';
|
||||||
|
|
||||||
export default class LoginKey extends BaseCommand {
|
export class LoginKey extends BaseCommand {
|
||||||
public async run(instanceUrl: string, apiKey: string): Promise<void> {
|
public async run(instanceUrl: string, apiKey: string): Promise<void> {
|
||||||
console.log('Executing API key auth flow...');
|
console.log('Executing API key auth flow...');
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { BaseCommand } from '../cli/base-command';
|
import { BaseCommand } from '../cli/base-command';
|
||||||
|
|
||||||
export default class Logout extends BaseCommand {
|
export class Logout extends BaseCommand {
|
||||||
public static readonly description = 'Logout and remove persisted credentials';
|
public static readonly description = 'Logout and remove persisted credentials';
|
||||||
|
|
||||||
public async run(): Promise<void> {
|
public async run(): Promise<void> {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { BaseCommand } from '../cli/base-command';
|
import { BaseCommand } from '../cli/base-command';
|
||||||
|
|
||||||
export default class ServerInfo extends BaseCommand {
|
export class ServerInfo extends BaseCommand {
|
||||||
public async run() {
|
public async run() {
|
||||||
await this.connect();
|
await this.connect();
|
||||||
const { data: versionInfo } = await this.immichApi.serverInfoApi.getServerVersion();
|
const { data: versionInfo } = await this.immichApi.serverInfoApi.getServerVersion();
|
||||||
|
@ -6,10 +6,10 @@ import fs from 'node:fs';
|
|||||||
import cliProgress from 'cli-progress';
|
import cliProgress from 'cli-progress';
|
||||||
import byteSize from 'byte-size';
|
import byteSize from 'byte-size';
|
||||||
import { BaseCommand } from '../cli/base-command';
|
import { BaseCommand } from '../cli/base-command';
|
||||||
import axios, { AxiosRequestConfig } from 'axios';
|
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||||
import FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
|
|
||||||
export default class Upload extends BaseCommand {
|
export class Upload extends BaseCommand {
|
||||||
uploadLength!: number;
|
uploadLength!: number;
|
||||||
|
|
||||||
public async run(paths: string[], options: UploadOptionsDto): Promise<void> {
|
public async run(paths: string[], options: UploadOptionsDto): Promise<void> {
|
||||||
@ -172,7 +172,7 @@ export default class Upload extends BaseCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async uploadAsset(data: FormData): Promise<axios.AxiosResponse> {
|
private async uploadAsset(data: FormData): Promise<AxiosResponse> {
|
||||||
const url = this.immichApi.apiConfiguration.instanceUrl + '/asset/upload';
|
const url = this.immichApi.apiConfiguration.instanceUrl + '/asset/upload';
|
||||||
|
|
||||||
const config: AxiosRequestConfig = {
|
const config: AxiosRequestConfig = {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#! /usr/bin/env node
|
#! /usr/bin/env node
|
||||||
|
|
||||||
import { Option, Command } from 'commander';
|
import { Option, Command } from 'commander';
|
||||||
import Upload from './commands/upload';
|
import { Upload } from './commands/upload';
|
||||||
import ServerInfo from './commands/server-info';
|
import { ServerInfo } from './commands/server-info';
|
||||||
import LoginKey from './commands/login/key';
|
import { LoginKey } from './commands/login/key';
|
||||||
import Logout from './commands/logout';
|
import { Logout } from './commands/logout';
|
||||||
import { version } from '../package.json';
|
import { version } from '../package.json';
|
||||||
|
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
@ -16,10 +16,9 @@ import {
|
|||||||
const mockPingServer = jest.fn(() => Promise.resolve({ data: { res: 'pong' } }));
|
const mockPingServer = jest.fn(() => Promise.resolve({ data: { res: 'pong' } }));
|
||||||
const mockUserInfo = jest.fn(() => Promise.resolve({ data: { email: 'admin@example.com' } }));
|
const mockUserInfo = jest.fn(() => Promise.resolve({ data: { email: 'admin@example.com' } }));
|
||||||
|
|
||||||
jest.mock('../api/open-api', () => {
|
jest.mock('@immich/sdk', () => {
|
||||||
return {
|
return {
|
||||||
__esModule: true,
|
...jest.requireActual('@immich/sdk'),
|
||||||
...jest.requireActual('../api/open-api'),
|
|
||||||
UserApi: jest.fn().mockImplementation(() => {
|
UserApi: jest.fn().mockImplementation(() => {
|
||||||
return { getMyUserInfo: mockUserInfo };
|
return { getMyUserInfo: mockUserInfo };
|
||||||
}),
|
}),
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"testRegex": ".e2e-spec.ts$",
|
"testRegex": ".e2e-spec.ts$",
|
||||||
"testTimeout": 6000000,
|
"testTimeout": 6000000,
|
||||||
"transform": {
|
"transform": {
|
||||||
"^.+\\.(t|j)s$": "ts-jest"
|
"^.+\\.ts$": "ts-jest"
|
||||||
},
|
},
|
||||||
"collectCoverageFrom": [
|
"collectCoverageFrom": [
|
||||||
"<rootDir>/src/**/*.(t|j)s",
|
"<rootDir>/src/**/*.(t|j)s",
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { APIKeyCreateResponseDto } from '@app/domain';
|
import { APIKeyCreateResponseDto } from '@app/domain';
|
||||||
import { api } from '@test/../e2e/api/client';
|
import { api } from '@test/../e2e/api/client';
|
||||||
import { restoreTempFolder, testApp } from '@test/../e2e/jobs/utils';
|
import { restoreTempFolder, testApp } from '@test/../e2e/jobs/utils';
|
||||||
import { LoginResponseDto } from 'src/api/open-api';
|
import { LoginResponseDto } from '@immich/sdk';
|
||||||
import LoginKey from 'src/commands/login/key';
|
import { LoginKey } from 'src/commands/login/key';
|
||||||
import { LoginError } from 'src/cores/errors/login-error';
|
import { LoginError } from 'src/cores/errors/login-error';
|
||||||
import { CLI_BASE_OPTIONS, spyOnConsole } from 'test/cli-test-utils';
|
import { CLI_BASE_OPTIONS, spyOnConsole } from 'test/cli-test-utils';
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { APIKeyCreateResponseDto } from '@app/domain';
|
import { APIKeyCreateResponseDto } from '@app/domain';
|
||||||
import { api } from '@test/../e2e/api/client';
|
import { api } from '@test/../e2e/api/client';
|
||||||
import { restoreTempFolder, testApp } from '@test/../e2e/jobs/utils';
|
import { restoreTempFolder, testApp } from '@test/../e2e/jobs/utils';
|
||||||
import { LoginResponseDto } from 'src/api/open-api';
|
import { LoginResponseDto } from '@immich/sdk';
|
||||||
import ServerInfo from 'src/commands/server-info';
|
import { ServerInfo } from 'src/commands/server-info';
|
||||||
import { CLI_BASE_OPTIONS, spyOnConsole } from 'test/cli-test-utils';
|
import { CLI_BASE_OPTIONS, spyOnConsole } from 'test/cli-test-utils';
|
||||||
|
|
||||||
describe(`server-info (e2e)`, () => {
|
describe(`server-info (e2e)`, () => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { APIKeyCreateResponseDto } from '@app/domain';
|
import { APIKeyCreateResponseDto } from '@app/domain';
|
||||||
import { api } from '@test/../e2e/api/client';
|
import { api } from '@test/../e2e/api/client';
|
||||||
import { IMMICH_TEST_ASSET_PATH, restoreTempFolder, testApp } from '@test/../e2e/jobs/utils';
|
import { IMMICH_TEST_ASSET_PATH, restoreTempFolder, testApp } from '@test/../e2e/jobs/utils';
|
||||||
import { LoginResponseDto } from 'src/api/open-api';
|
import { LoginResponseDto } from '@immich/sdk';
|
||||||
import Upload from 'src/commands/upload';
|
import { Upload } from 'src/commands/upload';
|
||||||
import { CLI_BASE_OPTIONS, spyOnConsole } from 'test/cli-test-utils';
|
import { CLI_BASE_OPTIONS, spyOnConsole } from 'test/cli-test-utils';
|
||||||
|
|
||||||
describe(`upload (e2e)`, () => {
|
describe(`upload (e2e)`, () => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "Node16",
|
"module": "commonjs",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
@ -9,7 +9,6 @@
|
|||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"target": "es2021",
|
"target": "es2021",
|
||||||
"moduleResolution": "node16",
|
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
|
@ -15,6 +15,7 @@ x-server-build: &server-common
|
|||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ../server:/usr/src/app
|
- ../server:/usr/src/app
|
||||||
|
- ../open-api:/usr/src/open-api
|
||||||
- ${UPLOAD_LOCATION}/photos:/usr/src/app/upload
|
- ${UPLOAD_LOCATION}/photos:/usr/src/app/upload
|
||||||
- ${UPLOAD_LOCATION}/photos/upload:/usr/src/app/upload/upload
|
- ${UPLOAD_LOCATION}/photos/upload:/usr/src/app/upload/upload
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
@ -65,6 +66,7 @@ services:
|
|||||||
- 24678:24678
|
- 24678:24678
|
||||||
volumes:
|
volumes:
|
||||||
- ../web:/usr/src/app
|
- ../web:/usr/src/app
|
||||||
|
- ../open-api/:/usr/src/open-api/
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
ulimits:
|
ulimits:
|
||||||
nofile:
|
nofile:
|
||||||
|
@ -13,5 +13,5 @@ npm run api:generate # Run from the `server/` directory
|
|||||||
You can find the generated client SDK in the `web/src/api` for Typescript SDK and `mobile/openapi` for Dart SDK.
|
You can find the generated client SDK in the `web/src/api` for Typescript SDK and `mobile/openapi` for Dart SDK.
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
This can also be run via `make api` from the project root directory (not in the `server` folder)
|
This can also be run via `make open-api` from the project root directory (not in the `server` folder)
|
||||||
:::
|
:::
|
||||||
|
@ -56,7 +56,7 @@ const config = {
|
|||||||
editUrl: 'https://github.com/immich-app/immich/tree/main/docs/',
|
editUrl: 'https://github.com/immich-app/immich/tree/main/docs/',
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
path: '../server/immich-openapi-specs.json',
|
path: '../open-api/immich-openapi-specs.json',
|
||||||
routeBasePath: '/docs/api',
|
routeBasePath: '/docs/api',
|
||||||
},
|
},
|
||||||
// blog: {
|
// blog: {
|
||||||
|
39
open-api/bin/generate-open-api.sh
Executable file
39
open-api/bin/generate-open-api.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
OPENAPI_GENEARTOR_VERSION=v6.6.0
|
||||||
|
|
||||||
|
# usage: ./bin/generate-open-api.sh
|
||||||
|
|
||||||
|
function dart {
|
||||||
|
rm -rf ../mobile/openapi
|
||||||
|
cd ./templates/mobile/serialization/native
|
||||||
|
wget -O native_class.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache
|
||||||
|
patch -u native_class.mustache <native_class.mustache.patch
|
||||||
|
cd ../../../..
|
||||||
|
npx --yes @openapitools/openapi-generator-cli generate -g dart -i ./immich-openapi-specs.json -o ../mobile/openapi -t ./templates/mobile
|
||||||
|
|
||||||
|
# Post generate patches
|
||||||
|
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api_client.dart <./patch/api_client.dart.patch
|
||||||
|
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api.dart <./patch/api.dart.patch
|
||||||
|
sed -i 's/0.17.0/0.18.0/g' ../mobile/openapi/pubspec.yaml
|
||||||
|
}
|
||||||
|
|
||||||
|
function typescript {
|
||||||
|
rm -rf ./typescript-sdk/client
|
||||||
|
cd ./templates/typescript
|
||||||
|
wget -O apiInner.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
|
||||||
|
patch -u apiInner.mustache < apiInner.mustache.patch
|
||||||
|
cd ../..
|
||||||
|
npx --yes @openapitools/openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ./typescript-sdk/client -t ./templates/typescript --additional-properties=useSingleRequestParameter=true
|
||||||
|
npm --prefix typescript-sdk ci && npm --prefix typescript-sdk run build
|
||||||
|
}
|
||||||
|
|
||||||
|
node ./bin/sync-spec-version.js
|
||||||
|
|
||||||
|
if [[ $1 == 'dart' ]]; then
|
||||||
|
dart
|
||||||
|
elif [[ $1 == 'typescript' ]]; then
|
||||||
|
typescript
|
||||||
|
else
|
||||||
|
dart
|
||||||
|
typescript
|
||||||
|
fi
|
9
open-api/bin/sync-spec-version.js
Normal file
9
open-api/bin/sync-spec-version.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
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)
|
||||||
|
);
|
7
open-api/openapitools.json
Normal file
7
open-api/openapitools.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||||
|
"spaces": 2,
|
||||||
|
"generator-cli": {
|
||||||
|
"version": "6.5.0"
|
||||||
|
}
|
||||||
|
}
|
@ -5,4 +5,4 @@
|
|||||||
+import 'package:flutter/foundation.dart';
|
+import 'package:flutter/foundation.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
4
open-api/typescript-sdk/index.ts
Normal file
4
open-api/typescript-sdk/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from './client';
|
||||||
|
export * as base from './client/base';
|
||||||
|
export * as configuration from './client/configuration';
|
||||||
|
export * as common from './client/common';
|
132
open-api/typescript-sdk/package-lock.json
generated
Normal file
132
open-api/typescript-sdk/package-lock.json
generated
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
{
|
||||||
|
"name": "@immich/sdk",
|
||||||
|
"version": "1.92.1",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "@immich/sdk",
|
||||||
|
"version": "1.92.1",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.27.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.11.0",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "20.11.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz",
|
||||||
|
"integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~5.26.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
|
},
|
||||||
|
"node_modules/axios": {
|
||||||
|
"version": "0.27.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
||||||
|
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.14.9",
|
||||||
|
"form-data": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"dependencies": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/follow-redirects": {
|
||||||
|
"version": "1.15.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
|
||||||
|
"integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/form-data": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "5.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||||
|
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "5.26.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||||
|
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
open-api/typescript-sdk/package.json
Normal file
27
open-api/typescript-sdk/package.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "@immich/sdk",
|
||||||
|
"version": "1.92.1",
|
||||||
|
"description": "",
|
||||||
|
"type": "commonjs",
|
||||||
|
"main": "./build/cjs/index.js",
|
||||||
|
"module": "./build/esm/index.js",
|
||||||
|
"typings": "./build/types/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./build/esm/index.js",
|
||||||
|
"require": "./build/cjs/index.js",
|
||||||
|
"default": "./build/cjs/index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.27.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.11.0",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
}
|
||||||
|
}
|
10
open-api/typescript-sdk/tsconfig.cjs.json
Normal file
10
open-api/typescript-sdk/tsconfig.cjs.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/cjs",
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"target": "es2022",
|
||||||
|
"lib": ["es2022"]
|
||||||
|
}
|
||||||
|
}
|
9
open-api/typescript-sdk/tsconfig.esm.json
Normal file
9
open-api/typescript-sdk/tsconfig.esm.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/esm",
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"lib": ["esnext", "dom"]
|
||||||
|
}
|
||||||
|
}
|
7
open-api/typescript-sdk/tsconfig.json
Normal file
7
open-api/typescript-sdk/tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true
|
||||||
|
}
|
||||||
|
}
|
9
open-api/typescript-sdk/tsconfig.types.json
Normal file
9
open-api/typescript-sdk/tsconfig.types.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/types",
|
||||||
|
"declaration": true,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"lib": ["es2020"]
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,6 @@ node_modules
|
|||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
src/api/open-api
|
|
||||||
*.md
|
*.md
|
||||||
*.json
|
*.json
|
||||||
coverage
|
coverage
|
||||||
|
@ -26,10 +26,16 @@ COPY --from=dev /usr/src/app/node_modules/@img ./node_modules/@img
|
|||||||
# web build
|
# web build
|
||||||
FROM node:iron-alpine3.18 as web
|
FROM node:iron-alpine3.18 as web
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/open-api/typescript-sdk
|
||||||
COPY web/package*.json web/svelte.config.js .
|
COPY open-api/typescript-sdk/package*.json open-api/typescript-sdk/tsconfig*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
COPY web .
|
COPY open-api/typescript-sdk/ ./
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
COPY web/package*.json web/svelte.config.js ./
|
||||||
|
RUN npm ci
|
||||||
|
COPY web ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
OPENAPI_GENEARTOR_VERSION=v6.6.0
|
|
||||||
|
|
||||||
function mobile {
|
|
||||||
rm -rf ../mobile/openapi
|
|
||||||
cd ./openapi-generator/templates/mobile/serialization/native
|
|
||||||
wget -O native_class.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache
|
|
||||||
patch -u native_class.mustache <native_class.mustache.patch
|
|
||||||
cd ../../../../..
|
|
||||||
npx --yes @openapitools/openapi-generator-cli generate -g dart -i ./immich-openapi-specs.json -o ../mobile/openapi -t ./openapi-generator/templates/mobile
|
|
||||||
|
|
||||||
# Post generate patches
|
|
||||||
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api_client.dart <./openapi-generator/patch/api_client.dart.patch
|
|
||||||
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api.dart <./openapi-generator/patch/api.dart.patch
|
|
||||||
sed -i 's/0.17.0/0.18.0/g' ../mobile/openapi/pubspec.yaml
|
|
||||||
}
|
|
||||||
|
|
||||||
function web {
|
|
||||||
rm -rf ../web/src/api/open-api
|
|
||||||
cd ./openapi-generator/templates/web
|
|
||||||
wget -O apiInner.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
|
|
||||||
patch -u apiInner.mustache < apiInner.mustache.patch
|
|
||||||
cd ../../..
|
|
||||||
npx --yes @openapitools/openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ../web/src/api/open-api -t ./openapi-generator/templates/web --additional-properties=useSingleRequestParameter=true
|
|
||||||
}
|
|
||||||
|
|
||||||
function cli {
|
|
||||||
rm -rf ../cli/src/api/open-api
|
|
||||||
cd ./openapi-generator/templates/cli
|
|
||||||
wget -O apiInner.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
|
|
||||||
patch -u apiInner.mustache < apiInner.mustache.patch
|
|
||||||
cd ../../..
|
|
||||||
npx --yes @openapitools/openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ../cli/src/api/open-api -t ./openapi-generator/templates/cli --additional-properties=useSingleRequestParameter=true
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ $1 == 'mobile' ]]; then
|
|
||||||
mobile
|
|
||||||
elif [[ $1 == 'web' ]]; then
|
|
||||||
web
|
|
||||||
elif [[ $1 == 'cli' ]]; then
|
|
||||||
cli
|
|
||||||
else
|
|
||||||
mobile
|
|
||||||
web
|
|
||||||
cli
|
|
||||||
fi
|
|
@ -1,6 +0,0 @@
|
|||||||
const spec = require('../immich-openapi-specs.json');
|
|
||||||
const pkg = require('../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));
|
|
@ -1,391 +0,0 @@
|
|||||||
{{#withSeparateModelsAndApi}}
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
import type { Configuration } from '{{apiRelativeToRoot}}configuration';
|
|
||||||
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
import globalAxios from 'axios';
|
|
||||||
{{#withNodeImports}}
|
|
||||||
// URLSearchParams not necessarily used
|
|
||||||
// @ts-ignore
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{#multipartFormData}}
|
|
||||||
import FormData from 'form-data'
|
|
||||||
{{/multipartFormData}}
|
|
||||||
{{/withNodeImports}}
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common';
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
|
|
||||||
{{#imports}}
|
|
||||||
// @ts-ignore
|
|
||||||
import { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';
|
|
||||||
{{/imports}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{^withSeparateModelsAndApi}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{#operations}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - axios parameter creator{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) {
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{nickname}}: async ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
||||||
{{#allParams}}
|
|
||||||
{{#required}}
|
|
||||||
// verify required parameter '{{paramName}}' is not null or undefined
|
|
||||||
assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}})
|
|
||||||
{{/required}}
|
|
||||||
{{/allParams}}
|
|
||||||
const localVarPath = `{{{path}}}`{{#pathParams}}
|
|
||||||
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
|
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
||||||
let baseOptions;
|
|
||||||
if (configuration) {
|
|
||||||
baseOptions = configuration.baseOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options};
|
|
||||||
const localVarHeaderParameter = {} as any;
|
|
||||||
const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}}
|
|
||||||
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}((configuration && configuration.formDataCtor) || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
|
|
||||||
{{#authMethods}}
|
|
||||||
// authentication {{name}} required
|
|
||||||
{{#isApiKey}}
|
|
||||||
{{#isKeyInHeader}}
|
|
||||||
await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInHeader}}
|
|
||||||
{{#isKeyInQuery}}
|
|
||||||
await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInQuery}}
|
|
||||||
{{/isApiKey}}
|
|
||||||
{{#isBasicBasic}}
|
|
||||||
// http basic authentication required
|
|
||||||
setBasicAuthToObject(localVarRequestOptions, configuration)
|
|
||||||
{{/isBasicBasic}}
|
|
||||||
{{#isBasicBearer}}
|
|
||||||
// http bearer authentication required
|
|
||||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
||||||
{{/isBasicBearer}}
|
|
||||||
{{#isOAuth}}
|
|
||||||
// oauth required
|
|
||||||
await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration)
|
|
||||||
{{/isOAuth}}
|
|
||||||
|
|
||||||
{{/authMethods}}
|
|
||||||
{{#queryParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) {
|
|
||||||
{{#isDateTime}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString() :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDateTime}}
|
|
||||||
{{^isDateTime}}
|
|
||||||
{{#isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString().substr(0,10) :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{^isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{/isDateTime}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/queryParams}}
|
|
||||||
{{#headerParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#uniqueItems}}
|
|
||||||
let mapped = Array.from({{paramName}}).map(value => (<any>"{{{dataType}}}" !== "Set<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
let mapped = {{paramName}}.map(value => (<any>"{{{dataType}}}" !== "Array<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]);
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
{{! `val == null` covers for both `null` and `undefined`}}
|
|
||||||
if ({{paramName}} != null) {
|
|
||||||
{{#isString}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = String({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
{{^isString}}
|
|
||||||
{{! isString is falsy also for $ref that defines a string or enum type}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = typeof {{paramName}} === 'string'
|
|
||||||
? {{paramName}}
|
|
||||||
: JSON.stringify({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/headerParams}}
|
|
||||||
{{#vendorExtensions}}
|
|
||||||
{{#formParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{paramName}}.forEach((element) => {
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', element as any);
|
|
||||||
})
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) { {{^multipartFormData}}
|
|
||||||
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}{{#isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isEnum}}
|
|
||||||
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isEnum}}{{^isEnum}}
|
|
||||||
localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isEnum}}{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{/formParams}}{{/vendorExtensions}}
|
|
||||||
{{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}}
|
|
||||||
{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
{{^consumes}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
||||||
{{/consumes}}
|
|
||||||
{{#consumes.0}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}';
|
|
||||||
{{/consumes.0}}
|
|
||||||
|
|
||||||
{{/bodyParam}}
|
|
||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions,{{#hasFormParams}}{{#multipartFormData}} ...(localVarFormParams as any).getHeaders?.(),{{/multipartFormData}}{{/hasFormParams}} ...options.headers};
|
|
||||||
{{#hasFormParams}}
|
|
||||||
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
|
|
||||||
{{/hasFormParams}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration)
|
|
||||||
{{/bodyParam}}
|
|
||||||
|
|
||||||
return {
|
|
||||||
url: toPathString(localVarUrlObj),
|
|
||||||
options: localVarRequestOptions,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - functional programming interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Fp = function(configuration?: Configuration) {
|
|
||||||
const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
|
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - factory interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
||||||
const localVarFp = {{classname}}Fp(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{/operation}}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
{{#withInterfaces}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}
|
|
||||||
*/
|
|
||||||
export interface {{classname}}Interface {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}Interface
|
|
||||||
*/
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
|
|
||||||
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#operation}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
/**
|
|
||||||
* Request parameters for {{nickname}} operation in {{classname}}.
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}{{operationIdCamelCase}}Request
|
|
||||||
*/
|
|
||||||
export interface {{classname}}{{operationIdCamelCase}}Request {
|
|
||||||
{{#allParams}}
|
|
||||||
/**
|
|
||||||
* {{description}}
|
|
||||||
* @type {{=<% %>=}}{<%&dataType%>}<%={{ }}=%>
|
|
||||||
* @memberof {{classname}}{{operationIdCamelCase}}
|
|
||||||
*/
|
|
||||||
readonly {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/allParams}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/operation}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - object-oriented interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @class {{classname}}
|
|
||||||
* @extends {BaseAPI}
|
|
||||||
*/
|
|
||||||
{{#withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI implements {{classname}}Interface {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{^withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
{{/operations}}
|
|
@ -1,390 +0,0 @@
|
|||||||
{{#withSeparateModelsAndApi}}
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
import type { Configuration } from '{{apiRelativeToRoot}}configuration';
|
|
||||||
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
import globalAxios from 'axios';
|
|
||||||
{{#withNodeImports}}
|
|
||||||
// URLSearchParams not necessarily used
|
|
||||||
// @ts-ignore
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{#multipartFormData}}
|
|
||||||
import FormData from 'form-data'
|
|
||||||
{{/multipartFormData}}
|
|
||||||
{{/withNodeImports}}
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common';
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
|
|
||||||
{{#imports}}
|
|
||||||
// @ts-ignore
|
|
||||||
import { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';
|
|
||||||
{{/imports}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{^withSeparateModelsAndApi}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{#operations}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - axios parameter creator{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) {
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{nickname}}: async ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
||||||
{{#allParams}}
|
|
||||||
{{#required}}
|
|
||||||
// verify required parameter '{{paramName}}' is not null or undefined
|
|
||||||
assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}})
|
|
||||||
{{/required}}
|
|
||||||
{{/allParams}}
|
|
||||||
const localVarPath = `{{{path}}}`{{#pathParams}}
|
|
||||||
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
|
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
||||||
let baseOptions;
|
|
||||||
if (configuration) {
|
|
||||||
baseOptions = configuration.baseOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options};
|
|
||||||
const localVarHeaderParameter = {} as any;
|
|
||||||
const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}}
|
|
||||||
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}((configuration && configuration.formDataCtor) || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
|
|
||||||
{{#authMethods}}
|
|
||||||
// authentication {{name}} required
|
|
||||||
{{#isApiKey}}
|
|
||||||
{{#isKeyInHeader}}
|
|
||||||
await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInHeader}}
|
|
||||||
{{#isKeyInQuery}}
|
|
||||||
await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInQuery}}
|
|
||||||
{{/isApiKey}}
|
|
||||||
{{#isBasicBasic}}
|
|
||||||
// http basic authentication required
|
|
||||||
setBasicAuthToObject(localVarRequestOptions, configuration)
|
|
||||||
{{/isBasicBasic}}
|
|
||||||
{{#isBasicBearer}}
|
|
||||||
// http bearer authentication required
|
|
||||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
||||||
{{/isBasicBearer}}
|
|
||||||
{{#isOAuth}}
|
|
||||||
// oauth required
|
|
||||||
await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration)
|
|
||||||
{{/isOAuth}}
|
|
||||||
|
|
||||||
{{/authMethods}}
|
|
||||||
{{#queryParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) {
|
|
||||||
{{#isDateTime}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString() :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDateTime}}
|
|
||||||
{{^isDateTime}}
|
|
||||||
{{#isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString().substr(0,10) :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{^isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{/isDateTime}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/queryParams}}
|
|
||||||
{{#headerParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#uniqueItems}}
|
|
||||||
let mapped = Array.from({{paramName}}).map(value => (<any>"{{{dataType}}}" !== "Set<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
let mapped = {{paramName}}.map(value => (<any>"{{{dataType}}}" !== "Array<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]);
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
{{! `val == null` covers for both `null` and `undefined`}}
|
|
||||||
if ({{paramName}} != null) {
|
|
||||||
{{#isString}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = String({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
{{^isString}}
|
|
||||||
{{! isString is falsy also for $ref that defines a string or enum type}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = typeof {{paramName}} === 'string'
|
|
||||||
? {{paramName}}
|
|
||||||
: JSON.stringify({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/headerParams}}
|
|
||||||
{{#vendorExtensions}}
|
|
||||||
{{#formParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{paramName}}.forEach((element) => {
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', element as any);
|
|
||||||
})
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) { {{^multipartFormData}}
|
|
||||||
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}{{#isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{/formParams}}{{/vendorExtensions}}
|
|
||||||
{{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}}
|
|
||||||
{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
{{^consumes}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
||||||
{{/consumes}}
|
|
||||||
{{#consumes.0}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}';
|
|
||||||
{{/consumes.0}}
|
|
||||||
|
|
||||||
{{/bodyParam}}
|
|
||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions,{{#hasFormParams}}{{#multipartFormData}} ...(localVarFormParams as any).getHeaders?.(),{{/multipartFormData}}{{/hasFormParams}} ...options.headers};
|
|
||||||
{{#hasFormParams}}
|
|
||||||
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
|
|
||||||
{{/hasFormParams}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration)
|
|
||||||
{{/bodyParam}}
|
|
||||||
|
|
||||||
return {
|
|
||||||
url: toPathString(localVarUrlObj),
|
|
||||||
options: localVarRequestOptions,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - functional programming interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Fp = function(configuration?: Configuration) {
|
|
||||||
const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
|
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - factory interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
||||||
const localVarFp = {{classname}}Fp(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{/operation}}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
{{#withInterfaces}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}
|
|
||||||
*/
|
|
||||||
export interface {{classname}}Interface {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}Interface
|
|
||||||
*/
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
|
|
||||||
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#operation}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
/**
|
|
||||||
* Request parameters for {{nickname}} operation in {{classname}}.
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}{{operationIdCamelCase}}Request
|
|
||||||
*/
|
|
||||||
export interface {{classname}}{{operationIdCamelCase}}Request {
|
|
||||||
{{#allParams}}
|
|
||||||
/**
|
|
||||||
* {{description}}
|
|
||||||
* @type {{=<% %>=}}{<%&dataType%>}<%={{ }}=%>
|
|
||||||
* @memberof {{classname}}{{operationIdCamelCase}}
|
|
||||||
*/
|
|
||||||
readonly {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/allParams}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/operation}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - object-oriented interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @class {{classname}}
|
|
||||||
* @extends {BaseAPI}
|
|
||||||
*/
|
|
||||||
{{#withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI implements {{classname}}Interface {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{^withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
{{/operations}}
|
|
@ -1,14 +0,0 @@
|
|||||||
--- apiInner.mustache 2023-02-10 17:44:20.945845049 +0000
|
|
||||||
+++ apiInner.mustache.patch 2023-02-10 17:46:28.669054112 +0000
|
|
||||||
@@ -173,8 +173,9 @@
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) { {{^multipartFormData}}
|
|
||||||
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}{{#isPrimitiveType}}
|
|
||||||
- localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}
|
|
||||||
- localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
+ localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isEnum}}
|
|
||||||
+ localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isEnum}}{{^isEnum}}
|
|
||||||
+ localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isEnum}}{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{/formParams}}{{/vendorExtensions}}
|
|
||||||
{{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}}
|
|
@ -31,9 +31,6 @@
|
|||||||
"typeorm:migrations:revert": "typeorm migration:revert -d ./dist/infra/database.config.js",
|
"typeorm:migrations:revert": "typeorm migration:revert -d ./dist/infra/database.config.js",
|
||||||
"typeorm:schema:drop": "typeorm query -d ./dist/infra/database.config.js 'DROP schema public cascade; CREATE schema public;'",
|
"typeorm:schema:drop": "typeorm query -d ./dist/infra/database.config.js 'DROP schema public cascade; CREATE schema public;'",
|
||||||
"typeorm:schema:reset": "npm run typeorm:schema:drop && npm run typeorm:migrations:run",
|
"typeorm:schema:reset": "npm run typeorm:schema:drop && npm run typeorm:migrations:run",
|
||||||
"api:typescript": "bash ./bin/generate-open-api.sh web",
|
|
||||||
"api:dart": "bash ./bin/generate-open-api.sh mobile",
|
|
||||||
"api:generate": "node ./bin/sync-spec-version.js && bash ./bin/generate-open-api.sh",
|
|
||||||
"sql:generate": "node ./dist/infra/sql-generator/"
|
"sql:generate": "node ./dist/infra/sql-generator/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -197,7 +197,7 @@ export const useSwagger = (app: INestApplication, isDev: boolean) => {
|
|||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
// Generate API Documentation only in development mode
|
// Generate API Documentation only in development mode
|
||||||
const outputPath = path.resolve(process.cwd(), 'immich-openapi-specs.json');
|
const outputPath = path.resolve(process.cwd(), '../open-api/immich-openapi-specs.json');
|
||||||
writeFileSync(outputPath, JSON.stringify(patchOpenAPI(doc), null, 2), { encoding: 'utf8' });
|
writeFileSync(outputPath, JSON.stringify(patchOpenAPI(doc), null, 2), { encoding: 'utf8' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,6 @@ node_modules
|
|||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
src/api/open-api
|
|
||||||
*.md
|
*.md
|
||||||
*.json
|
*.json
|
||||||
|
|
||||||
|
23
web/package-lock.json
generated
23
web/package-lock.json
generated
@ -9,6 +9,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@egjs/svelte-view360": "^4.0.0-beta.7",
|
"@egjs/svelte-view360": "^4.0.0-beta.7",
|
||||||
|
"@immich/sdk": "file:../open-api/typescript-sdk",
|
||||||
"@mdi/js": "^7.3.67",
|
"@mdi/js": "^7.3.67",
|
||||||
"@zoom-image/svelte": "^0.2.0",
|
"@zoom-image/svelte": "^0.2.0",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
@ -58,6 +59,18 @@
|
|||||||
"vitest": "^1.0.4"
|
"vitest": "^1.0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"../open-api/typescript-sdk": {
|
||||||
|
"name": "@immich/sdk",
|
||||||
|
"version": "1.92.1",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.27.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.11.0",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
"version": "1.2.6",
|
"version": "1.2.6",
|
||||||
"resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
|
||||||
@ -996,6 +1009,10 @@
|
|||||||
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
|
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@immich/sdk": {
|
||||||
|
"resolved": "../open-api/typescript-sdk",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
"node_modules/@istanbuljs/schema": {
|
"node_modules/@istanbuljs/schema": {
|
||||||
"version": "0.1.3",
|
"version": "0.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
|
||||||
@ -3924,9 +3941,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/follow-redirects": {
|
"node_modules/follow-redirects": {
|
||||||
"version": "1.15.3",
|
"version": "1.15.4",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
|
||||||
"integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
|
"integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"package": "svelte-kit package",
|
"package": "svelte-kit package",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"check:svelte": "svelte-check --no-tsconfig --fail-on-warnings --ignore \"src/api/open-api\"",
|
"check:svelte": "svelte-check --no-tsconfig --fail-on-warnings",
|
||||||
"check:typescript": "tsc --noEmit",
|
"check:typescript": "tsc --noEmit",
|
||||||
"check:watch": "npm run check:svelte -- --watch",
|
"check:watch": "npm run check:svelte -- --watch",
|
||||||
"check:code": "npm run format && npm run lint && npm run check:svelte && npm run check:typescript",
|
"check:code": "npm run format && npm run lint && npm run check:svelte && npm run check:typescript",
|
||||||
@ -55,6 +55,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@egjs/svelte-view360": "^4.0.0-beta.7",
|
"@egjs/svelte-view360": "^4.0.0-beta.7",
|
||||||
|
"@immich/sdk": "file:../open-api/typescript-sdk",
|
||||||
"@mdi/js": "^7.3.67",
|
"@mdi/js": "^7.3.67",
|
||||||
"@zoom-image/svelte": "^0.2.0",
|
"@zoom-image/svelte": "^0.2.0",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
import {
|
import {
|
||||||
AlbumApi,
|
|
||||||
LibraryApi,
|
|
||||||
APIKeyApi,
|
APIKeyApi,
|
||||||
|
ActivityApi,
|
||||||
|
AlbumApi,
|
||||||
AssetApi,
|
AssetApi,
|
||||||
AssetApiFp,
|
AssetApiFp,
|
||||||
AssetJobName,
|
AssetJobName,
|
||||||
|
AuditApi,
|
||||||
AuthenticationApi,
|
AuthenticationApi,
|
||||||
Configuration,
|
|
||||||
ConfigurationParameters,
|
ConfigurationParameters,
|
||||||
|
FaceApi,
|
||||||
JobApi,
|
JobApi,
|
||||||
JobName,
|
JobName,
|
||||||
|
LibraryApi,
|
||||||
OAuthApi,
|
OAuthApi,
|
||||||
PartnerApi,
|
PartnerApi,
|
||||||
PersonApi,
|
PersonApi,
|
||||||
@ -19,12 +21,10 @@ import {
|
|||||||
SystemConfigApi,
|
SystemConfigApi,
|
||||||
UserApi,
|
UserApi,
|
||||||
UserApiFp,
|
UserApiFp,
|
||||||
AuditApi,
|
base,
|
||||||
ActivityApi,
|
common,
|
||||||
FaceApi,
|
configuration,
|
||||||
} from './open-api';
|
} from '@immich/sdk';
|
||||||
import { BASE_PATH } from './open-api/base';
|
|
||||||
import { DUMMY_BASE_URL, toPathString } from './open-api/common';
|
|
||||||
import type { ApiParams } from './types';
|
import type { ApiParams } from './types';
|
||||||
|
|
||||||
class ImmichApi {
|
class ImmichApi {
|
||||||
@ -46,7 +46,7 @@ class ImmichApi {
|
|||||||
public systemConfigApi: SystemConfigApi;
|
public systemConfigApi: SystemConfigApi;
|
||||||
public userApi: UserApi;
|
public userApi: UserApi;
|
||||||
|
|
||||||
private config: Configuration;
|
private config: configuration.Configuration;
|
||||||
private key?: string;
|
private key?: string;
|
||||||
|
|
||||||
get isSharedLink() {
|
get isSharedLink() {
|
||||||
@ -54,7 +54,7 @@ class ImmichApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(params: ConfigurationParameters) {
|
constructor(params: ConfigurationParameters) {
|
||||||
this.config = new Configuration(params);
|
this.config = new configuration.Configuration(params);
|
||||||
|
|
||||||
this.activityApi = new ActivityApi(this.config);
|
this.activityApi = new ActivityApi(this.config);
|
||||||
this.albumApi = new AlbumApi(this.config);
|
this.albumApi = new AlbumApi(this.config);
|
||||||
@ -84,10 +84,10 @@ class ImmichApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = new URL(path, DUMMY_BASE_URL);
|
const url = new URL(path, common.DUMMY_BASE_URL);
|
||||||
url.search = searchParams.toString();
|
url.search = searchParams.toString();
|
||||||
|
|
||||||
return (this.config.basePath || BASE_PATH) + toPathString(url);
|
return (this.config.basePath || base.BASE_PATH) + common.toPathString(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setKey(key: string) {
|
public setKey(key: string) {
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
export * from './api';
|
export * from './api';
|
||||||
export * from './open-api';
|
export * from '@immich/sdk';
|
||||||
export * from './utils';
|
export * from './utils';
|
||||||
|
4
web/src/api/open-api/.gitignore
vendored
4
web/src/api/open-api/.gitignore
vendored
@ -1,4 +0,0 @@
|
|||||||
wwwroot/*.js
|
|
||||||
node_modules
|
|
||||||
typings
|
|
||||||
dist
|
|
@ -1 +0,0 @@
|
|||||||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
|
@ -1,23 +0,0 @@
|
|||||||
# OpenAPI Generator Ignore
|
|
||||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
@ -1,9 +0,0 @@
|
|||||||
.gitignore
|
|
||||||
.npmignore
|
|
||||||
.openapi-generator-ignore
|
|
||||||
api.ts
|
|
||||||
base.ts
|
|
||||||
common.ts
|
|
||||||
configuration.ts
|
|
||||||
git_push.sh
|
|
||||||
index.ts
|
|
@ -1 +0,0 @@
|
|||||||
6.5.0
|
|
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Immich
|
|
||||||
* Immich API
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.92.1
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
import type { Configuration } from './configuration';
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
import globalAxios from 'axios';
|
|
||||||
|
|
||||||
export const BASE_PATH = "/api".replace(/\/+$/, "");
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const COLLECTION_FORMATS = {
|
|
||||||
csv: ",",
|
|
||||||
ssv: " ",
|
|
||||||
tsv: "\t",
|
|
||||||
pipes: "|",
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @interface RequestArgs
|
|
||||||
*/
|
|
||||||
export interface RequestArgs {
|
|
||||||
url: string;
|
|
||||||
options: AxiosRequestConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @class BaseAPI
|
|
||||||
*/
|
|
||||||
export class BaseAPI {
|
|
||||||
protected configuration: Configuration | undefined;
|
|
||||||
|
|
||||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
this.basePath = configuration.basePath || this.basePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @class RequiredError
|
|
||||||
* @extends {Error}
|
|
||||||
*/
|
|
||||||
export class RequiredError extends Error {
|
|
||||||
constructor(public field: string, msg?: string) {
|
|
||||||
super(msg);
|
|
||||||
this.name = "RequiredError"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,150 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Immich
|
|
||||||
* Immich API
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.92.1
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
import type { Configuration } from "./configuration";
|
|
||||||
import type { RequestArgs } from "./base";
|
|
||||||
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
||||||
import { RequiredError } from "./base";
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const DUMMY_BASE_URL = 'https://example.com'
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
|
||||||
if (paramValue === null || paramValue === undefined) {
|
|
||||||
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
|
||||||
if (configuration && configuration.apiKey) {
|
|
||||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
||||||
? await configuration.apiKey(keyParamName)
|
|
||||||
: await configuration.apiKey;
|
|
||||||
object[keyParamName] = localVarApiKeyValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
|
||||||
if (configuration && (configuration.username || configuration.password)) {
|
|
||||||
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
|
||||||
if (configuration && configuration.accessToken) {
|
|
||||||
const accessToken = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken()
|
|
||||||
: await configuration.accessToken;
|
|
||||||
object["Authorization"] = "Bearer " + accessToken;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
|
||||||
if (configuration && configuration.accessToken) {
|
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken(name, scopes)
|
|
||||||
: await configuration.accessToken;
|
|
||||||
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
|
|
||||||
if (parameter == null) return;
|
|
||||||
if (typeof parameter === "object") {
|
|
||||||
if (Array.isArray(parameter)) {
|
|
||||||
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Object.keys(parameter).forEach(currentKey =>
|
|
||||||
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (urlSearchParams.has(key)) {
|
|
||||||
urlSearchParams.append(key, parameter);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
urlSearchParams.set(key, parameter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
|
||||||
const searchParams = new URLSearchParams(url.search);
|
|
||||||
setFlattenedQueryParams(searchParams, objects);
|
|
||||||
url.search = searchParams.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
|
||||||
const nonString = typeof value !== 'string';
|
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
return needsSerialization
|
|
||||||
? JSON.stringify(value !== undefined ? value : {})
|
|
||||||
: (value || "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const toPathString = function (url: URL) {
|
|
||||||
return url.pathname + url.search + url.hash
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
|
||||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
||||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
|
||||||
return axios.request<T, R>(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Immich
|
|
||||||
* Immich API
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.92.1
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
|
||||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
||||||
username?: string;
|
|
||||||
password?: string;
|
|
||||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
||||||
basePath?: string;
|
|
||||||
baseOptions?: any;
|
|
||||||
formDataCtor?: new () => any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Configuration {
|
|
||||||
/**
|
|
||||||
* parameter for apiKey security
|
|
||||||
* @param name security name
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
||||||
/**
|
|
||||||
* parameter for basic security
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
username?: string;
|
|
||||||
/**
|
|
||||||
* parameter for basic security
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
password?: string;
|
|
||||||
/**
|
|
||||||
* parameter for oauth2 security
|
|
||||||
* @param name security name
|
|
||||||
* @param scopes oauth2 scope
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
||||||
/**
|
|
||||||
* override base path
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
basePath?: string;
|
|
||||||
/**
|
|
||||||
* base options for axios calls
|
|
||||||
*
|
|
||||||
* @type {any}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
baseOptions?: any;
|
|
||||||
/**
|
|
||||||
* The FormData constructor that will be used to create multipart form data
|
|
||||||
* requests. You can inject this here so that execution environments that
|
|
||||||
* do not support the FormData class can still run the generated client.
|
|
||||||
*
|
|
||||||
* @type {new () => FormData}
|
|
||||||
*/
|
|
||||||
formDataCtor?: new () => any;
|
|
||||||
|
|
||||||
constructor(param: ConfigurationParameters = {}) {
|
|
||||||
this.apiKey = param.apiKey;
|
|
||||||
this.username = param.username;
|
|
||||||
this.password = param.password;
|
|
||||||
this.accessToken = param.accessToken;
|
|
||||||
this.basePath = param.basePath;
|
|
||||||
this.baseOptions = param.baseOptions;
|
|
||||||
this.formDataCtor = param.formDataCtor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the given MIME is a JSON MIME.
|
|
||||||
* JSON MIME examples:
|
|
||||||
* application/json
|
|
||||||
* application/json; charset=UTF8
|
|
||||||
* APPLICATION/JSON
|
|
||||||
* application/vnd.company+json
|
|
||||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
||||||
* @return True if the given MIME is JSON, false otherwise.
|
|
||||||
*/
|
|
||||||
public isJsonMime(mime: string): boolean {
|
|
||||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
||||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
||||||
#
|
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
|
||||||
|
|
||||||
git_user_id=$1
|
|
||||||
git_repo_id=$2
|
|
||||||
release_note=$3
|
|
||||||
git_host=$4
|
|
||||||
|
|
||||||
if [ "$git_host" = "" ]; then
|
|
||||||
git_host="github.com"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
|
||||||
git_user_id="GIT_USER_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
|
||||||
git_repo_id="GIT_REPO_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$release_note" = "" ]; then
|
|
||||||
release_note="Minor update"
|
|
||||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize the local directory as a Git repository
|
|
||||||
git init
|
|
||||||
|
|
||||||
# Adds the files in the local repository and stages them for commit.
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
||||||
git commit -m "$release_note"
|
|
||||||
|
|
||||||
# Sets the new remote
|
|
||||||
git_remote=$(git remote)
|
|
||||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
||||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
|
||||||
else
|
|
||||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
git pull origin master
|
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
||||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
|
@ -1,18 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Immich
|
|
||||||
* Immich API
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.92.1
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export * from "./api";
|
|
||||||
export * from "./configuration";
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import type { Configuration } from './open-api';
|
import type { Configuration } from '@immich/sdk';
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
export type ApiFp = (configuration: Configuration) => Record<any, (...args: any) => any>;
|
export type ApiFp = (configuration: Configuration) => Record<any, (...args: any) => any>;
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
} from '../lib/components/shared-components/notification/notification';
|
} from '../lib/components/shared-components/notification/notification';
|
||||||
import { handleError } from '../lib/utils/handle-error';
|
import { handleError } from '../lib/utils/handle-error';
|
||||||
import { api } from './api';
|
import { api } from './api';
|
||||||
import type { UserResponseDto } from './open-api';
|
import type { UserResponseDto } from '@immich/sdk';
|
||||||
|
|
||||||
export type ApiError = AxiosError<{ message: string }>;
|
export type ApiError = AxiosError<{ message: string }>;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
||||||
import UserAvatar from '../shared-components/user-avatar.svelte';
|
import UserAvatar from '../shared-components/user-avatar.svelte';
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
import type { AlbumResponseDto, UserResponseDto } from '../../../api/open-api';
|
import type { AlbumResponseDto, UserResponseDto } from '@api';
|
||||||
import Icon from '$lib/components/elements/icon.svelte';
|
import Icon from '$lib/components/elements/icon.svelte';
|
||||||
|
|
||||||
export let album: AlbumResponseDto;
|
export let album: AlbumResponseDto;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import type { MemoryLaneResponseDto } from '../../api/open-api';
|
import type { MemoryLaneResponseDto } from '@api';
|
||||||
|
|
||||||
export const memoryStore = writable<MemoryLaneResponseDto[]>();
|
export const memoryStore = writable<MemoryLaneResponseDto[]>();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import type { AssetResponseDto } from '../../api/open-api';
|
import type { AssetResponseDto } from '@api';
|
||||||
|
|
||||||
export const stackAssetsStore = writable<AssetResponseDto[]>([]);
|
export const stackAssetsStore = writable<AssetResponseDto[]>([]);
|
||||||
|
Loading…
Reference in New Issue
Block a user