Class
Zendesk
@objc public final class Zendesk: NSObject
The entry point to execute SDK actions. To obtain an instance use Zendesk.initialize(channelKey:completionHandler:)
.
Relationships
Conforms To
Loggable
NSObject
Properties
messaging
@objc public var messaging: Messaging?
Optional property allows integrators to interact with the Messaging
capability
and its feature set.
instance
@objc public static var instance: Zendesk?
Optional property allows integrators to interact with the initialized Zendesk
instance.
initializationPhase
public private(set) static var initializationPhase = InitializationPhase.notProcessing
logNamespace
public static var logNamespace: String
logCategory
public static var logCategory: String
Methods
initialize(withChannelKey:messagingFactory:completionHandler:)
public class func initialize(withChannelKey channelKey: String,
messagingFactory: MessagingFactory? = nil,
completionHandler: @escaping (Result<Zendesk, Error>) -> Void)
Initializes Zendesk
for the given channelKey
. A MessagingFactory
can be optionally passed here
to add the Messaging
capability. This method is an asynchronous call
that retrieves settings from the network that calls the completionHandler
with the result.
Parameters
Name | Type | Description |
---|---|---|
channelKey | String |
The key of your Messaging iOS channel |
messagingFactory | MessagingFactory? |
Optional parameter to include the |
completionHandler | @escaping (Result<Zendesk, Error>) -> Void |
A block that takes a |
sendPageViewEvent(_:completionHandler:)
public func sendPageViewEvent(_ pageView: PageView, completionHandler: @escaping (Result<Void, Error>) -> Void)
Send a page view event, that captures a specific user interaction, to the PageView endpoint.
Parameters
Name | Type | Description |
---|---|---|
pageView | PageView |
The |
completionHandler | @escaping (Result<Void, Error>) -> Void |
A block that takes a |
invalidate()
@objc public static func invalidate()
Invalidates the current instance of Zendesk
.
After calling this method you will have to call Zendesk.initialize()
again if you would like to use Zendesk
.
addEventObserver(_:_:)
public func addEventObserver(_ observer: AnyObject,
_ completionHandler: @escaping (ZendeskEvent) -> Void)
Add an event observer to observe events emitted from Zendesk
.
Parameters
Name | Type | Description |
---|---|---|
observer | AnyObject |
The object in which events will be received. |
completionHandler | @escaping (ZendeskEvent) -> Void |
Block that receives a |
removeEventObserver(_:)
@objc public func removeEventObserver(_ observer: AnyObject)
Remove event observer to stop observing events emitted by from Zendesk
.
loginUser(with:completionHandler:)
func loginUser(with jwt: String, completionHandler: ((Result<ZendeskUser, Error>) -> Void)? = nil)
Authenticate a user.
Parameters
Name | Type | Description |
---|---|---|
jwt | String |
The |
completionHandler | ((Result<ZendeskUser, Error>) -> Void)? |
A block that takes a |
logoutUser(completionHandler:)
func logoutUser(completionHandler: ((Result<Void, Error>) -> Void)? = nil)
Unauthenticate a user.
Parameters
Name | Type | Description |
---|---|---|
completionHandler | ((Result<Void, Error>) -> Void)? |
A block that takes a |
loginUser(with:completionHandler:)
@available(swift, obsoleted: 1.0)
@objc func loginUser(with jwt: String, completionHandler: ((ZendeskUser?, Error?) -> Void)? = nil)
Authenticate a user.
Parameters
Name | Type | Description |
---|---|---|
jwt | String |
The |
completionHandler | ((ZendeskUser?, Error?) -> Void)? |
A block that takes an optional |
logoutUser(completionHandler:)
@available(swift, obsoleted: 1.0)
@objc func logoutUser(completionHandler: ((Error?) -> Void)? = nil)
Unauthenticate a user.
Parameters
Name | Type | Description |
---|---|---|
completionHandler | ((Error?) -> Void)? |
A block that takes an optional |
initialize(channelKey:messagingFactory:completionHandler:)
@available(swift, obsoleted: 1.0)
@objc static func initialize(channelKey: String,
messagingFactory: MessagingFactory?,
completionHandler: ((Zendesk?, Error?) -> Void)?)
Initializes Zendesk
for the given channelKey
. A MessagingFactory
can be optionally passed here
to add the Messaging
capability. This method is an asynchronous call
that retrieves settings from the network that calls the completionHandler
with the result.
Parameters
Name | Type | Description |
---|---|---|
channelKey | String |
The key of your Messaging iOS channel |
messagingFactory | MessagingFactory? |
Optional parameter to include the |
completionHandler | ((Zendesk?, Error?) -> Void)? |
A block that takes an optional |
addEventObserver(_:_:)
@available(swift, obsoleted: 1.0)
@objc func addEventObserver(_ observer: AnyObject,
_ completionHandler: ((ZDKZendeskEvent, AnyObject?) -> Void)?)
Add an event observer to observe events emitted from Zendesk
.
Parameters
Name | Type | Description |
---|---|---|
observer | AnyObject |
The object in which events will be received. |
completionHandler | ((ZDKZendeskEvent, AnyObject?) -> Void)? |
A block that receives a |
sendPageViewEvent(_:completionHandler:)
@available(swift, obsoleted: 1.0)
@objc func sendPageViewEvent(_ pageView: PageView,
completionHandler: ((Error?) -> Void)?)
Send a page view event, that captures a specific user interaction, to the PageView endpoint.
Parameters
Name | Type | Description |
---|---|---|
pageView | PageView |
The |
completionHandler | ((Error?) -> Void)? |
A block that takes an optional |