Introduction
Welcome to the documentation for the Persona Inquiry SDK 2.0, a powerful tool that allows developers to incorporate persona inquiries into their applications. This documentation provides comprehensive information about the features and functionalities of the SDK, along with step-by-step guidance on how to integrate it into your project.
Requirements
In order to use the Persona Inquiry SDK 2.0, you need:
- Xcode 11 or higher
- iOS 12.0 or later
Installation
To install the SDK, follow these steps:
- Open your project in Xcode.
- Navigate to the target configuration for your app.
- Select “Build Phases” and expand the “Link Binary With Libraries” section.
- Click the “+” button and add the “PersonaInquirySDK.framework” file.
- Ensure that the framework is added to your project’s “Frameworks” folder.
- Import the SDK in your code files using the following statement:
import PersonaInquirySDK
Quick Start Guide
Follow these steps to quickly integrate the Persona Inquiry SDK into your project:
- Create an instance of the
PersonaInquiry
class. - Configure the necessary parameters for the inquiry, such as your API key and target user information.
- Invoke the
execute
method to initiate the inquiry request. - Implement the necessary callback methods to handle the inquiry response.
Refer to the detailed documentation below for more information on each step.
API Reference
This section provides detailed information about each class, method, and property available in the Persona Inquiry SDK. It includes usage examples, parameter descriptions, and return types. Use the navigation menu on the left to browse through the different topics.
Class: PersonaInquiry
The PersonaInquiry
class is responsible for handling all the persona inquiry functionality within the SDK. It provides methods to configure and execute the inquiry requests.
Method: init(apiKey: String)
Initializes a new instance of the PersonaInquiry
class with the specified API key.
Parameters:
apiKey
: The API key used to authenticate the inquiry requests.
Example:
let personaInquiry = PersonaInquiry(apiKey: "YOUR_API_KEY")
Method: configure(user: User)
Configures the user information for the persona inquiry request.
Parameters:
user
: An instance of theUser
class containing the user details.
Example:
let user = User(name: "John Doe", age: 30)
personaInquiry.configure(user: user)
Method: execute(completion: @escaping (Result<InquiryResponse, Error>) -> Void)
Initiates the persona inquiry request and handles the response asynchronously.
Parameters:
completion
: A closure that is executed once the inquiry response is received. It contains theResult
type, where the success case holds theInquiryResponse
and the failure case holds anError
.
Example:
personaInquiry.execute { (result) in
switch result {
case .success(let response):
// Handle successful inquiry response
print(response)
case .failure(let error):
// Handle error
print(error.localizedDescription)
}
}
Class: User
The User
class represents a target user for the persona inquiry. It contains information such as the user’s name, age, and other relevant attributes.
Property: name
A string property that represents the user’s name.
Property: age
An integer property that represents the user’s age.
Inquiry Response
The InquiryResponse
structure represents the response received from a persona inquiry request. It contains information about the target user’s persona traits, interests, and other relevant details.
Property: traits
An array of strings representing the persona traits of the target user.
Property: interests
An array of strings representing the interests of the target user.
Property: details
A dictionary containing additional details about the target user, such as their occupation, location, etc.
FAQs
Question: How can I obtain an API key?
To obtain an API key, follow these steps:
- Visit the Persona Inquiry Developer Portal.
- Create a new developer account or sign in to your existing account.
- Generate a new API key in the developer dashboard.
- Copy the generated API key and use it to initialize the
PersonaInquiry
class.
Question: How can I handle errors during the inquiry request?
To handle errors during the inquiry request, you can use the completion
closure provided in the execute
method. If an error occurs, it will be returned in the failure
case of the Result
type. You can then handle the error according to your application’s requirements.
Conclusion
Congratulations! You have completed the detailed documentation for the Persona Inquiry SDK 2.0. Feel free to explore the various classes, methods, and properties available in the SDK to enhance your app’s functionality and provide personalized experiences to your users. If you have any further questions or need assistance, please refer to the FAQs section or reach out to our support team.