Skip to content

Commit df2b1a5

Browse files
author
awstools
committed
feat(client-location): This release adds place IDs, which are unique identifiers of places, along with a new GetPlace operation, which can be used with place IDs to find a place again later. UnitNumber and UnitType are also added as new properties of places.
1 parent a4bfd1f commit df2b1a5

File tree

7 files changed

+655
-169
lines changed

7 files changed

+655
-169
lines changed

clients/client-location/src/Location.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ import {
141141
GetMapStyleDescriptorCommandOutput,
142142
} from "./commands/GetMapStyleDescriptorCommand";
143143
import { GetMapTileCommand, GetMapTileCommandInput, GetMapTileCommandOutput } from "./commands/GetMapTileCommand";
144+
import { GetPlaceCommand, GetPlaceCommandInput, GetPlaceCommandOutput } from "./commands/GetPlaceCommand";
144145
import {
145146
ListDevicePositionsCommand,
146147
ListDevicePositionsCommandInput,
@@ -1419,6 +1420,48 @@ export class Location extends LocationClient {
14191420
}
14201421
}
14211422

1423+
/**
1424+
* <p>Finds a place by its unique ID. A <code>PlaceId</code> is returned by other search
1425+
* operations.</p>
1426+
* <note>
1427+
* <p>A PlaceId is valid only if all of the following are the same in the original
1428+
* search request and the call to <code>GetPlace</code>.</p>
1429+
* <ul>
1430+
* <li>
1431+
* <p>Customer AWS account</p>
1432+
* </li>
1433+
* <li>
1434+
* <p>AWS Region</p>
1435+
* </li>
1436+
* <li>
1437+
* <p>Data provider specified in the place index resource</p>
1438+
* </li>
1439+
* </ul>
1440+
* </note>
1441+
*/
1442+
public getPlace(args: GetPlaceCommandInput, options?: __HttpHandlerOptions): Promise<GetPlaceCommandOutput>;
1443+
public getPlace(args: GetPlaceCommandInput, cb: (err: any, data?: GetPlaceCommandOutput) => void): void;
1444+
public getPlace(
1445+
args: GetPlaceCommandInput,
1446+
options: __HttpHandlerOptions,
1447+
cb: (err: any, data?: GetPlaceCommandOutput) => void
1448+
): void;
1449+
public getPlace(
1450+
args: GetPlaceCommandInput,
1451+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetPlaceCommandOutput) => void),
1452+
cb?: (err: any, data?: GetPlaceCommandOutput) => void
1453+
): Promise<GetPlaceCommandOutput> | void {
1454+
const command = new GetPlaceCommand(args);
1455+
if (typeof optionsOrCb === "function") {
1456+
this.send(command, optionsOrCb);
1457+
} else if (typeof cb === "function") {
1458+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1459+
this.send(command, optionsOrCb || {}, cb);
1460+
} else {
1461+
return this.send(command, optionsOrCb);
1462+
}
1463+
}
1464+
14221465
/**
14231466
* <p>A batch request to retrieve all device positions.</p>
14241467
*/

clients/client-location/src/LocationClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ import {
133133
GetMapStyleDescriptorCommandOutput,
134134
} from "./commands/GetMapStyleDescriptorCommand";
135135
import { GetMapTileCommandInput, GetMapTileCommandOutput } from "./commands/GetMapTileCommand";
136+
import { GetPlaceCommandInput, GetPlaceCommandOutput } from "./commands/GetPlaceCommand";
136137
import {
137138
ListDevicePositionsCommandInput,
138139
ListDevicePositionsCommandOutput,
@@ -218,6 +219,7 @@ export type ServiceInputTypes =
218219
| GetMapSpritesCommandInput
219220
| GetMapStyleDescriptorCommandInput
220221
| GetMapTileCommandInput
222+
| GetPlaceCommandInput
221223
| ListDevicePositionsCommandInput
222224
| ListGeofenceCollectionsCommandInput
223225
| ListGeofencesCommandInput
@@ -272,6 +274,7 @@ export type ServiceOutputTypes =
272274
| GetMapSpritesCommandOutput
273275
| GetMapStyleDescriptorCommandOutput
274276
| GetMapTileCommandOutput
277+
| GetPlaceCommandOutput
275278
| ListDevicePositionsCommandOutput
276279
| ListGeofenceCollectionsCommandOutput
277280
| ListGeofencesCommandOutput
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import { LocationClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LocationClient";
16+
import {
17+
GetPlaceRequest,
18+
GetPlaceRequestFilterSensitiveLog,
19+
GetPlaceResponse,
20+
GetPlaceResponseFilterSensitiveLog,
21+
} from "../models/models_0";
22+
import {
23+
deserializeAws_restJson1GetPlaceCommand,
24+
serializeAws_restJson1GetPlaceCommand,
25+
} from "../protocols/Aws_restJson1";
26+
27+
export interface GetPlaceCommandInput extends GetPlaceRequest {}
28+
export interface GetPlaceCommandOutput extends GetPlaceResponse, __MetadataBearer {}
29+
30+
/**
31+
* <p>Finds a place by its unique ID. A <code>PlaceId</code> is returned by other search
32+
* operations.</p>
33+
* <note>
34+
* <p>A PlaceId is valid only if all of the following are the same in the original
35+
* search request and the call to <code>GetPlace</code>.</p>
36+
* <ul>
37+
* <li>
38+
* <p>Customer AWS account</p>
39+
* </li>
40+
* <li>
41+
* <p>AWS Region</p>
42+
* </li>
43+
* <li>
44+
* <p>Data provider specified in the place index resource</p>
45+
* </li>
46+
* </ul>
47+
* </note>
48+
* @example
49+
* Use a bare-bones client and the command you need to make an API call.
50+
* ```javascript
51+
* import { LocationClient, GetPlaceCommand } from "@aws-sdk/client-location"; // ES Modules import
52+
* // const { LocationClient, GetPlaceCommand } = require("@aws-sdk/client-location"); // CommonJS import
53+
* const client = new LocationClient(config);
54+
* const command = new GetPlaceCommand(input);
55+
* const response = await client.send(command);
56+
* ```
57+
*
58+
* @see {@link GetPlaceCommandInput} for command's `input` shape.
59+
* @see {@link GetPlaceCommandOutput} for command's `response` shape.
60+
* @see {@link LocationClientResolvedConfig | config} for LocationClient's `config` shape.
61+
*
62+
*/
63+
export class GetPlaceCommand extends $Command<
64+
GetPlaceCommandInput,
65+
GetPlaceCommandOutput,
66+
LocationClientResolvedConfig
67+
> {
68+
// Start section: command_properties
69+
// End section: command_properties
70+
71+
constructor(readonly input: GetPlaceCommandInput) {
72+
// Start section: command_constructor
73+
super();
74+
// End section: command_constructor
75+
}
76+
77+
/**
78+
* @internal
79+
*/
80+
resolveMiddleware(
81+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
82+
configuration: LocationClientResolvedConfig,
83+
options?: __HttpHandlerOptions
84+
): Handler<GetPlaceCommandInput, GetPlaceCommandOutput> {
85+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
86+
87+
const stack = clientStack.concat(this.middlewareStack);
88+
89+
const { logger } = configuration;
90+
const clientName = "LocationClient";
91+
const commandName = "GetPlaceCommand";
92+
const handlerExecutionContext: HandlerExecutionContext = {
93+
logger,
94+
clientName,
95+
commandName,
96+
inputFilterSensitiveLog: GetPlaceRequestFilterSensitiveLog,
97+
outputFilterSensitiveLog: GetPlaceResponseFilterSensitiveLog,
98+
};
99+
const { requestHandler } = configuration;
100+
return stack.resolve(
101+
(request: FinalizeHandlerArguments<any>) =>
102+
requestHandler.handle(request.request as __HttpRequest, options || {}),
103+
handlerExecutionContext
104+
);
105+
}
106+
107+
private serialize(input: GetPlaceCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
108+
return serializeAws_restJson1GetPlaceCommand(input, context);
109+
}
110+
111+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetPlaceCommandOutput> {
112+
return deserializeAws_restJson1GetPlaceCommand(output, context);
113+
}
114+
115+
// Start section: command_body_extra
116+
// End section: command_body_extra
117+
}

clients/client-location/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export * from "./GetMapGlyphsCommand";
3131
export * from "./GetMapSpritesCommand";
3232
export * from "./GetMapStyleDescriptorCommand";
3333
export * from "./GetMapTileCommand";
34+
export * from "./GetPlaceCommand";
3435
export * from "./ListDevicePositionsCommand";
3536
export * from "./ListGeofenceCollectionsCommand";
3637
export * from "./ListGeofencesCommand";

0 commit comments

Comments
 (0)