update
Updates the current member’s profile data.
Returns an AFResult indicating success or failure. On failure, the result contains an com.advantahealth.api.AFException with server validation details including com.advantahealth.api.AFException.detail and com.advantahealth.api.AFException.errors.
Return
AFResult with status = true on success, or status = false with AFResult.exception containing validation errors on failure.
Android (Kotlin)
lifecycleScope.launch {
val result = AFCore.profile().update(profileData)
if (result.status) {
showMessage("Profile updated successfully")
} else {
val errors = result.exception?.errors?.joinToString("\n") ?: result.statusMessage
showError("Profile update failed: $errors")
}
}Content copied to clipboard
iOS (Swift)
Task {
var profile = try await AFCore.shared.profile().get()
profile.firstName = "Alex"
let result = AFCore.shared.profile().update(profileData: profile)
if result.status {
print("Profile updated")
} else {
let errors = result.exception?.errors?.joined(separator: "\n") ?? result.statusMessage
print("Update failed: \(errors ?? "Unknown error")")
}
}Content copied to clipboard
Parameters
profile Data
The updated profile information to save.