Skip to content

Commit 90a7f16

Browse files
authored
chore(server): remove deprecated endpoints (#6984)
* chore: remove deprecated endpoints * chore: open api
1 parent 198e851 commit 90a7f16

36 files changed

+140
-2877
lines changed

mobile/lib/modules/asset_viewer/services/asset_description.service.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class AssetDescriptionService {
3636

3737
Future<String> readLatest(String assetRemoteId, int localExifId) async {
3838
final latestAssetFromServer =
39-
await _api.assetApi.getAssetById(assetRemoteId);
39+
await _api.assetApi.getAssetInfo(assetRemoteId);
4040
final localExifInfo = await _db.exifInfos.get(localExifId);
4141

4242
if (latestAssetFromServer != null && localExifInfo != null) {

mobile/lib/modules/asset_viewer/services/image_viewer.service.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class ImageViewerService {
2525
// Download LivePhotos image and motion part
2626
if (asset.isImage && asset.livePhotoVideoId != null && Platform.isIOS) {
2727
var imageResponse =
28-
await _apiService.assetApi.downloadFileOldWithHttpInfo(
28+
await _apiService.downloadApi.downloadFileWithHttpInfo(
2929
asset.remoteId!,
3030
);
3131

3232
var motionReponse =
33-
await _apiService.assetApi.downloadFileOldWithHttpInfo(
33+
await _apiService.downloadApi.downloadFileWithHttpInfo(
3434
asset.livePhotoVideoId!,
3535
);
3636

@@ -71,8 +71,8 @@ class ImageViewerService {
7171

7272
return entity != null;
7373
} else {
74-
var res = await _apiService.assetApi
75-
.downloadFileOldWithHttpInfo(asset.remoteId!);
74+
var res = await _apiService.downloadApi
75+
.downloadFileWithHttpInfo(asset.remoteId!);
7676

7777
if (res.statusCode != 200) {
7878
_log.severe(

mobile/lib/modules/backup/services/backup_verification.service.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class BackupVerificationService {
136136
ExifInfo? exif = remote.exifInfo;
137137
if (exif != null && exif.lat != null) return false;
138138
if (exif == null || exif.fileSize == null) {
139-
final dto = await apiService.assetApi.getAssetById(remote.remoteId!);
139+
final dto = await apiService.assetApi.getAssetInfo(remote.remoteId!);
140140
if (dto != null && dto.exifInfo != null) {
141141
exif = ExifInfo.fromDto(dto.exifInfo!);
142142
}
@@ -165,8 +165,8 @@ class BackupVerificationService {
165165
// (skip first few KBs containing metadata)
166166
final Uint64List localImage =
167167
_fakeDecodeImg(local, await file.readAsBytes());
168-
final res = await apiService.assetApi
169-
.downloadFileOldWithHttpInfo(remote.remoteId!);
168+
final res = await apiService.downloadApi
169+
.downloadFileWithHttpInfo(remote.remoteId!);
170170
final Uint64List remoteImage = _fakeDecodeImg(remote, res.bodyBytes);
171171

172172
final eq = const ListEquality().equals(remoteImage, localImage);

mobile/lib/modules/trash/services/trash.service.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TrashService {
2222
try {
2323
List<String> remoteIds =
2424
assetList.where((a) => a.isRemote).map((e) => e.remoteId!).toList();
25-
await _apiService.assetApi.restoreAssetsOld(BulkIdsDto(ids: remoteIds));
25+
await _apiService.trashApi.restoreAssets(BulkIdsDto(ids: remoteIds));
2626
return true;
2727
} catch (error, stack) {
2828
_log.severe("Cannot restore assets ${error.toString()}", error, stack);
@@ -32,15 +32,15 @@ class TrashService {
3232

3333
Future<void> emptyTrash() async {
3434
try {
35-
await _apiService.assetApi.emptyTrashOld();
35+
await _apiService.trashApi.emptyTrash();
3636
} catch (error, stack) {
3737
_log.severe("Cannot empty trash ${error.toString()}", error, stack);
3838
}
3939
}
4040

4141
Future<void> restoreTrash() async {
4242
try {
43-
await _apiService.assetApi.restoreTrashOld();
43+
await _apiService.trashApi.restoreTrash();
4444
} catch (error, stack) {
4545
_log.severe("Cannot restore trash ${error.toString()}", error, stack);
4646
}

mobile/lib/shared/services/api.service.dart

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class ApiService {
2424
late SharedLinkApi sharedLinkApi;
2525
late SystemConfigApi systemConfigApi;
2626
late ActivityApi activityApi;
27+
late DownloadApi downloadApi;
28+
late TrashApi trashApi;
2729

2830
ApiService() {
2931
final endpoint = Store.tryGet(StoreKey.serverEndpoint);
@@ -51,6 +53,8 @@ class ApiService {
5153
sharedLinkApi = SharedLinkApi(_apiClient);
5254
systemConfigApi = SystemConfigApi(_apiClient);
5355
activityApi = ActivityApi(_apiClient);
56+
downloadApi = DownloadApi(_apiClient);
57+
trashApi = TrashApi(_apiClient);
5458
}
5559

5660
Future<String> resolveAndSetEndpoint(String serverUrl) async {

mobile/lib/shared/services/asset.service.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class AssetService {
129129
// fileSize is always filled on the server but not set on client
130130
if (a.exifInfo?.fileSize == null) {
131131
if (a.isRemote) {
132-
final dto = await _apiService.assetApi.getAssetById(a.remoteId!);
132+
final dto = await _apiService.assetApi.getAssetInfo(a.remoteId!);
133133
if (dto != null && dto.exifInfo != null) {
134134
final newExif = Asset.remote(dto).exifInfo!.copyWith(id: a.id);
135135
if (newExif != a.exifInfo) {

mobile/lib/shared/services/share.service.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class ShareService {
3131
final tempDir = await getTemporaryDirectory();
3232
final fileName = asset.fileName;
3333
final tempFile = await File('${tempDir.path}/$fileName').create();
34-
final res = await _apiService.assetApi
35-
.downloadFileOldWithHttpInfo(asset.remoteId!);
34+
final res = await _apiService.downloadApi
35+
.downloadFileWithHttpInfo(asset.remoteId!);
3636

3737
if (res.statusCode != 200) {
3838
_log.severe(

mobile/openapi/.openapi-generator/FILES

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mobile/openapi/README.md

-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)