From 09a50b416a0d50d9faba37a60964f5288b6bbc8c Mon Sep 17 00:00:00 2001 From: Kevin Boulongne Date: Fri, 6 Sep 2024 08:57:11 +0200 Subject: [PATCH] Renamed UploadTasks into Upload + Some code/packages cleaning --- .../interfaces/{ => transfers}/Container.kt | 2 +- .../common/interfaces/{ => transfers}/File.kt | 2 +- .../interfaces/{ => transfers}/Transfer.kt | 2 +- .../interfaces/upload/InitUploadResponse.kt | 2 +- .../interfaces/upload/UploadContainer.kt | 4 +-- .../database/RealmProvider.kt | 28 +++++++++---------- .../cache/setting/AppSettingsController.kt | 6 +--- .../{setting => appSettings}/AppSettingsDB.kt | 2 +- .../models/{ => transfers}/ContainerDB.kt | 4 +-- .../database/models/{ => transfers}/FileDB.kt | 4 +-- .../models/{ => transfers}/TransferDB.kt | 4 +-- .../upload/{UploadTasks.kt => Upload.kt} | 2 +- .../network/models/transfer/ContainerApi.kt | 2 +- .../network/models/transfer/FileApi.kt | 2 +- .../network/models/transfer/TransferApi.kt | 2 +- .../upload/{ => response}/AuthorEmailToken.kt | 2 +- .../{ => response}/InitUploadResponseApi.kt | 4 +-- .../{ => response}/UploadCompleteResponse.kt | 2 +- .../{ => response}/UploadContainerApi.kt | 7 +++-- .../network/repositories/UploadRepository.kt | 6 ++-- .../network/requests/UploadRequest.kt | 6 ++-- 21 files changed, 46 insertions(+), 49 deletions(-) rename STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/{ => transfers}/Container.kt (98%) rename STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/{ => transfers}/File.kt (98%) rename STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/{ => transfers}/Transfer.kt (98%) rename STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/{setting => appSettings}/AppSettingsDB.kt (99%) rename STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/{ => transfers}/ContainerDB.kt (98%) rename STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/{ => transfers}/FileDB.kt (97%) rename STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/{ => transfers}/TransferDB.kt (97%) rename STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/upload/{UploadTasks.kt => Upload.kt} (96%) rename STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/{ => response}/AuthorEmailToken.kt (98%) rename STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/{ => response}/InitUploadResponseApi.kt (93%) rename STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/{ => response}/UploadCompleteResponse.kt (98%) rename STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/{ => response}/UploadContainerApi.kt (91%) diff --git a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Container.kt b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/transfers/Container.kt similarity index 98% rename from STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Container.kt rename to STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/transfers/Container.kt index a55a8dab..2a5a66a8 100644 --- a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Container.kt +++ b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/transfers/Container.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.common.interfaces +package com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers interface Container> { var uuid: String diff --git a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/File.kt b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/transfers/File.kt similarity index 98% rename from STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/File.kt rename to STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/transfers/File.kt index 0cc2932d..96c2a562 100644 --- a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/File.kt +++ b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/transfers/File.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.common.interfaces +package com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers interface File { var containerUUID: String diff --git a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Transfer.kt b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/transfers/Transfer.kt similarity index 98% rename from STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Transfer.kt rename to STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/transfers/Transfer.kt index ebc417a9..8fda08f5 100644 --- a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Transfer.kt +++ b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/transfers/Transfer.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.common.interfaces +package com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers interface Transfer { var linkUUID: String diff --git a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/InitUploadResponse.kt b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/InitUploadResponse.kt index 34f0e7c5..13d25270 100644 --- a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/InitUploadResponse.kt +++ b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/InitUploadResponse.kt @@ -20,5 +20,5 @@ package com.infomaniak.multiplatform_swisstransfer.common.interfaces.upload interface InitUploadResponse { var container: C var uploadHost: String - var filesUUID: List + var filesUuid: List } diff --git a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainer.kt b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainer.kt index 39c14a13..36d07d3c 100644 --- a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainer.kt +++ b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainer.kt @@ -27,9 +27,9 @@ interface UploadContainer { val authorIP: String val swiftVersion: String - // val createdDate: Object TODO: (Date) Waiting or deserialize this complex date object to timestamp + // val createdDate: Object // TODO: (Date) Waiting or deserialize this complex date object to timestamp val expiredDateTimestamp: Long val needPassword: Boolean val message: String - val numberOfFile: Long + val numberOfFiles: Long } diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/RealmProvider.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/RealmProvider.kt index da9c4852..cd95dfc4 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/RealmProvider.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/RealmProvider.kt @@ -17,11 +17,11 @@ */ package com.infomaniak.multiplatform_swisstransfer.database -import com.infomaniak.multiplatform_swisstransfer.database.models.ContainerDB -import com.infomaniak.multiplatform_swisstransfer.database.models.FileDB -import com.infomaniak.multiplatform_swisstransfer.database.models.TransferDB -import com.infomaniak.multiplatform_swisstransfer.database.models.setting.AppSettingsDB -import com.infomaniak.multiplatform_swisstransfer.database.models.upload.UploadTasks +import com.infomaniak.multiplatform_swisstransfer.database.models.appSettings.AppSettingsDB +import com.infomaniak.multiplatform_swisstransfer.database.models.transfers.ContainerDB +import com.infomaniak.multiplatform_swisstransfer.database.models.transfers.FileDB +import com.infomaniak.multiplatform_swisstransfer.database.models.transfers.TransferDB +import com.infomaniak.multiplatform_swisstransfer.database.models.upload.Upload import io.realm.kotlin.Realm import io.realm.kotlin.RealmConfiguration @@ -29,7 +29,7 @@ class RealmProvider { val realmAppSettings by lazy { Realm.open(realmAppSettingsConfiguration) } - val realmUploadTasks by lazy { Realm.open(realmUploadTasksConfiguration) } + val realmUploads by lazy { Realm.open(realmUploadConfiguration) } var realmTransfers: Realm? = null private set @@ -42,11 +42,11 @@ class RealmProvider { realmAppSettings.close() } - fun closeRealmUploadTasks() { - realmUploadTasks.close() + fun closeRealmUploads() { + realmUploads.close() } - fun closeCurrentRealmTransfers() { + fun closeRealmTransfers() { realmTransfers?.close() } @@ -56,8 +56,8 @@ class RealmProvider { fun closeAllRealms() { closeRealmAppSettings() - closeRealmUploadTasks() - closeCurrentRealmTransfers() + closeRealmUploads() + closeRealmTransfers() } private val realmAppSettingsConfiguration = RealmConfiguration @@ -65,9 +65,9 @@ class RealmProvider { .name("AppSettings") .build() - private val realmUploadTasksConfiguration = RealmConfiguration - .Builder(schema = setOf(UploadTasks::class)) - .name("UploadTasks") + private val realmUploadConfiguration = RealmConfiguration + .Builder(schema = setOf(Upload::class)) + .name("Uploads") .build() private fun realmTransfersConfiguration(userId: Int) = RealmConfiguration diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/cache/setting/AppSettingsController.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/cache/setting/AppSettingsController.kt index e6c1043b..def7ee5d 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/cache/setting/AppSettingsController.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/cache/setting/AppSettingsController.kt @@ -22,7 +22,7 @@ import com.infomaniak.multiplatform_swisstransfer.common.models.EmailLanguage import com.infomaniak.multiplatform_swisstransfer.common.models.Theme import com.infomaniak.multiplatform_swisstransfer.common.models.ValidityPeriod import com.infomaniak.multiplatform_swisstransfer.database.RealmProvider -import com.infomaniak.multiplatform_swisstransfer.database.models.setting.AppSettingsDB +import com.infomaniak.multiplatform_swisstransfer.database.models.appSettings.AppSettingsDB import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.ext.query import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -46,15 +46,12 @@ class AppSettingsController(private val realmProvider: RealmProvider) { } //region Get data - fun getAppSettingsFlow(): Flow { return appSettingsQuery.asFlow().mapLatest { it.obj } } - //endregion //region Update data - @Throws(IllegalArgumentException::class, CancellationException::class) private suspend fun updateAppSettings(onUpdate: (AppSettingsDB) -> Unit) { val appSettings = appSettingsQuery.find() ?: return @@ -93,6 +90,5 @@ class AppSettingsController(private val realmProvider: RealmProvider) { mutableAppSettings.emailLanguage = emailLanguage } } - //endregion } diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/setting/AppSettingsDB.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/appSettings/AppSettingsDB.kt similarity index 99% rename from STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/setting/AppSettingsDB.kt rename to STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/appSettings/AppSettingsDB.kt index 970c7e28..817bbc26 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/setting/AppSettingsDB.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/appSettings/AppSettingsDB.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.database.models.setting +package com.infomaniak.multiplatform_swisstransfer.database.models.appSettings import com.infomaniak.multiplatform_swisstransfer.common.interfaces.appSettings.AppSettings import com.infomaniak.multiplatform_swisstransfer.common.models.DownloadLimit diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/ContainerDB.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/transfers/ContainerDB.kt similarity index 98% rename from STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/ContainerDB.kt rename to STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/transfers/ContainerDB.kt index 07410909..37857021 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/ContainerDB.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/transfers/ContainerDB.kt @@ -15,9 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.database.models +package com.infomaniak.multiplatform_swisstransfer.database.models.transfers -import com.infomaniak.multiplatform_swisstransfer.common.interfaces.Container +import com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers.Container import io.realm.kotlin.ext.realmListOf import io.realm.kotlin.types.RealmList import io.realm.kotlin.types.RealmObject diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/FileDB.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/transfers/FileDB.kt similarity index 97% rename from STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/FileDB.kt rename to STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/transfers/FileDB.kt index 930ec56e..d5742c30 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/FileDB.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/transfers/FileDB.kt @@ -15,9 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.database.models +package com.infomaniak.multiplatform_swisstransfer.database.models.transfers -import com.infomaniak.multiplatform_swisstransfer.common.interfaces.File +import com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers.File import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.annotations.PrimaryKey diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/TransferDB.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/transfers/TransferDB.kt similarity index 97% rename from STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/TransferDB.kt rename to STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/transfers/TransferDB.kt index c5bef022..677299d8 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/TransferDB.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/transfers/TransferDB.kt @@ -15,9 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.database.models +package com.infomaniak.multiplatform_swisstransfer.database.models.transfers -import com.infomaniak.multiplatform_swisstransfer.common.interfaces.Transfer +import com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers.Transfer import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.annotations.PrimaryKey diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/upload/UploadTasks.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/upload/Upload.kt similarity index 96% rename from STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/upload/UploadTasks.kt rename to STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/upload/Upload.kt index 9aefbf70..f24603e3 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/upload/UploadTasks.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/upload/Upload.kt @@ -22,7 +22,7 @@ import io.realm.kotlin.types.RealmObject /** * Class representing files to be uploaded */ -class UploadTasks : RealmObject { +class Upload : RealmObject { var userId: Long = 0 //TODO: implement } diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/ContainerApi.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/ContainerApi.kt index 1bbc2217..87f89111 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/ContainerApi.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/ContainerApi.kt @@ -17,7 +17,7 @@ */ package com.infomaniak.multiplatform_swisstransfer.network.models.transfer -import com.infomaniak.multiplatform_swisstransfer.common.interfaces.Container +import com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers.Container import com.infomaniak.multiplatform_swisstransfer.network.serializers.DateToTimestampSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/FileApi.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/FileApi.kt index ac0d6f9f..4526a906 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/FileApi.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/FileApi.kt @@ -17,7 +17,7 @@ */ package com.infomaniak.multiplatform_swisstransfer.network.models.transfer -import com.infomaniak.multiplatform_swisstransfer.common.interfaces.File +import com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers.File import com.infomaniak.multiplatform_swisstransfer.network.serializers.DateToTimestampSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/TransferApi.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/TransferApi.kt index 2926749b..df7a6453 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/TransferApi.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/transfer/TransferApi.kt @@ -17,7 +17,7 @@ */ package com.infomaniak.multiplatform_swisstransfer.network.models.transfer -import com.infomaniak.multiplatform_swisstransfer.common.interfaces.Transfer +import com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers.Transfer import com.infomaniak.multiplatform_swisstransfer.network.serializers.DateToTimestampSerializer import com.infomaniak.multiplatform_swisstransfer.network.serializers.IntToBooleanSerializer import kotlinx.serialization.SerialName diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/AuthorEmailToken.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/AuthorEmailToken.kt similarity index 98% rename from STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/AuthorEmailToken.kt rename to STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/AuthorEmailToken.kt index 5938493f..186355b2 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/AuthorEmailToken.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/AuthorEmailToken.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.network.models.upload +package com.infomaniak.multiplatform_swisstransfer.network.models.upload.response import kotlinx.serialization.Serializable diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/InitUploadResponseApi.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/InitUploadResponseApi.kt similarity index 93% rename from STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/InitUploadResponseApi.kt rename to STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/InitUploadResponseApi.kt index 290e1e04..2fc7b13d 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/InitUploadResponseApi.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/InitUploadResponseApi.kt @@ -15,12 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.network.models.upload +package com.infomaniak.multiplatform_swisstransfer.network.models.upload.response import com.infomaniak.multiplatform_swisstransfer.common.interfaces.upload.InitUploadResponse class InitUploadResponseApi : InitUploadResponse { override var container: UploadContainerApi = UploadContainerApi() override var uploadHost: String = "" - override var filesUUID: List = emptyList() + override var filesUuid: List = emptyList() } diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/UploadCompleteResponse.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/UploadCompleteResponse.kt similarity index 98% rename from STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/UploadCompleteResponse.kt rename to STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/UploadCompleteResponse.kt index 2ee3204c..b659d39f 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/UploadCompleteResponse.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/UploadCompleteResponse.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.network.models.upload +package com.infomaniak.multiplatform_swisstransfer.network.models.upload.response import com.infomaniak.multiplatform_swisstransfer.network.serializers.DateToTimestampSerializer import com.infomaniak.multiplatform_swisstransfer.network.serializers.IntToBooleanSerializer diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/UploadContainerApi.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/UploadContainerApi.kt similarity index 91% rename from STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/UploadContainerApi.kt rename to STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/UploadContainerApi.kt index bc193752..91c5d060 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/UploadContainerApi.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/models/upload/response/UploadContainerApi.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.infomaniak.multiplatform_swisstransfer.network.models.upload +package com.infomaniak.multiplatform_swisstransfer.network.models.upload.response import com.infomaniak.multiplatform_swisstransfer.common.interfaces.upload.UploadContainer import com.infomaniak.multiplatform_swisstransfer.network.serializers.DateToTimestampSerializer @@ -38,11 +38,12 @@ class UploadContainerApi : UploadContainer { override var authorIP: String = "" override var swiftVersion: String = "" - // var createdDate: String TODO: Why a complex date instead of a simple date ? May be Custom serial this + // var createdDate: String // TODO: Why a complex date instead of a simple date ? May be Custom serial this @SerialName("expiredDate") @Serializable(DateToTimestampSerializer::class) override var expiredDateTimestamp: Long = 0 override var needPassword: Boolean = false override var message: String = "" - override var numberOfFile: Long = 0 + @SerialName("numberOfFile") + override var numberOfFiles: Long = 0 } diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt index ed2bab66..7cbc1503 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt @@ -22,9 +22,9 @@ import com.infomaniak.multiplatform_swisstransfer.network.ApiClientProvider import com.infomaniak.multiplatform_swisstransfer.network.exceptions.* import com.infomaniak.multiplatform_swisstransfer.network.exceptions.ContainerErrorsException.Companion.toContainerErrorsException import com.infomaniak.multiplatform_swisstransfer.network.exceptions.EmailValidationException.Companion.toEmailValidationException -import com.infomaniak.multiplatform_swisstransfer.network.models.upload.AuthorEmailToken -import com.infomaniak.multiplatform_swisstransfer.network.models.upload.InitUploadResponseApi -import com.infomaniak.multiplatform_swisstransfer.network.models.upload.UploadCompleteResponse +import com.infomaniak.multiplatform_swisstransfer.network.models.upload.response.AuthorEmailToken +import com.infomaniak.multiplatform_swisstransfer.network.models.upload.response.InitUploadResponseApi +import com.infomaniak.multiplatform_swisstransfer.network.models.upload.response.UploadCompleteResponse import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.FinishUploadBody import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.InitUploadBody import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.ResendEmailCodeBody diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt index c519bdd1..1556aac8 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt @@ -17,9 +17,9 @@ */ package com.infomaniak.multiplatform_swisstransfer.network.requests -import com.infomaniak.multiplatform_swisstransfer.network.models.upload.AuthorEmailToken -import com.infomaniak.multiplatform_swisstransfer.network.models.upload.InitUploadResponseApi -import com.infomaniak.multiplatform_swisstransfer.network.models.upload.UploadCompleteResponse +import com.infomaniak.multiplatform_swisstransfer.network.models.upload.response.AuthorEmailToken +import com.infomaniak.multiplatform_swisstransfer.network.models.upload.response.InitUploadResponseApi +import com.infomaniak.multiplatform_swisstransfer.network.models.upload.response.UploadCompleteResponse import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.FinishUploadBody import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.InitUploadBody import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.ResendEmailCodeBody