iOS SDK
Getting applications setup to leverage the experience server requires the installation of our SDK (Tender).
If you do not have the iOS SDK, please contact your account executive, or contact Ketch support.
Setup
This method sets up the Tender framework with provided parameters. This method must be called before using request methods.
- Parameter
organizationCode
: The code of Organization - Parameter
propertyCode
: The code of Property - Parameter
session
: TheURLSession
used to send network requests. By default, shared session is used. - Throws:
TenderError
in case ifsetup
failed or called more than once
func setup(organizationCode: String, propertyCode: String, session: URLSession = URLSession.shared) throws
Requests
The next methods send requests to the back-end.
Get BootstrapConfiguration
Retrieve BootstrapConfiguration
from network request or cache if network request failed.
- Parameter completion: The block with
BootstrapConfiguration
or error called when the request is completed. Ifsetup
is not called, completion will be called immediately withTenderError.haveNotSetupYet
error.
The result is cached in case of success. The cache is used in case of failure.
func getBootstrapConfiguration(completion: @escaping (Tender.NetworkTaskResult<Tender.BootstrapConfiguration>) -> Void)
Get FullConfiguration with CountryCode and RegionCode
Retrieve Configuration
from network request or cache if network request failed. The configuration is associated with jurisdiction
associated with provided countryCode
and regionCode
.
- Parameter bootstrapConfiguration: The configuration that was retrieved by
getBootstrapConfiguration()
task - Parameter environmentCode: The code of required environment. The environment must exist in provided
bootstrapConfiguration
- Parameter countryCode: The code of country needed for configuration, will be used to find appropriate
jurisdictionCode
inbootstrapConfiguration
- Parameter regionCode: The code of USA region needed for configuration, will be used to find appropriate
jurisdictionCode
inbootstrapConfiguration
- Parameter languageCode: The short language code. By default used iOS language code from current locale
- Parameter completion: The block with
Configuration
or error called when the request is completed. Ifsetup
is not called, completion will be called immediately withTenderError.haveNotSetupYet
error.
The result is cached in case of success. The cache is used in case of failure.
func getFullConfiguration(bootstrapConfiguration: BootstrapConfiguration, environmentCode: String, countryCode: String, regionCode: String?, languageCode: String, completion: @escaping (NetworkTaskResult<Configuration>) -> Void)
Get FullConfiguration with Coordinate
Retrieve Configuration
from network request or cache if network request failed. The configuration is associated with jurisdiction
associated with provided coordinate
- Parameter `bootstrapConfiguration: The configuration that was retrieved by
getBootstrapConfiguration()
task - Parameter environmentCode: The code of required environment. The environment must exist in provided
bootstrapConfiguration
- Parameter coordinate: The geographic coordinate of the user
- Parameter languageCode: The short language code. By default used iOS language code from current locale
- Parameter completion: The block with
Configuration
or error called when the request is completed. Ifsetup
is not called, completion will be called immediately withTenderError.haveNotSetupYet
error.
The result is cached in case of success. The cache is used in case of failure.
func getFullConfiguration(bootstrapConfiguration: BootstrapConfiguration, environmentCode: String, coordinate: CLLocationCoordinate2D, languageCode: String, completion: @escaping (NetworkTaskResult<Configuration>) -> Void)
Get FullConfiguration with IP address
Retrieve Configuration
from network request or cache if network request failed. The configuration is associated with jurisdiction
associated with user's coordinate according to their IP address.
- Parameter bootstrapConfiguration: The configuration that was retrieved by
getBootstrapConfiguration()
task - Parameter environmentCode: The code of required environment. The environment must exist in provided
bootstrapConfiguration
- Parameter languageCode: The short language code. By default used iOS language code from current locale
- Parameter completion: The block with
Configuration
or error called when the request is completed. Ifsetup
is not called, completion will be called immediately withTenderError.haveNotSetupYet
error.
The result is cached in case of success. The cache is used in case of failure.
func getFullConfiguration(bootstrapConfiguration: BootstrapConfiguration, environmentCode: String, languageCode: String, completion: @escaping (NetworkTaskResult<Configuration>) -> Void)
Get Consent Status
Retrieve Consent Statuses from network request or cache if network request failed.
- Parameter configuration: The configuration that was retrieved by
getFullConfiguration()
task - Parameter identities: The map of identities in format
[<identitySpaceCode>, <identityValue>]
. Must be not empty - Parameter purposes: The map of purposes in format
[<code>: <legalBasisCode>]
. Each<code>
must exist inconfiguration.purposes
. - Parameter completion: The block with map
[<code>: ConsentStatus]
or error called when the request is completed. Ifsetup
is not called, completion will be called immediately withTenderError.haveNotSetupYet
error.
The result is cached in case of success. The cache is used in case of failure.
func getConsentStatus(configuration: Configuration, identities: [String : String], purposes: [String : String], completion: @escaping (NetworkTaskResult<[String : ConsentStatus]>) -> Void)
Set Consent Status
Updates Consent Statuses on back-end with provided parameters
- Parameter configuration: The configuration that was retrieved by
getFullConfiguration()
task - Parameter identities: The map of identities in format
[<identitySpaceCode>, <identityValue>]
. Must be not empty - Parameter consents: The map of consent statuses in format
[<code>: ConsentStatus]
. Each<code>
must exist inconfiguration.purposes
. - Parameter completion: The block with void result called when the request is completed. If
setup
is not called, completion will be called immediately withTenderError.haveNotSetupYet
error.
func setConsentStatus(configuration: Configuration, identities: [String : String], consents: [String : ConsentStatus], migrationOption: MigrationOption, completion: @escaping (NetworkTaskVoidResult) -> Void)
Invoke Rights
Invokes rights on back-end with provided parameters
- Parameter configuration: The configuration that was retrieved by
getFullConfiguration()
task - Parameter identities: The map of identities in format
[<identitySpaceCode>, <identityValue>]
. Must be not empty - Parameter rights: The array of rights to invoke in format
[<rightCode>]
. Each<rightCode>
must exist inconfiguration.rights
. - Parameter userData: The user's data
- Parameter completion: The block with void result called when the request is completed. If
setup
is not called, completion will be called immediately withTenderError.haveNotSetupYet
error.
func invokeRights(configuration: Configuration, identities: [String : String], rights: [String], userData: UserData, completion: @escaping (NetworkTaskVoidResult) -> Void)
Updated 8 months ago