Get User Data
getUser
For viewing/getting a specific user's data you need to use getUser and provide the user_id.
Parameters
- user_id: (string) - The ID of the user to retrieve.
Returns
Promise<ResponseType<UserType>>: A promise that resolves with aUserTypeobject containing the user data.
Example
import { getUser } from 'react-native-altibbi';
const response = await getUser('999999999');
const data: UserType = response.data;
The
getUserwill return a user data object that can be decoded toUserTypeobject.
Responses
Status 200
Success
{
"id": 999999999,
"name": "Altibbi User",
"email": "[email protected]",
"phone_number": "0791234567",
"date_of_birth": "2000-01-30",
"gender": "male",
"insurance_id": "123123123",
"policy_number": "111111111",
"nationality_number": "9999999999",
"height": "180",
"weight": "90",
"blood_type": "A+",
"smoker": "yes",
"alcoholic": "no",
"marital_status": "single",
"relation_type": "brother",
"created_at": "2024-01-01 00:00:00",
"updated_at": "2024-01-01 00:00:00"
}
Status 401
UnauthorizedHttpException represents an Unauthorized HTTP exception with status code 401.
{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials",
"code": "0",
"status": "401",
"type": "yii\\web\\UnauthorizedHttpException"
}
Status 403
Current user can't access this page.
{
"name": "Forbidden",
"message": "duplicate request OR Current user cant access this page",
"code": "0",
"status": "403",
"type": "yii\\web\\ForbiddenHttpException"
}
Status 404
User ID invalid or deleted.
{
"name": "Not Found",
"message": "Object not found: {id}",
"code": "0",
"status": "404",
"type": "yii\\web\\NotFoundHttpException"
}