2022-07-08 21:26:50 -05:00
|
|
|
import {
|
|
|
|
AlbumApi,
|
2023-01-02 15:22:33 -05:00
|
|
|
APIKeyApi,
|
2022-07-08 21:26:50 -05:00
|
|
|
AssetApi,
|
|
|
|
AuthenticationApi,
|
|
|
|
Configuration,
|
2023-02-24 21:42:20 +01:00
|
|
|
ConfigurationParameters,
|
2022-07-08 21:26:50 -05:00
|
|
|
DeviceInfoApi,
|
2022-10-06 11:25:54 -05:00
|
|
|
JobApi,
|
2022-11-14 21:24:25 -05:00
|
|
|
OAuthApi,
|
2022-07-08 21:26:50 -05:00
|
|
|
ServerInfoApi,
|
2023-01-09 14:16:08 -06:00
|
|
|
ShareApi,
|
2022-11-14 23:39:32 -05:00
|
|
|
SystemConfigApi,
|
2022-07-18 14:14:25 -05:00
|
|
|
UserApi
|
2022-07-10 21:41:45 -05:00
|
|
|
} from './open-api';
|
2022-07-08 21:26:50 -05:00
|
|
|
|
2023-02-24 21:42:20 +01:00
|
|
|
export class ImmichApi {
|
2022-07-08 21:26:50 -05:00
|
|
|
public userApi: UserApi;
|
|
|
|
public albumApi: AlbumApi;
|
|
|
|
public assetApi: AssetApi;
|
|
|
|
public authenticationApi: AuthenticationApi;
|
2022-11-14 21:24:25 -05:00
|
|
|
public oauthApi: OAuthApi;
|
2022-07-08 21:26:50 -05:00
|
|
|
public deviceInfoApi: DeviceInfoApi;
|
|
|
|
public serverInfoApi: ServerInfoApi;
|
2022-10-06 11:25:54 -05:00
|
|
|
public jobApi: JobApi;
|
2023-01-02 15:22:33 -05:00
|
|
|
public keyApi: APIKeyApi;
|
2022-11-14 23:39:32 -05:00
|
|
|
public systemConfigApi: SystemConfigApi;
|
2023-01-09 14:16:08 -06:00
|
|
|
public shareApi: ShareApi;
|
2022-10-06 11:25:54 -05:00
|
|
|
|
2023-02-24 21:42:20 +01:00
|
|
|
private config: Configuration;
|
|
|
|
|
|
|
|
constructor(params: ConfigurationParameters) {
|
|
|
|
this.config = new Configuration(params);
|
2022-07-08 21:26:50 -05:00
|
|
|
|
|
|
|
this.userApi = new UserApi(this.config);
|
|
|
|
this.albumApi = new AlbumApi(this.config);
|
|
|
|
this.assetApi = new AssetApi(this.config);
|
|
|
|
this.authenticationApi = new AuthenticationApi(this.config);
|
2022-11-14 21:24:25 -05:00
|
|
|
this.oauthApi = new OAuthApi(this.config);
|
2022-07-08 21:26:50 -05:00
|
|
|
this.deviceInfoApi = new DeviceInfoApi(this.config);
|
|
|
|
this.serverInfoApi = new ServerInfoApi(this.config);
|
2022-10-06 11:25:54 -05:00
|
|
|
this.jobApi = new JobApi(this.config);
|
2023-01-02 15:22:33 -05:00
|
|
|
this.keyApi = new APIKeyApi(this.config);
|
2022-11-14 23:39:32 -05:00
|
|
|
this.systemConfigApi = new SystemConfigApi(this.config);
|
2023-01-09 14:16:08 -06:00
|
|
|
this.shareApi = new ShareApi(this.config);
|
2022-07-08 21:26:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public setAccessToken(accessToken: string) {
|
|
|
|
this.config.accessToken = accessToken;
|
|
|
|
}
|
2022-07-26 12:28:07 -05:00
|
|
|
|
|
|
|
public removeAccessToken() {
|
|
|
|
this.config.accessToken = undefined;
|
|
|
|
}
|
2022-08-06 18:14:54 -05:00
|
|
|
|
|
|
|
public setBaseUrl(baseUrl: string) {
|
|
|
|
this.config.basePath = baseUrl;
|
|
|
|
}
|
2022-07-08 21:26:50 -05:00
|
|
|
}
|
|
|
|
|
2023-02-24 21:42:20 +01:00
|
|
|
export const api = new ImmichApi({ basePath: '/api' });
|