@azure-rest/maps-search 2.0.0-beta.2 → 2.0.0-beta.4
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/CHANGELOG.md +59 -0
- package/LICENSE +4 -4
- package/README.md +80 -90
- package/dist/browser/MapsSearch.d.ts +53 -0
- package/dist/browser/MapsSearch.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/MapsSearch.js +1 -1
- package/dist/browser/MapsSearch.js.map +1 -0
- package/dist/browser/generated/clientDefinitions.d.ts +137 -0
- package/dist/browser/generated/clientDefinitions.d.ts.map +1 -0
- package/dist/browser/generated/clientDefinitions.js +4 -0
- package/dist/browser/generated/clientDefinitions.js.map +1 -0
- package/dist/browser/generated/index.d.ts +10 -0
- package/dist/browser/generated/index.d.ts.map +1 -0
- package/dist/browser/generated/index.js +12 -0
- package/dist/browser/generated/index.js.map +1 -0
- package/dist/browser/generated/isUnexpected.d.ts +7 -0
- package/dist/browser/generated/isUnexpected.d.ts.map +1 -0
- package/dist/browser/generated/isUnexpected.js +74 -0
- package/dist/browser/generated/isUnexpected.js.map +1 -0
- package/dist/browser/generated/logger.d.ts +2 -0
- package/dist/browser/generated/logger.d.ts.map +1 -0
- package/dist/browser/generated/logger.js.map +1 -0
- package/dist/browser/generated/mapsSearchClient.d.ts +15 -0
- package/dist/browser/generated/mapsSearchClient.d.ts.map +1 -0
- package/dist/browser/generated/mapsSearchClient.js +44 -0
- package/dist/browser/generated/mapsSearchClient.js.map +1 -0
- package/dist/browser/generated/models.d.ts +97 -0
- package/dist/browser/generated/models.d.ts.map +1 -0
- package/dist/browser/generated/models.js +4 -0
- package/dist/browser/generated/models.js.map +1 -0
- package/dist/browser/generated/outputModels.d.ts +298 -0
- package/dist/browser/generated/outputModels.d.ts.map +1 -0
- package/dist/browser/generated/outputModels.js +4 -0
- package/dist/browser/generated/outputModels.js.map +1 -0
- package/dist/browser/generated/parameters.d.ts +135 -0
- package/dist/browser/generated/parameters.d.ts.map +1 -0
- package/dist/browser/generated/parameters.js +4 -0
- package/dist/browser/generated/parameters.js.map +1 -0
- package/dist/browser/generated/responses.d.ts +255 -0
- package/dist/browser/generated/responses.d.ts.map +1 -0
- package/dist/browser/generated/responses.js +4 -0
- package/dist/browser/generated/responses.js.map +1 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +6 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/logger.d.ts +2 -0
- package/dist/browser/logger.d.ts.map +1 -0
- package/dist/browser/logger.js +5 -0
- package/dist/browser/package.json +3 -0
- package/dist/commonjs/MapsSearch.d.ts +53 -0
- package/dist/commonjs/MapsSearch.d.ts.map +1 -0
- package/dist/commonjs/MapsSearch.js +44 -0
- package/dist/commonjs/MapsSearch.js.map +1 -0
- package/dist/commonjs/generated/clientDefinitions.d.ts +137 -0
- package/dist/commonjs/generated/clientDefinitions.d.ts.map +1 -0
- package/dist/commonjs/generated/clientDefinitions.js +5 -0
- package/dist/commonjs/generated/clientDefinitions.js.map +1 -0
- package/dist/commonjs/generated/index.d.ts +10 -0
- package/dist/commonjs/generated/index.d.ts.map +1 -0
- package/dist/commonjs/generated/index.js +15 -0
- package/dist/commonjs/generated/index.js.map +1 -0
- package/dist/commonjs/generated/isUnexpected.d.ts +7 -0
- package/dist/commonjs/generated/isUnexpected.d.ts.map +1 -0
- package/dist/commonjs/generated/isUnexpected.js +77 -0
- package/dist/commonjs/generated/isUnexpected.js.map +1 -0
- package/dist/commonjs/generated/logger.d.ts +2 -0
- package/dist/commonjs/generated/logger.d.ts.map +1 -0
- package/dist/commonjs/generated/logger.js +8 -0
- package/dist/commonjs/generated/logger.js.map +1 -0
- package/dist/commonjs/generated/mapsSearchClient.d.ts +15 -0
- package/dist/commonjs/generated/mapsSearchClient.d.ts.map +1 -0
- package/dist/commonjs/generated/mapsSearchClient.js +47 -0
- package/dist/commonjs/generated/mapsSearchClient.js.map +1 -0
- package/dist/commonjs/generated/models.d.ts +97 -0
- package/dist/commonjs/generated/models.d.ts.map +1 -0
- package/dist/commonjs/generated/models.js +5 -0
- package/dist/commonjs/generated/models.js.map +1 -0
- package/dist/commonjs/generated/outputModels.d.ts +298 -0
- package/dist/commonjs/generated/outputModels.d.ts.map +1 -0
- package/dist/commonjs/generated/outputModels.js +5 -0
- package/dist/commonjs/generated/outputModels.js.map +1 -0
- package/dist/commonjs/generated/parameters.d.ts +135 -0
- package/dist/commonjs/generated/parameters.d.ts.map +1 -0
- package/dist/commonjs/generated/parameters.js +5 -0
- package/dist/commonjs/generated/parameters.js.map +1 -0
- package/dist/commonjs/generated/responses.d.ts +255 -0
- package/dist/commonjs/generated/responses.d.ts.map +1 -0
- package/dist/commonjs/generated/responses.js +5 -0
- package/dist/commonjs/generated/responses.js.map +1 -0
- package/dist/commonjs/index.d.ts +4 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +9 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/logger.d.ts +2 -0
- package/dist/commonjs/logger.d.ts.map +1 -0
- package/dist/commonjs/logger.js +8 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/esm/MapsSearch.d.ts +53 -0
- package/dist/esm/MapsSearch.d.ts.map +1 -0
- package/dist/esm/MapsSearch.js +40 -0
- package/dist/esm/MapsSearch.js.map +1 -0
- package/dist/esm/generated/clientDefinitions.d.ts +137 -0
- package/dist/esm/generated/clientDefinitions.d.ts.map +1 -0
- package/dist/esm/generated/clientDefinitions.js +4 -0
- package/dist/esm/generated/clientDefinitions.js.map +1 -0
- package/dist/esm/generated/index.d.ts +10 -0
- package/dist/esm/generated/index.d.ts.map +1 -0
- package/dist/esm/generated/index.js +12 -0
- package/dist/esm/generated/index.js.map +1 -0
- package/dist/esm/generated/isUnexpected.d.ts +7 -0
- package/dist/esm/generated/isUnexpected.d.ts.map +1 -0
- package/dist/esm/generated/isUnexpected.js +74 -0
- package/dist/esm/generated/isUnexpected.js.map +1 -0
- package/dist/esm/generated/logger.d.ts +2 -0
- package/dist/esm/generated/logger.d.ts.map +1 -0
- package/dist/esm/generated/logger.js +5 -0
- package/dist/esm/generated/logger.js.map +1 -0
- package/dist/esm/generated/mapsSearchClient.d.ts +15 -0
- package/dist/esm/generated/mapsSearchClient.d.ts.map +1 -0
- package/dist/esm/generated/mapsSearchClient.js +44 -0
- package/dist/esm/generated/mapsSearchClient.js.map +1 -0
- package/dist/esm/generated/models.d.ts +97 -0
- package/dist/esm/generated/models.d.ts.map +1 -0
- package/dist/esm/generated/models.js +4 -0
- package/dist/esm/generated/models.js.map +1 -0
- package/dist/esm/generated/outputModels.d.ts +298 -0
- package/dist/esm/generated/outputModels.d.ts.map +1 -0
- package/dist/esm/generated/outputModels.js +4 -0
- package/dist/esm/generated/outputModels.js.map +1 -0
- package/dist/esm/generated/parameters.d.ts +135 -0
- package/dist/esm/generated/parameters.d.ts.map +1 -0
- package/dist/esm/generated/parameters.js +4 -0
- package/dist/esm/generated/parameters.js.map +1 -0
- package/dist/esm/generated/responses.d.ts +255 -0
- package/dist/esm/generated/responses.d.ts.map +1 -0
- package/dist/esm/generated/responses.js +4 -0
- package/dist/esm/generated/responses.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.d.ts +2 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +5 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/react-native/MapsSearch.d.ts +53 -0
- package/dist/react-native/MapsSearch.d.ts.map +1 -0
- package/dist/react-native/MapsSearch.js +40 -0
- package/dist/react-native/MapsSearch.js.map +1 -0
- package/dist/react-native/generated/clientDefinitions.d.ts +137 -0
- package/dist/react-native/generated/clientDefinitions.d.ts.map +1 -0
- package/dist/react-native/generated/clientDefinitions.js +4 -0
- package/dist/react-native/generated/clientDefinitions.js.map +1 -0
- package/dist/react-native/generated/index.d.ts +10 -0
- package/dist/react-native/generated/index.d.ts.map +1 -0
- package/dist/react-native/generated/index.js +12 -0
- package/dist/react-native/generated/index.js.map +1 -0
- package/dist/react-native/generated/isUnexpected.d.ts +7 -0
- package/dist/react-native/generated/isUnexpected.d.ts.map +1 -0
- package/dist/react-native/generated/isUnexpected.js +74 -0
- package/dist/react-native/generated/isUnexpected.js.map +1 -0
- package/dist/react-native/generated/logger.d.ts +2 -0
- package/dist/react-native/generated/logger.d.ts.map +1 -0
- package/dist/react-native/generated/logger.js +5 -0
- package/dist/react-native/generated/logger.js.map +1 -0
- package/dist/react-native/generated/mapsSearchClient.d.ts +15 -0
- package/dist/react-native/generated/mapsSearchClient.d.ts.map +1 -0
- package/dist/react-native/generated/mapsSearchClient.js +44 -0
- package/dist/react-native/generated/mapsSearchClient.js.map +1 -0
- package/dist/react-native/generated/models.d.ts +97 -0
- package/dist/react-native/generated/models.d.ts.map +1 -0
- package/dist/react-native/generated/models.js +4 -0
- package/dist/react-native/generated/models.js.map +1 -0
- package/dist/react-native/generated/outputModels.d.ts +298 -0
- package/dist/react-native/generated/outputModels.d.ts.map +1 -0
- package/dist/react-native/generated/outputModels.js +4 -0
- package/dist/react-native/generated/outputModels.js.map +1 -0
- package/dist/react-native/generated/parameters.d.ts +135 -0
- package/dist/react-native/generated/parameters.d.ts.map +1 -0
- package/dist/react-native/generated/parameters.js +4 -0
- package/dist/react-native/generated/parameters.js.map +1 -0
- package/dist/react-native/generated/responses.d.ts +255 -0
- package/dist/react-native/generated/responses.d.ts.map +1 -0
- package/dist/react-native/generated/responses.js +4 -0
- package/dist/react-native/generated/responses.js.map +1 -0
- package/dist/react-native/index.d.ts +4 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +6 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/logger.d.ts +2 -0
- package/dist/react-native/logger.d.ts.map +1 -0
- package/dist/react-native/logger.js +5 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/package.json +88 -74
- package/dist/index.js +0 -171
- package/dist/index.js.map +0 -1
- package/dist-esm/src/MapsSearch.js.map +0 -1
- package/dist-esm/src/index.js +0 -6
- package/dist-esm/src/index.js.map +0 -1
- package/types/maps-search-rest.d.ts +0 -1066
- /package/{dist-esm/src → dist/browser/generated}/logger.js +0 -0
- /package/{dist-esm/src → dist/browser}/logger.js.map +0 -0
- /package/review/{maps-search.api.md → maps-search-node.api.md} +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Release History
|
|
2
|
+
|
|
3
|
+
## 2.0.0-beta.4 (Unreleased)
|
|
4
|
+
|
|
5
|
+
### Features Added
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
### Bugs Fixed
|
|
10
|
+
|
|
11
|
+
### Other Changes
|
|
12
|
+
|
|
13
|
+
## 2.0.0-beta.3 (2025-03-14)
|
|
14
|
+
|
|
15
|
+
### Bugs Fixed
|
|
16
|
+
|
|
17
|
+
- Fix ESM module file not found.
|
|
18
|
+
|
|
19
|
+
## 2.0.0-beta.2 (2024-12-10)
|
|
20
|
+
|
|
21
|
+
### Breaking Changes
|
|
22
|
+
|
|
23
|
+
- Marked fields in various interfaces as readonly, which may impact code that previously modified these properties.
|
|
24
|
+
|
|
25
|
+
### Bugs Fixed
|
|
26
|
+
|
|
27
|
+
- Fix the Microsoft Entra ID authentication when providing `baseUrl`.
|
|
28
|
+
|
|
29
|
+
## 2.0.0-beta.1 (2024-01-09)
|
|
30
|
+
|
|
31
|
+
### Features Added
|
|
32
|
+
|
|
33
|
+
- Introducing compliant [Maps Search V2](https://learn.microsoft.com/rest/api/maps/search?view=rest-maps-2023-06-01) features:
|
|
34
|
+
- `/geocode`, `/geocode:batch`: Turn an address to coordinates. Replace the v1 `/search/address`, `/search/address/batch/sync/`.
|
|
35
|
+
- `/reverseGeocode`, `/reverseGeocode:batch`: Turn coordinates to an address. Replace the v1 `/search/address/reverse`, `/search/address/batch/reverse/sync/`.
|
|
36
|
+
- `/search/polygon`: Supplies polygon data of a geographical area outline such as a city or a country region. Replace the v1 `/search/polygon`.
|
|
37
|
+
- Support SAS token authentication.
|
|
38
|
+
|
|
39
|
+
### Breaking Changes
|
|
40
|
+
|
|
41
|
+
- All the paths in V1 are now deprecated. Please follow the section "Use V1 SDK" in README if you find paths in V1 are still needed.
|
|
42
|
+
|
|
43
|
+
## 1.0.0-beta.3 (2023-07-11)
|
|
44
|
+
|
|
45
|
+
### Other Changes
|
|
46
|
+
|
|
47
|
+
- Update README.
|
|
48
|
+
|
|
49
|
+
## 1.0.0-beta.2 (2023-02-07)
|
|
50
|
+
|
|
51
|
+
### Bugs Fixed
|
|
52
|
+
|
|
53
|
+
- Correct the path of the type declaration file.
|
|
54
|
+
|
|
55
|
+
## 1.0.0-beta.1 (2023-01-10)
|
|
56
|
+
|
|
57
|
+
### Features Added
|
|
58
|
+
|
|
59
|
+
- Initial Release
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
Copyright (c) Microsoft Corporation.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MIT License
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -12,10 +12,10 @@ furnished to do so, subject to the following conditions:
|
|
|
12
12
|
The above copyright notice and this permission notice shall be included in all
|
|
13
13
|
copies or substantial portions of the Software.
|
|
14
14
|
|
|
15
|
-
THE SOFTWARE IS PROVIDED
|
|
15
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@ Key links:
|
|
|
8
8
|
|
|
9
9
|
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-search-rest)
|
|
10
10
|
- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/maps-search)
|
|
11
|
-
- [API reference documentation](https://
|
|
11
|
+
- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure-rest/maps-search?view=azure-node-preview)
|
|
12
12
|
- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-search-rest/samples)
|
|
13
|
-
- [Product Information](https://
|
|
13
|
+
- [Product Information](https://learn.microsoft.com/rest/api/maps/search)
|
|
14
14
|
|
|
15
15
|
| Package Version | Service Version |
|
|
16
16
|
| --------------- | --------------- |
|
|
@@ -27,9 +27,9 @@ Key links:
|
|
|
27
27
|
### Prerequisites
|
|
28
28
|
|
|
29
29
|
- You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package.
|
|
30
|
-
- An [Azure Maps account](https://
|
|
30
|
+
- An [Azure Maps account](https://learn.microsoft.com/azure/azure-maps/how-to-manage-account-keys). You can create the resource via the [Azure Portal](https://portal.azure.com), the [Azure PowerShell](https://learn.microsoft.com/powershell/module/az.maps/new-azmapsaccount), or the [Azure CLI](https://learn.microsoft.com/cli/azure).
|
|
31
31
|
|
|
32
|
-
If you use Azure CLI, replace `<resource-group-name>` and `<map-account-name>` of your choice, and select a proper [pricing tier](https://
|
|
32
|
+
If you use Azure CLI, replace `<resource-group-name>` and `<map-account-name>` of your choice, and select a proper [pricing tier](https://learn.microsoft.com/azure/azure-maps/choose-pricing-tier) based on your needs via the `<sku-name>` parameter. Please refer to [this page](https://learn.microsoft.com/cli/azure/maps/account?view=azure-cli-latest#az_maps_account_create) for more details.
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
35
|
az maps account create --resource-group <resource-group-name> --name <map-account-name> --sku <sku-name>
|
|
@@ -55,16 +55,16 @@ You can authenticate with Microsoft Entra ID using the [Azure Identity library](
|
|
|
55
55
|
npm install @azure/identity
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
You will also need to register a new Microsoft Entra ID application and grant access to Azure Maps by assigning the suitable role to your service principal. Please refer to the [Manage authentication](https://
|
|
58
|
+
You will also need to register a new Microsoft Entra ID application and grant access to Azure Maps by assigning the suitable role to your service principal. Please refer to the [Manage authentication](https://learn.microsoft.com/azure/azure-maps/how-to-manage-authentication) page.
|
|
59
59
|
|
|
60
60
|
Set the values of the client ID, tenant ID, and client secret of the Microsoft Entra ID application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
|
|
61
61
|
|
|
62
62
|
You will also need to specify the Azure Maps resource you intend to use by specifying the `clientId` in the client options.
|
|
63
|
-
The Azure Maps resource client id can be found in the Authentication sections in the Azure Maps resource. Please refer to the [documentation](https://
|
|
63
|
+
The Azure Maps resource client id can be found in the Authentication sections in the Azure Maps resource. Please refer to the [documentation](https://learn.microsoft.com/azure/azure-maps/how-to-manage-authentication#view-authentication-details) on how to find it.
|
|
64
64
|
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
```ts snippet:ReadmeSampleCreateClient_TokenCredential
|
|
66
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
67
|
+
import MapsSearch from "@azure-rest/maps-search";
|
|
68
68
|
|
|
69
69
|
const credential = new DefaultAzureCredential();
|
|
70
70
|
const client = MapsSearch(credential, "<maps-account-client-id>");
|
|
@@ -74,9 +74,9 @@ const client = MapsSearch(credential, "<maps-account-client-id>");
|
|
|
74
74
|
|
|
75
75
|
You can authenticate with your Azure Maps Subscription Key.
|
|
76
76
|
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
```ts snippet:ReadmeSampleCreateClient_SubscriptionKey
|
|
78
|
+
import { AzureKeyCredential } from "@azure/core-auth";
|
|
79
|
+
import MapsSearch from "@azure-rest/maps-search";
|
|
80
80
|
|
|
81
81
|
const credential = new AzureKeyCredential("<subscription-key>");
|
|
82
82
|
const client = MapsSearch(credential);
|
|
@@ -98,11 +98,11 @@ npm install @azure/core-auth
|
|
|
98
98
|
|
|
99
99
|
Finally, you can use the SAS token to authenticate the client:
|
|
100
100
|
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
```ts snippet:ReadmeSampleCreateClient_SAS
|
|
102
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
103
|
+
import { AzureMapsManagementClient } from "@azure/arm-maps";
|
|
104
|
+
import { AzureSASCredential } from "@azure/core-auth";
|
|
105
|
+
import MapsSearch from "@azure-rest/maps-search";
|
|
106
106
|
|
|
107
107
|
const subscriptionId = "<subscription ID of the map account>";
|
|
108
108
|
const resourceGroupName = "<resource group name of the map account>";
|
|
@@ -114,6 +114,7 @@ const mapsAccountSasParameters = {
|
|
|
114
114
|
principalId: "<principle ID (object ID) of the managed identity>",
|
|
115
115
|
signingKey: "primaryKey",
|
|
116
116
|
};
|
|
117
|
+
|
|
117
118
|
const credential = new DefaultAzureCredential();
|
|
118
119
|
const managementClient = new AzureMapsManagementClient(credential, subscriptionId);
|
|
119
120
|
const { accountSasToken } = await managementClient.accounts.listSas(
|
|
@@ -121,9 +122,11 @@ const { accountSasToken } = await managementClient.accounts.listSas(
|
|
|
121
122
|
accountName,
|
|
122
123
|
mapsAccountSasParameters,
|
|
123
124
|
);
|
|
125
|
+
|
|
124
126
|
if (accountSasToken === undefined) {
|
|
125
127
|
throw new Error("No accountSasToken was found for the Maps Account.");
|
|
126
128
|
}
|
|
129
|
+
|
|
127
130
|
const sasCredential = new AzureSASCredential(accountSasToken);
|
|
128
131
|
const client = MapsSearch(sasCredential);
|
|
129
132
|
```
|
|
@@ -145,41 +148,36 @@ The following sections provide several code snippets covering some of the most c
|
|
|
145
148
|
|
|
146
149
|
You can use an authenticated client to convert an address into latitude and longitude coordinates. This process is also called geocoding. In addition to returning the coordinates, the response will also return detailed address properties such as postal code, admin districts, and country/region information.
|
|
147
150
|
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const { isUnexpected } = require("@azure-rest/maps-search");
|
|
151
|
+
```ts snippet:ReadmeSampleGeocode
|
|
152
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
153
|
+
import MapsSearch, { isUnexpected } from "@azure-rest/maps-search";
|
|
152
154
|
|
|
153
|
-
|
|
154
|
-
const client = MapsSearch(
|
|
155
|
+
const credential = new DefaultAzureCredential();
|
|
156
|
+
const client = MapsSearch(credential, "<maps-account-client-id>");
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
/** Log the response body. */
|
|
166
|
-
if (!response.body.features) {
|
|
167
|
-
console.log(`No coordinates found for the address.`);
|
|
168
|
-
} else {
|
|
169
|
-
console.log(`The followings are the possible coordinates of the address:`);
|
|
170
|
-
for (const result of response.body.features) {
|
|
171
|
-
const [lon, lat] = result.geometry.coordinates;
|
|
172
|
-
console.log(`Latitude: ${lat}, Longitude ${lon}`);
|
|
173
|
-
console.log("Postal code: ", result.properties?.address?.postalCode);
|
|
174
|
-
console.log("Admin districts: ", result.properties?.address?.adminDistricts?.join(", "));
|
|
175
|
-
console.log("Country region: ", result.properties?.address?.countryRegion);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
158
|
+
/** Make a request to the geocoding API */
|
|
159
|
+
const response = await client
|
|
160
|
+
.path("/geocode")
|
|
161
|
+
.get({ queryParameters: { query: "400 Broad, Seattle" } });
|
|
162
|
+
// @ts-preserve-whitespaces
|
|
163
|
+
/** Handle error response */
|
|
164
|
+
if (isUnexpected(response)) {
|
|
165
|
+
throw response.body.error;
|
|
178
166
|
}
|
|
179
167
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
168
|
+
/** Log the response body. */
|
|
169
|
+
if (!response.body.features) {
|
|
170
|
+
console.log(`No coordinates found for the address.`);
|
|
171
|
+
} else {
|
|
172
|
+
console.log(`The followings are the possible coordinates of the address:`);
|
|
173
|
+
for (const result of response.body.features) {
|
|
174
|
+
const [lon, lat] = result.geometry.coordinates;
|
|
175
|
+
console.log(`Latitude: ${lat}, Longitude ${lon}`);
|
|
176
|
+
console.log("Postal code: ", result.properties?.address?.postalCode);
|
|
177
|
+
console.log("Admin districts: ", result.properties?.address?.adminDistricts?.join(", "));
|
|
178
|
+
console.log("Country region: ", result.properties?.address?.countryRegion);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
183
181
|
```
|
|
184
182
|
|
|
185
183
|
### Make a Reverse Address Search to translate coordinate location to street address
|
|
@@ -187,40 +185,35 @@ main().catch((err) => {
|
|
|
187
185
|
You can translate coordinates into human readable street addresses. This process is also called reverse geocoding.
|
|
188
186
|
This is often used for applications that consume GPS feeds and want to discover addresses at specific coordinate points.
|
|
189
187
|
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const { isUnexpected } = require("@azure-rest/maps-search");
|
|
188
|
+
```ts snippet:ReadmeSampleReverseGeocode
|
|
189
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
190
|
+
import MapsSearch, { isUnexpected } from "@azure-rest/maps-search";
|
|
194
191
|
|
|
195
|
-
|
|
196
|
-
const client = MapsSearch(
|
|
192
|
+
const credential = new DefaultAzureCredential();
|
|
193
|
+
const client = MapsSearch(credential, "<maps-account-client-id>");
|
|
197
194
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
195
|
+
/** Make the request. */
|
|
196
|
+
const response = await client.path("/reverseGeocode").get({
|
|
197
|
+
queryParameters: { coordinates: [-121.89, 37.337] }, // [longitude, latitude],
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
/** Handle error response. */
|
|
201
|
+
if (isUnexpected(response)) {
|
|
202
|
+
throw response.body.error;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (!response.body.features || response.body.features.length === 0) {
|
|
206
|
+
console.log("No results found.");
|
|
207
|
+
} else {
|
|
208
|
+
/** Log the response body. */
|
|
209
|
+
for (const feature of response.body.features) {
|
|
210
|
+
if (feature.properties?.address?.formattedAddress) {
|
|
211
|
+
console.log(feature.properties.address.formattedAddress);
|
|
212
|
+
} else {
|
|
213
|
+
console.log("No address found.");
|
|
217
214
|
}
|
|
218
215
|
}
|
|
219
216
|
}
|
|
220
|
-
|
|
221
|
-
main().catch((err) => {
|
|
222
|
-
console.log(err);
|
|
223
|
-
});
|
|
224
217
|
```
|
|
225
218
|
|
|
226
219
|
## Use V1 SDK
|
|
@@ -234,19 +227,17 @@ npm install @azure-rest/map-search-v2@npm:@azure-rest/map-search@^2.0.0
|
|
|
234
227
|
|
|
235
228
|
Then, you can import the two packages:
|
|
236
229
|
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
|
|
230
|
+
```ts snippet:ignore
|
|
231
|
+
import MapsSearchV1 from "@azure-rest/map-search-v1";
|
|
232
|
+
import MapsSearchV2 from "@azure-rest/map-search-v2";
|
|
240
233
|
```
|
|
241
234
|
|
|
242
235
|
In the following example, we want to accept an address and search POIs around it. We'll use V2 SDK to get the coordinate of the address(/geocode), and use V1 SDK to search POIs around it(/search/nearby).
|
|
243
236
|
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const { isUnexpected: isUnexpectedV1 } = require("@azure-rest/maps-search-v1");
|
|
249
|
-
const { isUnexpected: isUnexpectedV2 } = require("@azure-rest/maps-search-v2");
|
|
237
|
+
```ts snippet:ignore
|
|
238
|
+
import MapsSearchV1, { isUnexpected: isUnexpectedV1 } from "@azure-rest/map-search-v1";
|
|
239
|
+
import MapsSearchV2, { isUnexpected: isUnexpectedV2 } from "@azure-rest/map-search-v2";
|
|
240
|
+
import { AzureKeyCredential } from "@azure/core-auth";
|
|
250
241
|
|
|
251
242
|
/** Initialize the MapsSearchClient */
|
|
252
243
|
const clientV1 = MapsSearchV1(new AzureKeyCredential("<subscription-key>"));
|
|
@@ -257,6 +248,7 @@ async function searchNearby(address) {
|
|
|
257
248
|
const geocodeResponse = await clientV2
|
|
258
249
|
.path("/geocode")
|
|
259
250
|
.get({ queryParameters: { query: address } });
|
|
251
|
+
|
|
260
252
|
/** Handle error response */
|
|
261
253
|
if (isUnexpectedV2(geocodeResponse)) {
|
|
262
254
|
throw geocodeResponse.body.error;
|
|
@@ -297,12 +289,10 @@ main().catch((err) => {
|
|
|
297
289
|
|
|
298
290
|
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
|
299
291
|
|
|
300
|
-
```
|
|
301
|
-
|
|
292
|
+
```ts snippet:SetLogLevel
|
|
293
|
+
import { setLogLevel } from "@azure/logger";
|
|
302
294
|
|
|
303
295
|
setLogLevel("info");
|
|
304
296
|
```
|
|
305
297
|
|
|
306
298
|
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|
|
307
|
-
|
|
308
|
-

|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ClientOptions } from "@azure-rest/core-client";
|
|
2
|
+
import type { AzureKeyCredential, AzureSASCredential, TokenCredential } from "@azure/core-auth";
|
|
3
|
+
import type { MapsSearchClient } from "./generated/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Creates an instance of MapsSearchClient from a subscription key.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey
|
|
9
|
+
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
10
|
+
* import MapsSearch from "@azure-rest/maps-search";
|
|
11
|
+
*
|
|
12
|
+
* const credential = new AzureKeyCredential("<subscription-key>");
|
|
13
|
+
* const client = MapsSearch(credential);
|
|
14
|
+
*```
|
|
15
|
+
*
|
|
16
|
+
* @param credential - An AzureKeyCredential instance used to authenticate requests to the service
|
|
17
|
+
* @param options - Options used to configure the Search Client
|
|
18
|
+
*/
|
|
19
|
+
export default function MapsSearch(credential: AzureKeyCredential, options?: ClientOptions): MapsSearchClient;
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts snippet:ReadmeSampleCreateClient_TokenCredential
|
|
25
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
26
|
+
* import MapsSearch from "@azure-rest/maps-search";
|
|
27
|
+
*
|
|
28
|
+
* const credential = new DefaultAzureCredential();
|
|
29
|
+
* const client = MapsSearch(credential, "<maps-account-client-id>");
|
|
30
|
+
*```
|
|
31
|
+
*
|
|
32
|
+
* @param credential - An TokenCredential instance used to authenticate requests to the service
|
|
33
|
+
* @param mapsAccountClientId - The Azure Maps client id of a specific map resource
|
|
34
|
+
* @param options - Options used to configure the Search Client
|
|
35
|
+
*/
|
|
36
|
+
export default function MapsSearch(credential: TokenCredential, mapsAccountClientId: string, options?: ClientOptions): MapsSearchClient;
|
|
37
|
+
/**
|
|
38
|
+
* Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts snippet:ReadmeSampleCreateClient_SASToken
|
|
42
|
+
* import { AzureSASCredential } from "@azure/core-auth";
|
|
43
|
+
* import MapsSearch from "@azure-rest/maps-search";
|
|
44
|
+
*
|
|
45
|
+
* const credential = new AzureSASCredential("<SAS Token>");
|
|
46
|
+
* const client = MapsSearch(credential);
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param credential - An AzureSASCredential instance used to authenticate requests to the service
|
|
50
|
+
* @param options - Options used to configure the Search Client
|
|
51
|
+
*/
|
|
52
|
+
export default function MapsSearch(credential: AzureSASCredential, options?: ClientOptions): MapsSearchClient;
|
|
53
|
+
//# sourceMappingURL=MapsSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapsSearch.d.ts","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGhG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,gBAAgB,CAAC;AACpB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAU,EAAE,eAAe,EAC3B,mBAAmB,EAAE,MAAM,EAC3B,OAAO,CAAC,EAAE,aAAa,GACtB,gBAAgB,CAAC;AACpB;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,gBAAgB,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { isSASCredential, isTokenCredential } from "@azure/core-auth";
|
|
4
4
|
import { createMapsClientIdPolicy } from "@azure/maps-common";
|
|
5
|
-
import createClient from "
|
|
5
|
+
import createClient from "./generated/index.js";
|
|
6
6
|
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
|
7
7
|
export default function MapsSearch(credential, clientIdOrOptions = {}, maybeOptions = {}) {
|
|
8
8
|
const options = typeof clientIdOrOptions === "string" ? maybeOptions : clientIdOrOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapsSearch.js","sourceRoot":"","sources":["../../src/MapsSearch.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AA6D5E,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAqE,EACrE,oBAA4C,EAAE,EAC9C,eAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CACvB,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,sCAAsC;SAC/C,CAAC,CACH,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsSearchClient } from \"./generated/index.js\";\nimport createClient from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Creates an instance of MapsSearchClient from a subscription key.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsSearch(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_TokenCredential\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsSearch(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsSearchClient;\n/**\n * Creates an instance of MapsSearch from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SASToken\n * import { AzureSASCredential } from \"@azure/core-auth\";\n * import MapsSearch from \"@azure-rest/maps-search\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsSearch(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Search Client\n */\nexport default function MapsSearch(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsSearchClient;\nexport default function MapsSearch(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsSearchClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { SearchGetGeocodingParameters, SearchGetGeocodingBatchParameters, SearchGetPolygonParameters, SearchGetReverseGeocodingParameters, SearchGetReverseGeocodingBatchParameters } from "./parameters.js";
|
|
2
|
+
import { SearchGetGeocoding200Response, SearchGetGeocodingDefaultResponse, SearchGetGeocodingBatch200Response, SearchGetGeocodingBatchDefaultResponse, SearchGetPolygon200Response, SearchGetPolygonDefaultResponse, SearchGetReverseGeocoding200Response, SearchGetReverseGeocodingDefaultResponse, SearchGetReverseGeocodingBatch200Response, SearchGetReverseGeocodingBatchDefaultResponse } from "./responses.js";
|
|
3
|
+
import { Client, StreamableMethod } from "@azure-rest/core-client";
|
|
4
|
+
export interface GetGeocoding {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* The `Get Geocoding` API is an HTTP `GET` request that returns the longitude and latitude coordinates of the location being searched.
|
|
8
|
+
*
|
|
9
|
+
* In many cases, the complete search service might be too much, for instance if you are only interested in traditional geocoding. Search can also be accessed for address look up exclusively. The geocoding is performed by hitting the geocoding endpoint with just the address or partial address in question. The geocoding search index will be queried for everything above the street level data. No Point of Interest (POIs) will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. It will also handle everything from exact street addresses or street or intersections as well as higher level geographies such as city centers, counties and states. The response also returns detailed address properties such as street, postal code, municipality, and country/region information.
|
|
10
|
+
*/
|
|
11
|
+
get(options?: SearchGetGeocodingParameters): StreamableMethod<SearchGetGeocoding200Response | SearchGetGeocodingDefaultResponse>;
|
|
12
|
+
}
|
|
13
|
+
export interface GetGeocodingBatch {
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* The `Get Geocoding Batch` API is an HTTP `POST` request that sends batches of up to **100** queries to the [Geocoding](/rest/api/maps/search/get-geocoding) API in a single request.
|
|
17
|
+
*
|
|
18
|
+
* ### Submit Synchronous Batch Request
|
|
19
|
+
* The Synchronous API is recommended for lightweight batch requests. When the service receives a request, it will respond as soon as the batch items are calculated and there will be no possibility to retrieve the results later. The Synchronous API will return a timeout error (a 408 response) if the request takes longer than 60 seconds. The number of batch items is limited to **100** for this API.
|
|
20
|
+
* ```
|
|
21
|
+
* POST https://atlas.microsoft.com/geocode:batch?api-version=2023-06-01
|
|
22
|
+
* ```
|
|
23
|
+
* ### POST Body for Batch Request
|
|
24
|
+
* To send the _geocoding_ queries you will use a `POST` request where the request body will contain the `batchItems` array in `json` format and the `Content-Type` header will be set to `application/json`. Here's a sample request body containing 2 _geocoding_ queries:
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
* ```
|
|
28
|
+
* {
|
|
29
|
+
* "batchItems": [
|
|
30
|
+
* {
|
|
31
|
+
* "addressLine": "One, Microsoft Way, Redmond, WA 98052",
|
|
32
|
+
* "top": 2
|
|
33
|
+
* },
|
|
34
|
+
* {
|
|
35
|
+
* "addressLine": "Pike Pl",
|
|
36
|
+
* "adminDistrict": "WA",
|
|
37
|
+
* "locality": "Seattle",
|
|
38
|
+
* "top": 3
|
|
39
|
+
* }
|
|
40
|
+
* ]
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* A _geocoding_ batchItem object can accept any of the supported _geocoding_ [URI parameters](/rest/api/maps/search/get-geocoding#uri-parameters).
|
|
45
|
+
*
|
|
46
|
+
*
|
|
47
|
+
* The batch should contain at least **1** query.
|
|
48
|
+
*
|
|
49
|
+
*
|
|
50
|
+
* ### Batch Response Model
|
|
51
|
+
* The batch response contains a `summary` component that indicates the `totalRequests` that were part of the original batch request and `successfulRequests` i.e. queries which were executed successfully. The batch response also includes a `batchItems` array which contains a response for each and every query in the batch request. The `batchItems` will contain the results in the exact same order the original queries were sent in the batch request. Each item is of one of the following types:
|
|
52
|
+
*
|
|
53
|
+
* - [`GeocodingResponse`](/rest/api/maps/search/get-geocoding#geocodingresponse) - If the query completed successfully.
|
|
54
|
+
*
|
|
55
|
+
* - `Error` - If the query failed. The response will contain a `code` and a `message` in this case.
|
|
56
|
+
*
|
|
57
|
+
*
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
post(options: SearchGetGeocodingBatchParameters): StreamableMethod<SearchGetGeocodingBatch200Response | SearchGetGeocodingBatchDefaultResponse>;
|
|
61
|
+
}
|
|
62
|
+
export interface GetPolygon {
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* The `Get Polygon` API is an HTTP `GET` request that supplies polygon data of a geographical area outline such as a city or a country region.
|
|
66
|
+
*/
|
|
67
|
+
get(options: SearchGetPolygonParameters): StreamableMethod<SearchGetPolygon200Response | SearchGetPolygonDefaultResponse>;
|
|
68
|
+
}
|
|
69
|
+
export interface GetReverseGeocoding {
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* The `Get Reverse Geocoding` API is an HTTP `GET` request used to translate a coordinate (example: 37.786505, -122.3862) into a human understandable street address. Useful in tracking applications where you receive a GPS feed from the device or asset and wish to know the address associated with the coordinates. This endpoint will return address information for a given coordinate.
|
|
73
|
+
*/
|
|
74
|
+
get(options: SearchGetReverseGeocodingParameters): StreamableMethod<SearchGetReverseGeocoding200Response | SearchGetReverseGeocodingDefaultResponse>;
|
|
75
|
+
}
|
|
76
|
+
export interface GetReverseGeocodingBatch {
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* The `Get Reverse Geocoding Batch` API is an HTTP `POST` request that sends batches of up to **100** queries to [Reverse Geocoding](/rest/api/maps/search/get-reverse-geocoding) API using a single request.
|
|
80
|
+
*
|
|
81
|
+
* ### Submit Synchronous Batch Request
|
|
82
|
+
* The Synchronous API is recommended for lightweight batch requests. When the service receives a request, it will respond as soon as the batch items are calculated and there will be no possibility to retrieve the results later. The Synchronous API will return a timeout error (a 408 response) if the request takes longer than 60 seconds. The number of batch items is limited to **100** for this API.
|
|
83
|
+
* ```
|
|
84
|
+
* POST https://atlas.microsoft.com/reverseGeocode:batch?api-version=2023-06-01
|
|
85
|
+
* ```
|
|
86
|
+
* ### POST Body for Batch Request
|
|
87
|
+
* To send the _reverse geocoding_ queries you will use a `POST` request where the request body will contain the `batchItems` array in `json` format and the `Content-Type` header will be set to `application/json`. Here's a sample request body containing 2 _reverse geocoding_ queries:
|
|
88
|
+
*
|
|
89
|
+
*
|
|
90
|
+
* ```
|
|
91
|
+
* {
|
|
92
|
+
* "batchItems": [
|
|
93
|
+
* {
|
|
94
|
+
* "coordinates": [-122.128275, 47.639429],
|
|
95
|
+
* "resultTypes": ["Address", "PopulatedPlace"]
|
|
96
|
+
* },
|
|
97
|
+
* {
|
|
98
|
+
* "coordinates": [-122.341979399674, 47.6095253501216]
|
|
99
|
+
* }
|
|
100
|
+
* ]
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* A _reverse geocoding_ batchItem object can accept any of the supported _reverse geocoding_ [URI parameters](/rest/api/maps/search/get-reverse-geocoding#uri-parameters).
|
|
105
|
+
*
|
|
106
|
+
*
|
|
107
|
+
* The batch should contain at least **1** query.
|
|
108
|
+
*
|
|
109
|
+
*
|
|
110
|
+
* ### Batch Response Model
|
|
111
|
+
* The batch response contains a `summary` component that indicates the `totalRequests` that were part of the original batch request and `successfulRequests` i.e. queries which were executed successfully. The batch response also includes a `batchItems` array which contains a response for each and every query in the batch request. The `batchItems` will contain the results in the exact same order the original queries were sent in the batch request. Each item is of one of the following types:
|
|
112
|
+
*
|
|
113
|
+
* - [`GeocodingResponse`](/rest/api/maps/search/get-reverse-geocoding#geocodingresponse) - If the query completed successfully.
|
|
114
|
+
*
|
|
115
|
+
* - `Error` - If the query failed. The response will contain a `code` and a `message` in this case.
|
|
116
|
+
*
|
|
117
|
+
*
|
|
118
|
+
*
|
|
119
|
+
*/
|
|
120
|
+
post(options: SearchGetReverseGeocodingBatchParameters): StreamableMethod<SearchGetReverseGeocodingBatch200Response | SearchGetReverseGeocodingBatchDefaultResponse>;
|
|
121
|
+
}
|
|
122
|
+
export interface Routes {
|
|
123
|
+
/** Resource for '/geocode' has methods for the following verbs: get */
|
|
124
|
+
(path: "/geocode"): GetGeocoding;
|
|
125
|
+
/** Resource for '/geocode:batch' has methods for the following verbs: post */
|
|
126
|
+
(path: "/geocode:batch"): GetGeocodingBatch;
|
|
127
|
+
/** Resource for '/search/polygon' has methods for the following verbs: get */
|
|
128
|
+
(path: "/search/polygon"): GetPolygon;
|
|
129
|
+
/** Resource for '/reverseGeocode' has methods for the following verbs: get */
|
|
130
|
+
(path: "/reverseGeocode"): GetReverseGeocoding;
|
|
131
|
+
/** Resource for '/reverseGeocode:batch' has methods for the following verbs: post */
|
|
132
|
+
(path: "/reverseGeocode:batch"): GetReverseGeocodingBatch;
|
|
133
|
+
}
|
|
134
|
+
export type MapsSearchClient = Client & {
|
|
135
|
+
path: Routes;
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=clientDefinitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientDefinitions.d.ts","sourceRoot":"","sources":["../../../src/generated/clientDefinitions.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,4BAA4B,EAC5B,iCAAiC,EACjC,0BAA0B,EAC1B,mCAAmC,EACnC,wCAAwC,EACzC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,kCAAkC,EAClC,sCAAsC,EACtC,2BAA2B,EAC3B,+BAA+B,EAC/B,oCAAoC,EACpC,wCAAwC,EACxC,yCAAyC,EACzC,6CAA6C,EAC9C,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,GAAG,CACD,OAAO,CAAC,EAAE,4BAA4B,GACrC,gBAAgB,CACjB,6BAA6B,GAAG,iCAAiC,CAClE,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,IAAI,CACF,OAAO,EAAE,iCAAiC,GACzC,gBAAgB,CACjB,kCAAkC,GAAG,sCAAsC,CAC5E,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,GAAG,CACD,OAAO,EAAE,0BAA0B,GAClC,gBAAgB,CACjB,2BAA2B,GAAG,+BAA+B,CAC9D,CAAC;CACH;AAED,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,GAAG,CACD,OAAO,EAAE,mCAAmC,GAC3C,gBAAgB,CACf,oCAAoC,GACpC,wCAAwC,CAC3C,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,IAAI,CACF,OAAO,EAAE,wCAAwC,GAChD,gBAAgB,CACf,yCAAyC,GACzC,6CAA6C,CAChD,CAAC;CACH;AAED,MAAM,WAAW,MAAM;IACrB,uEAAuE;IACvE,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IACjC,8EAA8E;IAC9E,CAAC,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IAC5C,8EAA8E;IAC9E,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,CAAC;IACtC,8EAA8E;IAC9E,CAAC,IAAI,EAAE,iBAAiB,GAAG,mBAAmB,CAAC;IAC/C,qFAAqF;IACrF,CAAC,IAAI,EAAE,uBAAuB,GAAG,wBAAwB,CAAC;CAC3D;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../../src/generated/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n SearchGetGeocodingParameters,\n SearchGetGeocodingBatchParameters,\n SearchGetPolygonParameters,\n SearchGetReverseGeocodingParameters,\n SearchGetReverseGeocodingBatchParameters,\n} from \"./parameters.js\";\nimport {\n SearchGetGeocoding200Response,\n SearchGetGeocodingDefaultResponse,\n SearchGetGeocodingBatch200Response,\n SearchGetGeocodingBatchDefaultResponse,\n SearchGetPolygon200Response,\n SearchGetPolygonDefaultResponse,\n SearchGetReverseGeocoding200Response,\n SearchGetReverseGeocodingDefaultResponse,\n SearchGetReverseGeocodingBatch200Response,\n SearchGetReverseGeocodingBatchDefaultResponse,\n} from \"./responses.js\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface GetGeocoding {\n /**\n *\n * The `Get Geocoding` API is an HTTP `GET` request that returns the longitude and latitude coordinates of the location being searched.\n *\n * In many cases, the complete search service might be too much, for instance if you are only interested in traditional geocoding. Search can also be accessed for address look up exclusively. The geocoding is performed by hitting the geocoding endpoint with just the address or partial address in question. The geocoding search index will be queried for everything above the street level data. No Point of Interest (POIs) will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. It will also handle everything from exact street addresses or street or intersections as well as higher level geographies such as city centers, counties and states. The response also returns detailed address properties such as street, postal code, municipality, and country/region information.\n */\n get(\n options?: SearchGetGeocodingParameters,\n ): StreamableMethod<\n SearchGetGeocoding200Response | SearchGetGeocodingDefaultResponse\n >;\n}\n\nexport interface GetGeocodingBatch {\n /**\n *\n * The `Get Geocoding Batch` API is an HTTP `POST` request that sends batches of up to **100** queries to the [Geocoding](/rest/api/maps/search/get-geocoding) API in a single request.\n *\n * ### Submit Synchronous Batch Request\n * The Synchronous API is recommended for lightweight batch requests. When the service receives a request, it will respond as soon as the batch items are calculated and there will be no possibility to retrieve the results later. The Synchronous API will return a timeout error (a 408 response) if the request takes longer than 60 seconds. The number of batch items is limited to **100** for this API.\n * ```\n * POST https://atlas.microsoft.com/geocode:batch?api-version=2023-06-01\n * ```\n * ### POST Body for Batch Request\n * To send the _geocoding_ queries you will use a `POST` request where the request body will contain the `batchItems` array in `json` format and the `Content-Type` header will be set to `application/json`. Here's a sample request body containing 2 _geocoding_ queries:\n *\n *\n * ```\n * {\n * \"batchItems\": [\n * {\n * \"addressLine\": \"One, Microsoft Way, Redmond, WA 98052\",\n * \"top\": 2\n * },\n * {\n * \"addressLine\": \"Pike Pl\",\n * \"adminDistrict\": \"WA\",\n * \"locality\": \"Seattle\",\n * \"top\": 3\n * }\n * ]\n * }\n * ```\n *\n * A _geocoding_ batchItem object can accept any of the supported _geocoding_ [URI parameters](/rest/api/maps/search/get-geocoding#uri-parameters).\n *\n *\n * The batch should contain at least **1** query.\n *\n *\n * ### Batch Response Model\n * The batch response contains a `summary` component that indicates the `totalRequests` that were part of the original batch request and `successfulRequests` i.e. queries which were executed successfully. The batch response also includes a `batchItems` array which contains a response for each and every query in the batch request. The `batchItems` will contain the results in the exact same order the original queries were sent in the batch request. Each item is of one of the following types:\n *\n * - [`GeocodingResponse`](/rest/api/maps/search/get-geocoding#geocodingresponse) - If the query completed successfully.\n *\n * - `Error` - If the query failed. The response will contain a `code` and a `message` in this case.\n *\n *\n *\n */\n post(\n options: SearchGetGeocodingBatchParameters,\n ): StreamableMethod<\n SearchGetGeocodingBatch200Response | SearchGetGeocodingBatchDefaultResponse\n >;\n}\n\nexport interface GetPolygon {\n /**\n *\n * The `Get Polygon` API is an HTTP `GET` request that supplies polygon data of a geographical area outline such as a city or a country region.\n */\n get(\n options: SearchGetPolygonParameters,\n ): StreamableMethod<\n SearchGetPolygon200Response | SearchGetPolygonDefaultResponse\n >;\n}\n\nexport interface GetReverseGeocoding {\n /**\n *\n * The `Get Reverse Geocoding` API is an HTTP `GET` request used to translate a coordinate (example: 37.786505, -122.3862) into a human understandable street address. Useful in tracking applications where you receive a GPS feed from the device or asset and wish to know the address associated with the coordinates. This endpoint will return address information for a given coordinate.\n */\n get(\n options: SearchGetReverseGeocodingParameters,\n ): StreamableMethod<\n | SearchGetReverseGeocoding200Response\n | SearchGetReverseGeocodingDefaultResponse\n >;\n}\n\nexport interface GetReverseGeocodingBatch {\n /**\n *\n * The `Get Reverse Geocoding Batch` API is an HTTP `POST` request that sends batches of up to **100** queries to [Reverse Geocoding](/rest/api/maps/search/get-reverse-geocoding) API using a single request.\n *\n * ### Submit Synchronous Batch Request\n * The Synchronous API is recommended for lightweight batch requests. When the service receives a request, it will respond as soon as the batch items are calculated and there will be no possibility to retrieve the results later. The Synchronous API will return a timeout error (a 408 response) if the request takes longer than 60 seconds. The number of batch items is limited to **100** for this API.\n * ```\n * POST https://atlas.microsoft.com/reverseGeocode:batch?api-version=2023-06-01\n * ```\n * ### POST Body for Batch Request\n * To send the _reverse geocoding_ queries you will use a `POST` request where the request body will contain the `batchItems` array in `json` format and the `Content-Type` header will be set to `application/json`. Here's a sample request body containing 2 _reverse geocoding_ queries:\n *\n *\n * ```\n * {\n * \"batchItems\": [\n * {\n * \"coordinates\": [-122.128275, 47.639429],\n * \"resultTypes\": [\"Address\", \"PopulatedPlace\"]\n * },\n * {\n * \"coordinates\": [-122.341979399674, 47.6095253501216]\n * }\n * ]\n * }\n * ```\n *\n * A _reverse geocoding_ batchItem object can accept any of the supported _reverse geocoding_ [URI parameters](/rest/api/maps/search/get-reverse-geocoding#uri-parameters).\n *\n *\n * The batch should contain at least **1** query.\n *\n *\n * ### Batch Response Model\n * The batch response contains a `summary` component that indicates the `totalRequests` that were part of the original batch request and `successfulRequests` i.e. queries which were executed successfully. The batch response also includes a `batchItems` array which contains a response for each and every query in the batch request. The `batchItems` will contain the results in the exact same order the original queries were sent in the batch request. Each item is of one of the following types:\n *\n * - [`GeocodingResponse`](/rest/api/maps/search/get-reverse-geocoding#geocodingresponse) - If the query completed successfully.\n *\n * - `Error` - If the query failed. The response will contain a `code` and a `message` in this case.\n *\n *\n *\n */\n post(\n options: SearchGetReverseGeocodingBatchParameters,\n ): StreamableMethod<\n | SearchGetReverseGeocodingBatch200Response\n | SearchGetReverseGeocodingBatchDefaultResponse\n >;\n}\n\nexport interface Routes {\n /** Resource for '/geocode' has methods for the following verbs: get */\n (path: \"/geocode\"): GetGeocoding;\n /** Resource for '/geocode:batch' has methods for the following verbs: post */\n (path: \"/geocode:batch\"): GetGeocodingBatch;\n /** Resource for '/search/polygon' has methods for the following verbs: get */\n (path: \"/search/polygon\"): GetPolygon;\n /** Resource for '/reverseGeocode' has methods for the following verbs: get */\n (path: \"/reverseGeocode\"): GetReverseGeocoding;\n /** Resource for '/reverseGeocode:batch' has methods for the following verbs: post */\n (path: \"/reverseGeocode:batch\"): GetReverseGeocodingBatch;\n}\n\nexport type MapsSearchClient = Client & {\n path: Routes;\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import MapsSearchClient from "./mapsSearchClient.js";
|
|
2
|
+
export * from "./mapsSearchClient.js";
|
|
3
|
+
export * from "./parameters.js";
|
|
4
|
+
export * from "./responses.js";
|
|
5
|
+
export * from "./clientDefinitions.js";
|
|
6
|
+
export * from "./isUnexpected.js";
|
|
7
|
+
export * from "./models.js";
|
|
8
|
+
export * from "./outputModels.js";
|
|
9
|
+
export default MapsSearchClient;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/index.ts"],"names":[],"mappings":"AAGA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAErD,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAElC,eAAe,gBAAgB,CAAC"}
|