Skip to content

Commit

Permalink
feat(client-location): This release adds place IDs, which are unique …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
awstools committed Sep 27, 2022
1 parent a4bfd1f commit df2b1a5
Show file tree
Hide file tree
Showing 7 changed files with 655 additions and 169 deletions.
43 changes: 43 additions & 0 deletions clients/client-location/src/Location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ import {
GetMapStyleDescriptorCommandOutput,
} from "./commands/GetMapStyleDescriptorCommand";
import { GetMapTileCommand, GetMapTileCommandInput, GetMapTileCommandOutput } from "./commands/GetMapTileCommand";
import { GetPlaceCommand, GetPlaceCommandInput, GetPlaceCommandOutput } from "./commands/GetPlaceCommand";
import {
ListDevicePositionsCommand,
ListDevicePositionsCommandInput,
Expand Down Expand Up @@ -1419,6 +1420,48 @@ export class Location extends LocationClient {
}
}

/**
* <p>Finds a place by its unique ID. A <code>PlaceId</code> is returned by other search
* operations.</p>
* <note>
* <p>A PlaceId is valid only if all of the following are the same in the original
* search request and the call to <code>GetPlace</code>.</p>
* <ul>
* <li>
* <p>Customer AWS account</p>
* </li>
* <li>
* <p>AWS Region</p>
* </li>
* <li>
* <p>Data provider specified in the place index resource</p>
* </li>
* </ul>
* </note>
*/
public getPlace(args: GetPlaceCommandInput, options?: __HttpHandlerOptions): Promise<GetPlaceCommandOutput>;
public getPlace(args: GetPlaceCommandInput, cb: (err: any, data?: GetPlaceCommandOutput) => void): void;
public getPlace(
args: GetPlaceCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetPlaceCommandOutput) => void
): void;
public getPlace(
args: GetPlaceCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetPlaceCommandOutput) => void),
cb?: (err: any, data?: GetPlaceCommandOutput) => void
): Promise<GetPlaceCommandOutput> | void {
const command = new GetPlaceCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>A batch request to retrieve all device positions.</p>
*/
Expand Down
3 changes: 3 additions & 0 deletions clients/client-location/src/LocationClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ import {
GetMapStyleDescriptorCommandOutput,
} from "./commands/GetMapStyleDescriptorCommand";
import { GetMapTileCommandInput, GetMapTileCommandOutput } from "./commands/GetMapTileCommand";
import { GetPlaceCommandInput, GetPlaceCommandOutput } from "./commands/GetPlaceCommand";
import {
ListDevicePositionsCommandInput,
ListDevicePositionsCommandOutput,
Expand Down Expand Up @@ -218,6 +219,7 @@ export type ServiceInputTypes =
| GetMapSpritesCommandInput
| GetMapStyleDescriptorCommandInput
| GetMapTileCommandInput
| GetPlaceCommandInput
| ListDevicePositionsCommandInput
| ListGeofenceCollectionsCommandInput
| ListGeofencesCommandInput
Expand Down Expand Up @@ -272,6 +274,7 @@ export type ServiceOutputTypes =
| GetMapSpritesCommandOutput
| GetMapStyleDescriptorCommandOutput
| GetMapTileCommandOutput
| GetPlaceCommandOutput
| ListDevicePositionsCommandOutput
| ListGeofenceCollectionsCommandOutput
| ListGeofencesCommandOutput
Expand Down
117 changes: 117 additions & 0 deletions clients/client-location/src/commands/GetPlaceCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// smithy-typescript generated code
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { LocationClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LocationClient";
import {
GetPlaceRequest,
GetPlaceRequestFilterSensitiveLog,
GetPlaceResponse,
GetPlaceResponseFilterSensitiveLog,
} from "../models/models_0";
import {
deserializeAws_restJson1GetPlaceCommand,
serializeAws_restJson1GetPlaceCommand,
} from "../protocols/Aws_restJson1";

export interface GetPlaceCommandInput extends GetPlaceRequest {}
export interface GetPlaceCommandOutput extends GetPlaceResponse, __MetadataBearer {}

/**
* <p>Finds a place by its unique ID. A <code>PlaceId</code> is returned by other search
* operations.</p>
* <note>
* <p>A PlaceId is valid only if all of the following are the same in the original
* search request and the call to <code>GetPlace</code>.</p>
* <ul>
* <li>
* <p>Customer AWS account</p>
* </li>
* <li>
* <p>AWS Region</p>
* </li>
* <li>
* <p>Data provider specified in the place index resource</p>
* </li>
* </ul>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { LocationClient, GetPlaceCommand } from "@aws-sdk/client-location"; // ES Modules import
* // const { LocationClient, GetPlaceCommand } = require("@aws-sdk/client-location"); // CommonJS import
* const client = new LocationClient(config);
* const command = new GetPlaceCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link GetPlaceCommandInput} for command's `input` shape.
* @see {@link GetPlaceCommandOutput} for command's `response` shape.
* @see {@link LocationClientResolvedConfig | config} for LocationClient's `config` shape.
*
*/
export class GetPlaceCommand extends $Command<
GetPlaceCommandInput,
GetPlaceCommandOutput,
LocationClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: GetPlaceCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: LocationClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<GetPlaceCommandInput, GetPlaceCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "LocationClient";
const commandName = "GetPlaceCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: GetPlaceRequestFilterSensitiveLog,
outputFilterSensitiveLog: GetPlaceResponseFilterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: GetPlaceCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_restJson1GetPlaceCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetPlaceCommandOutput> {
return deserializeAws_restJson1GetPlaceCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
1 change: 1 addition & 0 deletions clients/client-location/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export * from "./GetMapGlyphsCommand";
export * from "./GetMapSpritesCommand";
export * from "./GetMapStyleDescriptorCommand";
export * from "./GetMapTileCommand";
export * from "./GetPlaceCommand";
export * from "./ListDevicePositionsCommand";
export * from "./ListGeofenceCollectionsCommand";
export * from "./ListGeofencesCommand";
Expand Down
Loading

0 comments on commit df2b1a5

Please sign in to comment.