Getter function to retrieve activity data from Apple Health
Instance method of TerraManager
getActivity(type: Connections,
startDate: Date,
endDate: Date,
toWebhook: Bool,
completion: @escaping (Bool, TerraActivityDataPayloadModel?, TerraError?) -> Void)
getActivity(type: Connections,
startDate: TimeInterval,
endDate: TimeInterval,
toWebhook: Bool,
completion: @escaping (Bool, TerraActivityDataPayloadModel?, TerraError?) -> Void)
type: Connections
➡ The Connection to get data fromstartDate: Date
orstartDate: TimeInterval
➡ The beginning of the request in either Date or Unix TimestampendDate: Date
orendDate: TimeInterval
➡ The end of the request in either Date or Unix TimestamptoWebhook: Bool
➡ Whether or not to send data to your webhookcompletion: (Bool, TerraDailyDataPayloadModel?, TerraError?) -> Void
➡ A callback function that runs after the request is completed. It has the following parameters:Bool
-> If the request was successful or not. If not, theTerraError
parameter will be returnedTerraDailyDataPayloadModel?
-> A payload for each data type. IftoWebhook
is set to true, this returns a class with a propertyreference
referring to the payload reference sent to your webhook. IftoWebhook
is set to false, then this returns the entire Terra normalised payload.TerraError?
-> Returned if any error occurred while retrieving data