Skip to main content
reference

ThreadApi

Swift wrapper for privmx.NativeThreadApiWrapper, providing Thread-related operations within PrivMX platform.

Static Methods

create(connection:)

Creates a new instance of `ThreadApi</codeVoice> from a <codeVoice> object. This method initializes the `ThreadApi` instance, enabling Thread-related operations over the specified connection.

public static func create(
connection: inout Connection
) throws -> ThreadApi

NameTypeDescription
connectioninout ConnectionThe connection object to be used for interacting with Threads.

TypeDescription
ThreadApi A newly created `ThreadApi` instance.

Methods

createThread(contextId:users:managers:publicMeta:privateMeta:)

Creates a new Thread within PrivMX Bridge. This method creates a new Thread in the specified context, assigning users and managers to it. Note that managers must be added explicitly as users to access the Thread.

public func createThread(
contextId: std.string,
users: privmx.UserWithPubKeyVector,
managers: privmx.UserWithPubKeyVector,
publicMeta: privmx.endpoint.core.Buffer,
privateMeta: privmx.endpoint.core.Buffer
)throws -> std.string

NameTypeDescription
contextIdstd.stringThe context in which the Thread should be created.
usersprivmx.UserWithPubKeyVectorA vector of users who will have access to the Thread.
managersprivmx.UserWithPubKeyVectorA vector of managers responsible for the Thread.
publicMetaprivmx.endpoint.core.BufferPublic metadata for the Thread, which will not be encrypted.
privateMetaprivmx.endpoint.core.BufferPrivate metadata for the Thread, which will be encrypted.

TypeDescription
std.string The ID of the newly created Thread as a `std.string`.

getThread(threadId:)

Retrieves detailed information about a specific Thread.

public func getThread(
threadId: std.string
) throws -> privmx.endpoint.thread.Thread

NameTypeDescription
threadIdstd.stringThe unique identifier of the Thread to retrieve.

TypeDescription
privmx.endpoint.thread.Thread A `privmx.endpoint.thread.Thread` instance representing the Thread details.

updateThread(threadId:version:users:managers:publicMeta:privateMeta:force:forceGenerateNewKey:)

Updates an existing Thread with new values. This method updates the metadata, users, and managers of a Thread. The update can be forced, and a new key can be generated if needed.

public func updateThread(
threadId : std.string,
version: Int64,
users: privmx.UserWithPubKeyVector,
managers: privmx.UserWithPubKeyVector,
publicMeta: privmx.endpoint.core.Buffer,
privateMeta: privmx.endpoint.core.Buffer,
force: Bool,
forceGenerateNewKey: Bool
) throws -> Void

NameTypeDescription
threadIdstd.stringThe unique identifier of the Thread to be updated.
versionInt64The current version of the Thread to ensure version consistency.
usersprivmx.UserWithPubKeyVectorA vector of users who will have access to the Thread.
managersprivmx.UserWithPubKeyVectorA vector of managers responsible for the Thread.
publicMetaprivmx.endpoint.core.BufferNew public metadata for the Thread, which will not be encrypted.
privateMetaprivmx.endpoint.core.BufferNew private metadata for the Thread, which will be encrypted.
forceBoolWhether to force the update, bypassing version control.
forceGenerateNewKeyBoolWhether to generate a new key for the Thread.

deleteThread(threadId:)

Deletes a specified Thread.

public func deleteThread(
threadId: std.string
) throws -> Void

NameTypeDescription
threadIdstd.stringThe unique identifier of the Thread to delete.

listThreads(contextId:query:)

Lists all Threads accessible to the user within a specified context.

public func listThreads(
contextId: std.string,
query: privmx.endpoint.core.PagingQuery
) throws -> privmx.ThreadList

NameTypeDescription
contextIdstd.stringThe unique identifier of the context from which to list Threads.
queryprivmx.endpoint.core.PagingQueryA query object to filter and paginate the results.

TypeDescription
privmx.ThreadList A `privmx.ThreadList` instance containing the list of Threads.

sendMessage(threadId:publicMeta:privateMeta:data:)

Sends a message in a Thread.

public func sendMessage(
threadId: std.string,
publicMeta: privmx.endpoint.core.Buffer,
privateMeta: privmx.endpoint.core.Buffer,
data: privmx.endpoint.core.Buffer
) throws -> std.string

NameTypeDescription
threadIdstd.stringThe unique identifier of the Thread to send the message to.
publicMetaprivmx.endpoint.core.BufferPublic metadata for the message, which will not be encrypted.
privateMetaprivmx.endpoint.core.BufferEncrypted metadata for the message.
dataprivmx.endpoint.core.BufferThe actual content of the message.

TypeDescription
std.string The ID of the created message as a `std.string`.

deleteMessage(_:)

Deletes a specified message.

public func deleteMessage(
_ messageId: std.string
) throws -> Void

NameTypeDescription
messageIdstd.stringThe unique identifier of the message to delete.

getMessage(_:)

Retrieves a specific message by its ID.

public func getMessage(
_ messageId: std.string
) throws -> privmx.endpoint.thread.Message

NameTypeDescription
messageIdstd.stringThe unique identifier of the message to retrieve.

TypeDescription
privmx.endpoint.thread.Message A `privmx.endpoint.thread.Message` instance representing the message details.

listMessages(threadId:query:)

Lists all messages from a specified Thread based on a query.

public func listMessages(
threadId: std.string,
query: privmx.endpoint.core.PagingQuery
) throws -> privmx.MessageList

NameTypeDescription
threadIdstd.stringThe unique identifier of the Thread from which to list messages.
queryprivmx.endpoint.core.PagingQueryA query object to filter and paginate the results.

TypeDescription
privmx.MessageList A `privmx.MessageList` instance containing the list of messages.

updateMessage(messageId:publicMeta:privateMeta:data:)

Updates an existing message with new metadata and content.

public func updateMessage(
messageId: std.string,
publicMeta: privmx.endpoint.core.Buffer,
privateMeta: privmx.endpoint.core.Buffer,
data: privmx.endpoint.core.Buffer
) throws -> Void

NameTypeDescription
messageIdstd.stringThe unique identifier of the message to be updated.
publicMetaprivmx.endpoint.core.BufferNew public metadata for the message, which will not be encrypted.
privateMetaprivmx.endpoint.core.BufferNew encrypted metadata for the message.
dataprivmx.endpoint.core.BufferNew content for the message, which will not be encrypted.

subscribeForThreadEvents()

Subscribes to Thread-related events, allowing notifications when Thread changes occur.

public func subscribeForThreadEvents(
) throws -> Void

unsubscribeFromThreadEvents()

Unsubscribes from Thread-related events.

public func unsubscribeFromThreadEvents(
) throws -> Void

subscribeForMessageEvents(threadId:)

Subscribes to message-related events within a specific Thread, allowing notifications when messages are updated or received.

public func subscribeForMessageEvents(
threadId: std.string
) throws -> Void

NameTypeDescription
threadIdstd.stringThe unique identifier of the Thread for which to subscribe to message events.

unsubscribeFromMessageEvents(threadId:)

Unsubscribes from message-related events within a specific Thread.

public func unsubscribeFromMessageEvents(
threadId: std.string
) throws -> Void

NameTypeDescription
threadIdstd.stringThe unique identifier of the Thread for which to unsubscribe from message events.