Skip to content

Commit

Permalink
feat(client-location): This release 1) adds sub-municipality field in…
Browse files Browse the repository at this point in the history
… Places API for searching and getting places information, and 2) allows optimizing route calculation based on expected arrival time.
  • Loading branch information
awstools committed Dec 12, 2023
1 parent 5cea9af commit 98c0145
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 7 deletions.
2 changes: 2 additions & 0 deletions clients/client-location/src/commands/CalculateRouteCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export interface CalculateRouteCommandOutput extends CalculateRouteResponse, __M
* Unit: "STRING_VALUE",
* },
* },
* ArrivalTime: new Date("TIMESTAMP"),
* OptimizeFor: "STRING_VALUE",
* Key: "STRING_VALUE",
* };
* const command = new CalculateRouteCommand(input);
Expand Down
1 change: 1 addition & 0 deletions clients/client-location/src/commands/GetPlaceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface GetPlaceCommandOutput extends GetPlaceResponse, __MetadataBeare
* // SupplementalCategories: [ // PlaceSupplementalCategoryList
* // "STRING_VALUE",
* // ],
* // SubMunicipality: "STRING_VALUE",
* // },
* // };
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export interface SearchPlaceIndexForPositionCommandOutput
* // SupplementalCategories: [ // PlaceSupplementalCategoryList
* // "STRING_VALUE",
* // ],
* // SubMunicipality: "STRING_VALUE",
* // },
* // Distance: Number("double"), // required
* // PlaceId: "STRING_VALUE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export interface SearchPlaceIndexForTextCommandOutput extends SearchPlaceIndexFo
* // SupplementalCategories: [ // PlaceSupplementalCategoryList
* // "STRING_VALUE",
* // ],
* // SubMunicipality: "STRING_VALUE",
* // },
* // Distance: Number("double"),
* // Relevance: Number("double"),
Expand Down
37 changes: 32 additions & 5 deletions clients/client-location/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,11 @@ export interface CalculateRouteCarModeOptions {
*/
export type DistanceUnit = "Kilometers" | "Miles";

/**
* @public
*/
export type OptimizationMode = "FastestRoute" | "ShortestRoute";

/**
* @public
*/
Expand Down Expand Up @@ -1656,10 +1661,6 @@ export interface CalculateRouteRequest {
* <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
Expand Down Expand Up @@ -1719,6 +1720,22 @@ export interface CalculateRouteRequest {
*/
TruckModeOptions?: CalculateRouteTruckModeOptions;

/**
* @public
* <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>
*/
ArrivalTime?: Date;

/**
* @public
* <p>Specifies the distance to optimize for when calculating a route.</p>
*/
OptimizeFor?: OptimizationMode;

/**
* @public
* <p>The optional <a href="https://docs.aws.amazon.com/location/latest/developerguide/using-apikeys.html">API key</a> to authorize
Expand Down Expand Up @@ -5124,6 +5141,16 @@ export interface Place {
* to any Amazon Location categories.</p>
*/
SupplementalCategories?: string[];

/**
* @public
* <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>
*/
SubMunicipality?: string;
}

/**
Expand Down Expand Up @@ -5178,7 +5205,7 @@ export interface ListDevicePositionsRequest {

/**
* @public
* <p>The geomerty used to filter device positions.</p>
* <p>The geometry used to filter device positions.</p>
*/
FilterGeometry?: TrackingFilterGeometry;
}
Expand Down
3 changes: 3 additions & 0 deletions clients/client-location/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,15 @@ export const se_CalculateRouteCommand = async (
let body: any;
body = JSON.stringify(
take(input, {
ArrivalTime: (_) => _.toISOString().split(".")[0] + "Z",
CarModeOptions: (_) => _json(_),
DepartNow: [],
DeparturePosition: (_) => se_Position(_, context),
DepartureTime: (_) => _.toISOString().split(".")[0] + "Z",
DestinationPosition: (_) => se_Position(_, context),
DistanceUnit: [],
IncludeLegGeometry: [],
OptimizeFor: [],
TravelMode: [],
TruckModeOptions: (_) => se_CalculateRouteTruckModeOptions(_, context),
WaypointPositions: (_) => se_WaypointPositionList(_, context),
Expand Down Expand Up @@ -6856,6 +6858,7 @@ const de_Place = (output: any, context: __SerdeContext): Place => {
PostalCode: __expectString,
Region: __expectString,
Street: __expectString,
SubMunicipality: __expectString,
SubRegion: __expectString,
SupplementalCategories: _json,
TimeZone: _json,
Expand Down
35 changes: 33 additions & 2 deletions codegen/sdk-codegen/aws-models/location.json
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@
"DepartureTime": {
"target": "com.amazonaws.location#Timestamp",
"traits": {
"smithy.api#documentation": "<p>Specifies the desired time of departure. Uses the given time to calculate the route.\n Otherwise, the best time of day to travel with the best traffic conditions is used to\n calculate the route.</p>\n <note>\n <p>Setting a departure time in the past returns a <code>400\n ValidationException</code> error.</p>\n </note>\n <ul>\n <li>\n <p>In <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\">ISO\n 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. For example,\n <code>2020–07-2T12:15:20.000Z+01:00</code>\n </p>\n </li>\n </ul>"
"smithy.api#documentation": "<p>Specifies the desired time of departure. Uses the given time to calculate the route.\n Otherwise, the best time of day to travel with the best traffic conditions is used to\n calculate the route.</p>\n <ul>\n <li>\n <p>In <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\">ISO\n 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. For example,\n <code>2020–07-2T12:15:20.000Z+01:00</code>\n </p>\n </li>\n </ul>"
}
},
"DepartNow": {
Expand Down Expand Up @@ -1315,6 +1315,18 @@
"smithy.api#documentation": "<p>Specifies route preferences when traveling by <code>Truck</code>, such as avoiding\n routes that use ferries or tolls, and truck specifications to consider when choosing an\n optimal road.</p>\n <p>Requirements: <code>TravelMode</code> must be specified as <code>Truck</code>.</p>"
}
},
"ArrivalTime": {
"target": "com.amazonaws.location#Timestamp",
"traits": {
"smithy.api#documentation": "<p>Specifies the desired time of arrival. Uses the given time to calculate the route. \n Otherwise, the best time of day to travel with the best traffic conditions is used to calculate the route.</p>\n <note>\n <p>ArrivalTime is not supported Esri.</p>\n </note>"
}
},
"OptimizeFor": {
"target": "com.amazonaws.location#OptimizationMode",
"traits": {
"smithy.api#documentation": "<p>Specifies the distance to optimize for when calculating a route.</p>"
}
},
"Key": {
"target": "com.amazonaws.location#ApiKey",
"traits": {
Expand Down Expand Up @@ -4650,7 +4662,7 @@
"FilterGeometry": {
"target": "com.amazonaws.location#TrackingFilterGeometry",
"traits": {
"smithy.api#documentation": "<p>The geomerty used to filter device positions.</p>"
"smithy.api#documentation": "<p>The geometry used to filter device positions.</p>"
}
}
}
Expand Down Expand Up @@ -6617,6 +6629,19 @@
"smithy.api#pattern": "^[-._\\w]+$"
}
},
"com.amazonaws.location#OptimizationMode": {
"type": "string",
"traits": {
"smithy.api#enum": [
{
"value": "FastestRoute"
},
{
"value": "ShortestRoute"
}
]
}
},
"com.amazonaws.location#Place": {
"type": "structure",
"members": {
Expand Down Expand Up @@ -6715,6 +6740,12 @@
"traits": {
"smithy.api#documentation": "<p>Categories from the data provider that describe the Place that are not mapped\n to any Amazon Location categories.</p>"
}
},
"SubMunicipality": {
"target": "smithy.api#String",
"traits": {
"smithy.api#documentation": "<p>An area that's part of a larger municipality. For example, <code>Blissville </code> \n is a submunicipality in the Queen County in New York.</p>\n <note>\n <p>This property supported by Esri and OpenData. The Esri property is <code>district</code>, and the OpenData property is <code>borough</code>.</p>\n </note>"
}
}
},
"traits": {
Expand Down

0 comments on commit 98c0145

Please sign in to comment.