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>Connection
object.
This method initializes the ThreadApi
instance, enabling Thread-related operations over the specified connection.
public static func create ( connection : inout Connection ) throws - > ThreadApi
Params Name Type Description connection inout Connection
The connection object to be used for interacting with Threads.
Returns Type Description 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
Params Name Type Description contextId std.string
The context in which the Thread should be created. users privmx.UserWithPubKeyVector
A vector of users who will have access to the Thread. managers privmx.UserWithPubKeyVector
A vector of managers responsible for the Thread. publicMeta privmx.endpoint.core.Buffer
Public metadata for the Thread, which will not be encrypted. privateMeta privmx.endpoint.core.Buffer
Private metadata for the Thread, which will be encrypted.
Returns Type Description 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
Params Name Type Description threadId std.string
The unique identifier of the Thread to retrieve.
Returns Type Description privmx.endpoint.thread.Thread
A `privmx.endpoint.thread.Thread` instance representing the Thread details.
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
Params Name Type Description threadId std.string
The unique identifier of the Thread to be updated. version Int64
The current version of the Thread to ensure version consistency. users privmx.UserWithPubKeyVector
A vector of users who will have access to the Thread. managers privmx.UserWithPubKeyVector
A vector of managers responsible for the Thread. publicMeta privmx.endpoint.core.Buffer
New public metadata for the Thread, which will not be encrypted. privateMeta privmx.endpoint.core.Buffer
New private metadata for the Thread, which will be encrypted. force Bool
Whether to force the update, bypassing version control. forceGenerateNewKey Bool
Whether to generate a new key for the Thread.
deleteThread(threadId:)
Deletes a specified Thread.
public func deleteThread ( threadId : std . string ) throws - > Void
Params Name Type Description threadId std.string
The 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
Params Name Type Description contextId std.string
The unique identifier of the context from which to list Threads. query privmx.endpoint.core.PagingQuery
A query object to filter and paginate the results.
Returns Type Description privmx.ThreadList
A `privmx.ThreadList` instance containing the list of Threads.
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
Params Name Type Description threadId std.string
The unique identifier of the Thread to send the message to. publicMeta privmx.endpoint.core.Buffer
Public metadata for the message, which will not be encrypted. privateMeta privmx.endpoint.core.Buffer
Encrypted metadata for the message. data privmx.endpoint.core.Buffer
The actual content of the message.
Returns Type Description 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
Params Name Type Description messageId std.string
The 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
Params Name Type Description messageId std.string
The unique identifier of the message to retrieve.
Returns Type Description 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
Params Name Type Description threadId std.string
The unique identifier of the Thread from which to list messages. query privmx.endpoint.core.PagingQuery
A query object to filter and paginate the results.
Returns Type Description privmx.MessageList
A `privmx.MessageList` instance containing the list of messages.
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
Params Name Type Description messageId std.string
The unique identifier of the message to be updated. publicMeta privmx.endpoint.core.Buffer
New public metadata for the message, which will not be encrypted. privateMeta privmx.endpoint.core.Buffer
New encrypted metadata for the message. data privmx.endpoint.core.Buffer
New 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
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
Params Name Type Description threadId std.string
The 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
Params Name Type Description threadId std.string
The unique identifier of the Thread for which to unsubscribe from message events.