2022-07-10 21:41:45 -05:00
|
|
|
import { serverEndpoint } from '$lib/constants';
|
2022-07-08 21:26:50 -05:00
|
|
|
import {
|
|
|
|
AlbumApi,
|
|
|
|
AssetApi,
|
|
|
|
AuthenticationApi,
|
|
|
|
Configuration,
|
|
|
|
DeviceInfoApi,
|
|
|
|
ServerInfoApi,
|
|
|
|
UserApi,
|
2022-07-10 21:41:45 -05:00
|
|
|
} from './open-api';
|
2022-07-08 21:26:50 -05:00
|
|
|
|
|
|
|
class ImmichApi {
|
|
|
|
public userApi: UserApi;
|
|
|
|
public albumApi: AlbumApi;
|
|
|
|
public assetApi: AssetApi;
|
|
|
|
public authenticationApi: AuthenticationApi;
|
|
|
|
public deviceInfoApi: DeviceInfoApi;
|
|
|
|
public serverInfoApi: ServerInfoApi;
|
2022-07-10 21:41:45 -05:00
|
|
|
private config = new Configuration({ basePath: serverEndpoint });
|
2022-07-08 21:26:50 -05:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-10 21:41:45 -05:00
|
|
|
export const api = new ImmichApi();
|