QNAddressBooksRepository

public class QNAddressBooksRepository

Service to manage contact actions and subscribe to contact events

  • Sources from which the contacts will be fetched

    • contacts
    • phonebooks
    • domain
    • static
    • groups

    Declaration

    Swift

    public enum Source : String

Api

  • Emit event when new contact is created

    Declaration

    Swift

    public var newContact: AnyPublisher<QNContact, Never> { get }
  • Emit event when a contact is updated

    Declaration

    Swift

    public var contactUpdated: AnyPublisher<QNContact, Never> { get }
  • Emit event when a contact is deleted

    Declaration

    Swift

    public var contactDeleted: AnyPublisher<QNContact, Never> { get }
  • Fetch all contacts filtered by source

    Declaration

    Swift

    public func getContacts(
        using sources: [QNAddressBooksRepository.Source]? = nil,
        fetchPresences: Bool? = nil,
        fromCache: Bool = true
    ) async throws -> [QNContact]

    Parameters

    using

    Sources from which the contacts will be fetched; if nil by default, it will get the sdk configuration.

    fetchPresences

    Retrieve presences; if nil by default, it will get the sdk configuration.

    fromCache

    Retrieve from cache or server; true by default

    result

    Result with the list of Contacts

  • add(contact:) Asynchronous

    Add a new contact

    Declaration

    Swift

    public func add(contact: QNContact) async throws -> QNContact

    Parameters

    contact

    Contact to create

    result

    Result with new Contact

  • update(contact:) Asynchronous

    Update a contact

    Declaration

    Swift

    public func update(contact: QNContact) async throws -> QNContact

    Parameters

    contact

    Contact to update

    result

    Result with updated Contact

  • delete(contact:) Asynchronous

    Remove a contact

    Declaration

    Swift

    public func delete(contact: QNContact) async throws

    Parameters

    contact

    Contact to remove