@wireapp/wire-apps-js-sdk 0.0.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +141 -0
- package/build/WireAppSdk.d.ts +31 -0
- package/build/WireAppSdk.d.ts.map +1 -0
- package/build/WireAppSdk.js +159 -0
- package/build/WireAppSdk.js.map +1 -0
- package/build/api/AssetsApiClient.d.ts +12 -0
- package/build/api/AssetsApiClient.d.ts.map +1 -0
- package/build/api/AssetsApiClient.js +67 -0
- package/build/api/AssetsApiClient.js.map +1 -0
- package/build/api/AssetsTransferService.d.ts +12 -0
- package/build/api/AssetsTransferService.d.ts.map +1 -0
- package/build/api/AssetsTransferService.js +80 -0
- package/build/api/AssetsTransferService.js.map +1 -0
- package/build/api/ClientsApiClient.d.ts +13 -0
- package/build/api/ClientsApiClient.d.ts.map +1 -0
- package/build/api/ClientsApiClient.js +59 -0
- package/build/api/ClientsApiClient.js.map +1 -0
- package/build/api/ClientsService.d.ts +10 -0
- package/build/api/ClientsService.d.ts.map +1 -0
- package/build/api/ClientsService.js +45 -0
- package/build/api/ClientsService.js.map +1 -0
- package/build/api/ConversationService.d.ts +83 -0
- package/build/api/ConversationService.d.ts.map +1 -0
- package/build/api/ConversationService.js +534 -0
- package/build/api/ConversationService.js.map +1 -0
- package/build/api/ConversationsApiClient.d.ts +23 -0
- package/build/api/ConversationsApiClient.d.ts.map +1 -0
- package/build/api/ConversationsApiClient.js +113 -0
- package/build/api/ConversationsApiClient.js.map +1 -0
- package/build/api/FeatureConfigsApiClient.d.ts +9 -0
- package/build/api/FeatureConfigsApiClient.d.ts.map +1 -0
- package/build/api/FeatureConfigsApiClient.js +43 -0
- package/build/api/FeatureConfigsApiClient.js.map +1 -0
- package/build/api/FeatureConfigsService.d.ts +8 -0
- package/build/api/FeatureConfigsService.d.ts.map +1 -0
- package/build/api/FeatureConfigsService.js +45 -0
- package/build/api/FeatureConfigsService.js.map +1 -0
- package/build/api/MlsApiClient.d.ts +23 -0
- package/build/api/MlsApiClient.d.ts.map +1 -0
- package/build/api/MlsApiClient.js +77 -0
- package/build/api/MlsApiClient.js.map +1 -0
- package/build/api/MlsService.d.ts +17 -0
- package/build/api/MlsService.d.ts.map +1 -0
- package/build/api/MlsService.js +87 -0
- package/build/api/MlsService.js.map +1 -0
- package/build/api/NotificationsApiClient.d.ts +17 -0
- package/build/api/NotificationsApiClient.d.ts.map +1 -0
- package/build/api/NotificationsApiClient.js +60 -0
- package/build/api/NotificationsApiClient.js.map +1 -0
- package/build/api/OneToOneConversationsApiClient.d.ts +11 -0
- package/build/api/OneToOneConversationsApiClient.d.ts.map +1 -0
- package/build/api/OneToOneConversationsApiClient.js +45 -0
- package/build/api/OneToOneConversationsApiClient.js.map +1 -0
- package/build/api/SearchApiClient.d.ts +9 -0
- package/build/api/SearchApiClient.d.ts.map +1 -0
- package/build/api/SearchApiClient.js +61 -0
- package/build/api/SearchApiClient.js.map +1 -0
- package/build/api/TeamsApiClient.d.ts +11 -0
- package/build/api/TeamsApiClient.d.ts.map +1 -0
- package/build/api/TeamsApiClient.js +47 -0
- package/build/api/TeamsApiClient.js.map +1 -0
- package/build/api/UserService.d.ts +28 -0
- package/build/api/UserService.d.ts.map +1 -0
- package/build/api/UserService.js +90 -0
- package/build/api/UserService.js.map +1 -0
- package/build/api/UsersApiClient.d.ts +12 -0
- package/build/api/UsersApiClient.d.ts.map +1 -0
- package/build/api/UsersApiClient.js +63 -0
- package/build/api/UsersApiClient.js.map +1 -0
- package/build/api/model/AddMembersToConversationResult.d.ts +6 -0
- package/build/api/model/AddMembersToConversationResult.d.ts.map +1 -0
- package/build/api/model/AddMembersToConversationResult.js +17 -0
- package/build/api/model/AddMembersToConversationResult.js.map +1 -0
- package/build/api/model/ConversationIdsPaginationConfig.d.ts +5 -0
- package/build/api/model/ConversationIdsPaginationConfig.d.ts.map +1 -0
- package/build/api/model/ConversationIdsPaginationConfig.js +17 -0
- package/build/api/model/ConversationIdsPaginationConfig.js.map +1 -0
- package/build/api/model/ConversationMemberOtherResponse.d.ts +7 -0
- package/build/api/model/ConversationMemberOtherResponse.d.ts.map +1 -0
- package/build/api/model/ConversationMemberOtherResponse.js +17 -0
- package/build/api/model/ConversationMemberOtherResponse.js.map +1 -0
- package/build/api/model/ConversationMemberSelfResponse.d.ts +7 -0
- package/build/api/model/ConversationMemberSelfResponse.d.ts.map +1 -0
- package/build/api/model/ConversationMemberSelfResponse.js +17 -0
- package/build/api/model/ConversationMemberSelfResponse.js.map +1 -0
- package/build/api/model/ConversationMembersResponse.d.ts +7 -0
- package/build/api/model/ConversationMembersResponse.d.ts.map +1 -0
- package/build/api/model/ConversationMembersResponse.js +17 -0
- package/build/api/model/ConversationMembersResponse.js.map +1 -0
- package/build/api/model/ConversationTeamInfo.d.ts +5 -0
- package/build/api/model/ConversationTeamInfo.d.ts.map +1 -0
- package/build/api/model/ConversationTeamInfo.js +17 -0
- package/build/api/model/ConversationTeamInfo.js.map +1 -0
- package/build/api/model/RemoveMembersFromConversationResult.d.ts +5 -0
- package/build/api/model/RemoveMembersFromConversationResult.d.ts.map +1 -0
- package/build/api/model/RemoveMembersFromConversationResult.js +17 -0
- package/build/api/model/RemoveMembersFromConversationResult.js.map +1 -0
- package/build/api/model/UserClientResponse.d.ts +4 -0
- package/build/api/model/UserClientResponse.d.ts.map +1 -0
- package/build/api/model/UserClientResponse.js +17 -0
- package/build/api/model/UserClientResponse.js.map +1 -0
- package/build/api/model/UserResponse.d.ts +12 -0
- package/build/api/model/UserResponse.d.ts.map +1 -0
- package/build/api/model/UserResponse.js +17 -0
- package/build/api/model/UserResponse.js.map +1 -0
- package/build/api/model/asset/AssetUploadData.d.ts +5 -0
- package/build/api/model/asset/AssetUploadData.d.ts.map +1 -0
- package/build/api/model/asset/AssetUploadData.js +17 -0
- package/build/api/model/asset/AssetUploadData.js.map +1 -0
- package/build/api/model/asset/AssetUploadResponse.d.ts +7 -0
- package/build/api/model/asset/AssetUploadResponse.d.ts.map +1 -0
- package/build/api/model/asset/AssetUploadResponse.js +17 -0
- package/build/api/model/asset/AssetUploadResponse.js.map +1 -0
- package/build/api/request/CapabilitiesRequest.d.ts +4 -0
- package/build/api/request/CapabilitiesRequest.d.ts.map +1 -0
- package/build/api/request/CapabilitiesRequest.js +20 -0
- package/build/api/request/CapabilitiesRequest.js.map +1 -0
- package/build/api/request/ClientUpdateRequest.d.ts +5 -0
- package/build/api/request/ClientUpdateRequest.d.ts.map +1 -0
- package/build/api/request/ClientUpdateRequest.js +17 -0
- package/build/api/request/ClientUpdateRequest.js.map +1 -0
- package/build/api/request/ConversationIdsRequest.d.ts +5 -0
- package/build/api/request/ConversationIdsRequest.d.ts.map +1 -0
- package/build/api/request/ConversationIdsRequest.js +17 -0
- package/build/api/request/ConversationIdsRequest.js.map +1 -0
- package/build/api/request/CreateConversationRequest.d.ts +30 -0
- package/build/api/request/CreateConversationRequest.d.ts.map +1 -0
- package/build/api/request/CreateConversationRequest.js +57 -0
- package/build/api/request/CreateConversationRequest.js.map +1 -0
- package/build/api/request/MlsKeyPackagesRequest.d.ts +4 -0
- package/build/api/request/MlsKeyPackagesRequest.d.ts.map +1 -0
- package/build/api/request/MlsKeyPackagesRequest.js +17 -0
- package/build/api/request/MlsKeyPackagesRequest.js.map +1 -0
- package/build/api/request/PreKeyRequest.d.ts +6 -0
- package/build/api/request/PreKeyRequest.d.ts.map +1 -0
- package/build/api/request/PreKeyRequest.js +24 -0
- package/build/api/request/PreKeyRequest.js.map +1 -0
- package/build/api/request/RegisterClientRequest.d.ts +14 -0
- package/build/api/request/RegisterClientRequest.d.ts.map +1 -0
- package/build/api/request/RegisterClientRequest.js +36 -0
- package/build/api/request/RegisterClientRequest.js.map +1 -0
- package/build/api/response/AccessResponse.d.ts +7 -0
- package/build/api/response/AccessResponse.d.ts.map +1 -0
- package/build/api/response/AccessResponse.js +17 -0
- package/build/api/response/AccessResponse.js.map +1 -0
- package/build/api/response/ClaimedKeyPackageList.d.ts +14 -0
- package/build/api/response/ClaimedKeyPackageList.d.ts.map +1 -0
- package/build/api/response/ClaimedKeyPackageList.js +17 -0
- package/build/api/response/ClaimedKeyPackageList.js.map +1 -0
- package/build/api/response/ConversationIdsResponse.d.ts +7 -0
- package/build/api/response/ConversationIdsResponse.d.ts.map +1 -0
- package/build/api/response/ConversationIdsResponse.js +17 -0
- package/build/api/response/ConversationIdsResponse.js.map +1 -0
- package/build/api/response/ConversationResponse.d.ts +16 -0
- package/build/api/response/ConversationResponse.d.ts.map +1 -0
- package/build/api/response/ConversationResponse.js +17 -0
- package/build/api/response/ConversationResponse.js.map +1 -0
- package/build/api/response/ConversationsResponse.d.ts +8 -0
- package/build/api/response/ConversationsResponse.d.ts.map +1 -0
- package/build/api/response/ConversationsResponse.js +17 -0
- package/build/api/response/ConversationsResponse.js.map +1 -0
- package/build/api/response/EventResponse.d.ts +7 -0
- package/build/api/response/EventResponse.d.ts.map +1 -0
- package/build/api/response/EventResponse.js +17 -0
- package/build/api/response/EventResponse.js.map +1 -0
- package/build/api/response/FeatureConfigsResponse.d.ts +19 -0
- package/build/api/response/FeatureConfigsResponse.d.ts.map +1 -0
- package/build/api/response/FeatureConfigsResponse.js +17 -0
- package/build/api/response/FeatureConfigsResponse.js.map +1 -0
- package/build/api/response/MlsPublicKeysResponse.d.ts +7 -0
- package/build/api/response/MlsPublicKeysResponse.d.ts.map +1 -0
- package/build/api/response/MlsPublicKeysResponse.js +42 -0
- package/build/api/response/MlsPublicKeysResponse.js.map +1 -0
- package/build/api/response/NotificationsResponse.d.ts +7 -0
- package/build/api/response/NotificationsResponse.d.ts.map +1 -0
- package/build/api/response/NotificationsResponse.js +17 -0
- package/build/api/response/NotificationsResponse.js.map +1 -0
- package/build/api/response/OneToOneConversationResponse.d.ts +7 -0
- package/build/api/response/OneToOneConversationResponse.d.ts.map +1 -0
- package/build/api/response/OneToOneConversationResponse.js +17 -0
- package/build/api/response/OneToOneConversationResponse.js.map +1 -0
- package/build/api/response/RegisterClientResponse.d.ts +4 -0
- package/build/api/response/RegisterClientResponse.d.ts.map +1 -0
- package/build/api/response/RegisterClientResponse.js +17 -0
- package/build/api/response/RegisterClientResponse.js.map +1 -0
- package/build/api/response/SearchContactsResponse.d.ts +15 -0
- package/build/api/response/SearchContactsResponse.d.ts.map +1 -0
- package/build/api/response/SearchContactsResponse.js +17 -0
- package/build/api/response/SearchContactsResponse.js.map +1 -0
- package/build/core/CoreCryptoClient.d.ts +48 -0
- package/build/core/CoreCryptoClient.d.ts.map +1 -0
- package/build/core/CoreCryptoClient.js +219 -0
- package/build/core/CoreCryptoClient.js.map +1 -0
- package/build/core/CoreCryptoMlsTransport.d.ts +19 -0
- package/build/core/CoreCryptoMlsTransport.d.ts.map +1 -0
- package/build/core/CoreCryptoMlsTransport.js +64 -0
- package/build/core/CoreCryptoMlsTransport.js.map +1 -0
- package/build/core/CoreCryptoService.d.ts +59 -0
- package/build/core/CoreCryptoService.d.ts.map +1 -0
- package/build/core/CoreCryptoService.js +233 -0
- package/build/core/CoreCryptoService.js.map +1 -0
- package/build/core/HttpClient.d.ts +47 -0
- package/build/core/HttpClient.d.ts.map +1 -0
- package/build/core/HttpClient.js +258 -0
- package/build/core/HttpClient.js.map +1 -0
- package/build/core/HttpRetryHelper.d.ts +16 -0
- package/build/core/HttpRetryHelper.d.ts.map +1 -0
- package/build/core/HttpRetryHelper.js +49 -0
- package/build/core/HttpRetryHelper.js.map +1 -0
- package/build/core/HttpRetryPolicy.d.ts +7 -0
- package/build/core/HttpRetryPolicy.d.ts.map +1 -0
- package/build/core/HttpRetryPolicy.js +29 -0
- package/build/core/HttpRetryPolicy.js.map +1 -0
- package/build/core/WebSocketClient.d.ts +37 -0
- package/build/core/WebSocketClient.d.ts.map +1 -0
- package/build/core/WebSocketClient.js +244 -0
- package/build/core/WebSocketClient.js.map +1 -0
- package/build/core/WireApplicationManager.d.ts +39 -0
- package/build/core/WireApplicationManager.d.ts.map +1 -0
- package/build/core/WireApplicationManager.js +142 -0
- package/build/core/WireApplicationManager.js.map +1 -0
- package/build/core/WireEventsHandler.d.ts +33 -0
- package/build/core/WireEventsHandler.d.ts.map +1 -0
- package/build/core/WireEventsHandler.js +78 -0
- package/build/core/WireEventsHandler.js.map +1 -0
- package/build/core/event/DeleteConversationEventProcessor.d.ts +13 -0
- package/build/core/event/DeleteConversationEventProcessor.d.ts.map +1 -0
- package/build/core/event/DeleteConversationEventProcessor.js +58 -0
- package/build/core/event/DeleteConversationEventProcessor.js.map +1 -0
- package/build/core/event/EventProcessor.d.ts +6 -0
- package/build/core/event/EventProcessor.d.ts.map +1 -0
- package/build/core/event/EventProcessor.js +17 -0
- package/build/core/event/EventProcessor.js.map +1 -0
- package/build/core/event/EventRouter.d.ts +10 -0
- package/build/core/event/EventRouter.d.ts.map +1 -0
- package/build/core/event/EventRouter.js +58 -0
- package/build/core/event/EventRouter.js.map +1 -0
- package/build/core/event/MemberJoinEventProcessor.d.ts +13 -0
- package/build/core/event/MemberJoinEventProcessor.d.ts.map +1 -0
- package/build/core/event/MemberJoinEventProcessor.js +63 -0
- package/build/core/event/MemberJoinEventProcessor.js.map +1 -0
- package/build/core/event/MemberLeaveEventProcessor.d.ts +13 -0
- package/build/core/event/MemberLeaveEventProcessor.d.ts.map +1 -0
- package/build/core/event/MemberLeaveEventProcessor.js +58 -0
- package/build/core/event/MemberLeaveEventProcessor.js.map +1 -0
- package/build/core/event/MemberUpdateEventProcessor.d.ts +11 -0
- package/build/core/event/MemberUpdateEventProcessor.d.ts.map +1 -0
- package/build/core/event/MemberUpdateEventProcessor.js +50 -0
- package/build/core/event/MemberUpdateEventProcessor.js.map +1 -0
- package/build/core/event/MlsMessageEventProcessor.d.ts +18 -0
- package/build/core/event/MlsMessageEventProcessor.d.ts.map +1 -0
- package/build/core/event/MlsMessageEventProcessor.js +134 -0
- package/build/core/event/MlsMessageEventProcessor.js.map +1 -0
- package/build/core/event/MlsResetEventProcessor.d.ts +11 -0
- package/build/core/event/MlsResetEventProcessor.d.ts.map +1 -0
- package/build/core/event/MlsResetEventProcessor.js +48 -0
- package/build/core/event/MlsResetEventProcessor.js.map +1 -0
- package/build/core/event/MlsWelcomeEventProcessor.d.ts +18 -0
- package/build/core/event/MlsWelcomeEventProcessor.d.ts.map +1 -0
- package/build/core/event/MlsWelcomeEventProcessor.js +77 -0
- package/build/core/event/MlsWelcomeEventProcessor.js.map +1 -0
- package/build/core/event/NewConversationEventProcessor.d.ts +11 -0
- package/build/core/event/NewConversationEventProcessor.d.ts.map +1 -0
- package/build/core/event/NewConversationEventProcessor.js +49 -0
- package/build/core/event/NewConversationEventProcessor.js.map +1 -0
- package/build/core/event/processors.index.d.ts +9 -0
- package/build/core/event/processors.index.d.ts.map +1 -0
- package/build/core/event/processors.index.js +24 -0
- package/build/core/event/processors.index.js.map +1 -0
- package/build/db/AppPropertiesRepository.d.ts +16 -0
- package/build/db/AppPropertiesRepository.d.ts.map +1 -0
- package/build/db/AppPropertiesRepository.js +64 -0
- package/build/db/AppPropertiesRepository.js.map +1 -0
- package/build/db/ConversationMemberRepository.d.ts +23 -0
- package/build/db/ConversationMemberRepository.d.ts.map +1 -0
- package/build/db/ConversationMemberRepository.js +125 -0
- package/build/db/ConversationMemberRepository.js.map +1 -0
- package/build/db/ConversationRepository.d.ts +17 -0
- package/build/db/ConversationRepository.d.ts.map +1 -0
- package/build/db/ConversationRepository.js +100 -0
- package/build/db/ConversationRepository.js.map +1 -0
- package/build/db/DatabaseService.d.ts +12 -0
- package/build/db/DatabaseService.d.ts.map +1 -0
- package/build/db/DatabaseService.js +73 -0
- package/build/db/DatabaseService.js.map +1 -0
- package/build/db/migrations/0000_pink_lord_tyger.sql +27 -0
- package/build/db/migrations/0001_steady_selene.sql +16 -0
- package/build/db/migrations/meta/0000_snapshot.json +194 -0
- package/build/db/migrations/meta/0001_snapshot.json +197 -0
- package/build/db/migrations/meta/_journal.json +20 -0
- package/build/db/model/AppEntity.d.ts +5 -0
- package/build/db/model/AppEntity.d.ts.map +1 -0
- package/build/db/model/AppEntity.js +17 -0
- package/build/db/model/AppEntity.js.map +1 -0
- package/build/db/model/ConversationEntity.d.ts +11 -0
- package/build/db/model/ConversationEntity.d.ts.map +1 -0
- package/build/db/model/ConversationEntity.js +17 -0
- package/build/db/model/ConversationEntity.js.map +1 -0
- package/build/db/model/ConversationMemberEntity.d.ts +9 -0
- package/build/db/model/ConversationMemberEntity.d.ts.map +1 -0
- package/build/db/model/ConversationMemberEntity.js +17 -0
- package/build/db/model/ConversationMemberEntity.js.map +1 -0
- package/build/db/relations.d.ts +7 -0
- package/build/db/relations.d.ts.map +1 -0
- package/build/db/relations.js +12 -0
- package/build/db/relations.js.map +1 -0
- package/build/db/schema.d.ts +324 -0
- package/build/db/schema.d.ts.map +1 -0
- package/build/db/schema.js +34 -0
- package/build/db/schema.js.map +1 -0
- package/build/generated/messages.d.ts +5517 -0
- package/build/generated/messages.d.ts.map +1 -0
- package/build/generated/messages.js +14470 -0
- package/build/generated/messages.js.map +1 -0
- package/build/generated/package.json +3 -0
- package/build/index.d.ts +14 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +34 -0
- package/build/index.js.map +1 -0
- package/build/mappers/PreKeyMapper.d.ts +4 -0
- package/build/mappers/PreKeyMapper.d.ts.map +1 -0
- package/build/mappers/PreKeyMapper.js +22 -0
- package/build/mappers/PreKeyMapper.js.map +1 -0
- package/build/mappers/conversation/ConversationMapper.d.ts +6 -0
- package/build/mappers/conversation/ConversationMapper.d.ts.map +1 -0
- package/build/mappers/conversation/ConversationMapper.js +27 -0
- package/build/mappers/conversation/ConversationMapper.js.map +1 -0
- package/build/mappers/conversation/ConversationMemberMapper.d.ts +6 -0
- package/build/mappers/conversation/ConversationMemberMapper.d.ts.map +1 -0
- package/build/mappers/conversation/ConversationMemberMapper.js +25 -0
- package/build/mappers/conversation/ConversationMemberMapper.js.map +1 -0
- package/build/mappers/protobuf/EncryptionAlgorithmMapper.d.ts +7 -0
- package/build/mappers/protobuf/EncryptionAlgorithmMapper.d.ts.map +1 -0
- package/build/mappers/protobuf/EncryptionAlgorithmMapper.js +35 -0
- package/build/mappers/protobuf/EncryptionAlgorithmMapper.js.map +1 -0
- package/build/mappers/protobuf/MessageContentEncoder.d.ts +9 -0
- package/build/mappers/protobuf/MessageContentEncoder.d.ts.map +1 -0
- package/build/mappers/protobuf/MessageContentEncoder.js +85 -0
- package/build/mappers/protobuf/MessageContentEncoder.js.map +1 -0
- package/build/mappers/protobuf/MessageLinkPreviewMapper.d.ts +7 -0
- package/build/mappers/protobuf/MessageLinkPreviewMapper.d.ts.map +1 -0
- package/build/mappers/protobuf/MessageLinkPreviewMapper.js +79 -0
- package/build/mappers/protobuf/MessageLinkPreviewMapper.js.map +1 -0
- package/build/mappers/protobuf/MessageMentionMapper.d.ts +7 -0
- package/build/mappers/protobuf/MessageMentionMapper.d.ts.map +1 -0
- package/build/mappers/protobuf/MessageMentionMapper.js +39 -0
- package/build/mappers/protobuf/MessageMentionMapper.js.map +1 -0
- package/build/mappers/protobuf/ProtobufDeserializer.d.ts +12 -0
- package/build/mappers/protobuf/ProtobufDeserializer.d.ts.map +1 -0
- package/build/mappers/protobuf/ProtobufDeserializer.js +343 -0
- package/build/mappers/protobuf/ProtobufDeserializer.js.map +1 -0
- package/build/mappers/protobuf/ProtobufSerializer.d.ts +15 -0
- package/build/mappers/protobuf/ProtobufSerializer.d.ts.map +1 -0
- package/build/mappers/protobuf/ProtobufSerializer.js +331 -0
- package/build/mappers/protobuf/ProtobufSerializer.js.map +1 -0
- package/build/model/Asset.d.ts +9 -0
- package/build/model/Asset.d.ts.map +1 -0
- package/build/model/Asset.js +17 -0
- package/build/model/Asset.js.map +1 -0
- package/build/model/ClaimedKeyPackagesResult.d.ts +7 -0
- package/build/model/ClaimedKeyPackagesResult.d.ts.map +1 -0
- package/build/model/ClaimedKeyPackagesResult.js +17 -0
- package/build/model/ClaimedKeyPackagesResult.js.map +1 -0
- package/build/model/CryptoClientId.d.ts +8 -0
- package/build/model/CryptoClientId.d.ts.map +1 -0
- package/build/model/CryptoClientId.js +29 -0
- package/build/model/CryptoClientId.js.map +1 -0
- package/build/model/CryptoProtocol.d.ts +6 -0
- package/build/model/CryptoProtocol.d.ts.map +1 -0
- package/build/model/CryptoProtocol.js +22 -0
- package/build/model/CryptoProtocol.js.map +1 -0
- package/build/model/EventContentDTO.d.ts +84 -0
- package/build/model/EventContentDTO.d.ts.map +1 -0
- package/build/model/EventContentDTO.js +17 -0
- package/build/model/EventContentDTO.js.map +1 -0
- package/build/model/MlsPublicKeys.d.ts +7 -0
- package/build/model/MlsPublicKeys.d.ts.map +1 -0
- package/build/model/MlsPublicKeys.js +17 -0
- package/build/model/MlsPublicKeys.js.map +1 -0
- package/build/model/PreKeyCrypto.d.ts +6 -0
- package/build/model/PreKeyCrypto.d.ts.map +1 -0
- package/build/model/PreKeyCrypto.js +24 -0
- package/build/model/PreKeyCrypto.js.map +1 -0
- package/build/model/QualifiedId.d.ts +17 -0
- package/build/model/QualifiedId.d.ts.map +1 -0
- package/build/model/QualifiedId.js +43 -0
- package/build/model/QualifiedId.js.map +1 -0
- package/build/model/TeamId.d.ts +6 -0
- package/build/model/TeamId.d.ts.map +1 -0
- package/build/model/TeamId.js +26 -0
- package/build/model/TeamId.js.map +1 -0
- package/build/model/WireMessage.d.ts +336 -0
- package/build/model/WireMessage.d.ts.map +1 -0
- package/build/model/WireMessage.js +270 -0
- package/build/model/WireMessage.js.map +1 -0
- package/build/model/WireUser.d.ts +12 -0
- package/build/model/WireUser.d.ts.map +1 -0
- package/build/model/WireUser.js +32 -0
- package/build/model/WireUser.js.map +1 -0
- package/build/model/conversation/ChannelAddPermissionType.d.ts +7 -0
- package/build/model/conversation/ChannelAddPermissionType.d.ts.map +1 -0
- package/build/model/conversation/ChannelAddPermissionType.js +23 -0
- package/build/model/conversation/ChannelAddPermissionType.js.map +1 -0
- package/build/model/conversation/Conversation.d.ts +9 -0
- package/build/model/conversation/Conversation.d.ts.map +1 -0
- package/build/model/conversation/Conversation.js +17 -0
- package/build/model/conversation/Conversation.js.map +1 -0
- package/build/model/conversation/ConversationAccess.d.ts +8 -0
- package/build/model/conversation/ConversationAccess.d.ts.map +1 -0
- package/build/model/conversation/ConversationAccess.js +24 -0
- package/build/model/conversation/ConversationAccess.js.map +1 -0
- package/build/model/conversation/ConversationAccessRole.d.ts +8 -0
- package/build/model/conversation/ConversationAccessRole.d.ts.map +1 -0
- package/build/model/conversation/ConversationAccessRole.js +24 -0
- package/build/model/conversation/ConversationAccessRole.js.map +1 -0
- package/build/model/conversation/ConversationMember.d.ts +7 -0
- package/build/model/conversation/ConversationMember.d.ts.map +1 -0
- package/build/model/conversation/ConversationMember.js +17 -0
- package/build/model/conversation/ConversationMember.js.map +1 -0
- package/build/model/conversation/ConversationRole.d.ts +6 -0
- package/build/model/conversation/ConversationRole.d.ts.map +1 -0
- package/build/model/conversation/ConversationRole.js +29 -0
- package/build/model/conversation/ConversationRole.js.map +1 -0
- package/build/model/conversation/ConversationType.d.ts +6 -0
- package/build/model/conversation/ConversationType.d.ts.map +1 -0
- package/build/model/conversation/ConversationType.js +22 -0
- package/build/model/conversation/ConversationType.js.map +1 -0
- package/build/model/conversation/GroupConversationType.d.ts +5 -0
- package/build/model/conversation/GroupConversationType.d.ts.map +1 -0
- package/build/model/conversation/GroupConversationType.js +21 -0
- package/build/model/conversation/GroupConversationType.js.map +1 -0
- package/build/model/conversation/ReceiptMode.d.ts +5 -0
- package/build/model/conversation/ReceiptMode.d.ts.map +1 -0
- package/build/model/conversation/ReceiptMode.js +21 -0
- package/build/model/conversation/ReceiptMode.js.map +1 -0
- package/build/model/exception/CoreCryptoMlsException.d.ts +5 -0
- package/build/model/exception/CoreCryptoMlsException.d.ts.map +1 -0
- package/build/model/exception/CoreCryptoMlsException.js +25 -0
- package/build/model/exception/CoreCryptoMlsException.js.map +1 -0
- package/build/model/exception/MlsException.d.ts +5 -0
- package/build/model/exception/MlsException.d.ts.map +1 -0
- package/build/model/exception/MlsException.js +25 -0
- package/build/model/exception/MlsException.js.map +1 -0
- package/build/model/exception/WireApiError.d.ts +6 -0
- package/build/model/exception/WireApiError.d.ts.map +1 -0
- package/build/model/exception/WireApiError.js +17 -0
- package/build/model/exception/WireApiError.js.map +1 -0
- package/build/model/exception/WireApiException.d.ts +8 -0
- package/build/model/exception/WireApiException.d.ts.map +1 -0
- package/build/model/exception/WireApiException.js +29 -0
- package/build/model/exception/WireApiException.js.map +1 -0
- package/build/model/protobuf/MessageEncryptionAlgorithm.d.ts +5 -0
- package/build/model/protobuf/MessageEncryptionAlgorithm.d.ts.map +1 -0
- package/build/model/protobuf/MessageEncryptionAlgorithm.js +21 -0
- package/build/model/protobuf/MessageEncryptionAlgorithm.js.map +1 -0
- package/build/service/AppProperties.d.ts +25 -0
- package/build/service/AppProperties.d.ts.map +1 -0
- package/build/service/AppProperties.js +105 -0
- package/build/service/AppProperties.js.map +1 -0
- package/build/service/MlsFallbackStrategy.d.ts +11 -0
- package/build/service/MlsFallbackStrategy.d.ts.map +1 -0
- package/build/service/MlsFallbackStrategy.js +57 -0
- package/build/service/MlsFallbackStrategy.js.map +1 -0
- package/build/service/NotificationsService.d.ts +14 -0
- package/build/service/NotificationsService.d.ts.map +1 -0
- package/build/service/NotificationsService.js +71 -0
- package/build/service/NotificationsService.js.map +1 -0
- package/build/utils/AESUtils.d.ts +11 -0
- package/build/utils/AESUtils.d.ts.map +1 -0
- package/build/utils/AESUtils.js +47 -0
- package/build/utils/AESUtils.js.map +1 -0
- package/build/utils/BufferUtils.d.ts +2 -0
- package/build/utils/BufferUtils.d.ts.map +1 -0
- package/build/utils/BufferUtils.js +17 -0
- package/build/utils/BufferUtils.js.map +1 -0
- package/build/utils/DependencyInjectionTokens.d.ts +8 -0
- package/build/utils/DependencyInjectionTokens.d.ts.map +1 -0
- package/build/utils/DependencyInjectionTokens.js +23 -0
- package/build/utils/DependencyInjectionTokens.js.map +1 -0
- package/build/utils/HashUtils.d.ts +5 -0
- package/build/utils/HashUtils.d.ts.map +1 -0
- package/build/utils/HashUtils.js +25 -0
- package/build/utils/HashUtils.js.map +1 -0
- package/build/utils/ObfuscateUtil.d.ts +3 -0
- package/build/utils/ObfuscateUtil.d.ts.map +1 -0
- package/build/utils/ObfuscateUtil.js +30 -0
- package/build/utils/ObfuscateUtil.js.map +1 -0
- package/build/utils/StoragePaths.d.ts +4 -0
- package/build/utils/StoragePaths.d.ts.map +1 -0
- package/build/utils/StoragePaths.js +22 -0
- package/build/utils/StoragePaths.js.map +1 -0
- package/build/utils/logger/ConsoleLogger.d.ts +12 -0
- package/build/utils/logger/ConsoleLogger.d.ts.map +1 -0
- package/build/utils/logger/ConsoleLogger.js +31 -0
- package/build/utils/logger/ConsoleLogger.js.map +1 -0
- package/build/utils/logger/LogLevel.d.ts +7 -0
- package/build/utils/logger/LogLevel.d.ts.map +1 -0
- package/build/utils/logger/LogLevel.js +8 -0
- package/build/utils/logger/LogLevel.js.map +1 -0
- package/build/utils/logger/Logger.d.ts +27 -0
- package/build/utils/logger/Logger.d.ts.map +1 -0
- package/build/utils/logger/Logger.js +2 -0
- package/build/utils/logger/Logger.js.map +1 -0
- package/build/utils/logger/LoggerFactory.d.ts +7 -0
- package/build/utils/logger/LoggerFactory.d.ts.map +1 -0
- package/build/utils/logger/LoggerFactory.js +19 -0
- package/build/utils/logger/LoggerFactory.js.map +1 -0
- package/package.json +105 -0
- package/src/WireAppSdk.ts +224 -0
- package/src/api/AssetsApiClient.ts +77 -0
- package/src/api/AssetsTransferService.ts +96 -0
- package/src/api/ClientsApiClient.ts +71 -0
- package/src/api/ClientsService.ts +40 -0
- package/src/api/ConversationService.ts +654 -0
- package/src/api/ConversationsApiClient.ts +141 -0
- package/src/api/FeatureConfigsApiClient.ts +31 -0
- package/src/api/FeatureConfigsService.ts +33 -0
- package/src/api/MlsApiClient.ts +81 -0
- package/src/api/MlsService.ts +99 -0
- package/src/api/NotificationsApiClient.ts +58 -0
- package/src/api/OneToOneConversationsApiClient.ts +39 -0
- package/src/api/SearchApiClient.ts +58 -0
- package/src/api/TeamsApiClient.ts +40 -0
- package/src/api/UserService.ts +111 -0
- package/src/api/UsersApiClient.ts +61 -0
- package/src/api/model/AddMembersToConversationResult.ts +22 -0
- package/src/api/model/ConversationIdsPaginationConfig.ts +20 -0
- package/src/api/model/ConversationMemberOtherResponse.ts +23 -0
- package/src/api/model/ConversationMemberSelfResponse.ts +23 -0
- package/src/api/model/ConversationMembersResponse.ts +23 -0
- package/src/api/model/ConversationTeamInfo.ts +20 -0
- package/src/api/model/RemoveMembersFromConversationResult.ts +21 -0
- package/src/api/model/UserClientResponse.ts +19 -0
- package/src/api/model/UserResponse.ts +28 -0
- package/src/api/model/asset/AssetUploadData.ts +20 -0
- package/src/api/model/asset/AssetUploadResponse.ts +22 -0
- package/src/api/request/CapabilitiesRequest.ts +19 -0
- package/src/api/request/ClientUpdateRequest.ts +21 -0
- package/src/api/request/ConversationIdsRequest.ts +21 -0
- package/src/api/request/CreateConversationRequest.ts +86 -0
- package/src/api/request/MlsKeyPackagesRequest.ts +19 -0
- package/src/api/request/PreKeyRequest.ts +28 -0
- package/src/api/request/RegisterClientRequest.ts +46 -0
- package/src/api/response/AccessResponse.ts +22 -0
- package/src/api/response/ClaimedKeyPackageList.ts +30 -0
- package/src/api/response/ConversationIdsResponse.ts +23 -0
- package/src/api/response/ConversationResponse.ts +32 -0
- package/src/api/response/ConversationsResponse.ts +24 -0
- package/src/api/response/EventResponse.ts +23 -0
- package/src/api/response/FeatureConfigsResponse.ts +37 -0
- package/src/api/response/MlsPublicKeysResponse.ts +58 -0
- package/src/api/response/NotificationsResponse.ts +23 -0
- package/src/api/response/OneToOneConversationResponse.ts +24 -0
- package/src/api/response/RegisterClientResponse.ts +19 -0
- package/src/api/response/SearchContactsResponse.ts +32 -0
- package/src/core/CoreCryptoClient.ts +361 -0
- package/src/core/CoreCryptoMlsTransport.ts +58 -0
- package/src/core/CoreCryptoService.ts +276 -0
- package/src/core/HttpClient.ts +363 -0
- package/src/core/HttpRetryHelper.ts +57 -0
- package/src/core/HttpRetryPolicy.ts +40 -0
- package/src/core/WebSocketClient.ts +245 -0
- package/src/core/WireApplicationManager.ts +162 -0
- package/src/core/WireEventsHandler.ts +118 -0
- package/src/core/event/DeleteConversationEventProcessor.ts +47 -0
- package/src/core/event/EventProcessor.ts +22 -0
- package/src/core/event/EventRouter.ts +54 -0
- package/src/core/event/MemberJoinEventProcessor.ts +54 -0
- package/src/core/event/MemberLeaveEventProcessor.ts +47 -0
- package/src/core/event/MemberUpdateEventProcessor.ts +44 -0
- package/src/core/event/MlsMessageEventProcessor.ts +124 -0
- package/src/core/event/MlsResetEventProcessor.ts +42 -0
- package/src/core/event/MlsWelcomeEventProcessor.ts +68 -0
- package/src/core/event/NewConversationEventProcessor.ts +42 -0
- package/src/core/event/processors.index.ts +24 -0
- package/src/db/AppPropertiesRepository.ts +62 -0
- package/src/db/ConversationMemberRepository.ts +163 -0
- package/src/db/ConversationRepository.ts +119 -0
- package/src/db/DatabaseService.ts +69 -0
- package/src/db/migrations/0000_pink_lord_tyger.sql +27 -0
- package/src/db/migrations/0001_steady_selene.sql +16 -0
- package/src/db/migrations/meta/0000_snapshot.json +194 -0
- package/src/db/migrations/meta/0001_snapshot.json +197 -0
- package/src/db/migrations/meta/_journal.json +20 -0
- package/src/db/model/AppEntity.ts +20 -0
- package/src/db/model/ConversationEntity.ts +27 -0
- package/src/db/model/ConversationMemberEntity.ts +24 -0
- package/src/db/relations.ts +13 -0
- package/src/db/schema.ts +38 -0
- package/src/index.ts +67 -0
- package/src/mappers/PreKeyMapper.ts +25 -0
- package/src/mappers/conversation/ConversationMapper.ts +30 -0
- package/src/mappers/conversation/ConversationMemberMapper.ts +30 -0
- package/src/mappers/protobuf/EncryptionAlgorithmMapper.ts +39 -0
- package/src/mappers/protobuf/MessageContentEncoder.ts +121 -0
- package/src/mappers/protobuf/MessageLinkPreviewMapper.ts +89 -0
- package/src/mappers/protobuf/MessageMentionMapper.ts +43 -0
- package/src/mappers/protobuf/ProtobufDeserializer.ts +470 -0
- package/src/mappers/protobuf/ProtobufSerializer.ts +449 -0
- package/src/model/Asset.ts +26 -0
- package/src/model/ClaimedKeyPackagesResult.ts +23 -0
- package/src/model/CryptoClientId.ts +40 -0
- package/src/model/CryptoProtocol.ts +21 -0
- package/src/model/EventContentDTO.ts +123 -0
- package/src/model/MlsPublicKeys.ts +22 -0
- package/src/model/PreKeyCrypto.ts +25 -0
- package/src/model/QualifiedId.ts +45 -0
- package/src/model/TeamId.ts +25 -0
- package/src/model/WireMessage.ts +632 -0
- package/src/model/WireUser.ts +30 -0
- package/src/model/conversation/ChannelAddPermissionType.ts +23 -0
- package/src/model/conversation/Conversation.ts +25 -0
- package/src/model/conversation/ConversationAccess.ts +24 -0
- package/src/model/conversation/ConversationAccessRole.ts +24 -0
- package/src/model/conversation/ConversationMember.ts +23 -0
- package/src/model/conversation/ConversationRole.ts +30 -0
- package/src/model/conversation/ConversationType.ts +21 -0
- package/src/model/conversation/GroupConversationType.ts +21 -0
- package/src/model/conversation/ReceiptMode.ts +21 -0
- package/src/model/exception/CoreCryptoMlsException.ts +26 -0
- package/src/model/exception/MlsException.ts +26 -0
- package/src/model/exception/WireApiError.ts +21 -0
- package/src/model/exception/WireApiException.ts +33 -0
- package/src/model/protobuf/MessageEncryptionAlgorithm.ts +17 -0
- package/src/proto/messages.proto +383 -0
- package/src/service/AppProperties.ts +110 -0
- package/src/service/MlsFallbackStrategy.ts +52 -0
- package/src/service/NotificationsService.ts +65 -0
- package/src/utils/AESUtils.ts +62 -0
- package/src/utils/BufferUtils.ts +18 -0
- package/src/utils/DependencyInjectionTokens.ts +25 -0
- package/src/utils/HashUtils.ts +27 -0
- package/src/utils/ObfuscateUtil.ts +31 -0
- package/src/utils/StoragePaths.ts +23 -0
- package/src/utils/logger/ConsoleLogger.ts +35 -0
- package/src/utils/logger/LogLevel.ts +6 -0
- package/src/utils/logger/Logger.ts +29 -0
- package/src/utils/logger/LoggerFactory.ts +27 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {HttpClient} from "../core/HttpClient.js";
|
|
18
|
+
import type {ConversationResponse} from "./response/ConversationResponse.js";
|
|
19
|
+
import type {QualifiedId} from "../model/QualifiedId.js";
|
|
20
|
+
import {inject, singleton} from "tsyringe";
|
|
21
|
+
import type {ConversationIdsPaginationConfig} from "./model/ConversationIdsPaginationConfig.js";
|
|
22
|
+
import type {ConversationIdsResponse} from "./response/ConversationIdsResponse.js";
|
|
23
|
+
import type {ConversationIdsRequest} from "./request/ConversationIdsRequest.js";
|
|
24
|
+
import type {ConversationsResponse} from "./response/ConversationsResponse.js";
|
|
25
|
+
import {LoggerFactory} from "../utils/logger/LoggerFactory.js";
|
|
26
|
+
import {WIRE_USER_DOMAIN, WIRE_USER_ID} from "../utils/DependencyInjectionTokens.js";
|
|
27
|
+
import {obfuscateId} from "../utils/ObfuscateUtil.js";
|
|
28
|
+
import type {ConversationRole} from "../model/conversation/ConversationRole.js";
|
|
29
|
+
import type {CreateConversationRequest} from "./request/CreateConversationRequest.js";
|
|
30
|
+
|
|
31
|
+
@singleton()
|
|
32
|
+
export class ConversationsApiClient {
|
|
33
|
+
constructor(
|
|
34
|
+
@inject(WIRE_USER_ID) private wireUserId: string,
|
|
35
|
+
@inject(WIRE_USER_DOMAIN) private wireUserDomain: string,
|
|
36
|
+
private httpClient: HttpClient) {
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private logger = LoggerFactory.getLogger(this.constructor.name)
|
|
40
|
+
|
|
41
|
+
private readonly basePath = "conversations";
|
|
42
|
+
private readonly HEADER_MLS_ACCEPT = "message/mls"
|
|
43
|
+
private readonly CONVERSATION_LIST_IDS_PAGING_SIZE = 100
|
|
44
|
+
|
|
45
|
+
//TODO: Baris: In all ApiClient classes, we should use "fetch" word instead of "get" to be consistent in terms of naming.
|
|
46
|
+
// Note: We are following the common naming convention within this projects which is "fetch" for API calls and "get" for local data retrieval.
|
|
47
|
+
// I will change the method names in all ApiClient classes in a separate PR. The methods in service layer are alredy using "fetch" naming convention.
|
|
48
|
+
// But within ApiClient class, we missed this naming convention.
|
|
49
|
+
|
|
50
|
+
async getConversation(conversationQualifiedId: QualifiedId): Promise<ConversationResponse> {
|
|
51
|
+
return await this.httpClient.getRequest<ConversationResponse>(
|
|
52
|
+
`${this.basePath}/${conversationQualifiedId.domain}/${conversationQualifiedId.id}`
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async getConversationGroupInfo(conversationQualifiedId: QualifiedId): Promise<Uint8Array> {
|
|
57
|
+
return await this.httpClient.getRequest<Uint8Array>(
|
|
58
|
+
`${this.basePath}/${conversationQualifiedId.domain}/${conversationQualifiedId.id}/groupinfo`,
|
|
59
|
+
{ headerAccept: this.HEADER_MLS_ACCEPT }
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async getAllConversationIds(): Promise<QualifiedId[]> {
|
|
64
|
+
this.logger.info(`Getting all Conversation Ids`)
|
|
65
|
+
const conversationIds: QualifiedId[] = []
|
|
66
|
+
let paginationConfig: ConversationIdsPaginationConfig = {
|
|
67
|
+
paging_state: null,
|
|
68
|
+
size: this.CONVERSATION_LIST_IDS_PAGING_SIZE
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let hasMorePages: boolean = false
|
|
72
|
+
do {
|
|
73
|
+
const conversationIdsResponse = await this.httpClient.postRequest<ConversationIdsResponse>(
|
|
74
|
+
`${this.basePath}/list-ids`,
|
|
75
|
+
paginationConfig
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
hasMorePages = conversationIdsResponse.has_more
|
|
79
|
+
paginationConfig = {
|
|
80
|
+
...paginationConfig,
|
|
81
|
+
paging_state: conversationIdsResponse.paging_state
|
|
82
|
+
}
|
|
83
|
+
conversationIds.push(...conversationIdsResponse.qualified_conversations)
|
|
84
|
+
} while (hasMorePages)
|
|
85
|
+
|
|
86
|
+
this.logger.info(`Returning ${conversationIds.length} conversation Ids`)
|
|
87
|
+
|
|
88
|
+
return conversationIds
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async getConversationsById(conversationIds: QualifiedId[]): Promise<ConversationResponse[]> {
|
|
92
|
+
this.logger.info(`Getting ${conversationIds.length} conversations by Id`)
|
|
93
|
+
if (conversationIds.length === 0) {
|
|
94
|
+
return []
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const conversationIdsRequest: ConversationIdsRequest = {
|
|
98
|
+
qualified_ids: conversationIds
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const conversationListResponse = await this.httpClient.postRequest<ConversationsResponse>(
|
|
102
|
+
`${this.basePath}/list`,
|
|
103
|
+
conversationIdsRequest
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
this.logger.info(`Returning ${conversationListResponse.found.length} found conversations`)
|
|
107
|
+
|
|
108
|
+
return conversationListResponse.found
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async updateConversationMemberRole(
|
|
112
|
+
conversationId: QualifiedId,
|
|
113
|
+
userId: QualifiedId,
|
|
114
|
+
newRole: ConversationRole
|
|
115
|
+
): Promise<void> {
|
|
116
|
+
this.logger.debug(`Updating conversation member role. conversationId: ${obfuscateId(conversationId.id)}, userId: ${obfuscateId(userId.id)}, newRole: ${newRole}`)
|
|
117
|
+
|
|
118
|
+
const path = `${this.basePath}/${conversationId.domain}/${conversationId.id}/members/${userId.domain}/${userId.id}`
|
|
119
|
+
await this.httpClient.putRequest(path, {conversation_role: newRole})
|
|
120
|
+
|
|
121
|
+
this.logger.debug(`Updated conversation member role. conversationId: ${obfuscateId(conversationId.id)}, userId: ${obfuscateId(userId.id)}, newRole: ${newRole}`)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// This method is used to create both GROUP and CHANNEL type conversations
|
|
125
|
+
async createGroupConversation(createConversationRequest: CreateConversationRequest): Promise<ConversationResponse> {
|
|
126
|
+
this.logger.info(`Creating group conversation with name: ${createConversationRequest.name}`)
|
|
127
|
+
return await this.httpClient.postRequest<ConversationResponse>(
|
|
128
|
+
this.basePath,
|
|
129
|
+
createConversationRequest
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async leaveConversation(conversationQualifiedId: QualifiedId): Promise<void> {
|
|
134
|
+
this.logger.debug(`Leaving the conversation. conversationId: ${obfuscateId(conversationQualifiedId.id)}`)
|
|
135
|
+
|
|
136
|
+
const path = `${this.basePath}/${conversationQualifiedId.domain}/${conversationQualifiedId.id}/members/${this.wireUserDomain}/${this.wireUserId}`
|
|
137
|
+
await this.httpClient.deleteRequest(path)
|
|
138
|
+
|
|
139
|
+
this.logger.info(`Left the conversation. conversationId: ${obfuscateId(conversationQualifiedId.id)}`)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {HttpClient} from "../core/HttpClient.js";
|
|
18
|
+
import type {FeatureConfigsResponse} from "./response/FeatureConfigsResponse.js";
|
|
19
|
+
import { singleton } from "tsyringe";
|
|
20
|
+
|
|
21
|
+
@singleton()
|
|
22
|
+
export class FeatureConfigsApiClient {
|
|
23
|
+
constructor(private httpClient: HttpClient) {}
|
|
24
|
+
|
|
25
|
+
private readonly basePath = "feature-configs";
|
|
26
|
+
|
|
27
|
+
async getFeatureConfigs(): Promise<FeatureConfigsResponse> {
|
|
28
|
+
await this.httpClient.refreshAccessToken()
|
|
29
|
+
return await this.httpClient.getRequest<FeatureConfigsResponse>(this.basePath)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type {FeatureConfigsResponse} from "./response/FeatureConfigsResponse.js"
|
|
18
|
+
import {FeatureConfigsApiClient} from "./FeatureConfigsApiClient.js";
|
|
19
|
+
import { singleton } from "tsyringe";
|
|
20
|
+
|
|
21
|
+
@singleton()
|
|
22
|
+
export class FeatureConfigsService {
|
|
23
|
+
constructor(private featureConfigsApiClient: FeatureConfigsApiClient) {}
|
|
24
|
+
|
|
25
|
+
async getDefaultCipherSuite() {
|
|
26
|
+
const featureConfigs = await this.getFeatureConfigs()
|
|
27
|
+
return featureConfigs.mls.config.defaultCipherSuite
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private async getFeatureConfigs(): Promise<FeatureConfigsResponse> {
|
|
31
|
+
return await this.featureConfigsApiClient.getFeatureConfigs()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {HttpClient} from "../core/HttpClient.js";
|
|
18
|
+
import {Encoder} from "bazinga64";
|
|
19
|
+
import type {MlsKeyPackagesRequest} from "./request/MlsKeyPackagesRequest.js";
|
|
20
|
+
import {singleton} from "tsyringe";
|
|
21
|
+
import type {MlsPublicKeysResponse} from "./response/MlsPublicKeysResponse.js";
|
|
22
|
+
import type {ClaimedKeyPackageList} from "./response/ClaimedKeyPackageList.js";
|
|
23
|
+
import {AppProperties} from "../service/AppProperties.js";
|
|
24
|
+
|
|
25
|
+
@singleton()
|
|
26
|
+
export class MlsApiClient {
|
|
27
|
+
constructor(
|
|
28
|
+
private httpClient: HttpClient,
|
|
29
|
+
private appProperties: AppProperties
|
|
30
|
+
) { }
|
|
31
|
+
|
|
32
|
+
private readonly HEADER_MLS_CONTENT_TYPE = "message/mls"
|
|
33
|
+
private readonly basePath = "mls"
|
|
34
|
+
private readonly commitBundlesPath = this.basePath + "/commit-bundles"
|
|
35
|
+
private readonly sendMessagePath = this.basePath + "/messages"
|
|
36
|
+
private readonly uploadMlsKeyPackagesPath = this.basePath + "/key-packages/self/"
|
|
37
|
+
private readonly claimKeyPackagesPath = this.basePath + "/key-packages/claim"
|
|
38
|
+
private readonly getPublicKeysPath = this.basePath + "/public-keys"
|
|
39
|
+
private readonly CIPHERSUITE_QUERY_PARAM = "ciphersuite"
|
|
40
|
+
|
|
41
|
+
async uploadCommitBundle(commitBundle: Uint8Array): Promise<void> {
|
|
42
|
+
await this.httpClient.postRequest<void>(
|
|
43
|
+
this.commitBundlesPath, commitBundle, {
|
|
44
|
+
headerContentType: this.HEADER_MLS_CONTENT_TYPE
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async sendMessage(message: Uint8Array): Promise<void> {
|
|
50
|
+
await this.httpClient.postRequest<void>(
|
|
51
|
+
this.sendMessagePath, message, {
|
|
52
|
+
headerContentType: this.HEADER_MLS_CONTENT_TYPE
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async uploadMlsKeyPackages(mlsKeyPackages: Uint8Array[]): Promise<void> {
|
|
58
|
+
const path = `${this.uploadMlsKeyPackagesPath}${this.appProperties.getDeviceId()}`
|
|
59
|
+
|
|
60
|
+
const requestPayload: MlsKeyPackagesRequest = {
|
|
61
|
+
key_packages: mlsKeyPackages.map((keyPackage) => {
|
|
62
|
+
return Encoder.toBase64(keyPackage).asString
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
await this.httpClient.postRequest<void>(path, requestPayload)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async getPublicKeys(): Promise<MlsPublicKeysResponse> {
|
|
70
|
+
return await this.httpClient.getRequest<MlsPublicKeysResponse>(this.getPublicKeysPath)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async claimKeyPackages(
|
|
74
|
+
userId: string,
|
|
75
|
+
userDomain: string,
|
|
76
|
+
ciphersuite: string
|
|
77
|
+
): Promise<ClaimedKeyPackageList> {
|
|
78
|
+
const path = `${this.claimKeyPackagesPath}/${userDomain}/${userId}?${this.CIPHERSUITE_QUERY_PARAM}=${ciphersuite}`
|
|
79
|
+
return await this.httpClient.postRequest<ClaimedKeyPackageList>(path)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {singleton} from "tsyringe";
|
|
18
|
+
import {MlsApiClient} from "./MlsApiClient.js";
|
|
19
|
+
import type {CipherSuite} from "@wireapp/core-crypto/native";
|
|
20
|
+
import {getRemovalKeyFromPublicKeysResponse, type MlsPublicKeysResponse} from "./response/MlsPublicKeysResponse.js";
|
|
21
|
+
import type {ClaimedKeyPackagesResult} from "../model/ClaimedKeyPackagesResult.js";
|
|
22
|
+
import type {QualifiedId} from "../model/QualifiedId.js";
|
|
23
|
+
import type {KeyPackage} from "./response/ClaimedKeyPackageList.js";
|
|
24
|
+
import {LoggerFactory} from "../utils/logger/LoggerFactory.js";
|
|
25
|
+
import {obfuscateId} from "../utils/ObfuscateUtil.js";
|
|
26
|
+
import {Decoder} from "bazinga64";
|
|
27
|
+
|
|
28
|
+
@singleton()
|
|
29
|
+
export class MlsService {
|
|
30
|
+
private logger = LoggerFactory.getLogger(this.constructor.name)
|
|
31
|
+
|
|
32
|
+
constructor(private mlsApiClient: MlsApiClient) { }
|
|
33
|
+
|
|
34
|
+
async uploadCommitBundle(commitBundle: Uint8Array): Promise<void> {
|
|
35
|
+
await this.mlsApiClient.uploadCommitBundle(commitBundle)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async sendMessage(message: Uint8Array): Promise<void> {
|
|
39
|
+
await this.mlsApiClient.sendMessage(message)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async uploadMlsKeyPackages(mlsKeyPackages: Uint8Array[]): Promise<void> {
|
|
43
|
+
await this.mlsApiClient.uploadMlsKeyPackages(mlsKeyPackages)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getRemovalKey(
|
|
47
|
+
cipherSuite: CipherSuite,
|
|
48
|
+
existingPublicKeysResponse?: MlsPublicKeysResponse
|
|
49
|
+
): Promise<Uint8Array | null> {
|
|
50
|
+
const publicKeysResponse = existingPublicKeysResponse ?? await this.mlsApiClient.getPublicKeys()
|
|
51
|
+
return getRemovalKeyFromPublicKeysResponse(publicKeysResponse, cipherSuite)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async claimKeyPackages(
|
|
55
|
+
users: QualifiedId[],
|
|
56
|
+
ciphersuite: number
|
|
57
|
+
): Promise<ClaimedKeyPackagesResult> {
|
|
58
|
+
|
|
59
|
+
const claimedKeyPackages: KeyPackage[] = []
|
|
60
|
+
const successUsers: QualifiedId[] = []
|
|
61
|
+
const failedUsers: QualifiedId[] = []
|
|
62
|
+
|
|
63
|
+
const ciphersuiteHex = this.toHexString(ciphersuite)
|
|
64
|
+
|
|
65
|
+
for (const user of users) {
|
|
66
|
+
try {
|
|
67
|
+
const result = await this.mlsApiClient.claimKeyPackages(
|
|
68
|
+
user.id,
|
|
69
|
+
user.domain,
|
|
70
|
+
ciphersuiteHex
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
if (result.key_packages.length > 0) {
|
|
74
|
+
successUsers.push(user)
|
|
75
|
+
claimedKeyPackages.push(...result.key_packages)
|
|
76
|
+
}
|
|
77
|
+
} catch (exception) {
|
|
78
|
+
// Ignoring when claiming key packages fails for a user
|
|
79
|
+
// as for now there is no retry
|
|
80
|
+
failedUsers.push(user)
|
|
81
|
+
this.logger.error(
|
|
82
|
+
`Error when claiming key packages for userId: ${obfuscateId(user.id)}: ${exception}`
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
keyPackages: claimedKeyPackages.map(claimedKeyPackage => {
|
|
89
|
+
return Decoder.fromBase64(claimedKeyPackage.key_package).asBytes
|
|
90
|
+
}),
|
|
91
|
+
successUsers: successUsers,
|
|
92
|
+
failedUsers: failedUsers
|
|
93
|
+
} as ClaimedKeyPackagesResult
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private toHexString(value: number, minDigits: number = 4): string {
|
|
97
|
+
return "0x" + value.toString(16).padStart(minDigits, '0')
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2026 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {singleton} from "tsyringe"
|
|
18
|
+
import {HttpClient} from "../core/HttpClient.js"
|
|
19
|
+
import type {EventResponse} from "./response/EventResponse.js"
|
|
20
|
+
import type {NotificationsResponse} from "./response/NotificationsResponse.js"
|
|
21
|
+
import {AppProperties} from "../service/AppProperties.js"
|
|
22
|
+
|
|
23
|
+
@singleton()
|
|
24
|
+
export class NotificationsApiClient {
|
|
25
|
+
constructor(
|
|
26
|
+
private httpClient: HttpClient,
|
|
27
|
+
private appProperties: AppProperties
|
|
28
|
+
) {}
|
|
29
|
+
|
|
30
|
+
private readonly basePath = "notifications"
|
|
31
|
+
private readonly lastNotificationPath = this.basePath + "/last"
|
|
32
|
+
private readonly CLIENT_QUERY_KEY = "client"
|
|
33
|
+
private readonly SINCE_QUERY_KEY = "since"
|
|
34
|
+
private readonly SIZE_QUERY_KEY = "size"
|
|
35
|
+
|
|
36
|
+
async getLastNotification(): Promise<EventResponse> {
|
|
37
|
+
const storedDeviceId = this.appProperties.getDeviceId()
|
|
38
|
+
const path = `${this.lastNotificationPath}?${this.CLIENT_QUERY_KEY}=${storedDeviceId}`
|
|
39
|
+
|
|
40
|
+
return await this.httpClient.getRequest<EventResponse>(
|
|
41
|
+
path
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async getPaginatedNotifications(
|
|
46
|
+
querySize: number,
|
|
47
|
+
querySince?: string
|
|
48
|
+
): Promise<NotificationsResponse> {
|
|
49
|
+
const storedDeviceId = this.appProperties.getDeviceId()
|
|
50
|
+
|
|
51
|
+
let path = `${this.basePath}?${this.SIZE_QUERY_KEY}=${querySize}&${this.CLIENT_QUERY_KEY}=${storedDeviceId}`
|
|
52
|
+
if (querySince) {
|
|
53
|
+
path = `${path}&${this.SINCE_QUERY_KEY}=${querySince}`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return await this.httpClient.getRequest<NotificationsResponse>(path)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2026 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {HttpClient} from "../core/HttpClient.js";
|
|
18
|
+
import type {QualifiedId} from "../model/QualifiedId.js";
|
|
19
|
+
import {singleton} from "tsyringe";
|
|
20
|
+
import {LoggerFactory} from "../utils/logger/LoggerFactory.js";
|
|
21
|
+
import type {OneToOneConversationResponse} from "./response/OneToOneConversationResponse.js";
|
|
22
|
+
|
|
23
|
+
@singleton()
|
|
24
|
+
export class OneToOneConversationsApiClient {
|
|
25
|
+
constructor(
|
|
26
|
+
private httpClient: HttpClient) {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private logger = LoggerFactory.getLogger(this.constructor.name)
|
|
30
|
+
private readonly basePath = "one2one-conversations";
|
|
31
|
+
|
|
32
|
+
async getOneToOneConversation(userId: QualifiedId): Promise<OneToOneConversationResponse> {
|
|
33
|
+
this.logger.debug(`Getting OneToOne conversation. userId: ${userId}`)
|
|
34
|
+
return await this.httpClient.getRequest<OneToOneConversationResponse>(
|
|
35
|
+
`${this.basePath}/${userId.domain}/${userId.id}`
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2026 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {HttpClient} from "../core/HttpClient.js";
|
|
18
|
+
import {singleton} from "tsyringe";
|
|
19
|
+
import type {SearchContactsResponse} from "./response/SearchContactsResponse.js";
|
|
20
|
+
|
|
21
|
+
const DEFAULT_RESULT_SIZE = 15;
|
|
22
|
+
const MIN_RESULT_SIZE = 1;
|
|
23
|
+
const MAX_RESULT_SIZE = 500;
|
|
24
|
+
|
|
25
|
+
@singleton()
|
|
26
|
+
export class SearchApiClient {
|
|
27
|
+
constructor(private httpClient: HttpClient) {
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private readonly basePath = "search";
|
|
31
|
+
|
|
32
|
+
async searchUsers(
|
|
33
|
+
query: string,
|
|
34
|
+
domain: string,
|
|
35
|
+
numberOfResults?: number
|
|
36
|
+
): Promise<SearchContactsResponse> {
|
|
37
|
+
const size = numberOfResults ?? DEFAULT_RESULT_SIZE;
|
|
38
|
+
|
|
39
|
+
if (size < MIN_RESULT_SIZE || size > MAX_RESULT_SIZE) {
|
|
40
|
+
throw new Error(`Number of results value must be between ${MIN_RESULT_SIZE} and ${MAX_RESULT_SIZE}.`);
|
|
41
|
+
}
|
|
42
|
+
if (!query.trim()) {
|
|
43
|
+
throw new Error("Search query must not be blank.");
|
|
44
|
+
}
|
|
45
|
+
if (!domain.trim()) {
|
|
46
|
+
throw new Error("Domain must not be blank.");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const params = new URLSearchParams({
|
|
50
|
+
q: query,
|
|
51
|
+
domain,
|
|
52
|
+
type: "regular",
|
|
53
|
+
size: String(size),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return await this.httpClient.getRequest<SearchContactsResponse>(`${this.basePath}/contacts?${params}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {HttpClient} from "../core/HttpClient.js";
|
|
18
|
+
import type {QualifiedId} from "../model/QualifiedId.js";
|
|
19
|
+
import {singleton} from "tsyringe";
|
|
20
|
+
import {LoggerFactory} from "../utils/logger/LoggerFactory.js";
|
|
21
|
+
import type {TeamId} from "../model/TeamId.js";
|
|
22
|
+
|
|
23
|
+
@singleton()
|
|
24
|
+
export class TeamsApiClient {
|
|
25
|
+
constructor(
|
|
26
|
+
private httpClient: HttpClient) {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private logger = LoggerFactory.getLogger(this.constructor.name)
|
|
30
|
+
private readonly basePath = "teams";
|
|
31
|
+
|
|
32
|
+
async deleteConversation(teamId: TeamId, conversationId: QualifiedId): Promise<void> {
|
|
33
|
+
this.logger.info(`Conversation will be deleted in the backend. teamId: ${teamId}, conversationId: ${conversationId}`)
|
|
34
|
+
|
|
35
|
+
const path = `${this.basePath}/${teamId.value}/conversations/${conversationId.id}`
|
|
36
|
+
await this.httpClient.deleteRequest(path)
|
|
37
|
+
|
|
38
|
+
this.logger.info(`Conversation is deleted in the backend. teamId: ${teamId}, conversationId: ${conversationId}`)
|
|
39
|
+
}
|
|
40
|
+
}
|