TMDCloudApi Class Reference

Inherits from NSObject
Declared in TMDCloudApi.h

Overview

This class offers static functions to interact with the Moprim Cloud. Most common use cases are fetching data and metadata and uploading data to the sync.

+ fetchData:minutesOffset:

Fetch TMD activity data from the Moprim Cloud for the defined date

+ (TMDTask<NSArray<TMDActivity*> *> *)fetchData:(NSDate *)date minutesOffset:(double)offset

Parameters

date

the date (only the day, month, year components are relevant)

offset

Number of minutes after midnight that indicates the start of the day. (example: if you want data for the day and consider that days should be separated at 4AM instead of midnight, set this parameter to 240.0. Set this parameter to 0.0 if you want days to be separated at midnight.

Return Value

A list of TMD activities if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchDataWithStart:withEnd:

Fetch TMD activity data from the Moprim Cloud between two timestamps

+ (TMDTask<NSArray<TMDActivity*> *> *)fetchDataWithStart:(long long)start withEnd:(long long)end

Parameters

start

the start time (timestamp in ms)

end

the end time (timestamp in ms)

Return Value

A list of TMD activities if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchDataFromCache:minutesOffset:

Fetch TMD activity data from the cache for the defined date

+ (TMDTask<NSArray<TMDActivity*> *> *)fetchDataFromCache:(NSDate *)date minutesOffset:(double)offset

Parameters

date

the date (only the day, month, year components are relevant)

offset

Number of minutes after midnight that indicates the start of the day. (example: if you want data for the day and consider that days should be separated at 4AM instead of midnight, set this parameter to 240.0. Set this parameter to 0.0 if you want days to be separated at midnight.

Return Value

A list of TMD activities if successful, an error otherwise.

Discussion

Use this method if you wish not to request data from the cloud

Declared In

TMDCloudApi.h

+ fetchDataFromCacheWithStart:withEnd:

Fetch TMD activity data from the cache between two timestamps

+ (TMDTask<NSArray<TMDActivity*> *> *)fetchDataFromCacheWithStart:(long long)start withEnd:(long long)end

Parameters

start

the start time (timestamp in ms)

end

the end time (timestamp in ms)

Return Value

A list of TMD activities if successful, an error otherwise.

Discussion

Use this method if you wish not to request data from the cloud

Declared In

TMDCloudApi.h

+ fetchLastTrip

Fetch the last TMD Trip from the Moprim Cloud.

+ (TMDTask<TMDTrip*> *)fetchLastTrip

Return Value

The last TMD Trip if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchLastTrips:

Fetch the last TMD Trips from the Moprim Cloud.

+ (TMDTask<NSArray<TMDTrip*> *> *)fetchLastTrips:(int)count

Parameters

count

the number of TMD Trips you wish to receive

Return Value

A list of TMD Trips if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchTripsWithStart:withEnd:

Fetch TMD Trips from the Moprim Cloud between two timestamps.

+ (TMDTask<NSArray<TMDTrip*> *> *)fetchTripsWithStart:(long long)start withEnd:(long long)end

Parameters

start

the start time (timestamp in ms)

end

the end time (timestamp in ms)

Return Value

A list of TMD Trips if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchTripsForDate:minutesOffset:

Fetch TMD Trips from the Moprim Cloud for the defined date.

+ (TMDTask<NSArray<TMDTrip*> *> *)fetchTripsForDate:(NSDate *)date minutesOffset:(double)offset

Parameters

date

the date (only the day, month, year components are relevant)

offset

Number of minutes after midnight that indicates the start of the day. (example: if you want data for the day and consider that days should be separated at 4AM instead of midnight, set this parameter to 240.0. Set this parameter to 0.0 if you want days to be separated at midnight.

Return Value

A list of TMD Trips if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchLastTripFromCache

Fetch the last TMD Trip from the cache.

+ (TMDTask<TMDTrip*> *)fetchLastTripFromCache

Return Value

The last TMD Trip if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchLastTripsFromCache:

Fetch the last TMD Trips from the cache.

+ (TMDTask<NSArray<TMDTrip*> *> *)fetchLastTripsFromCache:(int)count

Parameters

count

the number of TMD Trips you wish to receive

Return Value

A list of TMD Trips if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchTripsFromCacheWithStart:withEnd:

Fetch TMD Trips from the cache between two timestamps.

+ (TMDTask<NSArray<TMDTrip*> *> *)fetchTripsFromCacheWithStart:(long long)start withEnd:(long long)end

Parameters

start

the start time (timestamp in ms)

end

the end time (timestamp in ms)

Return Value

A list of TMD Trips if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchTripsFromCacheForDate:minutesOffset:

Fetch TMD Trips from the cache for the defined date.

+ (TMDTask<NSArray<TMDTrip*> *> *)fetchTripsFromCacheForDate:(NSDate *)date minutesOffset:(double)offset

Parameters

date

the date (only the day, month, year components are relevant)

offset

Number of minutes after midnight that indicates the start of the day. (example: if you want data for the day and consider that days should be separated at 4AM instead of midnight, set this parameter to 240.0. Set this parameter to 0.0 if you want days to be separated at midnight.

Return Value

A list of TMD Trips if successful, an error otherwise.

Declared In

TMDCloudApi.h

+ fetchStatsForLast:

Fetching stats from the Moprim cloud.

+ (TMDTask<TMDStats*> *)fetchStatsForLast:(NSInteger)nbDays

Parameters

nbDays

the number of days to compute the statistics for (e.g. 30 for the last 30 days)

Return Value

A TMDStats object containing the statistics.

Declared In

TMDCloudApi.h

+ fetchStatsWithStartDate:withEnd:

Fetching stats from the cloud

+ (TMDTask<TMDStats*> *)fetchStatsWithStartDate:(NSString *)startDate withEnd:(NSString *)endDate

Parameters

startDate

the start date in ISO format “yyyy-MM-dd”

endDate

the end date in ISO format “yyyy-MM-dd”

Return Value

A TMDStats object containing the statistics between startDate and endDate (including those dates).

Declared In

TMDCloudApi.h

+ fetchStatsFromCacheForLast:

Fetching stats from the local cache

+ (TMDTask<TMDStats*> *)fetchStatsFromCacheForLast:(NSInteger)nbDays

Parameters

nbDays

the number of days to compute the statistics for (e.g. 30 for the last 30 days)

Return Value

A TMDStats object containing the statistics.

Declared In

TMDCloudApi.h

+ fetchStatsFromCacheWithStartDate:withEnd:

Fetching stats from the local cache

+ (TMDTask<TMDStats*> *)fetchStatsFromCacheWithStartDate:(NSString *)startDate withEnd:(NSString *)endDate

Parameters

startDate

the start date in ISO format “yyyy-MM-dd”

endDate

the end date in ISO format “yyyy-MM-dd”

Return Value

A TMDStats object containing the statistics between startDate and endDate (including those dates).

Declared In

TMDCloudApi.h

+ fetchMetadata

Fetch the metadata from the Cloud.

+ (TMDTask<TMDCloudMetadata*> *)fetchMetadata

Return Value

The cloud metadata.

Discussion

This function is usually called when one wants to know what data can be fetched from the Cloud

Declared In

TMDCloudApi.h

+ fetchMetadataFromCache

Fetch the metadata from the cache.

+ (TMDTask<TMDCloudMetadata*> *)fetchMetadataFromCache

Return Value

The cloud metadata.

Discussion

This function is usually called when one wants to know what data can be fetched from the Cloud

Declared In

TMDCloudApi.h

+ uploadData

Upload the collected data to the cloud pro-actively

+ (TMDTask<TMDUploadMetadata*> *)uploadData

Return Value

A TMDUploadMetadata object indicating how much data was sent.

Declared In

TMDCloudApi.h

+ uploadDataWithDelegate:

Upload the collected data to the cloud pro-actively and notifies the delegate when the upload starts and ends

+ (TMDTask<TMDUploadMetadata*> *)uploadDataWithDelegate:(id<TMDUploadDelegate> _Nullable)delegate

Return Value

A TMDUploadMetadata object indicating how much data was sent.

Declared In

TMDCloudApi.h

+ correctActivity:withLabel:

Correct the label of activity

+ (TMDTask<TMDActivity*> *)correctActivity:(TMDActivity *)activity withLabel:(NSString *)correctedLabel

Parameters

activity

the activity to correct

correctedLabel

the new label

Return Value

The corrected activity object.

Declared In

TMDCloudApi.h

+ annotateActivity:withMetadata:

Annotate the activity with metadata

+ (TMDTask<TMDActivity*> *)annotateActivity:(TMDActivity *)activity withMetadata:(NSString *)metadata

Parameters

activity

the activity to annotate

metadata

the metadata

Return Value

The annotated activity object.

Declared In

TMDCloudApi.h

+ updateActivity:withLabel:withMetadata:

Update the label and metadata of the activity

+ (TMDTask<TMDActivity*> *)updateActivity:(TMDActivity *)activity withLabel:(NSString *)correctedLabel withMetadata:(NSString *)metadata

Parameters

activity

the activity to update

correctedLabel

the new label

metadata

the metadata

Return Value

The updated activity object.

Declared In

TMDCloudApi.h

+ validateTrip:

Validates the trip

+ (TMDTask<TMDTrip*> *)validateTrip:(TMDTrip *)trip

Parameters

trip

the trip to validate

Return Value

The updated trip object.

Declared In

TMDCloudApi.h

+ updateTrip:withReason:withMetadata:

Update the reason and metadata of the trip

+ (TMDTask<TMDTrip*> *)updateTrip:(TMDTrip *)trip withReason:(NSString *)reason withMetadata:(NSString *)metadata

Parameters

trip

the trip to update

reason

the reason of the trip

metadata

the metadata

Return Value

The updated trip object.

Declared In

TMDCloudApi.h