0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-02-18 01:24:26 -05:00
immich/web/src/api/api.ts

36 lines
926 B
TypeScript
Raw Normal View History

import { serverEndpoint } from '$lib/constants';
import {
AlbumApi,
AssetApi,
AuthenticationApi,
Configuration,
DeviceInfoApi,
ServerInfoApi,
UserApi,
} from './open-api';
class ImmichApi {
public userApi: UserApi;
public albumApi: AlbumApi;
public assetApi: AssetApi;
public authenticationApi: AuthenticationApi;
public deviceInfoApi: DeviceInfoApi;
public serverInfoApi: ServerInfoApi;
private config = new Configuration({ basePath: serverEndpoint });
constructor() {
this.userApi = new UserApi(this.config);
this.albumApi = new AlbumApi(this.config);
this.assetApi = new AssetApi(this.config);
this.authenticationApi = new AuthenticationApi(this.config);
this.deviceInfoApi = new DeviceInfoApi(this.config);
this.serverInfoApi = new ServerInfoApi(this.config);
}
public setAccessToken(accessToken: string) {
this.config.accessToken = accessToken;
}
}
export const api = new ImmichApi();