Interface TerraWebhookPayload


  • public interface TerraWebhookPayload
    Interface representing a payload received to a developer's webhook URL from Terra.
    • Method Detail

      • getRaw

        com.fasterxml.jackson.databind.JsonNode getRaw()
        The raw, unparsed JSON body for the request.
        Returns:
        the request body
      • getType

        String getType()
        Get the type of the webhook event.
        Returns:
        the event type
      • getUser

        Optional<User> getUser()
        Get the user that the webhook event is for. Note that this will not be present for events of type user_reauth.
        Returns:
        Optional containing the user for the event
      • asReauthData

        Optional<ReauthData> asReauthData()
        Attempt to parse the raw payload as a ReauthData object. If the event type is not user_reauth then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asAuthData

        Optional<AuthData> asAuthData()
        Attempt to parse the raw payload as a AuthData object. If the event type is not auth then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asDeauthData

        Optional<DeauthData> asDeauthData()
        Attempt to parse the raw payload as a DeauthData object. If the event type is not deauth then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asAthlete

        Optional<Athlete> asAthlete()
        Attempt to parse the raw payload as an Athlete object. If the event type is not athlete then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asActivityV2

        Optional<List<Activity>> asActivityV2()
        Attempt to parse the raw payload as an Activity object (API version 2). If the event type is not activity then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asBodyV2

        Optional<List<Body>> asBodyV2()
        Attempt to parse the raw payload as a Body object (API version 2). If the event type is not body then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asDailyV2

        Optional<List<Daily>> asDailyV2()
        Attempt to parse the raw payload as a Daily object (API version 2). If the event type is not daily then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asMenstruationV2

        Optional<List<Menstruation>> asMenstruationV2()
        Attempt to parse the raw payload as a Menstruation object (API version 2). If the event type is not menstruation then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asNutritionV2

        Optional<List<Nutrition>> asNutritionV2()
        Attempt to parse the raw payload as a Nutrition object (API version 2). If the event type is not nutrition then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asSleepV2

        Optional<List<Sleep>> asSleepV2()
        Attempt to parse the raw payload as an Sleep object (API version 2). If the event type is not sleep then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available
      • asRequestProcessing

        Optional<RequestProcessing> asRequestProcessing()
        Attempt to parse the raw payload as an RequestProcessing object. If the event type is not request_processing then this will fail and an empty Optional will be returned.
        Returns:
        Optional containing the parsed data, if available