Skip to content

Commit

Permalink
feat(AWSLocation): update models to latest (#5116)
Browse files Browse the repository at this point in the history
  • Loading branch information
awsmobilesdk authored Dec 28, 2023
1 parent c48991d commit dcaf1b7
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 4 deletions.
25 changes: 23 additions & 2 deletions AWSLocation/AWSLocationModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ typedef NS_ENUM(NSInteger, AWSLocationIntendedUse) {
AWSLocationIntendedUseStorage,
};

typedef NS_ENUM(NSInteger, AWSLocationOptimizationMode) {
AWSLocationOptimizationModeUnknown,
AWSLocationOptimizationModeFastestRoute,
AWSLocationOptimizationModeShortestRoute,
};

typedef NS_ENUM(NSInteger, AWSLocationPositionFiltering) {
AWSLocationPositionFilteringUnknown,
AWSLocationPositionFilteringTimeBased,
Expand Down Expand Up @@ -869,6 +875,11 @@ typedef NS_ENUM(NSInteger, AWSLocationVehicleWeightUnit) {
@interface AWSLocationCalculateRouteRequest : AWSRequest


/**
<p>Specifies the desired time of arrival. Uses the given time to calculate the route. Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p><note><p>ArrivalTime is not supported Esri.</p></note>
*/
@property (nonatomic, strong) NSDate * _Nullable arrivalTime;

/**
<p>The name of the route calculator resource that you want to use to calculate the route. </p>
*/
Expand All @@ -890,7 +901,7 @@ typedef NS_ENUM(NSInteger, AWSLocationVehicleWeightUnit) {
@property (nonatomic, strong) NSArray<NSNumber *> * _Nullable departurePosition;

/**
<p>Specifies the desired time of departure. Uses the given time to calculate the route. Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p><note><p>Setting a departure time in the past returns a <code>400 ValidationException</code> error.</p></note><ul><li><p>In <a href="https://www.iso.org/iso-8601-date-and-time-format.html">ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. For example, <code>2020–07-2T12:15:20.000Z+01:00</code></p></li></ul>
<p>Specifies the desired time of departure. Uses the given time to calculate the route. Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p><ul><li><p>In <a href="https://www.iso.org/iso-8601-date-and-time-format.html">ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. For example, <code>2020–07-2T12:15:20.000Z+01:00</code></p></li></ul>
*/
@property (nonatomic, strong) NSDate * _Nullable departureTime;

Expand All @@ -914,6 +925,11 @@ typedef NS_ENUM(NSInteger, AWSLocationVehicleWeightUnit) {
*/
@property (nonatomic, strong) NSString * _Nullable key;

/**
<p>Specifies the distance to optimize for when calculating a route.</p>
*/
@property (nonatomic, assign) AWSLocationOptimizationMode optimizeFor;

/**
<p>Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility. You can choose <code>Car</code>, <code>Truck</code>, <code>Walking</code>, <code>Bicycle</code> or <code>Motorcycle</code> as options for the <code>TravelMode</code>.</p><note><p><code>Bicycle</code> and <code>Motorcycle</code> are only valid when using Grab as a data provider, and only within Southeast Asia.</p><p><code>Truck</code> is not available for Grab.</p><p>For more details on the using Grab for routing, including areas of coverage, see <a href="https://docs.aws.amazon.com/location/latest/developerguide/grab.html">GrabMaps</a> in the <i>Amazon Location Service Developer Guide</i>.</p></note><p>The <code>TravelMode</code> you specify also determines how you specify route preferences: </p><ul><li><p>If traveling by <code>Car</code> use the <code>CarModeOptions</code> parameter.</p></li><li><p>If traveling by <code>Truck</code> use the <code>TruckModeOptions</code> parameter.</p></li></ul><p>Default Value: <code>Car</code></p>
*/
Expand Down Expand Up @@ -2536,7 +2552,7 @@ typedef NS_ENUM(NSInteger, AWSLocationVehicleWeightUnit) {


/**
<p>The geomerty used to filter device positions.</p>
<p>The geometry used to filter device positions.</p>
*/
@property (nonatomic, strong) AWSLocationTrackingFilterGeometry * _Nullable filterGeometry;

Expand Down Expand Up @@ -3305,6 +3321,11 @@ typedef NS_ENUM(NSInteger, AWSLocationVehicleWeightUnit) {
*/
@property (nonatomic, strong) NSString * _Nullable street;

/**
<p>An area that's part of a larger municipality. For example, <code>Blissville </code> is a submunicipality in the Queen County in New York.</p><note><p>This property supported by Esri and OpenData. The Esri property is <code>district</code>, and the OpenData property is <code>borough</code>.</p></note>
*/
@property (nonatomic, strong) NSString * _Nullable subMunicipality;

/**
<p>A county, or an area that's part of a larger region. For example, <code>Metro Vancouver</code>.</p>
*/
Expand Down
32 changes: 32 additions & 0 deletions AWSLocation/AWSLocationModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ + (BOOL)supportsSecureCoding {

+ (NSDictionary *)JSONKeyPathsByPropertyKey {
return @{
@"arrivalTime" : @"ArrivalTime",
@"calculatorName" : @"CalculatorName",
@"carModeOptions" : @"CarModeOptions",
@"departNow" : @"DepartNow",
Expand All @@ -739,12 +740,21 @@ + (NSDictionary *)JSONKeyPathsByPropertyKey {
@"distanceUnit" : @"DistanceUnit",
@"includeLegGeometry" : @"IncludeLegGeometry",
@"key" : @"Key",
@"optimizeFor" : @"OptimizeFor",
@"travelMode" : @"TravelMode",
@"truckModeOptions" : @"TruckModeOptions",
@"waypointPositions" : @"WaypointPositions",
};
}

+ (NSValueTransformer *)arrivalTimeJSONTransformer {
return [AWSMTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSNumber *number) {
return [NSDate dateWithTimeIntervalSince1970:[number doubleValue]];
} reverseBlock:^id(NSDate *date) {
return [NSString stringWithFormat:@"%f", [date timeIntervalSince1970]];
}];
}

+ (NSValueTransformer *)carModeOptionsJSONTransformer {
return [NSValueTransformer awsmtl_JSONDictionaryTransformerWithModelClass:[AWSLocationCalculateRouteCarModeOptions class]];
}
Expand Down Expand Up @@ -778,6 +788,27 @@ + (NSValueTransformer *)distanceUnitJSONTransformer {
}];
}

+ (NSValueTransformer *)optimizeForJSONTransformer {
return [AWSMTLValueTransformer reversibleTransformerWithForwardBlock:^NSNumber *(NSString *value) {
if ([value caseInsensitiveCompare:@"FastestRoute"] == NSOrderedSame) {
return @(AWSLocationOptimizationModeFastestRoute);
}
if ([value caseInsensitiveCompare:@"ShortestRoute"] == NSOrderedSame) {
return @(AWSLocationOptimizationModeShortestRoute);
}
return @(AWSLocationOptimizationModeUnknown);
} reverseBlock:^NSString *(NSNumber *value) {
switch ([value integerValue]) {
case AWSLocationOptimizationModeFastestRoute:
return @"FastestRoute";
case AWSLocationOptimizationModeShortestRoute:
return @"ShortestRoute";
default:
return nil;
}
}];
}

+ (NSValueTransformer *)travelModeJSONTransformer {
return [AWSMTLValueTransformer reversibleTransformerWithForwardBlock:^NSNumber *(NSString *value) {
if ([value caseInsensitiveCompare:@"Car"] == NSOrderedSame) {
Expand Down Expand Up @@ -3307,6 +3338,7 @@ + (NSDictionary *)JSONKeyPathsByPropertyKey {
@"postalCode" : @"PostalCode",
@"region" : @"Region",
@"street" : @"Street",
@"subMunicipality" : @"SubMunicipality",
@"subRegion" : @"SubRegion",
@"supplementalCategories" : @"SupplementalCategories",
@"timeZone" : @"TimeZone",
Expand Down
23 changes: 21 additions & 2 deletions AWSLocation/AWSLocationResources.m
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,10 @@ - (NSString *)definitionString {
\"DestinationPosition\"\
],\
\"members\":{\
\"ArrivalTime\":{\
\"shape\":\"Timestamp\",\
\"documentation\":\"<p>Specifies the desired time of arrival. Uses the given time to calculate the route. Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p> <note> <p>ArrivalTime is not supported Esri.</p> </note>\"\
},\
\"CalculatorName\":{\
\"shape\":\"ResourceName\",\
\"documentation\":\"<p>The name of the route calculator resource that you want to use to calculate the route. </p>\",\
Expand All @@ -1947,7 +1951,7 @@ - (NSString *)definitionString {
},\
\"DepartureTime\":{\
\"shape\":\"Timestamp\",\
\"documentation\":\"<p>Specifies the desired time of departure. Uses the given time to calculate the route. Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p> <note> <p>Setting a departure time in the past returns a <code>400 ValidationException</code> error.</p> </note> <ul> <li> <p>In <a href=\\\"https://www.iso.org/iso-8601-date-and-time-format.html\\\">ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. For example, <code>2020–07-2T12:15:20.000Z+01:00</code> </p> </li> </ul>\"\
\"documentation\":\"<p>Specifies the desired time of departure. Uses the given time to calculate the route. Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p> <ul> <li> <p>In <a href=\\\"https://www.iso.org/iso-8601-date-and-time-format.html\\\">ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. For example, <code>2020–07-2T12:15:20.000Z+01:00</code> </p> </li> </ul>\"\
},\
\"DestinationPosition\":{\
\"shape\":\"Position\",\
Expand All @@ -1967,6 +1971,10 @@ - (NSString *)definitionString {
\"location\":\"querystring\",\
\"locationName\":\"key\"\
},\
\"OptimizeFor\":{\
\"shape\":\"OptimizationMode\",\
\"documentation\":\"<p>Specifies the distance to optimize for when calculating a route.</p>\"\
},\
\"TravelMode\":{\
\"shape\":\"TravelMode\",\
\"documentation\":\"<p>Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility. You can choose <code>Car</code>, <code>Truck</code>, <code>Walking</code>, <code>Bicycle</code> or <code>Motorcycle</code> as options for the <code>TravelMode</code>.</p> <note> <p> <code>Bicycle</code> and <code>Motorcycle</code> are only valid when using Grab as a data provider, and only within Southeast Asia.</p> <p> <code>Truck</code> is not available for Grab.</p> <p>For more details on the using Grab for routing, including areas of coverage, see <a href=\\\"https://docs.aws.amazon.com/location/latest/developerguide/grab.html\\\">GrabMaps</a> in the <i>Amazon Location Service Developer Guide</i>.</p> </note> <p>The <code>TravelMode</code> you specify also determines how you specify route preferences: </p> <ul> <li> <p>If traveling by <code>Car</code> use the <code>CarModeOptions</code> parameter.</p> </li> <li> <p>If traveling by <code>Truck</code> use the <code>TruckModeOptions</code> parameter.</p> </li> </ul> <p>Default Value: <code>Car</code> </p>\"\
Expand Down Expand Up @@ -3685,7 +3693,7 @@ - (NSString *)definitionString {
\"members\":{\
\"FilterGeometry\":{\
\"shape\":\"TrackingFilterGeometry\",\
\"documentation\":\"<p>The geomerty used to filter device positions.</p>\"\
\"documentation\":\"<p>The geometry used to filter device positions.</p>\"\
},\
\"MaxResults\":{\
\"shape\":\"ListDevicePositionsRequestMaxResultsInteger\",\
Expand Down Expand Up @@ -4388,6 +4396,13 @@ - (NSString *)definitionString {
\"min\":1,\
\"pattern\":\"^[-._\\\\w]+$\"\
},\
\"OptimizationMode\":{\
\"type\":\"string\",\
\"enum\":[\
\"FastestRoute\",\
\"ShortestRoute\"\
]\
},\
\"Place\":{\
\"type\":\"structure\",\
\"required\":[\"Geometry\"],\
Expand Down Expand Up @@ -4433,6 +4448,10 @@ - (NSString *)definitionString {
\"shape\":\"String\",\
\"documentation\":\"<p>The name for a street or a road to identify a location. For example, <code>Main Street</code>.</p>\"\
},\
\"SubMunicipality\":{\
\"shape\":\"String\",\
\"documentation\":\"<p>An area that's part of a larger municipality. For example, <code>Blissville </code> is a submunicipality in the Queen County in New York.</p> <note> <p>This property supported by Esri and OpenData. The Esri property is <code>district</code>, and the OpenData property is <code>borough</code>.</p> </note>\"\
},\
\"SubRegion\":{\
\"shape\":\"String\",\
\"documentation\":\"<p>A county, or an area that's part of a larger region. For example, <code>Metro Vancouver</code>.</p>\"\
Expand Down

0 comments on commit dcaf1b7

Please sign in to comment.