Profile
The Profile module provides access to the authenticated member's personal data. You can retrieve the current profile and update editable fields.
Data Model
MemberProfile
| Field | Type | Description |
|---|---|---|
uniqueId | String? | Server-assigned unique identifier. Read-only. |
memberId | String? | Member ID within the organization. Read-only. |
firstName | String? | Given name. |
middleName | String? | Middle name. |
lastName | String? | Family name. |
email | String? | Email address. |
gender | String? | "M" or "F". |
dob | String? | Date of birth in ISO-8601 format (YYYY-MM-DD). |
dayPhone | String? | Daytime or landline phone number. |
cellPhone | String? | Mobile phone number. |
address | MemberAddress? | Structured mailing address. |
MemberAddress
| Field | Type | Description |
|---|---|---|
line1 | String? | Primary street address. |
line2 | String? | Apartment, suite, or unit number. |
city | String? | City or town. |
state | String? | Two-letter state code (e.g., CA). |
zipCode | String? | Postal or ZIP code. |
Get Profile
Retrieve the authenticated member's profile.
- Android (Kotlin)
- iOS (Swift)
lifecycleScope.launch {
try {
val profile = AFCore.profile().get()
// Populate the UI with the member's data
nameField.text = "${profile.firstName} ${profile.lastName}"
emailField.text = profile.email ?: "Not provided"
} catch (e: Exception) {
showError("Could not load profile: ${e.message}")
}
}
do {
let profile = try await AFCore.shared.profile().get()
nameLabel.text = "\(profile.firstName ?? "") \(profile.lastName ?? "")"
emailLabel.text = profile.email ?? "Not provided"
} catch {
showError("Could not load profile: \(error)")
}
Update Profile
Send a MemberProfile object with the fields you want to change. Only non-nil fields are updated server-side; omitted fields remain unchanged.
- Android (Kotlin)
- iOS (Swift)
lifecycleScope.launch {
try {
val updates = MemberProfile(
firstName = "Alex",
cellPhone = "+1-555-0199",
address = MemberAddress(
line1 = "456 Oak Avenue",
city = "San Diego",
state = "CA",
zipCode = "92101"
)
)
val updated = AFCore.profile().update(profileData = updates)
showSuccess("Profile updated")
} catch (e: Exception) {
showError("Update failed: ${e.message}")
}
}
do {
let updates = MemberProfile(
firstName: "Alex",
cellPhone: "+1-555-0199",
address: MemberAddress(
line1: "456 Oak Avenue",
city: "San Diego",
state: "CA",
zipCode: "92101"
)
)
let updated = try await AFCore.shared.profile().update(profileData: updates)
showSuccess("Profile updated")
} catch {
showError("Update failed: \(error)")
}
Best Practices
- Cache the profile locally to avoid redundant API calls. Refresh when the user navigates to the profile screen or pulls to refresh.
- Validate inputs before submitting. Validate email format, phone number format, and ZIP code length on the client side to provide immediate feedback.
- Handle read-only fields.
uniqueIdandmemberIdcannot be changed viaupdate(). They are set by the server during account creation.
Quick Reference
- Android (Kotlin)
- iOS (Swift)
// Android
AFCore.profile().get()
AFCore.profile().update(profileData)
// iOS
try await AFCore.shared.profile().get()
try await AFCore.shared.profile().update(profileData: updates)