@azure-rest/maps-search 2.0.0-beta.1 → 2.0.0-beta.3

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.
Files changed (223) hide show
  1. package/LICENSE +4 -4
  2. package/README.md +113 -123
  3. package/dist/browser/MapsSearch.d.ts +53 -0
  4. package/dist/browser/MapsSearch.d.ts.map +1 -0
  5. package/{dist-esm/src → dist/browser}/MapsSearch.js +5 -5
  6. package/dist/browser/MapsSearch.js.map +1 -0
  7. package/dist/browser/generated/clientDefinitions.d.ts +137 -0
  8. package/dist/browser/generated/clientDefinitions.d.ts.map +1 -0
  9. package/dist/browser/generated/clientDefinitions.js +4 -0
  10. package/dist/browser/generated/clientDefinitions.js.map +1 -0
  11. package/dist/browser/generated/index.d.ts +10 -0
  12. package/dist/browser/generated/index.d.ts.map +1 -0
  13. package/dist/browser/generated/index.js +12 -0
  14. package/dist/browser/generated/index.js.map +1 -0
  15. package/dist/browser/generated/isUnexpected.d.ts +7 -0
  16. package/dist/browser/generated/isUnexpected.d.ts.map +1 -0
  17. package/{dist-esm/src → dist/browser}/generated/isUnexpected.js +8 -7
  18. package/dist/browser/generated/isUnexpected.js.map +1 -0
  19. package/dist/browser/generated/logger.d.ts +2 -0
  20. package/dist/browser/generated/logger.d.ts.map +1 -0
  21. package/{dist-esm/src → dist/browser/generated}/logger.js +1 -1
  22. package/dist/browser/generated/logger.js.map +1 -0
  23. package/dist/browser/generated/mapsSearchClient.d.ts +15 -0
  24. package/dist/browser/generated/mapsSearchClient.d.ts.map +1 -0
  25. package/dist/browser/generated/mapsSearchClient.js +42 -0
  26. package/dist/browser/generated/mapsSearchClient.js.map +1 -0
  27. package/dist/browser/generated/models.d.ts +97 -0
  28. package/dist/browser/generated/models.d.ts.map +1 -0
  29. package/dist/browser/generated/models.js +4 -0
  30. package/dist/browser/generated/models.js.map +1 -0
  31. package/dist/browser/generated/outputModels.d.ts +298 -0
  32. package/dist/browser/generated/outputModels.d.ts.map +1 -0
  33. package/dist/browser/generated/outputModels.js +4 -0
  34. package/{dist-esm/src → dist/browser}/generated/outputModels.js.map +1 -1
  35. package/dist/browser/generated/parameters.d.ts +135 -0
  36. package/dist/browser/generated/parameters.d.ts.map +1 -0
  37. package/dist/browser/generated/parameters.js +4 -0
  38. package/dist/browser/generated/parameters.js.map +1 -0
  39. package/dist/browser/generated/responses.d.ts +255 -0
  40. package/dist/browser/generated/responses.d.ts.map +1 -0
  41. package/dist/browser/generated/responses.js +4 -0
  42. package/dist/browser/generated/responses.js.map +1 -0
  43. package/dist/browser/index.d.ts +4 -0
  44. package/dist/browser/index.d.ts.map +1 -0
  45. package/dist/browser/index.js +6 -0
  46. package/dist/browser/index.js.map +1 -0
  47. package/dist/browser/logger.d.ts +2 -0
  48. package/dist/browser/logger.d.ts.map +1 -0
  49. package/dist/browser/logger.js +5 -0
  50. package/{dist-esm/src → dist/browser}/logger.js.map +1 -1
  51. package/dist/browser/package.json +3 -0
  52. package/dist/commonjs/MapsSearch.d.ts +53 -0
  53. package/dist/commonjs/MapsSearch.d.ts.map +1 -0
  54. package/dist/commonjs/MapsSearch.js +44 -0
  55. package/dist/commonjs/MapsSearch.js.map +1 -0
  56. package/dist/commonjs/generated/clientDefinitions.d.ts +137 -0
  57. package/dist/commonjs/generated/clientDefinitions.d.ts.map +1 -0
  58. package/dist/commonjs/generated/clientDefinitions.js +5 -0
  59. package/dist/commonjs/generated/clientDefinitions.js.map +1 -0
  60. package/dist/commonjs/generated/index.d.ts +10 -0
  61. package/dist/commonjs/generated/index.d.ts.map +1 -0
  62. package/dist/commonjs/generated/index.js +15 -0
  63. package/dist/commonjs/generated/index.js.map +1 -0
  64. package/dist/commonjs/generated/isUnexpected.d.ts +7 -0
  65. package/dist/commonjs/generated/isUnexpected.d.ts.map +1 -0
  66. package/dist/commonjs/generated/isUnexpected.js +78 -0
  67. package/dist/commonjs/generated/isUnexpected.js.map +1 -0
  68. package/dist/commonjs/generated/logger.d.ts +2 -0
  69. package/dist/commonjs/generated/logger.d.ts.map +1 -0
  70. package/dist/commonjs/generated/logger.js +8 -0
  71. package/dist/commonjs/generated/logger.js.map +1 -0
  72. package/dist/commonjs/generated/mapsSearchClient.d.ts +15 -0
  73. package/dist/commonjs/generated/mapsSearchClient.d.ts.map +1 -0
  74. package/dist/commonjs/generated/mapsSearchClient.js +45 -0
  75. package/dist/commonjs/generated/mapsSearchClient.js.map +1 -0
  76. package/dist/commonjs/generated/models.d.ts +97 -0
  77. package/dist/commonjs/generated/models.d.ts.map +1 -0
  78. package/dist/commonjs/generated/models.js +5 -0
  79. package/dist/commonjs/generated/models.js.map +1 -0
  80. package/dist/commonjs/generated/outputModels.d.ts +298 -0
  81. package/dist/commonjs/generated/outputModels.d.ts.map +1 -0
  82. package/dist/commonjs/generated/outputModels.js +5 -0
  83. package/dist/commonjs/generated/outputModels.js.map +1 -0
  84. package/dist/commonjs/generated/parameters.d.ts +135 -0
  85. package/dist/commonjs/generated/parameters.d.ts.map +1 -0
  86. package/dist/commonjs/generated/parameters.js +5 -0
  87. package/dist/commonjs/generated/parameters.js.map +1 -0
  88. package/dist/commonjs/generated/responses.d.ts +255 -0
  89. package/dist/commonjs/generated/responses.d.ts.map +1 -0
  90. package/dist/commonjs/generated/responses.js +5 -0
  91. package/dist/commonjs/generated/responses.js.map +1 -0
  92. package/dist/commonjs/index.d.ts +4 -0
  93. package/dist/commonjs/index.d.ts.map +1 -0
  94. package/dist/commonjs/index.js +9 -0
  95. package/dist/commonjs/index.js.map +1 -0
  96. package/dist/commonjs/logger.d.ts +2 -0
  97. package/dist/commonjs/logger.d.ts.map +1 -0
  98. package/dist/commonjs/logger.js +8 -0
  99. package/dist/commonjs/logger.js.map +1 -0
  100. package/dist/commonjs/package.json +3 -0
  101. package/dist/commonjs/tsdoc-metadata.json +11 -0
  102. package/dist/esm/MapsSearch.d.ts +53 -0
  103. package/dist/esm/MapsSearch.d.ts.map +1 -0
  104. package/dist/esm/MapsSearch.js +40 -0
  105. package/dist/esm/MapsSearch.js.map +1 -0
  106. package/dist/esm/generated/clientDefinitions.d.ts +137 -0
  107. package/dist/esm/generated/clientDefinitions.d.ts.map +1 -0
  108. package/dist/esm/generated/clientDefinitions.js +4 -0
  109. package/dist/esm/generated/clientDefinitions.js.map +1 -0
  110. package/dist/esm/generated/index.d.ts +10 -0
  111. package/dist/esm/generated/index.d.ts.map +1 -0
  112. package/dist/esm/generated/index.js +12 -0
  113. package/dist/esm/generated/index.js.map +1 -0
  114. package/dist/esm/generated/isUnexpected.d.ts +7 -0
  115. package/dist/esm/generated/isUnexpected.d.ts.map +1 -0
  116. package/dist/esm/generated/isUnexpected.js +75 -0
  117. package/dist/esm/generated/isUnexpected.js.map +1 -0
  118. package/dist/esm/generated/logger.d.ts +2 -0
  119. package/dist/esm/generated/logger.d.ts.map +1 -0
  120. package/dist/esm/generated/logger.js +5 -0
  121. package/dist/esm/generated/logger.js.map +1 -0
  122. package/dist/esm/generated/mapsSearchClient.d.ts +15 -0
  123. package/dist/esm/generated/mapsSearchClient.d.ts.map +1 -0
  124. package/dist/esm/generated/mapsSearchClient.js +42 -0
  125. package/dist/esm/generated/mapsSearchClient.js.map +1 -0
  126. package/dist/esm/generated/models.d.ts +97 -0
  127. package/dist/esm/generated/models.d.ts.map +1 -0
  128. package/dist/esm/generated/models.js +4 -0
  129. package/dist/esm/generated/models.js.map +1 -0
  130. package/dist/esm/generated/outputModels.d.ts +298 -0
  131. package/dist/esm/generated/outputModels.d.ts.map +1 -0
  132. package/dist/esm/generated/outputModels.js +4 -0
  133. package/dist/esm/generated/outputModels.js.map +1 -0
  134. package/dist/esm/generated/parameters.d.ts +135 -0
  135. package/dist/esm/generated/parameters.d.ts.map +1 -0
  136. package/dist/esm/generated/parameters.js +4 -0
  137. package/dist/esm/generated/parameters.js.map +1 -0
  138. package/dist/esm/generated/responses.d.ts +255 -0
  139. package/dist/esm/generated/responses.d.ts.map +1 -0
  140. package/dist/esm/generated/responses.js +4 -0
  141. package/dist/esm/generated/responses.js.map +1 -0
  142. package/dist/esm/index.d.ts +4 -0
  143. package/dist/esm/index.d.ts.map +1 -0
  144. package/dist/esm/index.js +6 -0
  145. package/dist/esm/index.js.map +1 -0
  146. package/dist/esm/logger.d.ts +2 -0
  147. package/dist/esm/logger.d.ts.map +1 -0
  148. package/dist/esm/logger.js +5 -0
  149. package/dist/esm/logger.js.map +1 -0
  150. package/dist/esm/package.json +3 -0
  151. package/dist/react-native/MapsSearch.d.ts +53 -0
  152. package/dist/react-native/MapsSearch.d.ts.map +1 -0
  153. package/dist/react-native/MapsSearch.js +40 -0
  154. package/dist/react-native/MapsSearch.js.map +1 -0
  155. package/dist/react-native/generated/clientDefinitions.d.ts +137 -0
  156. package/dist/react-native/generated/clientDefinitions.d.ts.map +1 -0
  157. package/dist/react-native/generated/clientDefinitions.js +4 -0
  158. package/dist/react-native/generated/clientDefinitions.js.map +1 -0
  159. package/dist/react-native/generated/index.d.ts +10 -0
  160. package/dist/react-native/generated/index.d.ts.map +1 -0
  161. package/dist/react-native/generated/index.js +12 -0
  162. package/dist/react-native/generated/index.js.map +1 -0
  163. package/dist/react-native/generated/isUnexpected.d.ts +7 -0
  164. package/dist/react-native/generated/isUnexpected.d.ts.map +1 -0
  165. package/dist/react-native/generated/isUnexpected.js +75 -0
  166. package/dist/react-native/generated/isUnexpected.js.map +1 -0
  167. package/dist/react-native/generated/logger.d.ts +2 -0
  168. package/dist/react-native/generated/logger.d.ts.map +1 -0
  169. package/dist/react-native/generated/logger.js +5 -0
  170. package/dist/react-native/generated/logger.js.map +1 -0
  171. package/dist/react-native/generated/mapsSearchClient.d.ts +15 -0
  172. package/dist/react-native/generated/mapsSearchClient.d.ts.map +1 -0
  173. package/dist/react-native/generated/mapsSearchClient.js +42 -0
  174. package/dist/react-native/generated/mapsSearchClient.js.map +1 -0
  175. package/dist/react-native/generated/models.d.ts +97 -0
  176. package/dist/react-native/generated/models.d.ts.map +1 -0
  177. package/dist/react-native/generated/models.js +4 -0
  178. package/dist/react-native/generated/models.js.map +1 -0
  179. package/dist/react-native/generated/outputModels.d.ts +298 -0
  180. package/dist/react-native/generated/outputModels.d.ts.map +1 -0
  181. package/dist/react-native/generated/outputModels.js +4 -0
  182. package/dist/react-native/generated/outputModels.js.map +1 -0
  183. package/dist/react-native/generated/parameters.d.ts +135 -0
  184. package/dist/react-native/generated/parameters.d.ts.map +1 -0
  185. package/dist/react-native/generated/parameters.js +4 -0
  186. package/dist/react-native/generated/parameters.js.map +1 -0
  187. package/dist/react-native/generated/responses.d.ts +255 -0
  188. package/dist/react-native/generated/responses.d.ts.map +1 -0
  189. package/dist/react-native/generated/responses.js +4 -0
  190. package/dist/react-native/generated/responses.js.map +1 -0
  191. package/dist/react-native/index.d.ts +4 -0
  192. package/dist/react-native/index.d.ts.map +1 -0
  193. package/dist/react-native/index.js +6 -0
  194. package/dist/react-native/index.js.map +1 -0
  195. package/dist/react-native/logger.d.ts +2 -0
  196. package/dist/react-native/logger.d.ts.map +1 -0
  197. package/dist/react-native/logger.js +5 -0
  198. package/dist/react-native/logger.js.map +1 -0
  199. package/dist/react-native/package.json +3 -0
  200. package/package.json +83 -66
  201. package/dist/index.js +0 -160
  202. package/dist/index.js.map +0 -1
  203. package/dist-esm/src/MapsSearch.js.map +0 -1
  204. package/dist-esm/src/generated/clientDefinitions.js +0 -4
  205. package/dist-esm/src/generated/clientDefinitions.js.map +0 -1
  206. package/dist-esm/src/generated/index.js +0 -12
  207. package/dist-esm/src/generated/index.js.map +0 -1
  208. package/dist-esm/src/generated/isUnexpected.js.map +0 -1
  209. package/dist-esm/src/generated/mapsSearchClient.js +0 -32
  210. package/dist-esm/src/generated/mapsSearchClient.js.map +0 -1
  211. package/dist-esm/src/generated/models.js +0 -4
  212. package/dist-esm/src/generated/models.js.map +0 -1
  213. package/dist-esm/src/generated/outputModels.js +0 -4
  214. package/dist-esm/src/generated/parameters.js +0 -4
  215. package/dist-esm/src/generated/parameters.js.map +0 -1
  216. package/dist-esm/src/generated/pollingHelper.js +0 -55
  217. package/dist-esm/src/generated/pollingHelper.js.map +0 -1
  218. package/dist-esm/src/generated/responses.js +0 -4
  219. package/dist-esm/src/generated/responses.js.map +0 -1
  220. package/dist-esm/src/index.js +0 -6
  221. package/dist-esm/src/index.js.map +0 -1
  222. package/review/maps-search.api.md +0 -544
  223. package/types/maps-search-rest.d.ts +0 -1117
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ Copyright (c) Microsoft Corporation.
2
2
 
3
- Copyright (c) 2022 Microsoft
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 "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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://docs.microsoft.com/javascript/api/@azure-rest/maps-search?view=azure-node-preview)
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://docs.microsoft.com/rest/api/maps/search)
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://docs.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://docs.microsoft.com/powershell/module/az.maps/new-azmapsaccount), or the [Azure CLI](https://docs.microsoft.com/cli/azure).
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://docs.microsoft.com/azure/azure-maps/choose-pricing-tier) based on your needs via the `<sku-name>` parameter. Please refer to [this page](https://docs.microsoft.com/cli/azure/maps/account?view=azure-cli-latest#az_maps_account_create) for more details.
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>
@@ -45,26 +45,26 @@ npm install @azure-rest/maps-search
45
45
 
46
46
  ### Create and authenticate a `MapsSearchClient`
47
47
 
48
- To create a client object to access the Azure Maps Search APIs, you will need a `credential` object. The Azure Maps Search client can use an Azure Active Directory credential or an Azure Key credential to authenticate.
48
+ To create a client object to access the Azure Maps Search APIs, you will need a `credential` object. The Azure Maps Search client can use a Microsoft Entra ID credential or an Azure Key credential to authenticate.
49
49
 
50
- #### Using an Azure Active Directory Credential
50
+ #### Using a Microsoft Entra ID Credential
51
51
 
52
- You can authenticate with Azure Active Directory using the [Azure Identity library](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity). To use the [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential) provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
52
+ You can authenticate with Microsoft Entra ID using the [Azure Identity library](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity). To use the [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential) provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
53
53
 
54
54
  ```bash
55
55
  npm install @azure/identity
56
56
  ```
57
57
 
58
- You will also need to register a new AAD application and grant access to Azure Maps by assigning the suitable role to your service principal. Please refer to the [Manage authentication](https://docs.microsoft.com/azure/azure-maps/how-to-manage-authentication) page.
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
- Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
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://docs.microsoft.com/azure/azure-maps/how-to-manage-authentication#view-authentication-details) on how to find it.
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
- ```javascript
66
- const MapsSearch = require("@azure-rest/maps-search").default;
67
- const { DefaultAzureCredential } = require("@azure/identity");
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
- ```javascript
78
- const MapsSearch = require("@azure-rest/maps-search").default;
79
- const { AzureKeyCredential } = require("@azure/core-auth");
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,34 +98,37 @@ npm install @azure/core-auth
98
98
 
99
99
  Finally, you can use the SAS token to authenticate the client:
100
100
 
101
- ```javascript
102
- const MapsSearch = require("@azure-rest/maps-search").default;
103
- const { AzureSASCredential } = require("@azure/core-auth");
104
- const { DefaultAzureCredential } = require("@azure/identity");
105
- const { AzureMapsManagementClient } = require("@azure/arm-maps");
106
-
107
- const subscriptionId = "<subscription ID of the map account>"
108
- const resourceGroupName = "<resource group name of the map account>";
109
- const accountName = "<name of the map account>";
110
- const mapsAccountSasParameters = {
111
- start: "<start time in ISO format>", // e.g. "2023-11-24T03:51:53.161Z"
112
- expiry: "<expiry time in ISO format>", // maximum value to start + 1 day
113
- maxRatePerSecond: 500,
114
- principalId: "<principle ID (object ID) of the managed identity>",
115
- signingKey: "primaryKey",
116
- };
117
- const credential = new DefaultAzureCredential();
118
- const managementClient = new AzureMapsManagementClient(credential, subscriptionId);
119
- const {accountSasToken} = await managementClient.accounts.listSas(
120
- resourceGroupName,
121
- accountName,
122
- mapsAccountSasParameters
123
- );
124
- if (accountSasToken === undefined) {
125
- throw new Error("No accountSasToken was found for the Maps Account.");
126
- }
127
- const sasCredential = new AzureSASCredential(accountSasToken);
128
- const client = MapsSearch(sasCredential);
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
+
107
+ const subscriptionId = "<subscription ID of the map account>";
108
+ const resourceGroupName = "<resource group name of the map account>";
109
+ const accountName = "<name of the map account>";
110
+ const mapsAccountSasParameters = {
111
+ start: "<start time in ISO format>", // e.g. "2023-11-24T03:51:53.161Z"
112
+ expiry: "<expiry time in ISO format>", // maximum value to start + 1 day
113
+ maxRatePerSecond: 500,
114
+ principalId: "<principle ID (object ID) of the managed identity>",
115
+ signingKey: "primaryKey",
116
+ };
117
+
118
+ const credential = new DefaultAzureCredential();
119
+ const managementClient = new AzureMapsManagementClient(credential, subscriptionId);
120
+ const { accountSasToken } = await managementClient.accounts.listSas(
121
+ resourceGroupName,
122
+ accountName,
123
+ mapsAccountSasParameters,
124
+ );
125
+
126
+ if (accountSasToken === undefined) {
127
+ throw new Error("No accountSasToken was found for the Maps Account.");
128
+ }
129
+
130
+ const sasCredential = new AzureSASCredential(accountSasToken);
131
+ const client = MapsSearch(sasCredential);
129
132
  ```
130
133
 
131
134
  ## Key concepts
@@ -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
- ```javascript
149
- const MapsSearch = require("@azure-rest/maps-search").default;
150
- const { AzureKeyCredential } = require("@azure/core-auth");
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
- /** Initialize the MapsSearchClient */
154
- const client = MapsSearch(new AzureKeyCredential("<subscription-key>"));
155
+ const credential = new DefaultAzureCredential();
156
+ const client = MapsSearch(credential, "<maps-account-client-id>");
155
157
 
156
- async function main(){
157
- /** Make a request to the geocoding API */
158
- const response = await client
159
- .path("/geocode")
160
- .get({ queryParameters: { query: "400 Broad, Seattle" } });
161
- /** Handle error response */
162
- if (isUnexpected(response)) {
163
- throw response.body.error;
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
- main().catch((err) => {
181
- console.log(err);
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
- ```javascript
191
- const MapsSearch = require("@azure-rest/maps-search").default;
192
- const { AzureKeyCredential } = require("@azure/core-auth");
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
- /** Initialize the MapsSearchClient */
196
- const client = MapsSearch(new AzureKeyCredential("<subscription-key>"));
192
+ const credential = new DefaultAzureCredential();
193
+ const client = MapsSearch(credential, "<maps-account-client-id>");
197
194
 
198
- async function main(){
199
- /** Make the request. */
200
- const response = await client.path("/reverseGeocode").get({
201
- queryParameters: { coordinates: [-121.89, 37.337] }, // [longitude, latitude],
202
- });
203
- /** Handle error response. */
204
- if (isUnexpected(response)) {
205
- throw response.body.error;
206
- }
207
- if (!response.body.features || response.body.features.length === 0) {
208
- console.log("No results found.");
209
- } else {
210
- /** Log the response body. */
211
- for(const feature of response.body.features) {
212
- if (feature.properties?.address?.formattedAddress) {
213
- console.log(feature.properties.address.formattedAddress);
214
- } else {
215
- console.log("No address found.");
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
- ```javascript
238
- const MapsSearchV1 = require("@azure-rest/map-search-v1").default;
239
- const MapsSearchV2 = require("@azure-rest/map-search-v2").default;
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
- ```javascript
245
- const MapsSearchV1 = require("@azure-rest/map-search-v1").default;
246
- const MapsSearchV2 = require("@azure-rest/map-search-v2").default;
247
- const { AzureKeyCredential } = require("@azure/core-auth");
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,13 +248,14 @@ 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;
263
255
  }
264
256
 
265
257
  const [lon, lat] = geocodeResponse.body.features[0].geometry.coordinates;
266
-
258
+
267
259
  /** Make a request to the search nearby API */
268
260
  const nearByResponse = await clientV1.path("/search/nearby/{format}", "json").get({
269
261
  queryParameters: { lat, lon },
@@ -273,22 +265,22 @@ async function searchNearby(address) {
273
265
  throw nearByResponse.body.error;
274
266
  }
275
267
  /** Log response body */
276
- for(const results of nearByResponse.body.results) {
268
+ for (const results of nearByResponse.body.results) {
277
269
  console.log(
278
270
  `${result.poi ? result.poi.name + ":" : ""} ${result.address.freeformAddress}. (${
279
271
  result.position.lat
280
- }, ${result.position.lon})\n`
272
+ }, ${result.position.lon})\n`,
281
273
  );
282
274
  }
283
275
  }
284
276
 
285
- async function main(){
277
+ async function main() {
286
278
  searchNearBy("15127 NE 24th Street, Redmond, WA 98052");
287
279
  }
288
280
 
289
281
  main().catch((err) => {
290
- console.log(err);
291
- })
282
+ console.log(err);
283
+ });
292
284
  ```
293
285
 
294
286
  ## Troubleshooting
@@ -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
- ```javascript
301
- const { setLogLevel } = require("@azure/logger");
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
- ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmaps%2Fmap-search-rest%2FREADME.png)
@@ -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"}
@@ -1,13 +1,13 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { isSASCredential, isTokenCredential, } from "@azure/core-auth";
2
+ // Licensed under the MIT License.
3
+ import { isSASCredential, isTokenCredential } from "@azure/core-auth";
4
4
  import { createMapsClientIdPolicy } from "@azure/maps-common";
5
- import createClient from "./generated";
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;
9
9
  /**
10
- * maps service requires a header "ms-x-client-id", which is different from the standard AAD.
10
+ * maps service requires a header "ms-x-client-id", which is different from the standard Microsoft Entra ID.
11
11
  * So we need to do our own implementation.
12
12
  * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication
13
13
  */
@@ -19,7 +19,7 @@ export default function MapsSearch(credential, clientIdOrOptions = {}, maybeOpti
19
19
  const client = createClient(undefined, options);
20
20
  client.pipeline.addPolicy(bearerTokenAuthenticationPolicy({
21
21
  credential,
22
- scopes: `${options.baseUrl || "https://atlas.microsoft.com"}/.default`,
22
+ scopes: "https://atlas.microsoft.com/.default",
23
23
  }));
24
24
  client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));
25
25
  return client;
@@ -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,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export {};
4
+ //# sourceMappingURL=clientDefinitions.js.map