Growth & Care Logging

Two logs per baby: growth — height and weight over time — and activitiesBabyActivityType.Feeding, Formula, Diaper, with FeedingSide and DiaperChangeType detail. Deleted activity ids stay retrievable so an offline cache can be pruned.

All calls are on InstaVision.babyService.

Pre-requisite: The user has to be signed in to perform the following operations.


Log baby activities

To log one or more baby activities (feeding, formula, diaper), 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 = BabyActivityType.Feeding.name,
        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(BabyActivityType.Feeding.name),
  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.