From 437b5d372b0ef6a7a3428eb92c61ed4484bd68ef Mon Sep 17 00:00:00 2001 From: Yamil Medina Date: Fri, 24 Jan 2025 07:42:27 -0300 Subject: [PATCH 1/3] feat: exposing commons validators to client (#3242) --- .../kotlin/com/wire/kalium/logic/GlobalKaliumScope.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/logic/src/commonMain/kotlin/com/wire/kalium/logic/GlobalKaliumScope.kt b/logic/src/commonMain/kotlin/com/wire/kalium/logic/GlobalKaliumScope.kt index 4f361f8376a..475b121ed33 100644 --- a/logic/src/commonMain/kotlin/com/wire/kalium/logic/GlobalKaliumScope.kt +++ b/logic/src/commonMain/kotlin/com/wire/kalium/logic/GlobalKaliumScope.kt @@ -38,6 +38,8 @@ import com.wire.kalium.logic.feature.auth.ValidatePasswordUseCase import com.wire.kalium.logic.feature.auth.ValidatePasswordUseCaseImpl import com.wire.kalium.logic.feature.auth.ValidateUserHandleUseCase import com.wire.kalium.logic.feature.auth.ValidateUserHandleUseCaseImpl +import com.wire.kalium.logic.feature.auth.sso.ValidateSSOCodeUseCase +import com.wire.kalium.logic.feature.auth.sso.ValidateSSOCodeUseCaseImpl import com.wire.kalium.logic.feature.client.ClearNewClientsForUserUseCase import com.wire.kalium.logic.feature.client.ClearNewClientsForUserUseCaseImpl import com.wire.kalium.logic.feature.client.ObserveNewClientsUseCase @@ -126,6 +128,7 @@ class GlobalKaliumScope internal constructor( globalDatabase.serverConfigurationDAO ) val validateEmailUseCase: ValidateEmailUseCase get() = ValidateEmailUseCaseImpl() + val validateSSOCodeUseCase: ValidateSSOCodeUseCase get() = ValidateSSOCodeUseCaseImpl() val validateUserHandleUseCase: ValidateUserHandleUseCase get() = ValidateUserHandleUseCaseImpl() val validatePasswordUseCase: ValidatePasswordUseCase get() = ValidatePasswordUseCaseImpl() From 6e0c8b7f32e47845f0a96e3307be249c054b6d40 Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Mon, 27 Jan 2025 14:36:40 +0100 Subject: [PATCH 2/3] feat: support skeleton for api v8 --- .../kalium/network/BackendMetaDataUtil.kt | 4 +- .../api/v8/authenticated/AccessTokenApiV8.kt | 26 +++ .../api/v8/authenticated/AssetApiV8.kt | 28 ++++ .../network/api/v8/authenticated/CallApiV8.kt | 26 +++ .../api/v8/authenticated/ClientApiV8.kt | 26 +++ .../api/v8/authenticated/ConnectionApiV8.kt | 26 +++ .../api/v8/authenticated/ConversationApiV8.kt | 43 +++++ .../network/api/v8/authenticated/E2EIApiV8.kt | 25 +++ .../v8/authenticated/FeatureConfigApiV8.kt | 26 +++ .../api/v8/authenticated/KeyPackageApiV8.kt | 26 +++ .../api/v8/authenticated/LogoutApiV8.kt | 28 ++++ .../api/v8/authenticated/MLSMessageApiV8.kt | 26 +++ .../api/v8/authenticated/MLSPublicKeyApiV8.kt | 26 +++ .../api/v8/authenticated/MessageApiV8.kt | 28 ++++ .../api/v8/authenticated/NotificationApiV8.kt | 30 ++++ .../api/v8/authenticated/PreKeyApiV8.kt | 26 +++ .../api/v8/authenticated/PropertiesApiV8.kt | 26 +++ .../network/api/v8/authenticated/SelfApiV8.kt | 28 ++++ .../api/v8/authenticated/TeamsApiV8.kt | 26 +++ .../UpgradePersonalToTeamApiV8.kt | 32 ++++ .../api/v8/authenticated/UserDetailsApiV8.kt | 26 +++ .../api/v8/authenticated/UserSearchApiV8.kt | 26 +++ .../AuthenticatedNetworkContainerV8.kt | 158 ++++++++++++++++++ .../v8/unauthenticated/DomainLookupApiV8.kt | 25 +++ .../api/v8/unauthenticated/LoginApiV8.kt | 26 +++ .../api/v8/unauthenticated/RegisterApiV8.kt | 26 +++ .../api/v8/unauthenticated/SSOLoginApiV8.kt | 26 +++ .../unauthenticated/VerificationCodeApiV8.kt | 25 +++ .../UnauthenticatedNetworkContainerV8.kt | 85 ++++++++++ .../AuthenticatedNetworkContainer.kt | 12 +- .../UnauthenticatedNetworkContainer.kt | 11 +- 31 files changed, 974 insertions(+), 4 deletions(-) create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/AccessTokenApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/AssetApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/CallApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ClientApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConnectionApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConversationApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/E2EIApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/FeatureConfigApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/KeyPackageApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/LogoutApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MLSMessageApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MLSPublicKeyApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MessageApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/NotificationApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/PreKeyApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/PropertiesApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/SelfApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/TeamsApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UpgradePersonalToTeamApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UserDetailsApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UserSearchApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/networkContainer/AuthenticatedNetworkContainerV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/DomainLookupApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/LoginApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/RegisterApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/SSOLoginApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/VerificationCodeApiV8.kt create mode 100644 network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/networkContainer/UnauthenticatedNetworkContainerV8.kt diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/BackendMetaDataUtil.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/BackendMetaDataUtil.kt index 179e1b936fa..87305d9b1e3 100644 --- a/network/src/commonMain/kotlin/com/wire/kalium/network/BackendMetaDataUtil.kt +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/BackendMetaDataUtil.kt @@ -1,6 +1,6 @@ /* * Wire - * Copyright (C) 2024 Wire Swiss GmbH + * Copyright (C) 2025 Wire Swiss GmbH * * 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 @@ -27,7 +27,7 @@ val SupportedApiVersions: Set = setOf(0, 1, 2, 4, 5, 6, 7) // They are not truly constants as set is not a primitive type, yet are treated as one in this context @Suppress("MagicNumber") -val DevelopmentApiVersions: Set = emptySet() +val DevelopmentApiVersions: Set = setOf(8) // You can use scripts/generate_new_api_version.sh or gradle task network:generateNewApiVersion to // bump API version and generate all needed classes diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/AccessTokenApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/AccessTokenApiV8.kt new file mode 100644 index 00000000000..b5429a3ed6b --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/AccessTokenApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.api.v7.authenticated.AccessTokenApiV7 +import io.ktor.client.HttpClient + +internal open class AccessTokenApiV8 internal constructor( + httpClient: HttpClient +) : AccessTokenApiV7(httpClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/AssetApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/AssetApiV8.kt new file mode 100644 index 00000000000..dd162ee93a8 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/AssetApiV8.kt @@ -0,0 +1,28 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.model.UserId +import com.wire.kalium.network.api.v7.authenticated.AssetApiV7 + +internal open class AssetApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient, + selfUserId: UserId +) : AssetApiV7(authenticatedNetworkClient, selfUserId) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/CallApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/CallApiV8.kt new file mode 100644 index 00000000000..7280198aa88 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/CallApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.CallApiV7 + +internal open class CallApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : CallApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ClientApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ClientApiV8.kt new file mode 100644 index 00000000000..1f9ff1b2edf --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ClientApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.ClientApiV7 + +internal open class ClientApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : ClientApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConnectionApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConnectionApiV8.kt new file mode 100644 index 00000000000..75d604505d1 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConnectionApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.ConnectionApiV7 + +internal open class ConnectionApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : ConnectionApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConversationApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConversationApiV8.kt new file mode 100644 index 00000000000..6ee7543f01b --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConversationApiV8.kt @@ -0,0 +1,43 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.authenticated.conversation.AddServiceRequest +import com.wire.kalium.network.api.authenticated.conversation.ConversationResponse +import com.wire.kalium.network.api.authenticated.conversation.ConversationResponseV6 +import com.wire.kalium.network.api.model.ApiModelMapper +import com.wire.kalium.network.api.model.ApiModelMapperImpl +import com.wire.kalium.network.api.model.ConversationId +import com.wire.kalium.network.api.model.ServiceAddedResponse +import com.wire.kalium.network.api.model.UserId +import com.wire.kalium.network.api.v7.authenticated.ConversationApiV7 +import com.wire.kalium.network.exceptions.KaliumException +import com.wire.kalium.network.utils.NetworkResponse +import com.wire.kalium.network.utils.mapSuccess +import com.wire.kalium.network.utils.wrapKaliumResponse +import io.ktor.client.request.get +import io.ktor.client.request.post +import io.ktor.client.request.setBody +import okio.IOException + +internal open class ConversationApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient, + apiModelMapper: ApiModelMapper = ApiModelMapperImpl(), +) : ConversationApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/E2EIApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/E2EIApiV8.kt new file mode 100644 index 00000000000..cb73bbd1e6a --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/E2EIApiV8.kt @@ -0,0 +1,25 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.E2EIApiV7 + +internal open class E2EIApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : E2EIApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/FeatureConfigApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/FeatureConfigApiV8.kt new file mode 100644 index 00000000000..bca7a0c793e --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/FeatureConfigApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.FeatureConfigApiV7 + +internal open class FeatureConfigApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : FeatureConfigApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/KeyPackageApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/KeyPackageApiV8.kt new file mode 100644 index 00000000000..b2079cb3e00 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/KeyPackageApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.KeyPackageApiV7 + +internal open class KeyPackageApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : KeyPackageApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/LogoutApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/LogoutApiV8.kt new file mode 100644 index 00000000000..56c164abe7a --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/LogoutApiV8.kt @@ -0,0 +1,28 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.LogoutApiV7 +import com.wire.kalium.network.session.SessionManager + +internal open class LogoutApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient, + sessionManager: SessionManager +) : LogoutApiV7(authenticatedNetworkClient, sessionManager) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MLSMessageApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MLSMessageApiV8.kt new file mode 100644 index 00000000000..844f6a02fcf --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MLSMessageApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.MLSMessageApiV7 + +internal open class MLSMessageApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : MLSMessageApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MLSPublicKeyApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MLSPublicKeyApiV8.kt new file mode 100644 index 00000000000..2b8112e687d --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MLSPublicKeyApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.MLSPublicKeyApiV7 + +internal open class MLSPublicKeyApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : MLSPublicKeyApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MessageApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MessageApiV8.kt new file mode 100644 index 00000000000..f8fdd936d41 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/MessageApiV8.kt @@ -0,0 +1,28 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.base.authenticated.message.EnvelopeProtoMapper +import com.wire.kalium.network.api.v7.authenticated.MessageApiV7 + +internal open class MessageApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient, + envelopeProtoMapper: EnvelopeProtoMapper +) : MessageApiV7(authenticatedNetworkClient, envelopeProtoMapper) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/NotificationApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/NotificationApiV8.kt new file mode 100644 index 00000000000..3db6b62813f --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/NotificationApiV8.kt @@ -0,0 +1,30 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.AuthenticatedWebSocketClient +import com.wire.kalium.network.api.unbound.configuration.ServerConfigDTO +import com.wire.kalium.network.api.v7.authenticated.NotificationApiV7 + +internal open class NotificationApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient, + authenticatedWebSocketClient: AuthenticatedWebSocketClient, + serverLinks: ServerConfigDTO.Links +) : NotificationApiV7(authenticatedNetworkClient, authenticatedWebSocketClient, serverLinks) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/PreKeyApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/PreKeyApiV8.kt new file mode 100644 index 00000000000..4541d99248a --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/PreKeyApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.PreKeyApiV7 + +internal open class PreKeyApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : PreKeyApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/PropertiesApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/PropertiesApiV8.kt new file mode 100644 index 00000000000..478324be612 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/PropertiesApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.PropertiesApiV7 + +internal open class PropertiesApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : PropertiesApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/SelfApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/SelfApiV8.kt new file mode 100644 index 00000000000..d93e6f62ec5 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/SelfApiV8.kt @@ -0,0 +1,28 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.SelfApiV7 +import com.wire.kalium.network.session.SessionManager + +internal open class SelfApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient, + sessionManager: SessionManager +) : SelfApiV7(authenticatedNetworkClient, sessionManager) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/TeamsApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/TeamsApiV8.kt new file mode 100644 index 00000000000..883c0a1e55a --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/TeamsApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.TeamsApiV7 + +internal open class TeamsApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : TeamsApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UpgradePersonalToTeamApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UpgradePersonalToTeamApiV8.kt new file mode 100644 index 00000000000..de49b7a4c2d --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UpgradePersonalToTeamApiV8.kt @@ -0,0 +1,32 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.authenticated.user.CreateUserTeamDTO +import com.wire.kalium.network.api.unauthenticated.register.NewBindingTeamDTO +import com.wire.kalium.network.api.v7.authenticated.UpgradePersonalToTeamApiV7 +import com.wire.kalium.network.utils.NetworkResponse +import com.wire.kalium.network.utils.wrapKaliumResponse +import io.ktor.client.request.post +import io.ktor.client.request.setBody + +internal open class UpgradePersonalToTeamApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient, +) : UpgradePersonalToTeamApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UserDetailsApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UserDetailsApiV8.kt new file mode 100644 index 00000000000..8f7a2c2daec --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UserDetailsApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.UserDetailsApiV7 + +internal open class UserDetailsApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : UserDetailsApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UserSearchApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UserSearchApiV8.kt new file mode 100644 index 00000000000..04f6ab93827 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UserSearchApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated + +import com.wire.kalium.network.AuthenticatedNetworkClient +import com.wire.kalium.network.api.v7.authenticated.UserSearchApiV7 + +internal open class UserSearchApiV8 internal constructor( + authenticatedNetworkClient: AuthenticatedNetworkClient +) : UserSearchApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/networkContainer/AuthenticatedNetworkContainerV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/networkContainer/AuthenticatedNetworkContainerV8.kt new file mode 100644 index 00000000000..39edfcea0df --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/networkContainer/AuthenticatedNetworkContainerV8.kt @@ -0,0 +1,158 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.authenticated.networkContainer + +import com.wire.kalium.logger.KaliumLogger +import com.wire.kalium.network.api.base.authenticated.AccessTokenApi +import com.wire.kalium.network.api.base.authenticated.CallApi +import com.wire.kalium.network.api.base.authenticated.TeamsApi +import com.wire.kalium.network.api.base.authenticated.UpgradePersonalToTeamApi +import com.wire.kalium.network.api.base.authenticated.WildCardApi +import com.wire.kalium.network.api.base.authenticated.asset.AssetApi +import com.wire.kalium.network.api.base.authenticated.client.ClientApi +import com.wire.kalium.network.api.base.authenticated.connection.ConnectionApi +import com.wire.kalium.network.api.base.authenticated.conversation.ConversationApi +import com.wire.kalium.network.api.base.authenticated.e2ei.E2EIApi +import com.wire.kalium.network.api.base.authenticated.featureConfigs.FeatureConfigApi +import com.wire.kalium.network.api.base.authenticated.keypackage.KeyPackageApi +import com.wire.kalium.network.api.base.authenticated.logout.LogoutApi +import com.wire.kalium.network.api.base.authenticated.message.EnvelopeProtoMapperImpl +import com.wire.kalium.network.api.base.authenticated.message.MLSMessageApi +import com.wire.kalium.network.api.base.authenticated.message.MessageApi +import com.wire.kalium.network.api.base.authenticated.notification.NotificationApi +import com.wire.kalium.network.api.base.authenticated.prekey.PreKeyApi +import com.wire.kalium.network.api.base.authenticated.properties.PropertiesApi +import com.wire.kalium.network.api.base.authenticated.search.UserSearchApi +import com.wire.kalium.network.api.base.authenticated.self.SelfApi +import com.wire.kalium.network.api.base.authenticated.serverpublickey.MLSPublicKeyApi +import com.wire.kalium.network.api.base.authenticated.userDetails.UserDetailsApi +import com.wire.kalium.network.api.model.UserId +import com.wire.kalium.network.api.v8.authenticated.AccessTokenApiV8 +import com.wire.kalium.network.api.v8.authenticated.AssetApiV8 +import com.wire.kalium.network.api.v8.authenticated.CallApiV8 +import com.wire.kalium.network.api.v8.authenticated.ClientApiV8 +import com.wire.kalium.network.api.v8.authenticated.ConnectionApiV8 +import com.wire.kalium.network.api.v8.authenticated.ConversationApiV8 +import com.wire.kalium.network.api.v8.authenticated.E2EIApiV8 +import com.wire.kalium.network.api.v8.authenticated.FeatureConfigApiV8 +import com.wire.kalium.network.api.v8.authenticated.KeyPackageApiV8 +import com.wire.kalium.network.api.v8.authenticated.LogoutApiV8 +import com.wire.kalium.network.api.v8.authenticated.MLSMessageApiV8 +import com.wire.kalium.network.api.v8.authenticated.MLSPublicKeyApiV8 +import com.wire.kalium.network.api.v8.authenticated.MessageApiV8 +import com.wire.kalium.network.api.v8.authenticated.NotificationApiV8 +import com.wire.kalium.network.api.v8.authenticated.PreKeyApiV8 +import com.wire.kalium.network.api.v8.authenticated.PropertiesApiV8 +import com.wire.kalium.network.api.v8.authenticated.SelfApiV8 +import com.wire.kalium.network.api.v8.authenticated.TeamsApiV8 +import com.wire.kalium.network.api.v8.authenticated.UpgradePersonalToTeamApiV8 +import com.wire.kalium.network.api.v8.authenticated.UserDetailsApiV8 +import com.wire.kalium.network.api.v8.authenticated.UserSearchApiV8 +import com.wire.kalium.network.api.vcommon.WildCardApiImpl +import com.wire.kalium.network.defaultHttpEngine +import com.wire.kalium.network.networkContainer.AuthenticatedHttpClientProvider +import com.wire.kalium.network.networkContainer.AuthenticatedHttpClientProviderImpl +import com.wire.kalium.network.networkContainer.AuthenticatedNetworkContainer +import com.wire.kalium.network.session.CertificatePinning +import com.wire.kalium.network.session.SessionManager +import io.ktor.client.engine.HttpClientEngine +import io.ktor.websocket.WebSocketSession + +@Suppress("LongParameterList") +internal class AuthenticatedNetworkContainerV8 internal constructor( + private val sessionManager: SessionManager, + private val selfUserId: UserId, + certificatePinning: CertificatePinning, + mockEngine: HttpClientEngine?, + mockWebSocketSession: WebSocketSession?, + kaliumLogger: KaliumLogger, + engine: HttpClientEngine = mockEngine ?: defaultHttpEngine( + serverConfigDTOApiProxy = sessionManager.serverConfig().links.apiProxy, + proxyCredentials = sessionManager.proxyCredentials(), + certificatePinning = certificatePinning + ) +) : AuthenticatedNetworkContainer, + AuthenticatedHttpClientProvider by AuthenticatedHttpClientProviderImpl( + sessionManager = sessionManager, + accessTokenApi = { httpClient -> AccessTokenApiV8(httpClient) }, + engine = engine, + kaliumLogger = kaliumLogger, + webSocketSessionProvider = if (mockWebSocketSession != null) { + { _, _ -> mockWebSocketSession } + } else { + null + } + ) { + + override val accessTokenApi: AccessTokenApi get() = AccessTokenApiV8(networkClient.httpClient) + + override val logoutApi: LogoutApi get() = LogoutApiV8(networkClient, sessionManager) + + override val clientApi: ClientApi get() = ClientApiV8(networkClient) + + override val messageApi: MessageApi + get() = MessageApiV8( + networkClient, + EnvelopeProtoMapperImpl() + ) + + override val mlsMessageApi: MLSMessageApi get() = MLSMessageApiV8(networkClient) + + override val e2eiApi: E2EIApi get() = E2EIApiV8(networkClient) + + override val conversationApi: ConversationApi get() = ConversationApiV8(networkClient) + + override val keyPackageApi: KeyPackageApi get() = KeyPackageApiV8(networkClient) + + override val preKeyApi: PreKeyApi get() = PreKeyApiV8(networkClient) + + override val assetApi: AssetApi get() = AssetApiV8(networkClientWithoutCompression, selfUserId) + + override val notificationApi: NotificationApi + get() = NotificationApiV8( + networkClient, + websocketClient, + backendConfig + ) + + override val teamsApi: TeamsApi get() = TeamsApiV8(networkClient) + + override val selfApi: SelfApi get() = SelfApiV8(networkClient, sessionManager) + + override val userDetailsApi: UserDetailsApi get() = UserDetailsApiV8(networkClient) + + override val userSearchApi: UserSearchApi get() = UserSearchApiV8(networkClient) + + override val callApi: CallApi get() = CallApiV8(networkClient) + + override val connectionApi: ConnectionApi get() = ConnectionApiV8(networkClient) + + override val featureConfigApi: FeatureConfigApi get() = FeatureConfigApiV8(networkClient) + + override val mlsPublicKeyApi: MLSPublicKeyApi get() = MLSPublicKeyApiV8(networkClient) + + override val propertiesApi: PropertiesApi get() = PropertiesApiV8(networkClient) + + override val wildCardApi: WildCardApi get() = WildCardApiImpl(networkClient) + + override val upgradePersonalToTeamApi: UpgradePersonalToTeamApi + get() = UpgradePersonalToTeamApiV8( + networkClient + ) +} diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/DomainLookupApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/DomainLookupApiV8.kt new file mode 100644 index 00000000000..6e32149dabc --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/DomainLookupApiV8.kt @@ -0,0 +1,25 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ +package com.wire.kalium.network.api.v8.unauthenticated + +import com.wire.kalium.network.UnauthenticatedNetworkClient +import com.wire.kalium.network.api.v7.unauthenticated.DomainLookupApiV7 + +internal open class DomainLookupApiV8 internal constructor( + unauthenticatedNetworkClient: UnauthenticatedNetworkClient +) : DomainLookupApiV7(unauthenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/LoginApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/LoginApiV8.kt new file mode 100644 index 00000000000..f1eecd57afd --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/LoginApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.unauthenticated + +import com.wire.kalium.network.UnauthenticatedNetworkClient +import com.wire.kalium.network.api.v7.unauthenticated.LoginApiV7 + +internal open class LoginApiV8 internal constructor( + unauthenticatedNetworkClient: UnauthenticatedNetworkClient +) : LoginApiV7(unauthenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/RegisterApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/RegisterApiV8.kt new file mode 100644 index 00000000000..86bc4956fec --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/RegisterApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.unauthenticated + +import com.wire.kalium.network.UnauthenticatedNetworkClient +import com.wire.kalium.network.api.v7.unauthenticated.RegisterApiV7 + +internal open class RegisterApiV8 internal constructor( + unauthenticatedNetworkClient: UnauthenticatedNetworkClient +) : RegisterApiV7(unauthenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/SSOLoginApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/SSOLoginApiV8.kt new file mode 100644 index 00000000000..129be49feb1 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/SSOLoginApiV8.kt @@ -0,0 +1,26 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.unauthenticated + +import com.wire.kalium.network.UnauthenticatedNetworkClient +import com.wire.kalium.network.api.v7.unauthenticated.SSOLoginApiV7 + +internal open class SSOLoginApiV8 internal constructor( + unauthenticatedNetworkClient: UnauthenticatedNetworkClient +) : SSOLoginApiV7(unauthenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/VerificationCodeApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/VerificationCodeApiV8.kt new file mode 100644 index 00000000000..534d8616b01 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/VerificationCodeApiV8.kt @@ -0,0 +1,25 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ +package com.wire.kalium.network.api.v8.unauthenticated + +import com.wire.kalium.network.UnauthenticatedNetworkClient +import com.wire.kalium.network.api.v7.unauthenticated.VerificationCodeApiV7 + +internal open class VerificationCodeApiV8 internal constructor( + unauthenticatedNetworkClient: UnauthenticatedNetworkClient +) : VerificationCodeApiV7(unauthenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/networkContainer/UnauthenticatedNetworkContainerV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/networkContainer/UnauthenticatedNetworkContainerV8.kt new file mode 100644 index 00000000000..74545927842 --- /dev/null +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/unauthenticated/networkContainer/UnauthenticatedNetworkContainerV8.kt @@ -0,0 +1,85 @@ +/* + * Wire + * Copyright (C) 2025 Wire Swiss GmbH + * + * 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 http://www.gnu.org/licenses/. + */ + +package com.wire.kalium.network.api.v8.unauthenticated.networkContainer + +import com.wire.kalium.network.api.base.unauthenticated.appVersioning.AppVersioningApi +import com.wire.kalium.network.api.base.unauthenticated.appVersioning.AppVersioningApiImpl +import com.wire.kalium.network.api.base.unauthenticated.domainLookup.DomainLookupApi +import com.wire.kalium.network.api.base.unauthenticated.login.LoginApi +import com.wire.kalium.network.api.base.unauthenticated.register.RegisterApi +import com.wire.kalium.network.api.base.unauthenticated.sso.SSOLoginApi +import com.wire.kalium.network.api.base.unauthenticated.verification.VerificationCodeApi +import com.wire.kalium.network.api.base.unbound.configuration.ServerConfigApi +import com.wire.kalium.network.api.base.unbound.configuration.ServerConfigApiImpl +import com.wire.kalium.network.api.base.unbound.versioning.VersionApi +import com.wire.kalium.network.api.base.unbound.versioning.VersionApiImpl +import com.wire.kalium.network.api.model.ProxyCredentialsDTO +import com.wire.kalium.network.api.unbound.configuration.ServerConfigDTO +import com.wire.kalium.network.api.v8.unauthenticated.DomainLookupApiV8 +import com.wire.kalium.network.api.v8.unauthenticated.LoginApiV8 +import com.wire.kalium.network.api.v8.unauthenticated.RegisterApiV8 +import com.wire.kalium.network.api.v8.unauthenticated.SSOLoginApiV8 +import com.wire.kalium.network.api.v8.unauthenticated.VerificationCodeApiV8 +import com.wire.kalium.network.defaultHttpEngine +import com.wire.kalium.network.networkContainer.UnauthenticatedNetworkClientProvider +import com.wire.kalium.network.networkContainer.UnauthenticatedNetworkClientProviderImpl +import com.wire.kalium.network.networkContainer.UnauthenticatedNetworkContainer +import com.wire.kalium.network.session.CertificatePinning +import io.ktor.client.engine.HttpClientEngine + +@Suppress("LongParameterList") +class UnauthenticatedNetworkContainerV8 internal constructor( + backendLinks: ServerConfigDTO, + proxyCredentials: ProxyCredentialsDTO?, + certificatePinning: CertificatePinning, + mockEngine: HttpClientEngine?, + engine: HttpClientEngine = mockEngine ?: defaultHttpEngine( + serverConfigDTOApiProxy = backendLinks.links.apiProxy, + proxyCredentials = proxyCredentials, + certificatePinning = certificatePinning + ), + private val developmentApiEnabled: Boolean +) : UnauthenticatedNetworkContainer, + UnauthenticatedNetworkClientProvider by UnauthenticatedNetworkClientProviderImpl( + backendLinks, + engine + ) { + override val loginApi: LoginApi get() = LoginApiV8(unauthenticatedNetworkClient) + override val verificationCodeApi: VerificationCodeApi + get() = VerificationCodeApiV8( + unauthenticatedNetworkClient + ) + override val domainLookupApi: DomainLookupApi + get() = DomainLookupApiV8( + unauthenticatedNetworkClient + ) + override val remoteVersion: VersionApi + get() = VersionApiImpl( + unauthenticatedNetworkClient, + developmentApiEnabled = developmentApiEnabled + ) + override val serverConfigApi: ServerConfigApi + get() = ServerConfigApiImpl(unauthenticatedNetworkClient) + override val registerApi: RegisterApi get() = RegisterApiV8(unauthenticatedNetworkClient) + override val sso: SSOLoginApi get() = SSOLoginApiV8(unauthenticatedNetworkClient) + override val appVersioningApi: AppVersioningApi + get() = AppVersioningApiImpl( + unauthenticatedNetworkClient + ) +} diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/networkContainer/AuthenticatedNetworkContainer.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/networkContainer/AuthenticatedNetworkContainer.kt index 2799e45f637..c3b8558d38b 100644 --- a/network/src/commonMain/kotlin/com/wire/kalium/network/networkContainer/AuthenticatedNetworkContainer.kt +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/networkContainer/AuthenticatedNetworkContainer.kt @@ -1,6 +1,6 @@ /* * Wire - * Copyright (C) 2024 Wire Swiss GmbH + * Copyright (C) 2025 Wire Swiss GmbH * * 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 @@ -51,6 +51,7 @@ import com.wire.kalium.network.api.v4.authenticated.networkContainer.Authenticat import com.wire.kalium.network.api.v5.authenticated.networkContainer.AuthenticatedNetworkContainerV5 import com.wire.kalium.network.api.v6.authenticated.networkContainer.AuthenticatedNetworkContainerV6 import com.wire.kalium.network.api.v7.authenticated.networkContainer.AuthenticatedNetworkContainerV7 +import com.wire.kalium.network.api.v8.authenticated.networkContainer.AuthenticatedNetworkContainerV8 import com.wire.kalium.network.session.CertificatePinning import com.wire.kalium.network.session.SessionManager import io.ktor.client.HttpClient @@ -201,6 +202,15 @@ interface AuthenticatedNetworkContainer { kaliumLogger ) + 8 -> AuthenticatedNetworkContainerV8( + sessionManager, + selfUserId, + certificatePinning, + mockEngine, + mockWebSocketSession, + kaliumLogger + ) + // You can use scripts/generate_new_api_version.sh or gradle task network:generateNewApiVersion to // bump API version and generate all needed classes else -> error("Unsupported version: $version") diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/networkContainer/UnauthenticatedNetworkContainer.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/networkContainer/UnauthenticatedNetworkContainer.kt index f647f9dcff3..a1b5e307ec6 100644 --- a/network/src/commonMain/kotlin/com/wire/kalium/network/networkContainer/UnauthenticatedNetworkContainer.kt +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/networkContainer/UnauthenticatedNetworkContainer.kt @@ -1,6 +1,6 @@ /* * Wire - * Copyright (C) 2024 Wire Swiss GmbH + * Copyright (C) 2025 Wire Swiss GmbH * * 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 @@ -35,6 +35,7 @@ import com.wire.kalium.network.api.v4.unauthenticated.networkContainer.Unauthent import com.wire.kalium.network.api.v5.unauthenticated.networkContainer.UnauthenticatedNetworkContainerV5 import com.wire.kalium.network.api.v6.unauthenticated.networkContainer.UnauthenticatedNetworkContainerV6 import com.wire.kalium.network.api.v7.unauthenticated.networkContainer.UnauthenticatedNetworkContainerV7 +import com.wire.kalium.network.api.v8.unauthenticated.networkContainer.UnauthenticatedNetworkContainerV8 import com.wire.kalium.network.session.CertificatePinning import io.ktor.client.engine.HttpClientEngine @@ -129,6 +130,14 @@ interface UnauthenticatedNetworkContainer { developmentApiEnabled = developmentApiEnabled ) + 8 -> UnauthenticatedNetworkContainerV8( + backendLinks = serverConfigDTO, + proxyCredentials = proxyCredentials, + certificatePinning = certificatePinning, + mockEngine = mockEngine, + developmentApiEnabled = developmentApiEnabled + ) + // You can use scripts/generate_new_api_version.sh or gradle task network:generateNewApiVersion to // bump API version and generate all needed classes else -> error("Unsupported version: ${serverConfigDTO.metaData.commonApiVersion.version}") From 784d144d37f51c6e893ae2d8d4ee45f3f4bc01e9 Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Mon, 27 Jan 2025 15:53:40 +0100 Subject: [PATCH 3/3] feat: detekt fixes --- .../api/v8/authenticated/ConversationApiV8.kt | 21 ++----------------- .../UpgradePersonalToTeamApiV8.kt | 8 +------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConversationApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConversationApiV8.kt index 6ee7543f01b..7faff977c2a 100644 --- a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConversationApiV8.kt +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/ConversationApiV8.kt @@ -19,25 +19,8 @@ package com.wire.kalium.network.api.v8.authenticated import com.wire.kalium.network.AuthenticatedNetworkClient -import com.wire.kalium.network.api.authenticated.conversation.AddServiceRequest -import com.wire.kalium.network.api.authenticated.conversation.ConversationResponse -import com.wire.kalium.network.api.authenticated.conversation.ConversationResponseV6 -import com.wire.kalium.network.api.model.ApiModelMapper -import com.wire.kalium.network.api.model.ApiModelMapperImpl -import com.wire.kalium.network.api.model.ConversationId -import com.wire.kalium.network.api.model.ServiceAddedResponse -import com.wire.kalium.network.api.model.UserId import com.wire.kalium.network.api.v7.authenticated.ConversationApiV7 -import com.wire.kalium.network.exceptions.KaliumException -import com.wire.kalium.network.utils.NetworkResponse -import com.wire.kalium.network.utils.mapSuccess -import com.wire.kalium.network.utils.wrapKaliumResponse -import io.ktor.client.request.get -import io.ktor.client.request.post -import io.ktor.client.request.setBody -import okio.IOException internal open class ConversationApiV8 internal constructor( - authenticatedNetworkClient: AuthenticatedNetworkClient, - apiModelMapper: ApiModelMapper = ApiModelMapperImpl(), -) : ConversationApiV7(authenticatedNetworkClient) + authenticatedNetworkClient: AuthenticatedNetworkClient +) : ConversationApiV7(authenticatedNetworkClient) diff --git a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UpgradePersonalToTeamApiV8.kt b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UpgradePersonalToTeamApiV8.kt index de49b7a4c2d..3fa67ff2bb2 100644 --- a/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UpgradePersonalToTeamApiV8.kt +++ b/network/src/commonMain/kotlin/com/wire/kalium/network/api/v8/authenticated/UpgradePersonalToTeamApiV8.kt @@ -19,14 +19,8 @@ package com.wire.kalium.network.api.v8.authenticated import com.wire.kalium.network.AuthenticatedNetworkClient -import com.wire.kalium.network.api.authenticated.user.CreateUserTeamDTO -import com.wire.kalium.network.api.unauthenticated.register.NewBindingTeamDTO import com.wire.kalium.network.api.v7.authenticated.UpgradePersonalToTeamApiV7 -import com.wire.kalium.network.utils.NetworkResponse -import com.wire.kalium.network.utils.wrapKaliumResponse -import io.ktor.client.request.post -import io.ktor.client.request.setBody internal open class UpgradePersonalToTeamApiV8 internal constructor( authenticatedNetworkClient: AuthenticatedNetworkClient, -) : UpgradePersonalToTeamApiV7(authenticatedNetworkClient) +) : UpgradePersonalToTeamApiV7(authenticatedNetworkClient)