PrivMXThread
Declaring thread and message management methods using Swift types.
Methods
listThreads(from:basedOn:)
Lists the Threads the user has access to in a specified context. This method retrieves a list of Threads in the given context, with pagination and filtering options.
Params
contextId
String
The unique identifier of the context from which to list Threads.
query
privmx.endpoint.core.PagingQuery
A paging query object for filtering and paginating the results.
Returns
privmx.ThreadList
·
A privmx.endpoint.thread.ThreadsList
instance containing the list of Threads.
getThread(_:)
Retrieves detailed information about a specific Thread. This method returns metadata and details of a Thread identified by its unique thread ID.
Params
threadId
String
The unique identifier of the Thread to retrieve.
Returns
privmx.endpoint.thread.Thread
·
A privmx.endpoint.thread.Thread
instance containing the Thread’s details.
deleteThread(_:)
Deletes a specific Thread from the platform. This method removes a Thread, identified by its thread ID, from the platform.
Params
threadId
String
The unique identifier of the Thread to delete.
createThread(in:for:managedBy:withPublicMeta:withPrivateMeta:withPolicies:)
Creates a new Thread in a specified context. This method creates a new Thread with specified users, managers, and metadata in the given context. Note: Managers do not automatically have access to the thread unless explicitly added as users. Note: when no policies are supplied, the default ones inherited from the context will be used instead.
Params
contextId
String
The unique identifier of the context in which to create the Thread.
users
[privmx.endpoint.core.UserWithPubKey]
A list of UserWithPubKey
objects representing users who will have access to the Thread.
managers
[privmx.endpoint.core.UserWithPubKey]
A list of UserWithPubKey
objects representing managers responsible for the Thread.
pubMeta
Data
privMeta
Data
policies
privmx.endpoint.core.ContainerPolicy?
The policies governing the Container, as well as the items within.
Returns
String
·
A String
representing the ID of the newly created Thread.
updateThread(_:atVersion:replacingUsers:replacingManagers:replacingPublicMeta:replacingPrivateMeta:force:forceGenerateNewKey:replacingPolicies:)
Updates an existing Thread with new users, managers, and metadata. This method updates a Thread, replacing its existing users, managers, and metadata with new values. The update can be forced and a new key can be generated if necessary.
Params
threadId
String
The unique identifier of the Thread to update.
version
Int64
The current version of the Thread, used to ensure version consistency.
users
[privmx.endpoint.core.UserWithPubKey]
A new list of UserWithPubKey
objects representing users who will have access to the Thread.
managers
[privmx.endpoint.core.UserWithPubKey]
A new list of UserWithPubKey
objects representing managers responsible for the Thread.
pubMeta
Data
privMeta
Data
force
Bool
A boolean indicating whether to force the update, bypassing version control.
forceGenerateNewKey
Bool
A boolean indicating whether a new key should be generated for the Thread.
policies
privmx.endpoint.core.ContainerPolicy?
The new policies for the Container.
listMessages(from:basedOn:)
Lists Messages from a specific Thread. This method retrieves a list of Messages from the specified Thread, filtered and paginated based on the query.
Params
threadId
String
The unique identifier of the Thread from which to list Messages.
query
privmx.endpoint.core.PagingQuery
A paging query object for filtering and paginating the results.
Returns
privmx.MessageList
·
A privmx.endpoint.core.MessageList
instance containing the list of Messages.
getMessage(_:)
Retrieves a specific Message by its ID. This method returns the details of a Message identified by its message ID.
Params
messageId
String
The unique identifier of the Message to retrieve.
Returns
privmx.endpoint.thread.Message
·
A privmx.endpoint.thread.Message
instance containing the Message’s details.
sendMessage(in:withPublicMeta:withPrivateMeta:containing:)
Sends a Message in a Thread. This method sends a Message to the specified Thread, with the option to include both public and private metadata.
Params
threadId
String
The unique identifier of the Thread to send the Message to.
publicMeta
Data
The public metadata associated with the Message, which will not be encrypted.
privateMeta
Data
The private metadata associated with the Message, which will be encrypted.
data
Data
The actual content of the Message as Data
, which will be encrypted.
Returns
String
·
A String
representing the ID of the created Message.
updateMessage(_:replacingData:replacingPublicMeta:replacingPrivateMeta:)
Updates an existing Message. This method updates a Message by replacing its data and metadata with new values.
Params
messageId
String
The unique identifier of the Message to update.
data
Data
The new content of the Message as Data
, which will be encrypted.
publicMeta
Data
The new public metadata of the Message, which will not be encrypted.
privMeta
Data
deleteMessage(_:)
Deletes a specific Message. This method deletes a Message identified by its unique message ID from the platform.
Params
messageId
String
The unique identifier of the Message to delete.
subscribeForThreadEvents()
unsubscribeFromThreadEvents()
subscribeForMessageEvents(in:)
Subscribes to receive events related to Messages in a specific Thread. This method subscribes to message-related events, allowing the client to receive notifications about changes in the Messages of the specified Thread.
Params
threadId
String
The unique identifier of the Thread for which to subscribe to message events.
unsubscribeFromMessageEvents(in:)
Unsubscribes from receiving events related to Messages in a specific Thread. This method unsubscribes from message-related events for the specified Thread, stopping further notifications.
Params
threadId
String
The unique identifier of the Thread for which to unsubscribe from message events.
We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.