Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
30b4303
Merge branch 'main' into dev
Drejzer Aug 4, 2025
bce8c85
Merge branch 'main' into dev
Drejzer Aug 5, 2025
321be4e
Feat: New event workflow (#73)
Drejzer Aug 13, 2025
998f79c
Thread Events PMXThreadEvent conformance
Drejzer Aug 14, 2025
f104703
Feat: random write support (#74)
Drejzer Aug 21, 2025
14e42e2
New event workflow, part 2 (#75)
Drejzer Aug 21, 2025
51bfb9c
Missing inist for Registration struct
Drejzer Aug 21, 2025
c747f8a
Fix!:proper conformance to Hashable in extensions (#76)
Drejzer Aug 26, 2025
6cdf717
Library event handling (#77)
Drejzer Aug 26, 2025
50c44e0
Package.swift update
Drejzer Aug 26, 2025
2380278
Fix libBreakEvent typestr from deprecated channel to a static string
Drejzer Aug 26, 2025
78c35c6
Implemented listConextUsers(of:basedOn:)
Drejzer Sep 3, 2025
7afe23e
Event extensions refactor
Drejzer Sep 4, 2025
ea05887
Reworked the event workflow for the third time
Drejzer Sep 4, 2025
487945d
Fix: Lib events now use correct fake subscription IDs in th eevent loop
Drejzer Sep 4, 2025
59c501a
Refactor: Removed unnecesary internal methods in registrations
Drejzer Sep 5, 2025
8f657dc
Registering for User Events
Drejzer Sep 22, 2025
75255c2
Sync with PESE changes.
Drejzer Sep 29, 2025
1e6e728
removed unneeded SelectorType
Drejzer Oct 2, 2025
611a821
Removed unnecesary enums
Drejzer Oct 6, 2025
eba9ebc
Docs: Updated doc comments for 2.6.0
Drejzer Oct 6, 2025
da28a73
Additional doc comments
Drejzer Oct 7, 2025
b67f447
Docs: 2.6.0 snippets (#79)
Drejzer Oct 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
],
dependencies:[
.package(url:"https://github.com/simplito/privmx-endpoint-swift",
.upToNextMinor(from: .init(2, 5, 0))
.upToNextMinor(from: .init(2, 6, 0,prereleaseIdentifiers: ["rc4"]))
),
],
targets: [
Expand Down
19 changes: 17 additions & 2 deletions Sources/PrivMXEndpointSwiftExtra/Core/BackendRequester.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,28 @@ extension BackendRequester {
///
/// - Parameters:
/// - serverUrl: The URL of PrivMX Bridge server.
/// - memberToken: The authentication token provided by the server.
/// - accessToken: The authentication token provided by the server.
/// - method: The API endpoint to be called (HTTP method, such as POST, GET, etc.).
/// - paramsAsJson: The parameters to be sent with the request, formatted as a JSON string.
///
/// - Returns: The result body as a `String`, representing the response from the backend.
///
/// - Throws: An error if the request fails, such as network issues or invalid parameters.
public static func backendRequest(
serverUrl: String,
accessToken: String,
method: String,
paramsAsJson: String
) throws -> String {
try String(
Self.backendRequest(
serverUrl: std.string(serverUrl),
accessToken: std.string(accessToken),
method: std.string(method),
paramsAsJson: std.string(paramsAsJson)))
}

@available(*, deprecated, renamed: "backendRequest(serverUrl:memberToken:method:paramsAsJson:)")
public static func backendRequest(
serverUrl: String,
memberToken: String,
Expand All @@ -39,7 +54,7 @@ extension BackendRequester {
try String(
Self.backendRequest(
serverUrl: std.string(serverUrl),
memberToken: std.string(memberToken),
accessToken: std.string(memberToken),
method: std.string(method),
paramsAsJson: std.string(paramsAsJson)))
}
Expand Down
60 changes: 56 additions & 4 deletions Sources/PrivMXEndpointSwiftExtra/Core/Connection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,65 @@ extension Connection: PrivMXConnection {
/// Retrieves a list of Users from a particular Context.
///
/// - parameter contextId: Id of the Context.
/// - parameter query: object containing parameters of the Query
///
/// - throws: When the operation fails.
///
/// - returns: a list of UserInfo objects.
public func getContextUsers(
of contextId: String
) throws -> [privmx.endpoint.core.UserInfo] {
try self.getContextUsers(contextId:std.string(contextId)).map({ x in x})
public func listContextUsers(
of contextId: String,
basedOn query: privmx.endpoint.core.PagingQuery
) throws -> privmx.UserInfoList {
try self.listContextUsers(
contextId:std.string(contextId),
query:query)
}

/// Subscribe for the events on the given subscription query.
///
/// - Parameter subscriptionQueries: list of queries
///
/// - Throws: When subscribing for events fails.
///
/// - Returns: list of subscriptionIds in maching order to subscriptionQueries.
public func subscribeFor(
_ subscriptionQueries: [String]
) throws -> [String] {
var sq = privmx.SubscriptionQueryVector()
sq.reserve(subscriptionQueries.count)

for q in subscriptionQueries{
sq.push_back(std.string(q))
}
return try subscribeFor(subscriptionQueries: sq).map({x in String(x)})
}

/// Unsubscribe from events for the given subscriptionId.
///
/// - Parameter subscriptionIds: list of subscriptionId
///
/// - Throws: When unsubscribing fails.
public func unsubscribeFrom(
_ subscriptionIds: [String]
) throws -> Void {
var sq = privmx.SubscriptionQueryVector()
sq.reserve(subscriptionIds.count)

for q in subscriptionIds{
sq.push_back(std.string(q))
}
try unsubscribeFrom(subscriptionIds: sq)
}


public func buildSubscriptionQuery(
forEventType eventType: privmx.endpoint.core.EventType,
selectorType: PMXEventSelectorType,
selectorId: String
) throws -> String {
try String(buildSubscriptionQuery(
eventType: eventType,
selectorType: privmx.endpoint.core.EventSelectorType(selectorType.rawValue),
selectorId: std.string(selectorId)))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import PrivMXEndpointSwiftNative
import PrivMXEndpointSwift

/// Provides a builder for configuring Container Policies
public class ContainerPolicyBuilder{

private var cpwi = privmx.endpoint.core.ContainerPolicyWithoutItem()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import Foundation
import PrivMXEndpointSwiftNative

/// Enumeration of values available for configuring Policies for Containers
/// Enumeration of values available for configuring Policies for Containers.
public enum ContainerPolicyValue: RawRepresentable{
public var rawValue: std.string {
switch self{
Expand Down
38 changes: 0 additions & 38 deletions Sources/PrivMXEndpointSwiftExtra/Core/EventChannel.swift

This file was deleted.

44 changes: 0 additions & 44 deletions Sources/PrivMXEndpointSwiftExtra/Core/EventChannelExtension.swift

This file was deleted.

18 changes: 12 additions & 6 deletions Sources/PrivMXEndpointSwiftExtra/Core/PMXEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import Foundation
import PrivMXEndpointSwift
import PrivMXEndpointSwiftNative

/// Protocol for managing events within PrivMX Endpoint. Provides a standardized interface for handling and processing events with Swift Types.
public protocol PMXEvent: Sendable {
Expand All @@ -35,10 +36,15 @@ public protocol PMXEvent: Sendable {
/// This property stores an `Int64` identifier that can be used to associate the event with a specific connection instance.
var connectionId: Int64 { get }

/// Retrieves the communication channel associated with this event.
///
/// This method provides the name or identifier of the channel related to the event, which can be useful for directing or filtering event handling based on channel context.
///
/// - Returns: A `String` representing the event's associated channel.
func getChannel() -> String
/// Retrieves the list of Subscribtion Ids of the Event
func getSubscriptionList()->[String]
}

public protocol PMXThreadEvent:PMXEvent{}
public protocol PMXStoreEvent:PMXEvent{}
public protocol PMXInboxEvent:PMXEvent{}
public protocol PMXKvdbEvent:PMXEvent{}
public protocol PMXCustomEvent:PMXEvent{}
public protocol PMXCoreEvent:PMXEvent{}
public protocol PMXLibraryEvent:PMXEvent{}

Loading