DefaultSudoTelephonyClient
public final class DefaultSudoTelephonyClient : SudoTelephonyClient
Default implementation of SudoTelephonyClient
.
This class works in general by delegating work in layers starting with a use case. Use cases are fetched from the factory, which is mocked for easy testing.
This class manages the lifecycle of core services that do things for the use cases, e.g. a KeyManager for providing keys and decryption services, a DoFoo object that does foo things and so forth.
For better or for worse error’s are transformed here to SudoTelephonyClientError. for the completion handlers.
-
Initialize an instance of
DefaultSudoTelephonyClient
. It uses configuration parameters defined insudoplatformconfig.json
file located in the app bundle.Declaration
Swift
public convenience init( keyNamespace: String = "com.sudoplatform.telephony", userClient: SudoUserClient, profilesClient: SudoProfilesClient, callProviderConfiguration: CallProviderConfiguration? ) throws
Parameters
keyNamespace
Namespace to use for the keys and passwords. This should be left as the default property.
userClient
SudoUserClient instance used for authentication.
profilesClient
SudoProfilesClient instance used for verifying sudo ownership proof. Throws:
-
Declaration
Swift
public func reset() throws
-
Declaration
Swift
public func getSupportedCountries(completion: @escaping TelephonyClientCompletion<[String]>)
-
Declaration
Swift
public func searchAvailablePhoneNumbers(countryCode: String, limit: UInt?, completion: @escaping SudoTelephonySearchResult)
-
Declaration
Swift
public func searchAvailablePhoneNumbers(countryCode: String, prefix: String, limit: UInt?, completion: @escaping SudoTelephonySearchResult)
-
Declaration
Swift
public func searchAvailablePhoneNumbers(countryCode: String, latitude: Double, longitude: Double, limit: UInt?, completion: @escaping SudoTelephonySearchResult)
-
Declaration
Swift
public func provisionPhoneNumber(countryCode: String, phoneNumber: String, sudoId: String, completion: @escaping TelephonyClientCompletion<PhoneNumber>)
-
Declaration
Swift
public func deletePhoneNumber(phoneNumber: String, completion: @escaping TelephonyClientCompletion<String>)
-
Declaration
Swift
public func listPhoneNumbers(sudoId: String?, limit: Int?, nextToken: String?, completion: @escaping TelephonyClientCompletion<TelephonyListToken<PhoneNumber>>)
-
Declaration
Swift
public func getPhoneNumber(id: String, completion: @escaping TelephonyClientCompletion<PhoneNumber?>)
-
Declaration
Swift
public func sendSMSMessage(localNumber: PhoneNumber, remoteNumber: String, body: String, completion: @escaping TelephonyClientCompletion<PhoneMessage>)
-
Declaration
Swift
public func sendMMSMessage(localNumber: PhoneNumber, remoteNumber: String, body: String?, localUrl: URL, completion: @escaping TelephonyClientCompletion<PhoneMessage>)
-
Declaration
Swift
public func getMessage(id: String, completion: @escaping TelephonyClientCompletion<PhoneMessage>)
-
Declaration
Swift
public func getMessages(localNumber: PhoneNumber, remoteNumber: String, limit: Int?, nextToken: String?, completion: @escaping TelephonyClientCompletion<TelephonyListToken<PhoneMessage>>)
-
Declaration
Swift
public func getMessages(conversationId: String, limit: Int?, nextToken: String?, completion: @escaping TelephonyClientCompletion<TelephonyListToken<PhoneMessage>>)
-
Declaration
Swift
public func deleteMessage(id: String, completion: @escaping TelephonyClientCompletion<String>)
-
Declaration
Swift
public func downloadData(for media: MediaObject, completion: @escaping TelephonyClientCompletion<Data>)
-
Declaration
Swift
public func subscribeToMessages(statusObserver: SubscriptionHandler<SubscriptionStatus>?, resultHandler: @escaping SubscriptionHandler<PhoneMessage>) throws -> SubscriptionToken?
-
Declaration
Swift
public func getConversation(conversationId: String, completion: @escaping TelephonyClientCompletion<PhoneMessageConversation>)
-
Declaration
Swift
public func getConversation(localNumber: PhoneNumber, remoteNumber: String, completion: @escaping TelephonyClientCompletion<PhoneMessageConversation>)
-
Declaration
Swift
public func getConversations(localNumber: PhoneNumber, limit: Int?, nextToken: String?, completion: @escaping TelephonyClientCompletion<TelephonyListToken<PhoneMessageConversation>>)
-
Declaration
Swift
public func createVoiceCall(localNumber: PhoneNumber, remoteNumber: String, delegate: ActiveCallDelegate) throws
-
Declaration
Swift
public func registerForIncomingCalls(with token: Data, useSandbox: Bool, completion: ((SudoTelephonyClientError?) -> Void)?) throws
-
Declaration
Swift
public func deregisterForIncomingCalls(completion: ((SudoTelephonyClientError?) -> Void)?) throws
-
Declaration
Swift
public func handleIncomingPushNotificationPayload(_ payload: [AnyHashable : Any], notificationDelegate: IncomingCallNotificationDelegate) throws -> Bool
-
Declaration
Swift
public func getCallRecord(callRecordId: String, completion: @escaping (Swift.Result<CallRecord, SudoTelephonyClientError>) -> Void) throws
-
Declaration
Swift
public func getCallRecords(localNumber: PhoneNumber, limit: Int?, nextToken: String?, completion: @escaping (Swift.Result<TelephonyListToken<CallRecord>, SudoTelephonyClientError>) -> Void) throws
-
Declaration
Swift
public func subscribeToCallRecords(resultHandler: @escaping (Swift.Result<CallRecord, SudoTelephonyClientError>) -> Void) throws -> SubscriptionToken
-
Declaration
Swift
public func deleteCallRecord(id: String, completion: @escaping (Swift.Result<String, SudoTelephonyClientError>) -> Void) throws
-
Declaration
Swift
public func getVoicemail(id: String, completion: @escaping (Swift.Result<Voicemail, SudoTelephonyClientError>) -> Void)
-
Declaration
Swift
public func getVoicemails(localNumber: PhoneNumber, limit: Int?, nextToken: String?, completion: @escaping (Swift.Result<TelephonyListToken<Voicemail>, SudoTelephonyClientError>) -> Void)
-
Declaration
Swift
public func deleteVoicemail(id: String, completion: @escaping (Swift.Result<Void, SudoTelephonyClientError>) -> Void)
-
Declaration
Swift
public func subscribeToVoicemails(resultHandler: @escaping (Swift.Result<Voicemail, SudoTelephonyClientError>) -> Void) throws -> SubscriptionToken