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)offsetParameters
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)endParameters
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)offsetParameters
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)endParameters
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
+ fetchTripsWithStart:withEnd:
Fetch TMD Trips from the Moprim Cloud between two timestamps.
+ (TMDTask<NSArray<TMDTrip*> *> *)fetchTripsWithStart:(long long)start withEnd:(long long)endParameters
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)offsetParameters
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
+ fetchTripsFromCacheWithStart:withEnd:
Fetch TMD Trips from the cache between two timestamps.
+ (TMDTask<NSArray<TMDTrip*> *> *)fetchTripsFromCacheWithStart:(long long)start withEnd:(long long)endParameters
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)offsetParameters
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
+ fetchTmdErrorStatusesFromCache:minutesOffset:withMinimumStatusDuration:
Fetch TMD Statuses related to errors for the defined date.
+ (TMDTask<NSArray<TMDStatus*> *> *)fetchTmdErrorStatusesFromCache:(NSDate *)date minutesOffset:(double)offset withMinimumStatusDuration:(NSTimeInterval)statusDurationParameters
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. |
statusDuration |
minimum duration of the requested statuses. |
Return Value
A list of TMDStatus that indicate an error.
Declared In
TMDCloudApi.h
+ fetchTmdErrorStatusesFromCacheWithStart:withEnd:withMinimumStatusDuration:
Fetch TMD Statuses related to errors between two timestamps.
+ (TMDTask<NSArray<TMDStatus*> *> *)fetchTmdErrorStatusesFromCacheWithStart:(long long)start withEnd:(long long)end withMinimumStatusDuration:(NSTimeInterval)statusDurationParameters
start |
the start time (timestamp in ms) |
|---|---|
end |
the end time (timestamp in ms) |
statusDuration |
minimum duration of the requested statuses. |
Return Value
A list of TMDStatus that indicate an error.
Declared In
TMDCloudApi.h
+ fetchLastAppKilledTmdStatusFromCacheBetweenStart:andEnd:withMinimumStatusDuration:
Fetch the last TMD Status indicating the app was killed between two timestamps.
+ (TMDTask<TMDStatus*> *)fetchLastAppKilledTmdStatusFromCacheBetweenStart:(long long)start andEnd:(long long)end withMinimumStatusDuration:(NSTimeInterval)statusDurationParameters
start |
the start time (timestamp in ms) |
|---|---|
end |
the end time (timestamp in ms) |
statusDuration |
minimum duration of the status. |
Return Value
A TMDStatus that indicates that the app was killed, or a nil object if there nothing to return.
Declared In
TMDCloudApi.h
+ fetchStatsForLast:
Fetching stats from the Moprim cloud.
+ (TMDTask<TMDStats*> *)fetchStatsForLast:(NSInteger)nbDaysParameters
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 *)endDateParameters
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)nbDaysParameters
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 *)endDateParameters
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*> *)fetchMetadataReturn 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*> *)fetchMetadataFromCacheReturn 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*> *)uploadDataReturn 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)delegateReturn 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 *)correctedLabelParameters
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 *)metadataParameters
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 *)metadataParameters
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 *)tripParameters
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 *)metadataParameters
trip |
the trip to update |
|---|---|
reason |
the reason of the trip |
metadata |
the metadata |
Return Value
The updated trip object.
Declared In
TMDCloudApi.h