refactor: open api (#6334)

This commit is contained in:
Jason Rasmussen 2024-01-12 07:36:27 -05:00 committed by GitHub
parent a1523a9af0
commit 2439c5ab57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
83 changed files with 404 additions and 19672 deletions

View file

@ -1,6 +1,6 @@
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> {
console.log('Executing API key auth flow...');

View file

@ -1,6 +1,6 @@
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 async run(): Promise<void> {

View file

@ -1,6 +1,6 @@
import { BaseCommand } from '../cli/base-command';
export default class ServerInfo extends BaseCommand {
export class ServerInfo extends BaseCommand {
public async run() {
await this.connect();
const { data: versionInfo } = await this.immichApi.serverInfoApi.getServerVersion();

View file

@ -6,10 +6,10 @@ import fs from 'node:fs';
import cliProgress from 'cli-progress';
import byteSize from 'byte-size';
import { BaseCommand } from '../cli/base-command';
import axios, { AxiosRequestConfig } from 'axios';
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
import FormData from 'form-data';
export default class Upload extends BaseCommand {
export class Upload extends BaseCommand {
uploadLength!: number;
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 config: AxiosRequestConfig = {