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
Name | Type | Description |
---|---|---|
connection | inout Connection | The connection object to be used for interacting with Threads. |
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
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. |
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
Name | Type | Description |
---|---|---|
threadId | std.string | The unique identifier of the Thread to retrieve. |
Type | Description |
---|---|
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
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
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
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. |
Type | Description |
---|---|
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
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. |
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
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
Name | Type | Description |
---|---|---|
messageId | std.string | The unique identifier of the message to retrieve. |
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
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. |
Type | Description |
---|---|
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
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
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
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
Name | Type | Description |
---|---|---|
threadId | std.string | The unique identifier of the Thread for which to unsubscribe from message events. |