Flutter
Misc
SuccessMessage
Terra initialization
initTerra
String devId
➡ The dev-id provided to you when signing up with Terra Developer Dashboard
String referenceID
➡ A random string used to characterise a user on your server
returns
Future<SuccessMessage>
Connection setup/management
initConnection
Initialise a device connection. This function needs to be called once only.
Connection connection
➡ An ENUM from the Connections class signifying the connection you wish to initiate for.String token
➡ A token used for authentication. Generate one here: https://docs.tryterra.co/reference/generate-authentication-tokenList<CustomPermissions> customPermissions
➡ This is defaulted as an emptySet
. If you want to make a more granular permissions request, you may send us a set ofCustomPermissions
bool schedulerOn
➡ A boolean dictating if you wish turn on background delivery. Defaults to true. Please see Background Delivery section for setup. On iOS, follow iOS.
returns
Future<SuccessMessage>
getUserId
Returns the user's User ID if the user exists, else returns null
Connection connection
➡ An ENUM from the Connection class signifying the connection you wish to retrieve user_id from.
returns
Future<UserId?>
Data retrieval
DataMessage
getActivity
Connection connection
➡ An ENUM from the Connections class signifying the connection you wish to initiate for.DateTime startDate
➡ The beginning of the request in either Date or Unix TimestampDateTime endDate
➡ The end of the request in either Date or Unix Timestamp(Optional)
bool toWebhook
➡ Whether or not to send data to your webhook. If false,DataMessage
on the returnedFuture
will contain the data in thedata
field.
returns
Future<DataMessage?>
getDaily
Connection connection
➡ An ENUM from the Connections class signifying the connection you wish to initiate for.DateTime startDate
➡ The beginning of the request in either Date or Unix TimestampDateTime endDate
➡ The end of the request in either Date or Unix Timestamp(Optional)
bool toWebhook
➡ Whether or not to send data to your webhook. If false,DataMessage
on the returnedFuture
will contain the data in thedata
field.
returns
Future<DataMessage?>
getSleep
Connection connection
➡ An ENUM from the Connections class signifying the connection you wish to initiate for.DateTime startDate
➡ The beginning of the request in either Date or Unix TimestampDateTime endDate
➡ The end of the request in either Date or Unix Timestamp(Optional)
bool toWebhook
➡ Whether or not to send data to your webhook. If false,DataMessage
on the returnedFuture
will contain the data in thedata
field.
returns
Future<DataMessage?>
getNutrition
Connection connection
➡ An ENUM from the Connections class signifying the connection you wish to initiate for.DateTime startDate
➡ The beginning of the request in either Date or Unix TimestampDateTime endDate
➡ The end of the request in either Date or Unix Timestamp(Optional)
bool toWebhook
➡ Whether or not to send data to your webhook. If false,DataMessage
on the returnedFuture
will contain the data in thedata
field.
returns
Future<DataMessage?>
getMenstruation
Connection connection
➡ An ENUM from the Connections class signifying the connection you wish to initiate for.DateTime startDate
➡ The beginning of the request in either Date or Unix TimestampDateTime endDate
➡ The end of the request in either Date or Unix Timestamp(Optional)
bool toWebhook
➡ Whether or not to send data to your webhook. If false,DataMessage
on the returnedFuture
will contain the data in thedata
field.
returns
Future<DataMessage?>
getAthlete
Connection connection
➡ An ENUM from the Connections class signifying the connection you wish to initiate for.(Optional)
bool toWebhook
➡ Whether or not to send data to your webhook. If false,DataMessage
on the returnedFuture
will contain the data in thedata
field.
returns
Future<SuccessMessage?>
: Returns aSuccessMessage
object wrapped in aFuture
. This contains information about whether the request was successful or if there was an error.
Writing data
postPlannedWorkout
Connection connection
: Specifies the connection type to which the planned workout data will be posted.payload
(TerraPlannedWorkout
): The payload containing the details of the planned workout. This includes metadata such as the workout type, duration, and intensity, as well as a list of steps to complete the workout.
returns
Future<SuccessMessage?>
: Returns aSuccessMessage
object wrapped in aFuture
. This contains information about whether the request was successful or if there was an error.
Android-only methods
Fetches permissions granted by Health connect
grantedPermissions
**returns**
`
Promise<Array<String>>
`
Was this helpful?