Baby Profiles
A baby profile belongs to a space and carries the baby’s details and profile image; growth records and care logs hang off it.
All calls are on InstaVision.babyService.
Pre-requisite: The user has to be signed in to perform the following operations.
Get the baby profiles
To get the list of baby profiles in a space, the following method can be used:
spaceId(required): The space ID.
InstaVision.babyService.getProfiles(
spaceId = "spaceId",
onSuccess = { profiles ->
// The list of BabyProfile objects
},
onError = { error ->
// The error object contains the error code and message
}
)
Create a baby profile
To create a baby profile in a space, the following method can be used:
spaceId(required): The space ID.request(required): TheBabyProfileRequestobject containingname,gender,dateOfBirthandprofileImageName.
InstaVision.babyService.createProfile(
spaceId = "spaceId",
request = BabyProfileRequest(
name = "Baby name",
gender = Gender.Girl.name // Gender: Boy, Girl, PreferNotToSay,
dateOfBirth = DateOfBirth(year = 2024, month = 1, day = 1),
profileImageName = null
),
onSuccess = { profile ->
// The created BabyProfile object
},
onError = { error ->
// The error object contains the error code and message
}
)
Get a baby profile
To get a single baby profile, the following method can be used:
spaceId(required): The space ID.babyId(required): The baby ID.
InstaVision.babyService.getProfile(
spaceId = "spaceId",
babyId = "babyId",
onSuccess = { profile ->
// The BabyProfile object
},
onError = { error ->
// The error object contains the error code and message
}
)
Update a baby profile
To update a baby profile, the following method can be used:
spaceId(required): The space ID.babyId(required): The baby ID.request(required): TheBabyProfileRequestobject containing the fields to update.
InstaVision.babyService.updateProfile(
spaceId = "spaceId",
babyId = "babyId",
request = BabyProfileRequest(
name = "New baby name"
),
onSuccess = { profile ->
// The updated BabyProfile object
},
onError = { error ->
// The error object contains the error code and message
}
)
Delete baby profiles
To delete one or more baby profiles, the following method can be used:
spaceId(required): The space ID.babyIds(required): The list of baby IDs to delete.
InstaVision.babyService.deleteProfiles(
spaceId = "spaceId",
babyIds = listOf("babyId"),
onSuccess = {
// The profiles were deleted successfully
},
onError = { error ->
// The error object contains the error code and message
}
)
Upload a baby profile image
To upload an image for a baby profile, the following method can be used:
spaceId(required): The space ID.babyId(required): The baby ID.image(required): TheBitmapimage to upload.
InstaVision.babyService.uploadProfileImage(
spaceId = "spaceId",
babyId = "babyId",
image = bitmap,
onSuccess = { imageUrl ->
// The uploaded image URL
},
onError = { error ->
// The error object contains the error code and message
}
)