Skip to content

Commit

Permalink
Merge pull request #186 from ably/no-arg-presence-ops
Browse files Browse the repository at this point in the history
Add no-arg variants of presence operations
  • Loading branch information
lawrence-forooghian authored Dec 9, 2024
2 parents 2ffb663 + 4ee16bd commit 76984aa
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Sources/AblyChat/Presence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ public protocol Presence: AnyObject, Sendable, EmitsDiscontinuities {
func get(params: PresenceQuery) async throws -> [PresenceMember]
func isUserPresent(clientID: String) async throws -> Bool
func enter(data: PresenceData?) async throws
func enter() async throws
func update(data: PresenceData?) async throws
func update() async throws
func leave(data: PresenceData?) async throws
func leave() async throws
func subscribe(event: PresenceEventType, bufferingPolicy: BufferingPolicy) async -> Subscription<PresenceEvent>
/// Same as calling ``subscribe(event:bufferingPolicy:)`` with ``BufferingPolicy.unbounded``.
///
Expand All @@ -94,6 +97,20 @@ public protocol Presence: AnyObject, Sendable, EmitsDiscontinuities {
func subscribe(events: [PresenceEventType]) async -> Subscription<PresenceEvent>
}

public extension Presence {
func enter() async throws {
try await enter(data: nil)
}

func update() async throws {
try await update(data: nil)
}

func leave() async throws {
try await leave(data: nil)
}
}

public extension Presence {
func subscribe(event: PresenceEventType) async -> Subscription<PresenceEvent> {
await subscribe(event: event, bufferingPolicy: .unbounded)
Expand Down

0 comments on commit 76984aa

Please sign in to comment.