From 6c1afc12de67a8283b717192911254edcd73a3d4 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 2 Jul 2024 14:40:57 +0200 Subject: [PATCH] core: Common models --- .../common/interfaces/Container.kt | 40 +++++++++++++++++++ .../common/interfaces/File.kt | 34 ++++++++++++++++ .../common/interfaces/Transfer.kt | 31 ++++++++++++++ .../upload/UploadCompleteResponse.kt | 30 ++++++++++++++ .../interfaces/upload/UploadContainer.kt | 36 +++++++++++++++++ .../upload/UploadContainerResponse.kt | 25 ++++++++++++ 6 files changed, 196 insertions(+) create mode 100644 Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Container.kt create mode 100644 Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/File.kt create mode 100644 Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Transfer.kt create mode 100644 Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadCompleteResponse.kt create mode 100644 Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainer.kt create mode 100644 Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainerResponse.kt diff --git a/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Container.kt b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Container.kt new file mode 100644 index 00000000..476c5f3e --- /dev/null +++ b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Container.kt @@ -0,0 +1,40 @@ +/* + * Infomaniak SwissTransfer - Multiplatform + * Copyright (C) 2024 Infomaniak Network SA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + +interface Container> { + var uuid: String + var duration: Long + var createdDateTimestamp: Long + var expiredDateTimestamp: Long + var numberOfFile: Long + var message: String? + var needPassword: Long + var lang: String + var sizeUploaded: Long + var deletedDateTimestamp: Long? + var swiftVersion: Long + var downloadLimit: Long + var source: String + + // @SerialName("WSUser") TODO: What's it ? + //val wsUser: JsonElement? + + var files: F +} diff --git a/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/File.kt b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/File.kt new file mode 100644 index 00000000..225dc83b --- /dev/null +++ b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/File.kt @@ -0,0 +1,34 @@ +/* + * Infomaniak SwissTransfer - Multiplatform + * Copyright (C) 2024 Infomaniak Network SA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + +interface File { + var containerUUID: String + var uuid: String + var fileName: String + var fileSizeInBytes: Long + var downloadCounter: Long + var createdDateTimestamp: Long + var expiredDateTimestamp: Long + var eVirus: String + var deletedDate: String? + var mimeType: String + var receivedSizeInBytes: Long + var path: String? +} diff --git a/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Transfer.kt b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Transfer.kt new file mode 100644 index 00000000..a073d87b --- /dev/null +++ b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/Transfer.kt @@ -0,0 +1,31 @@ +/* + * Infomaniak SwissTransfer - Multiplatform + * Copyright (C) 2024 Infomaniak Network SA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + +interface Transfer { + var linkUUID: String + var containerUUID: String + var downloadCounterCredit: Long + var createdDateTimestamp: Long + var expiredDateTimestamp: Long + var isDownloadOnetime: Long + var isMailSent: Boolean + var downloadHost: String + var container: ContainerType +} diff --git a/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadCompleteResponse.kt b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadCompleteResponse.kt new file mode 100644 index 00000000..d57bf56a --- /dev/null +++ b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadCompleteResponse.kt @@ -0,0 +1,30 @@ +/* + * Infomaniak SwissTransfer - Multiplatform + * Copyright (C) 2024 Infomaniak Network SA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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.upload + +interface UploadCompleteResponse { + var linkUUID: String + var containerUUID: String + var userEmail: String? + var downloadCounterCredit: Long + var createdDateTimestamp: Long + var expiredDateTimestamp: Long + var isDownloadOnetime: Boolean + var isMailSent: Boolean +} diff --git a/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainer.kt b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainer.kt new file mode 100644 index 00000000..760b15f5 --- /dev/null +++ b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainer.kt @@ -0,0 +1,36 @@ +/* + * Infomaniak SwissTransfer - Multiplatform + * Copyright (C) 2024 Infomaniak Network SA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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.upload + +interface UploadContainer { + val uuid: String + val duration: String + val downloadLimit: Long + val lang: String + val source: String + val wsUser: String? + val authorIP: String + val swiftVersion: String + + // 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 +} diff --git a/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainerResponse.kt b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainerResponse.kt new file mode 100644 index 00000000..0c8561a1 --- /dev/null +++ b/Common/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/interfaces/upload/UploadContainerResponse.kt @@ -0,0 +1,25 @@ +/* + * Infomaniak SwissTransfer - Multiplatform + * Copyright (C) 2024 Infomaniak Network SA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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.upload + +interface UploadContainerResponse { + var container: C + var uploadHost: String + var filesUUID: List +}