@aws/amazon-location-client 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Notice.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  Amazon Location JavaScript Client
2
- Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
 
4
4
  This product includes software developed at
5
5
  Amazon Web Services, Inc. (http://aws.amazon.com/).
package/README.md CHANGED
@@ -1,82 +1,121 @@
1
1
  # Amazon Location JavaScript Client
2
2
 
3
- Distribution of the [AWS SDK for JavaScript v3](https://github.com/aws/aws-sdk-js-v3) containing the [Amazon Location client](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/) and [credential providers](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/) to be used as a script for the browser.
3
+ This is a distribution of the [AWS SDK for JavaScript v3](https://github.com/aws/aws-sdk-js-v3) containing the standalone [Maps](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-maps/), [Places](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-places/), and [Routes](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-routes/) SDKs, the [Location SDK](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/location/), our [authentication helper](https://github.com/aws-geospatial/amazon-location-utilities-auth-helper-js), and [credential providers](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/) intended for use in browsers.
4
4
 
5
- # Installation
5
+ ## Installation
6
6
 
7
- ## Usage with the browser
7
+ ### Usage with a browser
8
8
 
9
9
  Add the script to an HTML file for usage directly in the browser.
10
10
 
11
11
  ```html
12
- <script src="https://www.unpkg.com/@aws/amazon-location-client@1.x/dist/amazonLocationClient.js"></script>
12
+ <script src="https://cdn.jsdelivr.net/npm/@aws/amazon-location-client@1"></script>
13
13
  ```
14
14
 
15
- ## Usage with modules
15
+ ### Usage with modules
16
16
 
17
- We recommend to use [@aws-sdk/client-location](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/) and [@aws-sdk/credential-providers](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/) from the [AWS SDK for JavaScript v3](https://github.com/aws/aws-sdk-js-v3) for the full benefit of modularized AWS SDK.
17
+ We recommend using [@aws-sdk/client-geo-maps](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-maps/), [@aws-sdk/client-geo-places](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-places/), [@aws-sdk/client-geo-routes](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-routes/), [@aws-sdk/client-location](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/location/) and [@aws-sdk/credential-providers](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/) from the [AWS SDK for JavaScript v3](https://github.com/aws/aws-sdk-js-v3) if possible to get the full benefit of the modularized AWS SDK.
18
18
 
19
- # Usage
19
+ ## Usage
20
20
 
21
- All of the functions will be under `amazonLocationClient`.
21
+ All functions are available under the `amazonLocationClient` global.
22
22
 
23
- This example uses the Amazon Location Client to make a request that that authenticates using Amazon Cognito.
23
+ ### API Key
24
+
25
+ This example uses the Amazon Location Client to make a request that authenticates using an API key.
24
26
 
25
27
  ```html
26
- <!-- Importing Amazon Location Client -->
27
- <script src="https://www.unpkg.com/@aws/amazon-location-client@1.x/dist/amazonLocationClient.js"></script>
28
+ <!-- Import the Amazon Location Client -->
29
+ <script src="https://cdn.jsdelivr.net/npm/@aws/amazon-location-client@1"></script>
28
30
  ```
29
31
 
30
32
  ```javascript
31
- const identityPoolId = "<Identity Pool ID>";
32
-
33
- const client = new amazonLocationClient.LocationClient({
34
- region: "<Region>", // region containing Amazon Location resource
35
- credentials: amazonLocationClient.fromCognitoIdentityPool({
36
- clientConfig: {
37
- region: "<Region>", // region containing Amazon Cognito Identity Pool
38
- },
39
- identityPoolId
40
- })
41
- });
33
+ // Create an authentication helper instance using an API key and region
34
+ const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");
35
+
36
+ const client = new amazonLocationClient.GeoRoutesClient(authHelper.getClientConfig());
42
37
  const input = { ... };
43
- const command = new amazonLocationClient.CalculateRouteCommand(input);
38
+ const command = new amazonLocationClient.routes.CalculateRoutesCommand(input);
44
39
  const response = await client.send(command);
45
40
  ```
46
41
 
47
- We can further simplify the authentication process by introducing the [Amazon Location authentication helper utility library](https://github.com/aws-geospatial/amazon-location-utilities-auth-helper-js)
42
+ ### Cognito
48
43
 
49
- ```html
50
- <!-- Importing Amazon Location Client -->
51
- <script src="https://www.unpkg.com/@aws/amazon-location-client@1.x/dist/amazonLocationClient.js"></script>
52
- <!-- Importing the Amazon Location authentication helper utility library -->
53
- <script src="https://www.unpkg.com/@aws/amazon-location-utilities-auth-helper@1.x/dist/amazonLocationAuthHelper.js"></script>
44
+ This example uses the Amazon Location Client to make a request that authenticates using Amazon Cognito. For more information on setting up Amazon Cognito identity pools, please refer to this [guide](https://docs.aws.amazon.com/location/latest/developerguide/authenticating-using-cognito.html).
45
+
46
+ ```javascript
47
+ // Create an authentication helper instance using credentials from Amazon Cognito
48
+ const authHelper = await amazonLocationClient.withIdentityPoolId("<Identity Pool ID>");
49
+
50
+ const client = new amazonLocationClient.GeoRoutesClient(authHelper.getClientConfig());
51
+ const input = { ... };
52
+ const command = new amazonLocationClient.routes.CalculateRoutesCommand(input);
53
+ const response = await client.send(command);
54
+ ```
55
+
56
+ ## Documentation
57
+
58
+ The APIs for the different client SDKs are grouped separately.
59
+
60
+ ### [@aws-sdk/client-geo-maps](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-maps/)
61
+
62
+ The standalone Maps SDK commands are grouped into a `maps` namespace. For example:
63
+
64
+ ```javascript
65
+ // Create an authentication helper instance using an API key and region
66
+ const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");
67
+
68
+ const client = new amazonLocationClient.GeoMapsClient(authHelper.getClientConfig());
69
+ const input = { ... };
70
+ const command = new amazonLocationClient.maps.GetStaticMapCommand(input);
71
+ const response = await client.send(command);
54
72
  ```
55
73
 
74
+ ### [@aws-sdk/client-geo-places](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-places/)
75
+
76
+ The standalone Places SDK commands are grouped into a `places` namespace. For example:
77
+
56
78
  ```javascript
57
- const identityPoolId = "<Identity Pool ID>";
79
+ // Create an authentication helper instance using an API key and region
80
+ const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");
81
+
82
+ const client = new amazonLocationClient.GeoPlacesClient(authHelper.getClientConfig());
83
+ const input = { ... };
84
+ const command = new amazonLocationClient.places.GetPlaceCommand(input);
85
+ const response = await client.send(command);
86
+ ```
58
87
 
59
- // Create an authentication helper instance using credentials from Cognito
60
- const authHelper = await amazonLocationAuthHelper.withIdentityPoolId(identityPoolId);
88
+ ### [@aws-sdk/client-geo-routes](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-routes/)
61
89
 
62
- const client = new amazonLocationClient.LocationClient({
63
- region: "<Region>", // region containing Amazon Location resource
64
- ...authHelper.getLocationClientConfig(), // Provides configuration required to make requests to Amazon Location
65
- });
90
+ The standalone Routes SDK commands are grouped into a `routes` namespace. For example:
91
+
92
+ ```javascript
93
+ // Create an authentication helper instance using an API key and region
94
+ const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");
95
+
96
+ const client = new amazonLocationClient.GeoRoutesClient(authHelper.getClientConfig());
66
97
  const input = { ... };
67
- const command = new amazonLocationClient.CalculateRouteCommand(input);
98
+ const command = new amazonLocationClient.routes.CalculateRoutesCommand(input);
68
99
  const response = await client.send(command);
69
100
  ```
70
101
 
71
- # Documentation
102
+ ### [@aws-sdk/client-location](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/location/)
103
+
104
+ The Location SDK commands are under the top-level namespace. For example:
72
105
 
73
- Refer to [@aws-sdk/client-location](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/) and [@aws-sdk/credential-providers](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/) for documentation.
106
+ ```javascript
107
+ // Create an authentication helper instance using an API key and region
108
+ const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");
74
109
 
75
- Prefix the class from the @aws-sdk/client-location documentation with `amazonLocationClient.` when using this Amazon Location Client library.
110
+ const client = new amazonLocationClient.LocationClient(authHelper.getClientConfig());
111
+ const input = { ... };
112
+ const command = new amazonLocationClient.ListGeofencesCommand(input);
113
+ const response = await client.send(command);
114
+ ```
76
115
 
77
- - For example, `const command = new CalculateRouteCommand(input);` should be used as `const command = new amazonLocationClient.CalculateRouteCommand(input);`
116
+ Refer to [@aws-sdk/client-geo-maps](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-maps/), [@aws-sdk/client-geo-places](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-places/), [@aws-sdk/client-geo-routes](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/geo-routes/), [@aws-sdk/client-location](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/location/) and [@aws-sdk/credential-providers](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/) for further documentation.
78
117
 
79
- # Getting Help
118
+ ## Getting Help
80
119
 
81
120
  The best way to interact with our team is through GitHub.
82
121
  You can [open an issue](https://github.com/aws-geospatial/amazon-location-client-js/issues/new/choose) and choose from one of our templates for
@@ -85,15 +124,15 @@ You can [open an issue](https://github.com/aws-geospatial/amazon-location-client
85
124
  or [guidance](https://github.com/aws-geospatial/amazon-location-client-js/issues/new?assignees=&labels=guidance%2C+needs-triage&template=---questions---help.md&title=).
86
125
  If you have a support plan with [AWS Support](https://aws.amazon.com/premiumsupport/), you can also create a new support case.
87
126
 
88
- Please make sure to check out our resources too before opening an issue:
127
+ Please make sure to check out the following resources before opening an issue:
89
128
 
90
- - Our [Changelog](https://github.com/aws-geospatial/amazon-location-client-js/blob/master/CHANGELOG.md) for recent changes.
129
+ - Our [Changelog](CHANGELOG.md) for recent changes.
91
130
 
92
- # Contributing
131
+ ## Contributing
93
132
 
94
- We welcome community contributions and pull requests. See [CONTRIBUTING.md](https://github.com/aws-geospatial/amazon-location-client-js/blob/master/CONTRIBUTING.md) for information on how to set up a development environment and submit code.
133
+ We welcome community contributions and pull requests. See [CONTRIBUTING.md](CONTRIBUTING.md) for information on how to set up a development environment and submit code.
95
134
 
96
- # License
135
+ ## License
97
136
 
98
137
  Amazon Location JavaScript Client is distributed under the
99
138
  [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),