A library to support using the Vonage APIs on iOS. Features:
- Force a cellular network request for use with Vonage Number Verification and Vonage Verify Silent Authentication
import PackageDescription
let package = Package(
dependencies: [
.Package(url: "https://github.com/Vonage/vonage-ios-client-library.git")
]
)
pod 'VonageClientLibrary'
iOS 13+
import VonageClientLibrary
let client = VGCellularRequestClient()
let params = VGCellularRequestParameters(url: "http://www.vonage.com",
headers: ["x-my-header": "My Value"],
queryParameters: ["query-param" : "value"],
maxRedirectCount: 10)
let response = try await client.startCellularGetRequest(params: params, debug: true)
maxRedirectCount
inVGCellularRequestParameters
is an optional and defaults to 10.debug
parameter forstartCellularRequest
is optional and defaults to false.
- Success - When the data connectivity has been achieved, and a response has been received from the url endpoint:
{
"http_status": string, // HTTP status related to the url
"response_body" : { // Optional depending on the HTTP status
... // The response body of the opened url
},
"debug" : {
"device_info": string,
"url_trace" : string
}
}
- Error - When data connectivity is not available and/or an internal SDK error occurred:
{
"error" : string,
"error_description": string,
"debug" : {
"device_info": string,
"url_trace" : string
}
}
Potential error codes: sdk_no_data_connectivity
, sdk_connection_error
, sdk_redirect_error
, sdk_error
.
VonageClientLibrary
replaces both VonageClientSDKNumberVerification
and VonageClientSDKSilentAuth
. To migrate from them do the following:
You will need to add VonageClientLibrary
as a dependency and remove either VonageClientSDKNumberVerification
or VonageClientSDKSilentAuth
depending on which one you were using.
// VonageClientSDKNumberVerification
import VonageClientSDKNumberVerification
or
// VonageClientSDKSilentAuth
import VonageClientSDKSilentAuth
should be replaced with:
import VonageClientLibrary
// VonageClientSDKNumberVerification
let client = VGNumberVerificationClient()
or
// VonageClientSDKSilentAuth
let client = VGSilentAuthClient()
should be replaced with:
let client = VGCellularRequestClient()
VonageClientLibrary
uses a params object to pass information to the function that makes the network call. This is a similar approach to VonageClientSDKNumberVerification
, but new if you are using VonageClientSDKSilentAuth
.
// VonageClientSDKNumberVerification
let params = VGNumberVerificationParameters(url: "http://www.vonage.com",
headers: ["x-my-header": "My Value"],
queryParameters: ["query-param" : "value"]
maxRedirectCount: 10
)
let response = try await client.startNumberVerification(params: params)
or
// VonageClientSDKSilentAuth
client.openWithDataCellular(url: url, debug: true) { response in
...
}
should be replaced with the VonageClientLibrary
example above.