1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package location
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/location/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Reverse geocodes a given coordinate and returns a legible address. Allows you to
15// search for Places or points of interest near a given position. By using Places,
16// you agree that AWS may transmit your API queries to your selected third party
17// provider for processing, which may be outside the AWS region you are currently
18// using. Because of licensing limitations, you may not use HERE to store results
19// for locations in Japan. For more information, see the AWS Service Terms
20// (https://aws.amazon.com/service-terms/) for Amazon Location Service.
21func (c *Client) SearchPlaceIndexForPosition(ctx context.Context, params *SearchPlaceIndexForPositionInput, optFns ...func(*Options)) (*SearchPlaceIndexForPositionOutput, error) {
22	if params == nil {
23		params = &SearchPlaceIndexForPositionInput{}
24	}
25
26	result, metadata, err := c.invokeOperation(ctx, "SearchPlaceIndexForPosition", params, optFns, addOperationSearchPlaceIndexForPositionMiddlewares)
27	if err != nil {
28		return nil, err
29	}
30
31	out := result.(*SearchPlaceIndexForPositionOutput)
32	out.ResultMetadata = metadata
33	return out, nil
34}
35
36type SearchPlaceIndexForPositionInput struct {
37
38	// The name of the Place index resource you want to use for the search.
39	//
40	// This member is required.
41	IndexName *string
42
43	// Specifies a coordinate for the query defined by a longitude, and latitude.
44	//
45	// *
46	// The first position is the X coordinate, or longitude.
47	//
48	// * The second position is
49	// the Y coordinate, or latitude.
50	//
51	// For example,
52	// position=xLongitude&position=yLatitude .
53	//
54	// This member is required.
55	Position []float64
56
57	// An optional paramer. The maximum number of results returned per request. Default
58	// value: 50
59	MaxResults int32
60}
61
62type SearchPlaceIndexForPositionOutput struct {
63
64	// Returns a list of Places closest to the specified position. Each result contains
65	// additional information about the Places returned.
66	//
67	// This member is required.
68	Results []types.SearchForPositionResult
69
70	// Contains a summary of the request.
71	//
72	// This member is required.
73	Summary *types.SearchPlaceIndexForPositionSummary
74
75	// Metadata pertaining to the operation's result.
76	ResultMetadata middleware.Metadata
77}
78
79func addOperationSearchPlaceIndexForPositionMiddlewares(stack *middleware.Stack, options Options) (err error) {
80	err = stack.Serialize.Add(&awsRestjson1_serializeOpSearchPlaceIndexForPosition{}, middleware.After)
81	if err != nil {
82		return err
83	}
84	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSearchPlaceIndexForPosition{}, middleware.After)
85	if err != nil {
86		return err
87	}
88	if err = addSetLoggerMiddleware(stack, options); err != nil {
89		return err
90	}
91	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
92		return err
93	}
94	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
95		return err
96	}
97	if err = addResolveEndpointMiddleware(stack, options); err != nil {
98		return err
99	}
100	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
101		return err
102	}
103	if err = addRetryMiddlewares(stack, options); err != nil {
104		return err
105	}
106	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
107		return err
108	}
109	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
113		return err
114	}
115	if err = addClientUserAgent(stack); err != nil {
116		return err
117	}
118	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
119		return err
120	}
121	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
122		return err
123	}
124	if err = addOpSearchPlaceIndexForPositionValidationMiddleware(stack); err != nil {
125		return err
126	}
127	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addResponseErrorMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addRequestResponseLogging(stack, options); err != nil {
134		return err
135	}
136	return nil
137}
138