import { proteus as ProtobufOTR } from '@wireapp/protocol-messaging/web/otr'; import { ADD_PERMISSION, Conversation, ConversationCode, ConversationRolesList, Invite, JoinConversationByCodePayload, Member, MessageSendingStatus, MLS1to1Conversation, MLSConversation, NewConversation, RemoteConversations } from '..'; import { BackendFeatures } from '../../APIClient'; import { ConversationAccessUpdateEvent, ConversationAddPermissionUpdateEvent, ConversationCodeDeleteEvent, ConversationCodeUpdateEvent, ConversationEvent, ConversationMemberJoinEvent, ConversationMemberLeaveEvent, ConversationMessageTimerUpdateEvent, ConversationProtocolUpdateEvent, ConversationReceiptModeUpdateEvent, ConversationRenameEvent } from '../../event'; import { HttpClient } from '../../http'; import { CONVERSATION_PROTOCOL } from '../../team'; import { QualifiedId } from '../../user'; import { ConversationAccessUpdateData, ConversationJoinData, ConversationMemberUpdateData, ConversationMessageTimerUpdateData, ConversationNameUpdateData, ConversationOtherMemberUpdateData, ConversationReceiptModeUpdateData, ConversationTypingData } from '../data'; import { Subconversation, SUBCONVERSATION_ID } from '../Subconversation'; export type PostMlsMessageResponse = { failed_to_send?: QualifiedId[]; failed?: QualifiedId[]; events: ConversationEvent[]; time: string; }; type ConversationGuestLinkStatus = { status: 'enabled' | 'disabled'; }; export declare class ConversationAPI { protected readonly client: HttpClient; protected readonly backendFeatures: BackendFeatures; static readonly MAX_CHUNK_SIZE = 500; static readonly URL: { ACCESS: string; BOT: string; BOTS: string; CLIENTS: string; CODE: string; CODE_CHECK: string; CONVERSATIONS: string; SUBCONVERSATIONS: string; GROUP_INFO: string; MLS: string; RESET_CONVERSATION: string; JOIN: string; LIST: string; LIST_IDS: string; MEMBERS: string; MESSAGE_TIMER: string; MESSAGES: string; NAME: string; OTR: string; PROTEUS: string; PROTOCOL: string; RECEIPT_MODE: string; ROLES: string; SELF: string; MLS_SELF: string; TYPING: string; V2: string; ONE_2_ONE: string; ADD_PERMISSION: string; }; constructor(client: HttpClient, backendFeatures: BackendFeatures); private generateBaseConversationUrl; /** * Delete a conversation code. * @param conversationId ID of conversation to delete the code for * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/deleteConversationCode */ deleteConversationCode(conversationId: string): Promise; /** * @deprecated Use `deleteService()` instead. */ deleteBot(conversationId: string, serviceId: string): Promise; /** * Remove service from conversation. * @param conversationId The conversation ID to remove the service from * @param serviceId The ID of the service to be removed from the conversation */ deleteService(conversationId: string, serviceId: string): Promise; /** * Remove member from conversation. * @param conversationId The conversation ID to remove the user from * @param userId The user to remove * @see https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/delete_conversations__cnv_domain___cnv__members__usr_domain___usr_ */ deleteMember(conversationId: QualifiedId, userId: QualifiedId): Promise; /** * Get a conversation code. * @param conversationId ID of conversation to get the code for * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/getConversationCode */ getConversationCode(conversationId: string): Promise; /** * @param conversationId * @deprecated use feature.getAllFeatures instead */ getConversationGuestLinkFeature(conversationId: string): Promise; getConversation(conversationId: QualifiedId): Promise; getMLSSelfConversation(): Promise; getSubconversation(conversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID): Promise; deleteSubconversation(conversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID, { groupId, epoch }: { groupId: string; epoch: number; }): Promise; deleteSubconversationSelf(conversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID): Promise; getSubconversationGroupInfo(conversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID): Promise>; /** * Get all qualified conversation IDs. * @param limit Max. number of qualified IDs to return */ getQualifiedConversationIds(limit?: number): Promise; /** * Get conversation metadata for a list of conversation qualified ids * @see https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_conversations_list_v2 */ getConversationsByQualifiedIds(conversations: QualifiedId[]): Promise; /** * Get all local & remote conversations from a federated backend. * @param conversationIdsToSkip Conversation qualified Ids to skip */ getConversationList(conversationIdsToSkip?: QualifiedId[]): Promise; /** * see https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/get_conversations__cnv_domain___cnv__groupinfo */ getGroupInfo({ id, domain }: QualifiedId): Promise>; /** * Get existing roles available for the given conversation. * @param conversationId The Conversation ID to get roles for * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/getConversationsRoles */ getRoles(conversationId: string): Promise; /** * Get self membership properties. * @param conversationId The Conversation ID to get properties for * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/getSelf */ getMembershipProperties(conversationId: QualifiedId): Promise; /** * Create a 1:1-conversation. * @param conversationData The new conversation * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/createOne2OneConversation */ post1to1(conversationData: NewConversation): Promise; /** * Get a MLS 1:1-conversation with a given user. * @param userId - qualified user id */ getMLS1to1Conversation({ domain, id }: QualifiedId): Promise; /** * Add users to an existing conversation. * @param conversationId The conversation ID * @param invitationData The new conversation * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/addMembers */ postAddMembers(conversationId: string, invitationData: Invite): Promise; /** * @deprecated Use `postService()` instead. */ postBot(conversationId: string, providerId: string, serviceId: string): Promise; /** * Add a service to an existing conversation. * @param conversationId ID of the conversation to add services to * @param providerId ID of the service provider * @param serviceId ID of the service provider */ postService(conversationId: string, providerId: string, serviceId: string): Promise; /** * Create a new conversation * @param conversationData The new conversation * @see https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_conversations */ postConversation(conversationData: NewConversation): Promise; /** * Create or recreate a conversation code. * @param conversationId ID of conversation to request the code for * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/createConversationCode */ postConversationCodeRequest(conversationId: string, password?: string): Promise; /** * Validate a conversation code. * @param conversationCode The conversation code * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/checkConversationCode */ postConversationCodeCheck(conversationCode: ConversationCode): Promise; /** * Join a conversation by conversation code. * @param conversationCode The conversation code * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/joinConversationByCode */ postJoinByCode(conversationCode: JoinConversationByCodePayload): Promise; /** * Get information about a conversation by conversation code. * @param conversationCode The conversation code * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/joinConversationByCode */ getJoinByCode(conversationCode: Omit): Promise; /** * Join a conversation. * @param conversationId The conversation ID * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/joinConversation */ postJoin(conversationId: string): Promise; /** * This endpoint ensures that the list of clients is correct and only sends the message if the list is correct. * To override this, the endpoint accepts `client_mismatch_strategy` in the body. It can have these values: * * - `report_all`: When set, the message is not sent if any clients are missing. The missing clients are reported * in the response. * - `ignore_all`: When set, no checks about missing clients are carried out. * - `report_only`: Takes a list of qualified UserIDs. If any clients of the listed users are missing, the message is * not sent. The missing clients are reported in the response. * - `ignore_only`: Takes a list of qualified UserIDs. If any clients of the non-listed users are missing, the message * is not sent. The missing clients are reported in the response. * * The sending of messages in a federated conversation could theorectically fail partially. To make this case * unlikely, the backend first gets a list of clients from all the involved backends and then tries to send a message. * So, if any backend is down, the message is not propagated to anyone. But the actual message fan out to multiple * backends could still fail partially. This type of failure is reported as a 201, the clients for which the message * sending failed are part of the response body. * * This endpoint can lead to OtrMessageAdd event being sent to the recipients. * * @see https://nginz-https.anta.wire.link/api/swagger-ui/#/default/post_conversations__cnv_domain___cnv__proteus_messages */ postOTRMessage(conversationId: string, domain: string, messageData: ProtobufOTR.QualifiedNewOtrMessage): Promise; /** * Post an encrypted message to a conversation. * @param messageData Mls message payload in TLS format. Please refer to the MLS specification for details. * @see https://messaginglayersecurity.rocks/mls-protocol/draft-ietf-mls-protocol.html#name-message-framing * @see https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_mls_messages */ postMlsMessage(messageData: Uint8Array): Promise; /** * Post the welcome encrypted message to a conversation. * @param messageData Mls welocome message payload in TLS format. Please refer to the MLS specification for details. * @see https://messaginglayersecurity.rocks/mls-protocol/draft-ietf-mls-protocol.html#name-message-framing * @see https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_mls_welcome */ postMlsCommitBundle(messageData: Uint8Array): Promise; /** * Create a self-conversation. * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/createSelfConversation */ postSelf(): Promise; /** * Send typing notifications. * @param conversationId The Conversation ID to send notifications in * @param typingData The typing status * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/isTyping */ postTyping(conversationId: QualifiedId, typingData: ConversationTypingData): Promise; /** * Update access modes for a conversation. * @param conversationId The conversation ID to update the access mode of * @param accessData The new access data * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/updateConversationAccess */ putAccess(conversationId: QualifiedId, accessData: ConversationAccessUpdateData): Promise; /** * Update conversation properties. * @param conversationId The conversation ID to update properties of * @param conversationNameData The new conversation name * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/updateConversation */ putConversation(conversationId: QualifiedId, conversationNameData: ConversationNameUpdateData): Promise; /** * Update the message timer for a conversation. * @param conversationId The conversation ID * @param conversationData The new message timer * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/updateConversationMessageTimer */ putConversationMessageTimer(conversationId: QualifiedId, messageTimerData: ConversationMessageTimerUpdateData): Promise; /** * Update the receipt mode for a conversation. * @param conversationId The conversation ID * @param receiptModeData The new receipt mode * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/updateConversationReceiptMode */ putConversationReceiptMode(conversationId: QualifiedId, receiptModeData: ConversationReceiptModeUpdateData): Promise; /** * Add qualified members to an existing Proteus conversation. * @param conversationId The conversation ID to add the users to * @param users List of users to add to a conversation */ postMembers(conversationId: QualifiedId, users: QualifiedId[]): Promise; /** * Add qualified members to an existing conversation. * @param conversationId The conversation ID to add the users to * @param users List of users to add to a conversation */ putMembers(conversationId: QualifiedId, users: QualifiedId[]): Promise>; /** * Update membership of the specified user in a certain conversation * @param userId The user qualified ID * @param conversationId The qualified ID of the conversation to change the user's membership in * @param memberUpdateData The new member data * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/updateOtherMember */ putOtherMember(userId: QualifiedId, conversationId: QualifiedId, memberUpdateData: ConversationOtherMemberUpdateData): Promise; /** * Update self membership properties. * @param conversationId The Conversation ID * @param memberData The new conversation * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/updateSelf */ putMembershipProperties(conversationId: QualifiedId, memberData: Partial): Promise; /** * * Update add_permission for channel. * @param conversationId The Conversation ID * @param addPermission The new add_permission */ putAddPermission(conversationId: QualifiedId, addPermission: ADD_PERMISSION): Promise; /** * Update the protocol of the conversation. * Used in MLS Migration feature: * - changing the protocol from "proteus" to "mixed" will assign a groupId to the conversation. * - changing the protocol from "mixed" to "mls" will finalise the migration of the conversation. * @param conversationId id of the conversation * @param protocol new protocol of the conversation * @returns ConversationProtocolUpdateEvent if the protocol was updated, null if the protocol was not changed * @see https://wearezeta.atlassian.net/wiki/spaces/CORE/pages/746488003/Proteus+to+MLS+Migration for more details */ putConversationProtocol(conversationId: QualifiedId, protocol: CONVERSATION_PROTOCOL.MIXED | CONVERSATION_PROTOCOL.MLS): Promise; resetMLSConversation({ groupId, epoch }: { groupId: string; epoch: number; }): Promise; } export {}; //# sourceMappingURL=ConversationAPI.d.ts.map