chore: tree shake unused API methods from CLI (#6973)

This commit is contained in:
Ben McCann 2024-02-09 12:53:37 -08:00 committed by GitHub
parent 954c1c2ef4
commit aff71a10e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
200 changed files with 3337 additions and 22416 deletions

View file

@ -3,7 +3,6 @@ import { access, constants, mkdir, readFile, unlink, writeFile } from 'node:fs/p
import path from 'node:path';
import yaml from 'yaml';
import { ImmichApi } from './api.service';
class LoginError extends Error {
constructor(message: string) {
super(message);
@ -51,12 +50,12 @@ export class SessionService {
const api = new ImmichApi(instanceUrl, apiKey);
const pingResponse = await api.serverInfoApi.pingServer().catch((error) => {
throw new Error(`Failed to connect to server ${api.instanceUrl}: ${error.message}`);
const pingResponse = await api.pingServer().catch((error) => {
throw new Error(`Failed to connect to server ${instanceUrl}: ${error.message}`, error);
});
if (pingResponse.res !== 'pong') {
throw new Error(`Could not parse response. Is Immich listening on ${api.instanceUrl}?`);
throw new Error(`Could not parse response. Is Immich listening on ${instanceUrl}?`);
}
return api;
@ -68,7 +67,7 @@ export class SessionService {
const api = new ImmichApi(instanceUrl, apiKey);
// Check if server and api key are valid
const userInfo = await api.userApi.getMyUserInfo().catch((error) => {
const userInfo = await api.getMyUserInfo().catch((error) => {
throw new LoginError(`Failed to connect to server ${instanceUrl}: ${error.message}`);
});