Baby Services

Baby services are a set of APIs that allow you to manage baby profiles, activities, and growth tracking within a space.

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): The BabyProfileRequest object containing name, gender, dateOfBirth and profileImageName.
InstaVision.babyService.createProfile(
  spaceId = "spaceId",
  request = BabyProfileRequest(
    name = "Baby name",
    gender = "female",
    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
  }
)

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
  }
)

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): The BabyProfileRequest object 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
  }
)

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
  }
)

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): The Bitmap image 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
  }
)

Log baby activities

To log one or more baby activities (feeding, sleep, diaper, etc.), the following method can be used:

  • spaceId (required): The space ID.
  • babyId (required): The baby ID.
  • request (required): The LogBabyActivityRequest object containing a list of BabyActivityLog entries (type, loggedAt, side, durationMinutes, quantityOz, diaperType).
InstaVision.babyService.logActivities(
  spaceId = "spaceId",
  babyId = "babyId",
  request = LogBabyActivityRequest(
    activities = listOf(
      BabyActivityLog(
        type = "feeding",
        loggedAt = System.currentTimeMillis(),
        quantityOz = 4.0f
      )
    )
  ),
  onSuccess = { activities ->
    // The list of logged BabyActivity objects
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)

Get baby activities

To get the baby activities for a space, the following method can be used:

  • spaceId (required): The space ID.
  • babyIds (optional): The list of baby IDs to filter by.
  • types (optional): The list of activity types to filter by.
  • from (required): The start of the time range, in epoch millis.
  • to (required): The end of the time range, in epoch millis.
  • limit (optional): The maximum number of activities to return.
  • skip (required): The number of activities to skip, for pagination.
InstaVision.babyService.getActivities(
  spaceId = "spaceId",
  babyIds = listOf("babyId"),
  types = listOf("feeding"),
  from = 0L,
  to = System.currentTimeMillis(),
  limit = 20,
  skip = 0,
  onSuccess = { response ->
    // The ListBabyActivitiesResponse object containing activities, totalCount and nextPage
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)

Delete baby activities

To delete one or more baby activities, the following method can be used:

  • spaceId (required): The space ID.
  • request (required): The DeleteBabyActivityRequest object containing the list of activity ids to delete.
InstaVision.babyService.deleteActivities(
  spaceId = "spaceId",
  request = DeleteBabyActivityRequest(
    ids = listOf("activityId")
  ),
  onSuccess = {
    // The activities were deleted successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)

Log baby growth

To log a baby’s growth measurement (weight/height), the following method can be used:

  • spaceId (required): The space ID.
  • babyId (required): The baby ID.
  • request (required): The LogBabyGrowthRequest object containing weight, height and measuredAt.
InstaVision.babyService.logGrowth(
  spaceId = "spaceId",
  babyId = "babyId",
  request = LogBabyGrowthRequest(
    weight = 7.5f,
    height = 65.0f,
    measuredAt = System.currentTimeMillis()
  ),
  onSuccess = { growth ->
    // The logged BabyGrowth object
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)

Get baby growth data

To get the growth history for a baby, the following method can be used:

  • spaceId (required): The space ID.
  • babyId (required): The baby ID.
  • from (optional): The start of the time range, in epoch millis.
  • to (optional): The end of the time range, in epoch millis.
  • limit (optional): The maximum number of entries to return.
  • skip (optional): The number of entries to skip, for pagination.
InstaVision.babyService.getGrowthData(
  spaceId = "spaceId",
  babyId = "babyId",
  from = null,
  to = null,
  limit = 20,
  skip = 0,
  onSuccess = { response ->
    // The BabyGrowthResponse object containing growthData, totalCount and nextPage
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)

Get user deleted activities

To get the IDs of baby activities that the user has deleted, the following method can be used:

  • spaceId (required): The space ID.
InstaVision.babyService.getUserDeletedActivities(
  spaceId = "spaceId",
  onSuccess = { activityIds ->
    // The list of deleted activity IDs
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)

This site uses Just the Docs, a documentation theme for Jekyll.