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
+ 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
+ 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
+ fetchTmdErrorStatusesFromCache:minutesOffset:withMinimumStatusDuration:
Fetch TMD Statuses related to errors for the defined date.
+ (TMDTask<NSArray<TMDStatus*> *> *)fetchTmdErrorStatusesFromCache:(NSDate *)date minutesOffset:(double)offset withMinimumStatusDuration:(NSTimeInterval)statusDuration
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. |
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)statusDuration
Parameters
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)statusDuration
Parameters
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)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
+ updateActivity:withLabel:withMetadata:withVehicleProfileJson:
Update the label, metadata and vehicle profile of the activity
+ (TMDTask<TMDActivity*> *)updateActivity:(TMDActivity *)activity withLabel:(NSString *)correctedLabel withMetadata:(NSString *)metadata withVehicleProfileJson:(NSString *)vehicleProfileJson
Parameters
activity |
the activity to update |
---|---|
correctedLabel |
the new label |
metadata |
the metadata |
vehicleProfileJson |
the JSON representation of the TMDVehicle profile |
Return Value
The updated activity object.
Declared In
TMDCloudApi.h
+ updateActivity:withLabel:withMetadata:withVehicleProfile:
Update the label, metadata and vehicle profile of the activity
+ (TMDTask<TMDActivity*> *)updateActivity:(TMDActivity *)activity withLabel:(NSString *)correctedLabel withMetadata:(NSString *)metadata withVehicleProfile:(TMDVehicle *)vehicleProfile
Parameters
activity |
the activity to update |
---|---|
correctedLabel |
the new label |
metadata |
the metadata |
vehicleProfile |
the TMDVehicle profile |
Return Value
The updated activity object.
Declared In
TMDCloudApi.h
+ updateActivity:withLabel:withMetadata:withEnergy:
Update the label, metadata and energy of the activity
+ (TMDTask<TMDActivity*> *)updateActivity:(TMDActivity *)activity withLabel:(NSString *)correctedLabel withMetadata:(NSString *)metadata withEnergy:(NSString *)energy
Parameters
activity |
the activity to update |
---|---|
correctedLabel |
the new label |
metadata |
the metadata |
energy |
the energy of the activity, which can be a string representation of a TMDEngineType, or any other string. |
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:withPurpose:withMetadata:
Update the reason and metadata of the trip
+ (TMDTask<TMDTrip*> *)updateTrip:(TMDTrip *)trip withPurpose:(NSString *)purpose withMetadata:(NSString *)metadata
Parameters
trip |
the trip to update |
---|---|
purpose |
the purpose of the trip |
metadata |
the metadata |
Return Value
The updated trip object.
Declared In
TMDCloudApi.h
+ updateTrip:withPurpose:withReasons:withMetadata:
Update the reason and metadata of the trip
+ (TMDTask<TMDTrip*> *)updateTrip:(TMDTrip *)trip withPurpose:(NSString *)purpose withReasons:(NSArray<NSString*> *)reasons withMetadata:(NSString *)metadata
Parameters
trip |
the trip to update |
---|---|
purpose |
the purpose of the trip |
reasons |
the reasons for making the trip with these activities. |
metadata |
the metadata |
Return Value
The updated trip object.
Declared In
TMDCloudApi.h
+ fetchAllVehiclesFromCloud
Fetch the user’s vehicle profiles from the Cloud.
+ (TMDTask<NSArray<TMDVehicle*> *> *)fetchAllVehiclesFromCloud
Return Value
An array of TMDVehicle objects.
Declared In
TMDCloudApi.h
+ fetchVehiclesFromCloudForModality:
Fetch the user’s vehicle profiles from the Cloud, for a given modality.
+ (TMDTask<NSArray<TMDVehicle*> *> *)fetchVehiclesFromCloudForModality:(NSString *)modality
Parameters
modality |
the modality of the vehicle profiles to fetch |
---|
Return Value
An array of TMDVehicle objects.
Declared In
TMDCloudApi.h
+ fetchDefaultVehicleFromCloudForModality:
Fetch the user’s default vehicle profile from the Cloud, for a given modality.
+ (TMDTask<TMDVehicle*> *)fetchDefaultVehicleFromCloudForModality:(NSString *)modality
Parameters
modality |
the modality of the vehicle profile to fetch |
---|
Return Value
A TMDVehicle object.
Declared In
TMDCloudApi.h
+ fetchAllVehiclesFromCache
Fetch the user’s vehicle profiles from the cache.
+ (TMDTask<NSArray<TMDVehicle*> *> *)fetchAllVehiclesFromCache
Return Value
An array of TMDVehicle objects.
Declared In
TMDCloudApi.h
+ fetchVehiclesFromCacheForModality:
Fetch the user’s vehicle profiles from the cache, for a given modality.
+ (TMDTask<NSArray<TMDVehicle*> *> *)fetchVehiclesFromCacheForModality:(NSString *)modality
Parameters
modality |
the modality of the vehicle profiles to fetch |
---|
Return Value
An array of TMDVehicle objects.
Declared In
TMDCloudApi.h
+ fetchDefaultVehicleFromCacheForModality:
Fetch the user’s default vehicle profile from the cache, for a given modality.
+ (TMDTask<TMDVehicle*> *)fetchDefaultVehicleFromCacheForModality:(NSString *)modality
Parameters
modality |
the modality of the vehicle profile to fetch |
---|
Return Value
A TMDVehicle object.
Declared In
TMDCloudApi.h
+ addVehicleToCloudWithMode:name:energy:make:makeAlt:model:modelAlt:year:owner:isDefaultVehicle:
Add a new vehicle profile to the Moprim cloud.
+ (TMDTask<TMDVehicle*> *)addVehicleToCloudWithMode:(NSString *)vehicleModality name:(NSString *)name energy:(NSString *)energy make:(NSString *)make makeAlt:(NSString *)makeAlt model:(NSString *)model modelAlt:(NSString *)modelAlt year:(int)year owner:(bool)owner isDefaultVehicle:(bool)isDefaultVehicle
Parameters
vehicleModality |
the modality of the vehicle profile to add |
---|---|
name |
the name of the vehicle. |
energy |
the energy of the vehicle, which can be a string representation of a TMDEngineType, or any other string. |
make |
the make of the vehicle. |
makeAlt |
an alternative value for the make of the vehicle. |
model |
the model of the vehicle. |
modelAlt |
an alternative value for the model of the vehicle. |
year |
the manufacturing year of the vehicle |
owner |
indicates if the user is the owner of the vehicle |
isDefaultVehicle |
indicates if this is the user’s default vehicle for this modality |
Return Value
The inserted TMDVehicle object.
Declared In
TMDCloudApi.h
+ updateVehicleInCloudWithId:name:energy:make:makeAlt:model:modelAlt:year:owner:isDefaultVehicle:
Update an existing vehicle profile to the Moprim cloud.
+ (TMDTask<TMDVehicle*> *)updateVehicleInCloudWithId:(NSUUID *)vehicleId name:(NSString *)name energy:(NSString *)energy make:(NSString *)make makeAlt:(NSString *)makeAlt model:(NSString *)model modelAlt:(NSString *)modelAlt year:(int)year owner:(bool)owner isDefaultVehicle:(bool)isDefaultVehicle
Parameters
vehicleId |
the unique identifier of the vehicle to update. |
---|---|
name |
the name of the vehicle. |
energy |
the energy of the vehicle, which can be a string representation of a TMDEngineType, or any other string. |
make |
the make of the vehicle. |
makeAlt |
an alternative value for the make of the vehicle. |
model |
the model of the vehicle. |
modelAlt |
an alternative value for the model of the vehicle. |
year |
the manufacturing year of the vehicle |
owner |
indicates if the user is the owner of the vehicle |
isDefaultVehicle |
indicates if this is the user’s default vehicle for this modality |
Return Value
The inserted TMDVehicle object.
Declared In
TMDCloudApi.h
+ deleteTmdVehicleFromCloudForId:
Delete a vehicle profile from the Moprim cloud.
+ (TMDTask<NSString*> *)deleteTmdVehicleFromCloudForId:(NSUUID *)vehicleId
Parameters
vehicleId |
the unique identifier of the vehicle to delete. |
---|
Return Value
A confirmation message, when the deletion succeeds.
Declared In
TMDCloudApi.h