Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(server): remove deprecated endpoints #6984

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AssetDescriptionService {

Future<String> readLatest(String assetRemoteId, int localExifId) async {
final latestAssetFromServer =
await _api.assetApi.getAssetById(assetRemoteId);
await _api.assetApi.getAssetInfo(assetRemoteId);
final localExifInfo = await _db.exifInfos.get(localExifId);

if (latestAssetFromServer != null && localExifInfo != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class ImageViewerService {
// Download LivePhotos image and motion part
if (asset.isImage && asset.livePhotoVideoId != null && Platform.isIOS) {
var imageResponse =
await _apiService.assetApi.downloadFileOldWithHttpInfo(
await _apiService.downloadApi.downloadFileWithHttpInfo(
asset.remoteId!,
);

var motionReponse =
await _apiService.assetApi.downloadFileOldWithHttpInfo(
await _apiService.downloadApi.downloadFileWithHttpInfo(
asset.livePhotoVideoId!,
);

Expand Down Expand Up @@ -71,8 +71,8 @@ class ImageViewerService {

return entity != null;
} else {
var res = await _apiService.assetApi
.downloadFileOldWithHttpInfo(asset.remoteId!);
var res = await _apiService.downloadApi
.downloadFileWithHttpInfo(asset.remoteId!);

if (res.statusCode != 200) {
_log.severe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class BackupVerificationService {
ExifInfo? exif = remote.exifInfo;
if (exif != null && exif.lat != null) return false;
if (exif == null || exif.fileSize == null) {
final dto = await apiService.assetApi.getAssetById(remote.remoteId!);
final dto = await apiService.assetApi.getAssetInfo(remote.remoteId!);
if (dto != null && dto.exifInfo != null) {
exif = ExifInfo.fromDto(dto.exifInfo!);
}
Expand Down Expand Up @@ -165,8 +165,8 @@ class BackupVerificationService {
// (skip first few KBs containing metadata)
final Uint64List localImage =
_fakeDecodeImg(local, await file.readAsBytes());
final res = await apiService.assetApi
.downloadFileOldWithHttpInfo(remote.remoteId!);
final res = await apiService.downloadApi
.downloadFileWithHttpInfo(remote.remoteId!);
final Uint64List remoteImage = _fakeDecodeImg(remote, res.bodyBytes);

final eq = const ListEquality().equals(remoteImage, localImage);
Expand Down
6 changes: 3 additions & 3 deletions mobile/lib/modules/trash/services/trash.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TrashService {
try {
List<String> remoteIds =
assetList.where((a) => a.isRemote).map((e) => e.remoteId!).toList();
await _apiService.assetApi.restoreAssetsOld(BulkIdsDto(ids: remoteIds));
await _apiService.trashApi.restoreAssets(BulkIdsDto(ids: remoteIds));
return true;
} catch (error, stack) {
_log.severe("Cannot restore assets ${error.toString()}", error, stack);
Expand All @@ -32,15 +32,15 @@ class TrashService {

Future<void> emptyTrash() async {
try {
await _apiService.assetApi.emptyTrashOld();
await _apiService.trashApi.emptyTrash();
} catch (error, stack) {
_log.severe("Cannot empty trash ${error.toString()}", error, stack);
}
}

Future<void> restoreTrash() async {
try {
await _apiService.assetApi.restoreTrashOld();
await _apiService.trashApi.restoreTrash();
} catch (error, stack) {
_log.severe("Cannot restore trash ${error.toString()}", error, stack);
}
Expand Down
4 changes: 4 additions & 0 deletions mobile/lib/shared/services/api.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class ApiService {
late SharedLinkApi sharedLinkApi;
late SystemConfigApi systemConfigApi;
late ActivityApi activityApi;
late DownloadApi downloadApi;
late TrashApi trashApi;

ApiService() {
final endpoint = Store.tryGet(StoreKey.serverEndpoint);
Expand Down Expand Up @@ -51,6 +53,8 @@ class ApiService {
sharedLinkApi = SharedLinkApi(_apiClient);
systemConfigApi = SystemConfigApi(_apiClient);
activityApi = ActivityApi(_apiClient);
downloadApi = DownloadApi(_apiClient);
trashApi = TrashApi(_apiClient);
}

Future<String> resolveAndSetEndpoint(String serverUrl) async {
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/shared/services/asset.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class AssetService {
// fileSize is always filled on the server but not set on client
if (a.exifInfo?.fileSize == null) {
if (a.isRemote) {
final dto = await _apiService.assetApi.getAssetById(a.remoteId!);
final dto = await _apiService.assetApi.getAssetInfo(a.remoteId!);
if (dto != null && dto.exifInfo != null) {
final newExif = Asset.remote(dto).exifInfo!.copyWith(id: a.id);
if (newExif != a.exifInfo) {
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/shared/services/share.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class ShareService {
final tempDir = await getTemporaryDirectory();
final fileName = asset.fileName;
final tempFile = await File('${tempDir.path}/$fileName').create();
final res = await _apiService.assetApi
.downloadFileOldWithHttpInfo(asset.remoteId!);
final res = await _apiService.downloadApi
.downloadFileWithHttpInfo(asset.remoteId!);

if (res.statusCode != 200) {
_log.severe(
Expand Down
3 changes: 0 additions & 3 deletions mobile/openapi/.openapi-generator/FILES

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions mobile/openapi/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.