@esri/arcgis-rest-places 1.0.0 → 1.0.2

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 (37) hide show
  1. package/README.md +8 -12
  2. package/dist/bundled/places.esm.js +14 -18
  3. package/dist/bundled/places.esm.js.map +1 -1
  4. package/dist/bundled/places.esm.min.js +4 -4
  5. package/dist/bundled/places.esm.min.js.map +1 -1
  6. package/dist/bundled/places.umd.js +14 -18
  7. package/dist/bundled/places.umd.js.map +1 -1
  8. package/dist/bundled/places.umd.min.js +4 -4
  9. package/dist/bundled/places.umd.min.js.map +1 -1
  10. package/dist/cjs/findPlacesNearPoint.js +3 -5
  11. package/dist/cjs/findPlacesNearPoint.js.map +1 -1
  12. package/dist/cjs/findPlacesWithinExtent.js +4 -6
  13. package/dist/cjs/findPlacesWithinExtent.js.map +1 -1
  14. package/dist/cjs/getCategory.js +1 -1
  15. package/dist/cjs/getCategory.js.map +1 -1
  16. package/dist/cjs/getPlaceDetails.js +1 -1
  17. package/dist/cjs/getPlaceDetails.js.map +1 -1
  18. package/dist/cjs/openapi-types.js.map +1 -1
  19. package/dist/cjs/utils.js +2 -2
  20. package/dist/cjs/utils.js.map +1 -1
  21. package/dist/esm/findPlacesNearPoint.d.ts +3 -5
  22. package/dist/esm/findPlacesNearPoint.js +3 -5
  23. package/dist/esm/findPlacesNearPoint.js.map +1 -1
  24. package/dist/esm/findPlacesWithinExtent.d.ts +4 -6
  25. package/dist/esm/findPlacesWithinExtent.js +4 -6
  26. package/dist/esm/findPlacesWithinExtent.js.map +1 -1
  27. package/dist/esm/getCategory.d.ts +1 -1
  28. package/dist/esm/getCategory.js +1 -1
  29. package/dist/esm/getCategory.js.map +1 -1
  30. package/dist/esm/getPlaceDetails.d.ts +1 -1
  31. package/dist/esm/getPlaceDetails.js +1 -1
  32. package/dist/esm/getPlaceDetails.js.map +1 -1
  33. package/dist/esm/openapi-types.d.ts +341 -164
  34. package/dist/esm/openapi-types.js.map +1 -1
  35. package/dist/esm/utils.js +2 -2
  36. package/dist/esm/utils.js.map +1 -1
  37. package/package.json +1 -1
package/README.md CHANGED
@@ -1,13 +1,10 @@
1
1
  [![npm version][npm-img]][npm-url]
2
- [![build status][travis-img]][travis-url]
3
2
  [![gzip bundle size][gzip-image]][npm-url]
4
3
  [![Coverage Status][coverage-img]][coverage-url]
5
4
  [![apache licensed](https://img.shields.io/badge/license-Apache-green.svg?style=flat-square)](https://raw.githubusercontent.com/Esri/arcgis-rest-js/master/LICENSE)
6
5
 
7
6
  [npm-img]: https://img.shields.io/npm/v/@esri/arcgis-rest-places.svg?style=flat-square
8
7
  [npm-url]: https://www.npmjs.com/package/@esri/arcgis-rest-places
9
- [travis-img]: https://img.shields.io/travis/Esri/arcgis-rest-js/master.svg?style=flat-square
10
- [travis-url]: https://travis-ci.org/Esri/arcgis-rest-js
11
8
  [gzip-image]: https://img.badgesize.io/https://unpkg.com/@esri/arcgis-rest-places/dist/bundled/places.umd.min.js?compression=gzip
12
9
  [coverage-img]: https://codecov.io/gh/Esri/arcgis-rest-js/branch/master/graph/badge.svg
13
10
  [coverage-url]: https://codecov.io/gh/Esri/arcgis-rest-js
@@ -24,21 +21,20 @@ npm install @esri/arcgis-rest-places
24
21
  ```
25
22
 
26
23
  ```js
27
- import { ApiKeyManager } from "@esri/arcgis-rest-request;
28
- import { findPlacesNearPoint
29
- } from "@esri/arcgis-rest-places"
24
+ import { ApiKeyManager } from "@esri/arcgis-rest-request";
25
+ import { findPlacesNearPoint } from "@esri/arcgis-rest-places";
30
26
 
31
27
  const { places } = await findPlacesNearPoint({
32
- x: -3.1883,
33
- y: 55.9533,
34
- categoryIds: ["13002"],
35
- authentication: ApiKeyManager.fromKey("YOUR_API_KEY")
36
- });
28
+ x: -3.1883,
29
+ y: 55.9533,
30
+ categoryIds: ["13002"],
31
+ authentication: ApiKeyManager.fromKey("YOUR_API_KEY")
32
+ });
37
33
 
38
34
  console.log(places[0].name);
39
35
  ```
40
36
 
41
- ### [API Reference](https://esri.github.io/arcgis-rest-js/api/places/)
37
+ ### [API Reference](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-places/)
42
38
 
43
39
  @TODO
44
40
 
@@ -1,14 +1,14 @@
1
1
  /* @preserve
2
- * @esri/arcgis-rest-places - v4.0.0 - Apache-2.0
3
- * Copyright (c) 2017-2023 Esri, Inc.
4
- * Thu May 04 2023 19:07:08 GMT+0000 (Coordinated Universal Time)
2
+ * @esri/arcgis-rest-places - v1.0.1 - Apache-2.0
3
+ * Copyright (c) 2017-2024 Esri, Inc.
4
+ * Sat Jun 15 2024 00:37:55 GMT+0000 (Coordinated Universal Time)
5
5
  */
6
6
  import { appendCustomParams, request } from '@esri/arcgis-rest-request';
7
7
 
8
8
  const baseUrl = "https://places-api.arcgis.com/arcgis/rest/services/places-service/v1";
9
9
  function hasNextPage(response) {
10
- var _a;
11
- return !!((_a = response === null || response === void 0 ? void 0 : response.links) === null || _a === void 0 ? void 0 : _a.next);
10
+ var _a, _b;
11
+ return !!((_a = response === null || response === void 0 ? void 0 : response.links) === null || _a === void 0 ? void 0 : _a.next) || !!((_b = response === null || response === void 0 ? void 0 : response.pagination) === null || _b === void 0 ? void 0 : _b.nextUrl);
12
12
  }
13
13
  function getNextPageParams(currentOffset = 0, currentPageSize = 10) {
14
14
  return {
@@ -35,11 +35,9 @@ function getNextPageParams(currentOffset = 0, currentPageSize = 10) {
35
35
  * - A partial name filter with `name` option
36
36
  *
37
37
  * As this request can return many results, pagination is supported.
38
- * Regardless of paging, the maximum number of places that can be returned
39
- * by a single query is `200`. When a query results in more than `200`
40
- * places, the response will contain the property
41
- * `"maxResultsExceeded":true` in addition to place results. If `maxResultsExceeded`
42
- * is true an additional method `response.nextPage()` can be used to get the next page of results.
38
+ * When a query results in more than [pageSize] places, the response will contain the property
39
+ * `pagination` in addition to place results. If `pagination` exists, an additional method
40
+ * `response.nextPage()` can be used to get the next page of results.
43
41
  *
44
42
  * ```js
45
43
  * import { findPlacesNearPoint } from "@esri/arcgis-rest-places";
@@ -86,11 +84,9 @@ function findPlacesNearPoint(requestOptions) {
86
84
  * - A partial name filter with `name` option
87
85
  *
88
86
  * As this request can return many results, pagination is supported.
89
- * Regardless of paging, the maximum number of places that can be returned
90
- * by a single query is `200`. When a query results in more than `200`
91
- * places, the response will contain the property
92
- * `"maxResultsExceeded":true` in addition to place results. If `maxResultsExceeded`
93
- * is true an additional method `response.nextPage()` can be used to get the next page of results.
87
+ * When a query results in more than [pageSize] places, the response will contain the property
88
+ * `pagination` in addition to place results. If `pagination` exists, an additional method
89
+ * `response.nextPage()` can be used to get the next page of results.
94
90
  *
95
91
  * ```
96
92
  * import { findPlacesWithinExtent } from "@esri/arcgis-rest-places";
@@ -102,7 +98,7 @@ function findPlacesNearPoint(requestOptions) {
102
98
  * xmax: -117.795753,
103
99
  * ymax: 33.873337,
104
100
  * categoryIds: ["13002"],
105
- * authentication: ApiKeyManager.fromKey("YOUR_API_KEY");
101
+ * authentication: ApiKeyManager.fromKey("YOUR_API_KEY")
106
102
  * });
107
103
  *
108
104
  * console.log(results)
@@ -153,7 +149,7 @@ function findPlacesWithinExtent(requestOptions) {
153
149
  *
154
150
  * const place = getPlaceDetails({
155
151
  * placeId: "e78051acc722c55ab11ba930d8dd7772",
156
- * authentication: ApiKeyManager.fromKey("YOUR_API_KEY");
152
+ * authentication: ApiKeyManager.fromKey("YOUR_API_KEY")
157
153
  * });
158
154
  *
159
155
  * console.log(place);
@@ -201,7 +197,7 @@ function getCategories(requestOptions) {
201
197
  *
202
198
  * const response = getCategory({
203
199
  * categoryId: "10000",
204
- * authentication: ApiKeyManager.fromKey("YOUR_API_KEY");
200
+ * authentication: ApiKeyManager.fromKey("YOUR_API_KEY")
205
201
  * });
206
202
  *
207
203
  * console.log(response);
@@ -1 +1 @@
1
- {"version":3,"file":"places.esm.js","sources":["../../src/utils.ts","../../src/findPlacesNearPoint.ts","../../src/findPlacesWithinExtent.ts","../../src/getPlaceDetails.ts","../../src/getCategories.ts","../../src/getCategory.ts"],"sourcesContent":["export const baseUrl =\n \"https://places-api.arcgis.com/arcgis/rest/services/places-service/v1\";\n\nexport function hasNextPage(response: any) {\n return !!response?.links?.next;\n}\n\nexport function getNextPageParams(currentOffset = 0, currentPageSize = 10) {\n return {\n offset: currentOffset + currentPageSize,\n pageSize: currentPageSize\n };\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"nearPointGet\"][\"parameters\"][\"query\"],\n \"x\" | \"y\" | \"radius\" | \"categoryIds\" | \"pageSize\" | \"offset\" | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"nearPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesNearPoint};\n */\nexport interface IFindPlacesNearPointResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesNearPointResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlacesNearPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches places that are within a given radius of a geographic point.\n * You must supply the `x` and `y` coordinates of the point that you wish\n * to search from. You can either specify a search radius, or use the\n * default (500 meters). You could use this method to search for places\n * around a user's GPS position, or a location clicked on a map.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * Regardless of paging, the maximum number of places that can be returned\n * by a single query is `200`. When a query results in more than `200`\n * places, the response will contain the property\n * `\"maxResultsExceeded\":true` in addition to place results. If `maxResultsExceeded`\n * is true an additional method `response.nextPage()` can be used to get the next page of results.\n *\n * ```js\n * import { findPlacesNearPoint } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await findPlacesNearPoint({\n * x: -3.1883,\n * y: 55.9533,\n * radius: 100,\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n */\nexport function findPlacesNearPoint(\n requestOptions: IFindPlacesNearPointOptions\n): Promise<IFindPlacesNearPointResponse> {\n const options = appendCustomParams<IFindPlacesNearPointOptions>(\n requestOptions,\n [\"x\", \"y\", \"radius\", \"categoryIds\", \"pageSize\", \"offset\", \"searchText\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/near-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesNearPointResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesNearPoint(nextOptions);\n };\n }\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"withinExtentGet\"][\"parameters\"][\"query\"],\n | \"xmin\"\n | \"ymin\"\n | \"xmax\"\n | \"ymax\"\n | \"categoryIds\"\n | \"pageSize\"\n | \"offset\"\n | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"withinExtentGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesWithinExtent};\n */\nexport interface IFindPlacesWithinExtentResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesWithinExtentResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlaceWithinExtentOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches the world-wide set of places for those that are within an\n * extent, or bounding box. You must supply the `xmin`, `ymin`, `xmax` and\n * `ymax` coordinates of the extent. You could use this endpoint to search\n * for places in the visible extent of a user's screen.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can also refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * Regardless of paging, the maximum number of places that can be returned\n * by a single query is `200`. When a query results in more than `200`\n * places, the response will contain the property\n * `\"maxResultsExceeded\":true` in addition to place results. If `maxResultsExceeded`\n * is true an additional method `response.nextPage()` can be used to get the next page of results.\n *\n * ```\n * import { findPlacesWithinExtent } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findPlacesWithinExtent({\n * xmin: -118.013334,\n * ymin: 33.78193,\n * xmax: -117.795753,\n * ymax: 33.873337,\n * categoryIds: [\"13002\"],\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findPlacesWithinExtent(\n requestOptions: IFindPlaceWithinExtentOptions\n): Promise<IFindPlacesWithinExtentResponse> {\n const options = appendCustomParams<IFindPlaceWithinExtentOptions>(\n requestOptions,\n [\n \"xmin\",\n \"ymin\",\n \"xmax\",\n \"ymax\",\n \"categoryIds\",\n \"pageSize\",\n \"offset\",\n \"searchText\"\n ],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/within-extent`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesWithinExtentResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesWithinExtent(nextOptions);\n };\n }\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"placeIdGet\"][\"parameters\"][\"query\"],\n \"requestedFields\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"placeIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getPlace};\n */\nexport interface IGetPlaceResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getPlace}.\n */\nexport interface IGetPlaceOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n placeId: string;\n}\n\n/**\n * Returns a single place, including additional details, such as:\n *\n * - contact details\n * - address\n * - price information\n * - user rating\n * - opening hours\n *\n * This endpoint can be used to fetch additional details for a specific\n * place, returned from a places search request.\n *\n * Note that some fields, such as opening hours, are not available for\n * every place. Where a field is not available it will be omitted from the\n * response and you will not be charged for this data.\n *\n * ```js\n * import { getPlaceDetails } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const place = getPlaceDetails({\n * placeId: \"e78051acc722c55ab11ba930d8dd7772\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(place);\n * ```\n */\nexport function getPlaceDetails(\n requestOptions: IGetPlaceOptions\n): Promise<IGetPlaceResponse> {\n const { placeId } = requestOptions;\n\n const options = appendCustomParams<IGetPlaceOptions>(\n requestOptions,\n [\"requestedFields\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/places/${placeId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"categoriesGet\"][\"parameters\"][\"query\"],\n \"filter\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategories};\n */\nexport interface IGetCategoriesResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategories}.\n */\nexport interface IGetCategoriesOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * The ArcGIS Places service has many categories (or types) of place, from\n * art museums to zoos. This endpoint returns all the categories including\n * their label and `categoryId`. The category Id can be used to search for\n * types of places with a `places/near-point` or `places/within-extent`\n * request.\n *\n * Categories also have information on their `parent`. This allows you to\n * search for specific categories such as \"French Restaurant\" - or to\n * look for more generic types such as \"Restaurant\".\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await getCategories({\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response.categories);\n * ```\n */\nexport function getCategories(\n requestOptions: IGetCategoriesOptions\n): Promise<IGetCategoriesResponse> {\n const options = appendCustomParams<IGetCategoriesOptions>(\n requestOptions,\n [\"filter\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/categories`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = operations[\"categoriesCategoryIdGet\"][\"parameters\"][\"query\"];\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesCategoryIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategory};\n */\nexport interface IGetCategoryResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategory}.\n */\nexport interface IGetCategoryOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n categoryId: string;\n}\n\n/**\n * Returns details about a single category by Id.\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = getCategory({\n * categoryId: \"10000\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n **/\nexport function getCategory(\n requestOptions: IGetCategoryOptions\n): Promise<IGetCategoryResponse> {\n const { categoryId } = requestOptions;\n\n const options = appendCustomParams<IGetCategoryOptions>(requestOptions, [], {\n ...requestOptions\n });\n\n return request(`${baseUrl}/categories/${categoryId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"places.esm.js","sources":["../../src/utils.ts","../../src/findPlacesNearPoint.ts","../../src/findPlacesWithinExtent.ts","../../src/getPlaceDetails.ts","../../src/getCategories.ts","../../src/getCategory.ts"],"sourcesContent":["export const baseUrl =\n \"https://places-api.arcgis.com/arcgis/rest/services/places-service/v1\";\n\nexport function hasNextPage(response: any) {\n return !!response?.links?.next || !!response?.pagination?.nextUrl;\n}\n\nexport function getNextPageParams(currentOffset = 0, currentPageSize = 10) {\n return {\n offset: currentOffset + currentPageSize,\n pageSize: currentPageSize\n };\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"nearPointGet\"][\"parameters\"][\"query\"],\n \"x\" | \"y\" | \"radius\" | \"categoryIds\" | \"pageSize\" | \"offset\" | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"nearPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesNearPoint};\n */\nexport interface IFindPlacesNearPointResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesNearPointResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlacesNearPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches places that are within a given radius of a geographic point.\n * You must supply the `x` and `y` coordinates of the point that you wish\n * to search from. You can either specify a search radius, or use the\n * default (500 meters). You could use this method to search for places\n * around a user's GPS position, or a location clicked on a map.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * When a query results in more than [pageSize] places, the response will contain the property\n * `pagination` in addition to place results. If `pagination` exists, an additional method\n * `response.nextPage()` can be used to get the next page of results.\n *\n * ```js\n * import { findPlacesNearPoint } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await findPlacesNearPoint({\n * x: -3.1883,\n * y: 55.9533,\n * radius: 100,\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n */\nexport function findPlacesNearPoint(\n requestOptions: IFindPlacesNearPointOptions\n): Promise<IFindPlacesNearPointResponse> {\n const options = appendCustomParams<IFindPlacesNearPointOptions>(\n requestOptions,\n [\"x\", \"y\", \"radius\", \"categoryIds\", \"pageSize\", \"offset\", \"searchText\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/near-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesNearPointResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesNearPoint(nextOptions);\n };\n }\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"withinExtentGet\"][\"parameters\"][\"query\"],\n | \"xmin\"\n | \"ymin\"\n | \"xmax\"\n | \"ymax\"\n | \"categoryIds\"\n | \"pageSize\"\n | \"offset\"\n | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"withinExtentGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesWithinExtent};\n */\nexport interface IFindPlacesWithinExtentResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesWithinExtentResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlaceWithinExtentOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches the world-wide set of places for those that are within an\n * extent, or bounding box. You must supply the `xmin`, `ymin`, `xmax` and\n * `ymax` coordinates of the extent. You could use this endpoint to search\n * for places in the visible extent of a user's screen.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can also refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * When a query results in more than [pageSize] places, the response will contain the property\n * `pagination` in addition to place results. If `pagination` exists, an additional method\n * `response.nextPage()` can be used to get the next page of results.\n *\n * ```\n * import { findPlacesWithinExtent } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findPlacesWithinExtent({\n * xmin: -118.013334,\n * ymin: 33.78193,\n * xmax: -117.795753,\n * ymax: 33.873337,\n * categoryIds: [\"13002\"],\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findPlacesWithinExtent(\n requestOptions: IFindPlaceWithinExtentOptions\n): Promise<IFindPlacesWithinExtentResponse> {\n const options = appendCustomParams<IFindPlaceWithinExtentOptions>(\n requestOptions,\n [\n \"xmin\",\n \"ymin\",\n \"xmax\",\n \"ymax\",\n \"categoryIds\",\n \"pageSize\",\n \"offset\",\n \"searchText\"\n ],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/within-extent`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesWithinExtentResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesWithinExtent(nextOptions);\n };\n }\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"placeIdGet\"][\"parameters\"][\"query\"],\n \"requestedFields\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"placeIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getPlace};\n */\nexport interface IGetPlaceResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getPlace}.\n */\nexport interface IGetPlaceOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n placeId: string;\n}\n\n/**\n * Returns a single place, including additional details, such as:\n *\n * - contact details\n * - address\n * - price information\n * - user rating\n * - opening hours\n *\n * This endpoint can be used to fetch additional details for a specific\n * place, returned from a places search request.\n *\n * Note that some fields, such as opening hours, are not available for\n * every place. Where a field is not available it will be omitted from the\n * response and you will not be charged for this data.\n *\n * ```js\n * import { getPlaceDetails } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const place = getPlaceDetails({\n * placeId: \"e78051acc722c55ab11ba930d8dd7772\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(place);\n * ```\n */\nexport function getPlaceDetails(\n requestOptions: IGetPlaceOptions\n): Promise<IGetPlaceResponse> {\n const { placeId } = requestOptions;\n\n const options = appendCustomParams<IGetPlaceOptions>(\n requestOptions,\n [\"requestedFields\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/places/${placeId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"categoriesGet\"][\"parameters\"][\"query\"],\n \"filter\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategories};\n */\nexport interface IGetCategoriesResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategories}.\n */\nexport interface IGetCategoriesOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * The ArcGIS Places service has many categories (or types) of place, from\n * art museums to zoos. This endpoint returns all the categories including\n * their label and `categoryId`. The category Id can be used to search for\n * types of places with a `places/near-point` or `places/within-extent`\n * request.\n *\n * Categories also have information on their `parent`. This allows you to\n * search for specific categories such as \"French Restaurant\" - or to\n * look for more generic types such as \"Restaurant\".\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await getCategories({\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response.categories);\n * ```\n */\nexport function getCategories(\n requestOptions: IGetCategoriesOptions\n): Promise<IGetCategoriesResponse> {\n const options = appendCustomParams<IGetCategoriesOptions>(\n requestOptions,\n [\"filter\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/categories`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = operations[\"categoriesCategoryIdGet\"][\"parameters\"][\"query\"];\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesCategoryIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategory};\n */\nexport interface IGetCategoryResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategory}.\n */\nexport interface IGetCategoryOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n categoryId: string;\n}\n\n/**\n * Returns details about a single category by Id.\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = getCategory({\n * categoryId: \"10000\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response);\n * ```\n **/\nexport function getCategory(\n requestOptions: IGetCategoryOptions\n): Promise<IGetCategoryResponse> {\n const { categoryId } = requestOptions;\n\n const options = appendCustomParams<IGetCategoryOptions>(requestOptions, [], {\n ...requestOptions\n });\n\n return request(`${baseUrl}/categories/${categoryId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n"],"names":[],"mappings":"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"}
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/arcgis-rest-places - v4.0.0 - Apache-2.0
3
- * Copyright (c) 2017-2023 Esri, Inc.
4
- * Thu May 04 2023 19:07:08 GMT+0000 (Coordinated Universal Time)
2
+ * @esri/arcgis-rest-places - v1.0.1 - Apache-2.0
3
+ * Copyright (c) 2017-2024 Esri, Inc.
4
+ * Sat Jun 15 2024 00:37:55 GMT+0000 (Coordinated Universal Time)
5
5
  */
6
- import{appendCustomParams as e,request as t}from"@esri/arcgis-rest-request";const s="https://places-api.arcgis.com/arcgis/rest/services/places-service/v1";function n(e){var t;return!!(null===(t=null==e?void 0:e.links)||void 0===t?void 0:t.next)}function c(e=0,t=10){return{offset:e+t,pageSize:t}}function i(a){const r=e(a,["x","y","radius","categoryIds","pageSize","offset","searchText"],Object.assign({},a));return t(`${s}/places/near-point`,Object.assign(Object.assign({},r),{httpMethod:"GET"})).then((e=>{const t=Object.assign({},e);return n(e)&&(t.nextPage=()=>i(Object.assign(Object.assign({},a),c(a.offset,a.pageSize)))),t}))}function a(i){const r=e(i,["xmin","ymin","xmax","ymax","categoryIds","pageSize","offset","searchText"],Object.assign({},i));return t(`${s}/places/within-extent`,Object.assign(Object.assign({},r),{httpMethod:"GET"})).then((e=>{const t=Object.assign({},e);return n(e)&&(t.nextPage=()=>a(Object.assign(Object.assign({},i),c(i.offset,i.pageSize)))),t}))}function r(n){const{placeId:c}=n,i=e(n,["requestedFields"],Object.assign({},n));return t(`${s}/places/${c}`,Object.assign(Object.assign({},i),{httpMethod:"GET"}))}function o(n){const c=e(n,["filter"],Object.assign({},n));return t(`${s}/categories`,Object.assign(Object.assign({},c),{httpMethod:"GET"}))}function g(n){const{categoryId:c}=n,i=e(n,[],Object.assign({},n));return t(`${s}/categories/${c}`,Object.assign(Object.assign({},i),{httpMethod:"GET"}))}export{i as findPlacesNearPoint,a as findPlacesWithinExtent,o as getCategories,g as getCategory,r as getPlaceDetails};
6
+ import{appendCustomParams as e,request as t}from"@esri/arcgis-rest-request";const s="https://places-api.arcgis.com/arcgis/rest/services/places-service/v1";function n(e){var t,s;return!!(null===(t=null==e?void 0:e.links)||void 0===t?void 0:t.next)||!!(null===(s=null==e?void 0:e.pagination)||void 0===s?void 0:s.nextUrl)}function i(e=0,t=10){return{offset:e+t,pageSize:t}}function c(a){const r=e(a,["x","y","radius","categoryIds","pageSize","offset","searchText"],Object.assign({},a));return t(`${s}/places/near-point`,Object.assign(Object.assign({},r),{httpMethod:"GET"})).then((e=>{const t=Object.assign({},e);return n(e)&&(t.nextPage=()=>c(Object.assign(Object.assign({},a),i(a.offset,a.pageSize)))),t}))}function a(c){const r=e(c,["xmin","ymin","xmax","ymax","categoryIds","pageSize","offset","searchText"],Object.assign({},c));return t(`${s}/places/within-extent`,Object.assign(Object.assign({},r),{httpMethod:"GET"})).then((e=>{const t=Object.assign({},e);return n(e)&&(t.nextPage=()=>a(Object.assign(Object.assign({},c),i(c.offset,c.pageSize)))),t}))}function r(n){const{placeId:i}=n,c=e(n,["requestedFields"],Object.assign({},n));return t(`${s}/places/${i}`,Object.assign(Object.assign({},c),{httpMethod:"GET"}))}function o(n){const i=e(n,["filter"],Object.assign({},n));return t(`${s}/categories`,Object.assign(Object.assign({},i),{httpMethod:"GET"}))}function g(n){const{categoryId:i}=n,c=e(n,[],Object.assign({},n));return t(`${s}/categories/${i}`,Object.assign(Object.assign({},c),{httpMethod:"GET"}))}export{c as findPlacesNearPoint,a as findPlacesWithinExtent,o as getCategories,g as getCategory,r as getPlaceDetails};
7
7
  //# sourceMappingURL=places.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"places.esm.min.js","sources":["../../src/utils.ts","../../src/findPlacesNearPoint.ts","../../src/findPlacesWithinExtent.ts","../../src/getPlaceDetails.ts","../../src/getCategories.ts","../../src/getCategory.ts"],"sourcesContent":["export const baseUrl =\n \"https://places-api.arcgis.com/arcgis/rest/services/places-service/v1\";\n\nexport function hasNextPage(response: any) {\n return !!response?.links?.next;\n}\n\nexport function getNextPageParams(currentOffset = 0, currentPageSize = 10) {\n return {\n offset: currentOffset + currentPageSize,\n pageSize: currentPageSize\n };\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"nearPointGet\"][\"parameters\"][\"query\"],\n \"x\" | \"y\" | \"radius\" | \"categoryIds\" | \"pageSize\" | \"offset\" | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"nearPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesNearPoint};\n */\nexport interface IFindPlacesNearPointResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesNearPointResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlacesNearPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches places that are within a given radius of a geographic point.\n * You must supply the `x` and `y` coordinates of the point that you wish\n * to search from. You can either specify a search radius, or use the\n * default (500 meters). You could use this method to search for places\n * around a user's GPS position, or a location clicked on a map.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * Regardless of paging, the maximum number of places that can be returned\n * by a single query is `200`. When a query results in more than `200`\n * places, the response will contain the property\n * `\"maxResultsExceeded\":true` in addition to place results. If `maxResultsExceeded`\n * is true an additional method `response.nextPage()` can be used to get the next page of results.\n *\n * ```js\n * import { findPlacesNearPoint } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await findPlacesNearPoint({\n * x: -3.1883,\n * y: 55.9533,\n * radius: 100,\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n */\nexport function findPlacesNearPoint(\n requestOptions: IFindPlacesNearPointOptions\n): Promise<IFindPlacesNearPointResponse> {\n const options = appendCustomParams<IFindPlacesNearPointOptions>(\n requestOptions,\n [\"x\", \"y\", \"radius\", \"categoryIds\", \"pageSize\", \"offset\", \"searchText\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/near-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesNearPointResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesNearPoint(nextOptions);\n };\n }\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"withinExtentGet\"][\"parameters\"][\"query\"],\n | \"xmin\"\n | \"ymin\"\n | \"xmax\"\n | \"ymax\"\n | \"categoryIds\"\n | \"pageSize\"\n | \"offset\"\n | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"withinExtentGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesWithinExtent};\n */\nexport interface IFindPlacesWithinExtentResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesWithinExtentResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlaceWithinExtentOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches the world-wide set of places for those that are within an\n * extent, or bounding box. You must supply the `xmin`, `ymin`, `xmax` and\n * `ymax` coordinates of the extent. You could use this endpoint to search\n * for places in the visible extent of a user's screen.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can also refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * Regardless of paging, the maximum number of places that can be returned\n * by a single query is `200`. When a query results in more than `200`\n * places, the response will contain the property\n * `\"maxResultsExceeded\":true` in addition to place results. If `maxResultsExceeded`\n * is true an additional method `response.nextPage()` can be used to get the next page of results.\n *\n * ```\n * import { findPlacesWithinExtent } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findPlacesWithinExtent({\n * xmin: -118.013334,\n * ymin: 33.78193,\n * xmax: -117.795753,\n * ymax: 33.873337,\n * categoryIds: [\"13002\"],\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findPlacesWithinExtent(\n requestOptions: IFindPlaceWithinExtentOptions\n): Promise<IFindPlacesWithinExtentResponse> {\n const options = appendCustomParams<IFindPlaceWithinExtentOptions>(\n requestOptions,\n [\n \"xmin\",\n \"ymin\",\n \"xmax\",\n \"ymax\",\n \"categoryIds\",\n \"pageSize\",\n \"offset\",\n \"searchText\"\n ],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/within-extent`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesWithinExtentResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesWithinExtent(nextOptions);\n };\n }\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"placeIdGet\"][\"parameters\"][\"query\"],\n \"requestedFields\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"placeIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getPlace};\n */\nexport interface IGetPlaceResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getPlace}.\n */\nexport interface IGetPlaceOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n placeId: string;\n}\n\n/**\n * Returns a single place, including additional details, such as:\n *\n * - contact details\n * - address\n * - price information\n * - user rating\n * - opening hours\n *\n * This endpoint can be used to fetch additional details for a specific\n * place, returned from a places search request.\n *\n * Note that some fields, such as opening hours, are not available for\n * every place. Where a field is not available it will be omitted from the\n * response and you will not be charged for this data.\n *\n * ```js\n * import { getPlaceDetails } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const place = getPlaceDetails({\n * placeId: \"e78051acc722c55ab11ba930d8dd7772\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(place);\n * ```\n */\nexport function getPlaceDetails(\n requestOptions: IGetPlaceOptions\n): Promise<IGetPlaceResponse> {\n const { placeId } = requestOptions;\n\n const options = appendCustomParams<IGetPlaceOptions>(\n requestOptions,\n [\"requestedFields\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/places/${placeId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"categoriesGet\"][\"parameters\"][\"query\"],\n \"filter\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategories};\n */\nexport interface IGetCategoriesResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategories}.\n */\nexport interface IGetCategoriesOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * The ArcGIS Places service has many categories (or types) of place, from\n * art museums to zoos. This endpoint returns all the categories including\n * their label and `categoryId`. The category Id can be used to search for\n * types of places with a `places/near-point` or `places/within-extent`\n * request.\n *\n * Categories also have information on their `parent`. This allows you to\n * search for specific categories such as \"French Restaurant\" - or to\n * look for more generic types such as \"Restaurant\".\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await getCategories({\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response.categories);\n * ```\n */\nexport function getCategories(\n requestOptions: IGetCategoriesOptions\n): Promise<IGetCategoriesResponse> {\n const options = appendCustomParams<IGetCategoriesOptions>(\n requestOptions,\n [\"filter\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/categories`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = operations[\"categoriesCategoryIdGet\"][\"parameters\"][\"query\"];\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesCategoryIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategory};\n */\nexport interface IGetCategoryResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategory}.\n */\nexport interface IGetCategoryOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n categoryId: string;\n}\n\n/**\n * Returns details about a single category by Id.\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = getCategory({\n * categoryId: \"10000\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n **/\nexport function getCategory(\n requestOptions: IGetCategoryOptions\n): Promise<IGetCategoryResponse> {\n const { categoryId } = requestOptions;\n\n const options = appendCustomParams<IGetCategoryOptions>(requestOptions, [], {\n ...requestOptions\n });\n\n return request(`${baseUrl}/categories/${categoryId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n"],"names":["baseUrl","hasNextPage","response","links","next","getNextPageParams","currentOffset","currentPageSize","offset","pageSize","findPlacesNearPoint","requestOptions","options","appendCustomParams","request","httpMethod","then","r","nextPage","findPlacesWithinExtent","getPlaceDetails","placeId","getCategories","getCategory","categoryId"],"mappings":";;;;;4EAAO,MAAMA,EACX,gFAEcC,EAAYC,SAC1B,mBAASA,eAAAA,EAAUC,4BAAOC,KAC5B,UAEgBC,EAAkBC,EAAgB,EAAGC,EAAkB,IACrE,MAAO,CACLC,OAAQF,EAAgBC,EACxBE,SAAUF,EAEd,UC4DgBG,EACdC,GAEA,MAAMC,EAAUC,EACdF,EACA,CAAC,IAAK,IAAK,SAAU,cAAe,WAAY,SAAU,+BAErDA,IAIP,OACEG,EAAQ,GAAGd,qDACNY,IACHG,WAAY,SAEdC,MAAMd,IACN,MAAMe,mBACDf,GAaL,OAVID,EAAYC,KACde,EAAEC,SAAW,IAKJR,iCAHFC,GACAN,EAAkBM,EAAeH,OAAQG,EAAeF,aAM1DQ,CAAC,GAEZ,UCzBgBE,EACdR,GAEA,MAAMC,EAAUC,EACdF,EACA,CACE,OACA,OACA,OACA,OACA,cACA,WACA,SACA,+BAGGA,IAIP,OACEG,EAAQ,GAAGd,wDACNY,IACHG,WAAY,SAEdC,MAAMd,IACN,MAAMe,mBACDf,GAYL,OATID,EAAYC,KACde,EAAEC,SAAW,IAKJC,iCAHFR,GACAN,EAAkBM,EAAeH,OAAQG,EAAeF,aAK1DQ,CAAC,GAEZ,UC3DgBG,EACdT,GAEA,MAAMU,QAAEA,GAAYV,EAEdC,EAAUC,EACdF,EACA,CAAC,oCAEIA,IAIP,OAAOG,EAAQ,GAAGd,YAAkBqB,mCAC/BT,IACHG,WAAY,QAEhB,UCzBgBO,EACdX,GAEA,MAAMC,EAAUC,EACdF,EACA,CAAC,2BAEIA,IAIP,OAAOG,EAAQ,GAAGd,8CACbY,IACHG,WAAY,QAEhB,UCvBgBQ,EACdZ,GAEA,MAAMa,WAAEA,GAAeb,EAEjBC,EAAUC,EAAwCF,EAAgB,oBACnEA,IAGL,OAAOG,EAAQ,GAAGd,gBAAsBwB,mCACnCZ,IACHG,WAAY,QAEhB"}
1
+ {"version":3,"file":"places.esm.min.js","sources":["../../src/utils.ts","../../src/findPlacesNearPoint.ts","../../src/findPlacesWithinExtent.ts","../../src/getPlaceDetails.ts","../../src/getCategories.ts","../../src/getCategory.ts"],"sourcesContent":["export const baseUrl =\n \"https://places-api.arcgis.com/arcgis/rest/services/places-service/v1\";\n\nexport function hasNextPage(response: any) {\n return !!response?.links?.next || !!response?.pagination?.nextUrl;\n}\n\nexport function getNextPageParams(currentOffset = 0, currentPageSize = 10) {\n return {\n offset: currentOffset + currentPageSize,\n pageSize: currentPageSize\n };\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"nearPointGet\"][\"parameters\"][\"query\"],\n \"x\" | \"y\" | \"radius\" | \"categoryIds\" | \"pageSize\" | \"offset\" | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"nearPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesNearPoint};\n */\nexport interface IFindPlacesNearPointResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesNearPointResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlacesNearPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches places that are within a given radius of a geographic point.\n * You must supply the `x` and `y` coordinates of the point that you wish\n * to search from. You can either specify a search radius, or use the\n * default (500 meters). You could use this method to search for places\n * around a user's GPS position, or a location clicked on a map.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * When a query results in more than [pageSize] places, the response will contain the property\n * `pagination` in addition to place results. If `pagination` exists, an additional method\n * `response.nextPage()` can be used to get the next page of results.\n *\n * ```js\n * import { findPlacesNearPoint } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await findPlacesNearPoint({\n * x: -3.1883,\n * y: 55.9533,\n * radius: 100,\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n */\nexport function findPlacesNearPoint(\n requestOptions: IFindPlacesNearPointOptions\n): Promise<IFindPlacesNearPointResponse> {\n const options = appendCustomParams<IFindPlacesNearPointOptions>(\n requestOptions,\n [\"x\", \"y\", \"radius\", \"categoryIds\", \"pageSize\", \"offset\", \"searchText\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/near-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesNearPointResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesNearPoint(nextOptions);\n };\n }\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"withinExtentGet\"][\"parameters\"][\"query\"],\n | \"xmin\"\n | \"ymin\"\n | \"xmax\"\n | \"ymax\"\n | \"categoryIds\"\n | \"pageSize\"\n | \"offset\"\n | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"withinExtentGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesWithinExtent};\n */\nexport interface IFindPlacesWithinExtentResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesWithinExtentResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlaceWithinExtentOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches the world-wide set of places for those that are within an\n * extent, or bounding box. You must supply the `xmin`, `ymin`, `xmax` and\n * `ymax` coordinates of the extent. You could use this endpoint to search\n * for places in the visible extent of a user's screen.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can also refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * When a query results in more than [pageSize] places, the response will contain the property\n * `pagination` in addition to place results. If `pagination` exists, an additional method\n * `response.nextPage()` can be used to get the next page of results.\n *\n * ```\n * import { findPlacesWithinExtent } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findPlacesWithinExtent({\n * xmin: -118.013334,\n * ymin: 33.78193,\n * xmax: -117.795753,\n * ymax: 33.873337,\n * categoryIds: [\"13002\"],\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findPlacesWithinExtent(\n requestOptions: IFindPlaceWithinExtentOptions\n): Promise<IFindPlacesWithinExtentResponse> {\n const options = appendCustomParams<IFindPlaceWithinExtentOptions>(\n requestOptions,\n [\n \"xmin\",\n \"ymin\",\n \"xmax\",\n \"ymax\",\n \"categoryIds\",\n \"pageSize\",\n \"offset\",\n \"searchText\"\n ],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/within-extent`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesWithinExtentResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesWithinExtent(nextOptions);\n };\n }\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"placeIdGet\"][\"parameters\"][\"query\"],\n \"requestedFields\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"placeIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getPlace};\n */\nexport interface IGetPlaceResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getPlace}.\n */\nexport interface IGetPlaceOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n placeId: string;\n}\n\n/**\n * Returns a single place, including additional details, such as:\n *\n * - contact details\n * - address\n * - price information\n * - user rating\n * - opening hours\n *\n * This endpoint can be used to fetch additional details for a specific\n * place, returned from a places search request.\n *\n * Note that some fields, such as opening hours, are not available for\n * every place. Where a field is not available it will be omitted from the\n * response and you will not be charged for this data.\n *\n * ```js\n * import { getPlaceDetails } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const place = getPlaceDetails({\n * placeId: \"e78051acc722c55ab11ba930d8dd7772\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(place);\n * ```\n */\nexport function getPlaceDetails(\n requestOptions: IGetPlaceOptions\n): Promise<IGetPlaceResponse> {\n const { placeId } = requestOptions;\n\n const options = appendCustomParams<IGetPlaceOptions>(\n requestOptions,\n [\"requestedFields\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/places/${placeId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"categoriesGet\"][\"parameters\"][\"query\"],\n \"filter\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategories};\n */\nexport interface IGetCategoriesResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategories}.\n */\nexport interface IGetCategoriesOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * The ArcGIS Places service has many categories (or types) of place, from\n * art museums to zoos. This endpoint returns all the categories including\n * their label and `categoryId`. The category Id can be used to search for\n * types of places with a `places/near-point` or `places/within-extent`\n * request.\n *\n * Categories also have information on their `parent`. This allows you to\n * search for specific categories such as \"French Restaurant\" - or to\n * look for more generic types such as \"Restaurant\".\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await getCategories({\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response.categories);\n * ```\n */\nexport function getCategories(\n requestOptions: IGetCategoriesOptions\n): Promise<IGetCategoriesResponse> {\n const options = appendCustomParams<IGetCategoriesOptions>(\n requestOptions,\n [\"filter\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/categories`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = operations[\"categoriesCategoryIdGet\"][\"parameters\"][\"query\"];\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesCategoryIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategory};\n */\nexport interface IGetCategoryResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategory}.\n */\nexport interface IGetCategoryOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n categoryId: string;\n}\n\n/**\n * Returns details about a single category by Id.\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = getCategory({\n * categoryId: \"10000\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response);\n * ```\n **/\nexport function getCategory(\n requestOptions: IGetCategoryOptions\n): Promise<IGetCategoryResponse> {\n const { categoryId } = requestOptions;\n\n const options = appendCustomParams<IGetCategoryOptions>(requestOptions, [], {\n ...requestOptions\n });\n\n return request(`${baseUrl}/categories/${categoryId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n"],"names":["baseUrl","hasNextPage","response","links","next","pagination","nextUrl","getNextPageParams","currentOffset","currentPageSize","offset","pageSize","findPlacesNearPoint","requestOptions","options","appendCustomParams","request","httpMethod","then","r","nextPage","findPlacesWithinExtent","getPlaceDetails","placeId","getCategories","getCategory","categoryId"],"mappings":";;;;;4EAAO,MAAMA,EACX,gFAEcC,EAAYC,WAC1B,mBAASA,eAAAA,EAAUC,4BAAOC,oBAAUF,eAAAA,EAAUG,iCAAYC,QAC5D,UAEgBC,EAAkBC,EAAgB,EAAGC,EAAkB,IACrE,MAAO,CACLC,OAAQF,EAAgBC,EACxBE,SAAUF,EAEd,UC0DgBG,EACdC,GAEA,MAAMC,EAAUC,EACdF,EACA,CAAC,IAAK,IAAK,SAAU,cAAe,WAAY,SAAU,+BAErDA,IAIP,OACEG,EAAQ,GAAGhB,qDACNc,IACHG,WAAY,SAEdC,MAAMhB,IACN,MAAMiB,mBACDjB,GAaL,OAVID,EAAYC,KACdiB,EAAEC,SAAW,IAKJR,iCAHFC,GACAN,EAAkBM,EAAeH,OAAQG,EAAeF,aAM1DQ,CAAC,GAEZ,UCzBgBE,EACdR,GAEA,MAAMC,EAAUC,EACdF,EACA,CACE,OACA,OACA,OACA,OACA,cACA,WACA,SACA,+BAGGA,IAIP,OACEG,EAAQ,GAAGhB,wDACNc,IACHG,WAAY,SAEdC,MAAMhB,IACN,MAAMiB,mBACDjB,GAYL,OATID,EAAYC,KACdiB,EAAEC,SAAW,IAKJC,iCAHFR,GACAN,EAAkBM,EAAeH,OAAQG,EAAeF,aAK1DQ,CAAC,GAEZ,UCzDgBG,EACdT,GAEA,MAAMU,QAAEA,GAAYV,EAEdC,EAAUC,EACdF,EACA,CAAC,oCAEIA,IAIP,OAAOG,EAAQ,GAAGhB,YAAkBuB,mCAC/BT,IACHG,WAAY,QAEhB,UCzBgBO,EACdX,GAEA,MAAMC,EAAUC,EACdF,EACA,CAAC,2BAEIA,IAIP,OAAOG,EAAQ,GAAGhB,8CACbc,IACHG,WAAY,QAEhB,UCvBgBQ,EACdZ,GAEA,MAAMa,WAAEA,GAAeb,EAEjBC,EAAUC,EAAwCF,EAAgB,oBACnEA,IAGL,OAAOG,EAAQ,GAAGhB,gBAAsB0B,mCACnCZ,IACHG,WAAY,QAEhB"}
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/arcgis-rest-places - v4.0.0 - Apache-2.0
3
- * Copyright (c) 2017-2023 Esri, Inc.
4
- * Thu May 04 2023 19:07:08 GMT+0000 (Coordinated Universal Time)
2
+ * @esri/arcgis-rest-places - v1.0.1 - Apache-2.0
3
+ * Copyright (c) 2017-2024 Esri, Inc.
4
+ * Sat Jun 15 2024 00:37:55 GMT+0000 (Coordinated Universal Time)
5
5
  */
6
6
  (function (global, factory) {
7
7
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/arcgis-rest-request')) :
@@ -11,8 +11,8 @@
11
11
 
12
12
  const baseUrl = "https://places-api.arcgis.com/arcgis/rest/services/places-service/v1";
13
13
  function hasNextPage(response) {
14
- var _a;
15
- return !!((_a = response === null || response === void 0 ? void 0 : response.links) === null || _a === void 0 ? void 0 : _a.next);
14
+ var _a, _b;
15
+ return !!((_a = response === null || response === void 0 ? void 0 : response.links) === null || _a === void 0 ? void 0 : _a.next) || !!((_b = response === null || response === void 0 ? void 0 : response.pagination) === null || _b === void 0 ? void 0 : _b.nextUrl);
16
16
  }
17
17
  function getNextPageParams(currentOffset = 0, currentPageSize = 10) {
18
18
  return {
@@ -39,11 +39,9 @@
39
39
  * - A partial name filter with `name` option
40
40
  *
41
41
  * As this request can return many results, pagination is supported.
42
- * Regardless of paging, the maximum number of places that can be returned
43
- * by a single query is `200`. When a query results in more than `200`
44
- * places, the response will contain the property
45
- * `"maxResultsExceeded":true` in addition to place results. If `maxResultsExceeded`
46
- * is true an additional method `response.nextPage()` can be used to get the next page of results.
42
+ * When a query results in more than [pageSize] places, the response will contain the property
43
+ * `pagination` in addition to place results. If `pagination` exists, an additional method
44
+ * `response.nextPage()` can be used to get the next page of results.
47
45
  *
48
46
  * ```js
49
47
  * import { findPlacesNearPoint } from "@esri/arcgis-rest-places";
@@ -90,11 +88,9 @@
90
88
  * - A partial name filter with `name` option
91
89
  *
92
90
  * As this request can return many results, pagination is supported.
93
- * Regardless of paging, the maximum number of places that can be returned
94
- * by a single query is `200`. When a query results in more than `200`
95
- * places, the response will contain the property
96
- * `"maxResultsExceeded":true` in addition to place results. If `maxResultsExceeded`
97
- * is true an additional method `response.nextPage()` can be used to get the next page of results.
91
+ * When a query results in more than [pageSize] places, the response will contain the property
92
+ * `pagination` in addition to place results. If `pagination` exists, an additional method
93
+ * `response.nextPage()` can be used to get the next page of results.
98
94
  *
99
95
  * ```
100
96
  * import { findPlacesWithinExtent } from "@esri/arcgis-rest-places";
@@ -106,7 +102,7 @@
106
102
  * xmax: -117.795753,
107
103
  * ymax: 33.873337,
108
104
  * categoryIds: ["13002"],
109
- * authentication: ApiKeyManager.fromKey("YOUR_API_KEY");
105
+ * authentication: ApiKeyManager.fromKey("YOUR_API_KEY")
110
106
  * });
111
107
  *
112
108
  * console.log(results)
@@ -157,7 +153,7 @@
157
153
  *
158
154
  * const place = getPlaceDetails({
159
155
  * placeId: "e78051acc722c55ab11ba930d8dd7772",
160
- * authentication: ApiKeyManager.fromKey("YOUR_API_KEY");
156
+ * authentication: ApiKeyManager.fromKey("YOUR_API_KEY")
161
157
  * });
162
158
  *
163
159
  * console.log(place);
@@ -205,7 +201,7 @@
205
201
  *
206
202
  * const response = getCategory({
207
203
  * categoryId: "10000",
208
- * authentication: ApiKeyManager.fromKey("YOUR_API_KEY");
204
+ * authentication: ApiKeyManager.fromKey("YOUR_API_KEY")
209
205
  * });
210
206
  *
211
207
  * console.log(response);
@@ -1 +1 @@
1
- {"version":3,"file":"places.umd.js","sources":["../../src/utils.ts","../../src/findPlacesNearPoint.ts","../../src/findPlacesWithinExtent.ts","../../src/getPlaceDetails.ts","../../src/getCategories.ts","../../src/getCategory.ts"],"sourcesContent":["export const baseUrl =\n \"https://places-api.arcgis.com/arcgis/rest/services/places-service/v1\";\n\nexport function hasNextPage(response: any) {\n return !!response?.links?.next;\n}\n\nexport function getNextPageParams(currentOffset = 0, currentPageSize = 10) {\n return {\n offset: currentOffset + currentPageSize,\n pageSize: currentPageSize\n };\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"nearPointGet\"][\"parameters\"][\"query\"],\n \"x\" | \"y\" | \"radius\" | \"categoryIds\" | \"pageSize\" | \"offset\" | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"nearPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesNearPoint};\n */\nexport interface IFindPlacesNearPointResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesNearPointResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlacesNearPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches places that are within a given radius of a geographic point.\n * You must supply the `x` and `y` coordinates of the point that you wish\n * to search from. You can either specify a search radius, or use the\n * default (500 meters). You could use this method to search for places\n * around a user's GPS position, or a location clicked on a map.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * Regardless of paging, the maximum number of places that can be returned\n * by a single query is `200`. When a query results in more than `200`\n * places, the response will contain the property\n * `\"maxResultsExceeded\":true` in addition to place results. If `maxResultsExceeded`\n * is true an additional method `response.nextPage()` can be used to get the next page of results.\n *\n * ```js\n * import { findPlacesNearPoint } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await findPlacesNearPoint({\n * x: -3.1883,\n * y: 55.9533,\n * radius: 100,\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n */\nexport function findPlacesNearPoint(\n requestOptions: IFindPlacesNearPointOptions\n): Promise<IFindPlacesNearPointResponse> {\n const options = appendCustomParams<IFindPlacesNearPointOptions>(\n requestOptions,\n [\"x\", \"y\", \"radius\", \"categoryIds\", \"pageSize\", \"offset\", \"searchText\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/near-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesNearPointResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesNearPoint(nextOptions);\n };\n }\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"withinExtentGet\"][\"parameters\"][\"query\"],\n | \"xmin\"\n | \"ymin\"\n | \"xmax\"\n | \"ymax\"\n | \"categoryIds\"\n | \"pageSize\"\n | \"offset\"\n | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"withinExtentGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesWithinExtent};\n */\nexport interface IFindPlacesWithinExtentResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesWithinExtentResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlaceWithinExtentOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches the world-wide set of places for those that are within an\n * extent, or bounding box. You must supply the `xmin`, `ymin`, `xmax` and\n * `ymax` coordinates of the extent. You could use this endpoint to search\n * for places in the visible extent of a user's screen.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can also refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * Regardless of paging, the maximum number of places that can be returned\n * by a single query is `200`. When a query results in more than `200`\n * places, the response will contain the property\n * `\"maxResultsExceeded\":true` in addition to place results. If `maxResultsExceeded`\n * is true an additional method `response.nextPage()` can be used to get the next page of results.\n *\n * ```\n * import { findPlacesWithinExtent } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findPlacesWithinExtent({\n * xmin: -118.013334,\n * ymin: 33.78193,\n * xmax: -117.795753,\n * ymax: 33.873337,\n * categoryIds: [\"13002\"],\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findPlacesWithinExtent(\n requestOptions: IFindPlaceWithinExtentOptions\n): Promise<IFindPlacesWithinExtentResponse> {\n const options = appendCustomParams<IFindPlaceWithinExtentOptions>(\n requestOptions,\n [\n \"xmin\",\n \"ymin\",\n \"xmax\",\n \"ymax\",\n \"categoryIds\",\n \"pageSize\",\n \"offset\",\n \"searchText\"\n ],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/within-extent`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesWithinExtentResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesWithinExtent(nextOptions);\n };\n }\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"placeIdGet\"][\"parameters\"][\"query\"],\n \"requestedFields\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"placeIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getPlace};\n */\nexport interface IGetPlaceResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getPlace}.\n */\nexport interface IGetPlaceOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n placeId: string;\n}\n\n/**\n * Returns a single place, including additional details, such as:\n *\n * - contact details\n * - address\n * - price information\n * - user rating\n * - opening hours\n *\n * This endpoint can be used to fetch additional details for a specific\n * place, returned from a places search request.\n *\n * Note that some fields, such as opening hours, are not available for\n * every place. Where a field is not available it will be omitted from the\n * response and you will not be charged for this data.\n *\n * ```js\n * import { getPlaceDetails } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const place = getPlaceDetails({\n * placeId: \"e78051acc722c55ab11ba930d8dd7772\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(place);\n * ```\n */\nexport function getPlaceDetails(\n requestOptions: IGetPlaceOptions\n): Promise<IGetPlaceResponse> {\n const { placeId } = requestOptions;\n\n const options = appendCustomParams<IGetPlaceOptions>(\n requestOptions,\n [\"requestedFields\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/places/${placeId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"categoriesGet\"][\"parameters\"][\"query\"],\n \"filter\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategories};\n */\nexport interface IGetCategoriesResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategories}.\n */\nexport interface IGetCategoriesOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * The ArcGIS Places service has many categories (or types) of place, from\n * art museums to zoos. This endpoint returns all the categories including\n * their label and `categoryId`. The category Id can be used to search for\n * types of places with a `places/near-point` or `places/within-extent`\n * request.\n *\n * Categories also have information on their `parent`. This allows you to\n * search for specific categories such as \"French Restaurant\" - or to\n * look for more generic types such as \"Restaurant\".\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await getCategories({\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response.categories);\n * ```\n */\nexport function getCategories(\n requestOptions: IGetCategoriesOptions\n): Promise<IGetCategoriesResponse> {\n const options = appendCustomParams<IGetCategoriesOptions>(\n requestOptions,\n [\"filter\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/categories`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = operations[\"categoriesCategoryIdGet\"][\"parameters\"][\"query\"];\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesCategoryIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategory};\n */\nexport interface IGetCategoryResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategory}.\n */\nexport interface IGetCategoryOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n categoryId: string;\n}\n\n/**\n * Returns details about a single category by Id.\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = getCategory({\n * categoryId: \"10000\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n **/\nexport function getCategory(\n requestOptions: IGetCategoryOptions\n): Promise<IGetCategoryResponse> {\n const { categoryId } = requestOptions;\n\n const options = appendCustomParams<IGetCategoryOptions>(requestOptions, [], {\n ...requestOptions\n });\n\n return request(`${baseUrl}/categories/${categoryId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n"],"names":["appendCustomParams","request"],"mappings":"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"}
1
+ {"version":3,"file":"places.umd.js","sources":["../../src/utils.ts","../../src/findPlacesNearPoint.ts","../../src/findPlacesWithinExtent.ts","../../src/getPlaceDetails.ts","../../src/getCategories.ts","../../src/getCategory.ts"],"sourcesContent":["export const baseUrl =\n \"https://places-api.arcgis.com/arcgis/rest/services/places-service/v1\";\n\nexport function hasNextPage(response: any) {\n return !!response?.links?.next || !!response?.pagination?.nextUrl;\n}\n\nexport function getNextPageParams(currentOffset = 0, currentPageSize = 10) {\n return {\n offset: currentOffset + currentPageSize,\n pageSize: currentPageSize\n };\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"nearPointGet\"][\"parameters\"][\"query\"],\n \"x\" | \"y\" | \"radius\" | \"categoryIds\" | \"pageSize\" | \"offset\" | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"nearPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesNearPoint};\n */\nexport interface IFindPlacesNearPointResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesNearPointResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlacesNearPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches places that are within a given radius of a geographic point.\n * You must supply the `x` and `y` coordinates of the point that you wish\n * to search from. You can either specify a search radius, or use the\n * default (500 meters). You could use this method to search for places\n * around a user's GPS position, or a location clicked on a map.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * When a query results in more than [pageSize] places, the response will contain the property\n * `pagination` in addition to place results. If `pagination` exists, an additional method\n * `response.nextPage()` can be used to get the next page of results.\n *\n * ```js\n * import { findPlacesNearPoint } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await findPlacesNearPoint({\n * x: -3.1883,\n * y: 55.9533,\n * radius: 100,\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n */\nexport function findPlacesNearPoint(\n requestOptions: IFindPlacesNearPointOptions\n): Promise<IFindPlacesNearPointResponse> {\n const options = appendCustomParams<IFindPlacesNearPointOptions>(\n requestOptions,\n [\"x\", \"y\", \"radius\", \"categoryIds\", \"pageSize\", \"offset\", \"searchText\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/near-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesNearPointResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesNearPoint(nextOptions);\n };\n }\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"withinExtentGet\"][\"parameters\"][\"query\"],\n | \"xmin\"\n | \"ymin\"\n | \"xmax\"\n | \"ymax\"\n | \"categoryIds\"\n | \"pageSize\"\n | \"offset\"\n | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"withinExtentGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesWithinExtent};\n */\nexport interface IFindPlacesWithinExtentResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesWithinExtentResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlaceWithinExtentOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches the world-wide set of places for those that are within an\n * extent, or bounding box. You must supply the `xmin`, `ymin`, `xmax` and\n * `ymax` coordinates of the extent. You could use this endpoint to search\n * for places in the visible extent of a user's screen.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can also refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * When a query results in more than [pageSize] places, the response will contain the property\n * `pagination` in addition to place results. If `pagination` exists, an additional method\n * `response.nextPage()` can be used to get the next page of results.\n *\n * ```\n * import { findPlacesWithinExtent } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findPlacesWithinExtent({\n * xmin: -118.013334,\n * ymin: 33.78193,\n * xmax: -117.795753,\n * ymax: 33.873337,\n * categoryIds: [\"13002\"],\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findPlacesWithinExtent(\n requestOptions: IFindPlaceWithinExtentOptions\n): Promise<IFindPlacesWithinExtentResponse> {\n const options = appendCustomParams<IFindPlaceWithinExtentOptions>(\n requestOptions,\n [\n \"xmin\",\n \"ymin\",\n \"xmax\",\n \"ymax\",\n \"categoryIds\",\n \"pageSize\",\n \"offset\",\n \"searchText\"\n ],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/within-extent`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesWithinExtentResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesWithinExtent(nextOptions);\n };\n }\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"placeIdGet\"][\"parameters\"][\"query\"],\n \"requestedFields\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"placeIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getPlace};\n */\nexport interface IGetPlaceResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getPlace}.\n */\nexport interface IGetPlaceOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n placeId: string;\n}\n\n/**\n * Returns a single place, including additional details, such as:\n *\n * - contact details\n * - address\n * - price information\n * - user rating\n * - opening hours\n *\n * This endpoint can be used to fetch additional details for a specific\n * place, returned from a places search request.\n *\n * Note that some fields, such as opening hours, are not available for\n * every place. Where a field is not available it will be omitted from the\n * response and you will not be charged for this data.\n *\n * ```js\n * import { getPlaceDetails } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const place = getPlaceDetails({\n * placeId: \"e78051acc722c55ab11ba930d8dd7772\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(place);\n * ```\n */\nexport function getPlaceDetails(\n requestOptions: IGetPlaceOptions\n): Promise<IGetPlaceResponse> {\n const { placeId } = requestOptions;\n\n const options = appendCustomParams<IGetPlaceOptions>(\n requestOptions,\n [\"requestedFields\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/places/${placeId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"categoriesGet\"][\"parameters\"][\"query\"],\n \"filter\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategories};\n */\nexport interface IGetCategoriesResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategories}.\n */\nexport interface IGetCategoriesOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * The ArcGIS Places service has many categories (or types) of place, from\n * art museums to zoos. This endpoint returns all the categories including\n * their label and `categoryId`. The category Id can be used to search for\n * types of places with a `places/near-point` or `places/within-extent`\n * request.\n *\n * Categories also have information on their `parent`. This allows you to\n * search for specific categories such as \"French Restaurant\" - or to\n * look for more generic types such as \"Restaurant\".\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await getCategories({\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response.categories);\n * ```\n */\nexport function getCategories(\n requestOptions: IGetCategoriesOptions\n): Promise<IGetCategoriesResponse> {\n const options = appendCustomParams<IGetCategoriesOptions>(\n requestOptions,\n [\"filter\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/categories`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = operations[\"categoriesCategoryIdGet\"][\"parameters\"][\"query\"];\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesCategoryIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategory};\n */\nexport interface IGetCategoryResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategory}.\n */\nexport interface IGetCategoryOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n categoryId: string;\n}\n\n/**\n * Returns details about a single category by Id.\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = getCategory({\n * categoryId: \"10000\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response);\n * ```\n **/\nexport function getCategory(\n requestOptions: IGetCategoryOptions\n): Promise<IGetCategoryResponse> {\n const { categoryId } = requestOptions;\n\n const options = appendCustomParams<IGetCategoryOptions>(requestOptions, [], {\n ...requestOptions\n });\n\n return request(`${baseUrl}/categories/${categoryId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n"],"names":["appendCustomParams","request"],"mappings":"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"}
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/arcgis-rest-places - v4.0.0 - Apache-2.0
3
- * Copyright (c) 2017-2023 Esri, Inc.
4
- * Thu May 04 2023 19:07:08 GMT+0000 (Coordinated Universal Time)
2
+ * @esri/arcgis-rest-places - v1.0.1 - Apache-2.0
3
+ * Copyright (c) 2017-2024 Esri, Inc.
4
+ * Sat Jun 15 2024 00:37:55 GMT+0000 (Coordinated Universal Time)
5
5
  */
6
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisRest=e.arcgisRest||{},e.arcgisRest)}(this,(function(e,t){"use strict";const s="https://places-api.arcgis.com/arcgis/rest/services/places-service/v1";function n(e){var t;return!!(null===(t=null==e?void 0:e.links)||void 0===t?void 0:t.next)}function a(e=0,t=10){return{offset:e+t,pageSize:t}}e.findPlacesNearPoint=function e(i){const c=t.appendCustomParams(i,["x","y","radius","categoryIds","pageSize","offset","searchText"],Object.assign({},i));return t.request(`${s}/places/near-point`,Object.assign(Object.assign({},c),{httpMethod:"GET"})).then((t=>{const s=Object.assign({},t);return n(t)&&(s.nextPage=()=>e(Object.assign(Object.assign({},i),a(i.offset,i.pageSize)))),s}))},e.findPlacesWithinExtent=function e(i){const c=t.appendCustomParams(i,["xmin","ymin","xmax","ymax","categoryIds","pageSize","offset","searchText"],Object.assign({},i));return t.request(`${s}/places/within-extent`,Object.assign(Object.assign({},c),{httpMethod:"GET"})).then((t=>{const s=Object.assign({},t);return n(t)&&(s.nextPage=()=>e(Object.assign(Object.assign({},i),a(i.offset,i.pageSize)))),s}))},e.getCategories=function(e){const n=t.appendCustomParams(e,["filter"],Object.assign({},e));return t.request(`${s}/categories`,Object.assign(Object.assign({},n),{httpMethod:"GET"}))},e.getCategory=function(e){const{categoryId:n}=e,a=t.appendCustomParams(e,[],Object.assign({},e));return t.request(`${s}/categories/${n}`,Object.assign(Object.assign({},a),{httpMethod:"GET"}))},e.getPlaceDetails=function(e){const{placeId:n}=e,a=t.appendCustomParams(e,["requestedFields"],Object.assign({},e));return t.request(`${s}/places/${n}`,Object.assign(Object.assign({},a),{httpMethod:"GET"}))},Object.defineProperty(e,"__esModule",{value:!0})}));
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisRest=e.arcgisRest||{},e.arcgisRest)}(this,(function(e,t){"use strict";const s="https://places-api.arcgis.com/arcgis/rest/services/places-service/v1";function n(e){var t,s;return!!(null===(t=null==e?void 0:e.links)||void 0===t?void 0:t.next)||!!(null===(s=null==e?void 0:e.pagination)||void 0===s?void 0:s.nextUrl)}function i(e=0,t=10){return{offset:e+t,pageSize:t}}e.findPlacesNearPoint=function e(a){const c=t.appendCustomParams(a,["x","y","radius","categoryIds","pageSize","offset","searchText"],Object.assign({},a));return t.request(`${s}/places/near-point`,Object.assign(Object.assign({},c),{httpMethod:"GET"})).then((t=>{const s=Object.assign({},t);return n(t)&&(s.nextPage=()=>e(Object.assign(Object.assign({},a),i(a.offset,a.pageSize)))),s}))},e.findPlacesWithinExtent=function e(a){const c=t.appendCustomParams(a,["xmin","ymin","xmax","ymax","categoryIds","pageSize","offset","searchText"],Object.assign({},a));return t.request(`${s}/places/within-extent`,Object.assign(Object.assign({},c),{httpMethod:"GET"})).then((t=>{const s=Object.assign({},t);return n(t)&&(s.nextPage=()=>e(Object.assign(Object.assign({},a),i(a.offset,a.pageSize)))),s}))},e.getCategories=function(e){const n=t.appendCustomParams(e,["filter"],Object.assign({},e));return t.request(`${s}/categories`,Object.assign(Object.assign({},n),{httpMethod:"GET"}))},e.getCategory=function(e){const{categoryId:n}=e,i=t.appendCustomParams(e,[],Object.assign({},e));return t.request(`${s}/categories/${n}`,Object.assign(Object.assign({},i),{httpMethod:"GET"}))},e.getPlaceDetails=function(e){const{placeId:n}=e,i=t.appendCustomParams(e,["requestedFields"],Object.assign({},e));return t.request(`${s}/places/${n}`,Object.assign(Object.assign({},i),{httpMethod:"GET"}))},Object.defineProperty(e,"__esModule",{value:!0})}));
7
7
  //# sourceMappingURL=places.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"places.umd.min.js","sources":["../../src/utils.ts","../../src/findPlacesNearPoint.ts","../../src/findPlacesWithinExtent.ts","../../src/getCategories.ts","../../src/getCategory.ts","../../src/getPlaceDetails.ts"],"sourcesContent":["export const baseUrl =\n \"https://places-api.arcgis.com/arcgis/rest/services/places-service/v1\";\n\nexport function hasNextPage(response: any) {\n return !!response?.links?.next;\n}\n\nexport function getNextPageParams(currentOffset = 0, currentPageSize = 10) {\n return {\n offset: currentOffset + currentPageSize,\n pageSize: currentPageSize\n };\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"nearPointGet\"][\"parameters\"][\"query\"],\n \"x\" | \"y\" | \"radius\" | \"categoryIds\" | \"pageSize\" | \"offset\" | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"nearPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesNearPoint};\n */\nexport interface IFindPlacesNearPointResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesNearPointResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlacesNearPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches places that are within a given radius of a geographic point.\n * You must supply the `x` and `y` coordinates of the point that you wish\n * to search from. You can either specify a search radius, or use the\n * default (500 meters). You could use this method to search for places\n * around a user's GPS position, or a location clicked on a map.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * Regardless of paging, the maximum number of places that can be returned\n * by a single query is `200`. When a query results in more than `200`\n * places, the response will contain the property\n * `\"maxResultsExceeded\":true` in addition to place results. If `maxResultsExceeded`\n * is true an additional method `response.nextPage()` can be used to get the next page of results.\n *\n * ```js\n * import { findPlacesNearPoint } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await findPlacesNearPoint({\n * x: -3.1883,\n * y: 55.9533,\n * radius: 100,\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n */\nexport function findPlacesNearPoint(\n requestOptions: IFindPlacesNearPointOptions\n): Promise<IFindPlacesNearPointResponse> {\n const options = appendCustomParams<IFindPlacesNearPointOptions>(\n requestOptions,\n [\"x\", \"y\", \"radius\", \"categoryIds\", \"pageSize\", \"offset\", \"searchText\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/near-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesNearPointResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesNearPoint(nextOptions);\n };\n }\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"withinExtentGet\"][\"parameters\"][\"query\"],\n | \"xmin\"\n | \"ymin\"\n | \"xmax\"\n | \"ymax\"\n | \"categoryIds\"\n | \"pageSize\"\n | \"offset\"\n | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"withinExtentGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesWithinExtent};\n */\nexport interface IFindPlacesWithinExtentResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesWithinExtentResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlaceWithinExtentOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches the world-wide set of places for those that are within an\n * extent, or bounding box. You must supply the `xmin`, `ymin`, `xmax` and\n * `ymax` coordinates of the extent. You could use this endpoint to search\n * for places in the visible extent of a user's screen.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can also refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * Regardless of paging, the maximum number of places that can be returned\n * by a single query is `200`. When a query results in more than `200`\n * places, the response will contain the property\n * `\"maxResultsExceeded\":true` in addition to place results. If `maxResultsExceeded`\n * is true an additional method `response.nextPage()` can be used to get the next page of results.\n *\n * ```\n * import { findPlacesWithinExtent } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findPlacesWithinExtent({\n * xmin: -118.013334,\n * ymin: 33.78193,\n * xmax: -117.795753,\n * ymax: 33.873337,\n * categoryIds: [\"13002\"],\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findPlacesWithinExtent(\n requestOptions: IFindPlaceWithinExtentOptions\n): Promise<IFindPlacesWithinExtentResponse> {\n const options = appendCustomParams<IFindPlaceWithinExtentOptions>(\n requestOptions,\n [\n \"xmin\",\n \"ymin\",\n \"xmax\",\n \"ymax\",\n \"categoryIds\",\n \"pageSize\",\n \"offset\",\n \"searchText\"\n ],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/within-extent`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesWithinExtentResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesWithinExtent(nextOptions);\n };\n }\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"categoriesGet\"][\"parameters\"][\"query\"],\n \"filter\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategories};\n */\nexport interface IGetCategoriesResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategories}.\n */\nexport interface IGetCategoriesOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * The ArcGIS Places service has many categories (or types) of place, from\n * art museums to zoos. This endpoint returns all the categories including\n * their label and `categoryId`. The category Id can be used to search for\n * types of places with a `places/near-point` or `places/within-extent`\n * request.\n *\n * Categories also have information on their `parent`. This allows you to\n * search for specific categories such as \"French Restaurant\" - or to\n * look for more generic types such as \"Restaurant\".\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await getCategories({\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response.categories);\n * ```\n */\nexport function getCategories(\n requestOptions: IGetCategoriesOptions\n): Promise<IGetCategoriesResponse> {\n const options = appendCustomParams<IGetCategoriesOptions>(\n requestOptions,\n [\"filter\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/categories`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = operations[\"categoriesCategoryIdGet\"][\"parameters\"][\"query\"];\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesCategoryIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategory};\n */\nexport interface IGetCategoryResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategory}.\n */\nexport interface IGetCategoryOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n categoryId: string;\n}\n\n/**\n * Returns details about a single category by Id.\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = getCategory({\n * categoryId: \"10000\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n **/\nexport function getCategory(\n requestOptions: IGetCategoryOptions\n): Promise<IGetCategoryResponse> {\n const { categoryId } = requestOptions;\n\n const options = appendCustomParams<IGetCategoryOptions>(requestOptions, [], {\n ...requestOptions\n });\n\n return request(`${baseUrl}/categories/${categoryId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"placeIdGet\"][\"parameters\"][\"query\"],\n \"requestedFields\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"placeIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getPlace};\n */\nexport interface IGetPlaceResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getPlace}.\n */\nexport interface IGetPlaceOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n placeId: string;\n}\n\n/**\n * Returns a single place, including additional details, such as:\n *\n * - contact details\n * - address\n * - price information\n * - user rating\n * - opening hours\n *\n * This endpoint can be used to fetch additional details for a specific\n * place, returned from a places search request.\n *\n * Note that some fields, such as opening hours, are not available for\n * every place. Where a field is not available it will be omitted from the\n * response and you will not be charged for this data.\n *\n * ```js\n * import { getPlaceDetails } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const place = getPlaceDetails({\n * placeId: \"e78051acc722c55ab11ba930d8dd7772\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(place);\n * ```\n */\nexport function getPlaceDetails(\n requestOptions: IGetPlaceOptions\n): Promise<IGetPlaceResponse> {\n const { placeId } = requestOptions;\n\n const options = appendCustomParams<IGetPlaceOptions>(\n requestOptions,\n [\"requestedFields\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/places/${placeId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n"],"names":["baseUrl","hasNextPage","response","links","next","getNextPageParams","currentOffset","currentPageSize","offset","pageSize","findPlacesNearPoint","requestOptions","options","appendCustomParams","request","httpMethod","then","r","nextPage","findPlacesWithinExtent","categoryId","placeId"],"mappings":";;;;;gVAAO,MAAMA,EACX,gFAEcC,EAAYC,SAC1B,mBAASA,eAAAA,EAAUC,4BAAOC,KAC5B,UAEgBC,EAAkBC,EAAgB,EAAGC,EAAkB,IACrE,MAAO,CACLC,OAAQF,EAAgBC,EACxBE,SAAUF,EAEd,gCC4DgBG,EACdC,GAEA,MAAMC,EAAUC,qBACdF,EACA,CAAC,IAAK,IAAK,SAAU,cAAe,WAAY,SAAU,+BAErDA,IAIP,OACEG,UAAQ,GAAGd,qDACNY,IACHG,WAAY,SAEdC,MAAMd,IACN,MAAMe,mBACDf,GAaL,OAVID,EAAYC,KACde,EAAEC,SAAW,IAKJR,iCAHFC,GACAN,EAAkBM,EAAeH,OAAQG,EAAeF,aAM1DQ,CAAC,GAEZ,oCCzBgBE,EACdR,GAEA,MAAMC,EAAUC,qBACdF,EACA,CACE,OACA,OACA,OACA,OACA,cACA,WACA,SACA,+BAGGA,IAIP,OACEG,UAAQ,GAAGd,wDACNY,IACHG,WAAY,SAEdC,MAAMd,IACN,MAAMe,mBACDf,GAYL,OATID,EAAYC,KACde,EAAEC,SAAW,IAKJC,iCAHFR,GACAN,EAAkBM,EAAeH,OAAQG,EAAeF,aAK1DQ,CAAC,GAEZ,2BClEEN,GAEA,MAAMC,EAAUC,qBACdF,EACA,CAAC,2BAEIA,IAIP,OAAOG,UAAQ,GAAGd,8CACbY,IACHG,WAAY,QAEhB,yBCtBEJ,GAEA,MAAMS,WAAEA,GAAeT,EAEjBC,EAAUC,qBAAwCF,EAAgB,oBACnEA,IAGL,OAAOG,UAAQ,GAAGd,gBAAsBoB,mCACnCR,IACHG,WAAY,QAEhB,6BCIEJ,GAEA,MAAMU,QAAEA,GAAYV,EAEdC,EAAUC,qBACdF,EACA,CAAC,oCAEIA,IAIP,OAAOG,UAAQ,GAAGd,YAAkBqB,mCAC/BT,IACHG,WAAY,QAEhB"}
1
+ {"version":3,"file":"places.umd.min.js","sources":["../../src/utils.ts","../../src/findPlacesNearPoint.ts","../../src/findPlacesWithinExtent.ts","../../src/getCategories.ts","../../src/getCategory.ts","../../src/getPlaceDetails.ts"],"sourcesContent":["export const baseUrl =\n \"https://places-api.arcgis.com/arcgis/rest/services/places-service/v1\";\n\nexport function hasNextPage(response: any) {\n return !!response?.links?.next || !!response?.pagination?.nextUrl;\n}\n\nexport function getNextPageParams(currentOffset = 0, currentPageSize = 10) {\n return {\n offset: currentOffset + currentPageSize,\n pageSize: currentPageSize\n };\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"nearPointGet\"][\"parameters\"][\"query\"],\n \"x\" | \"y\" | \"radius\" | \"categoryIds\" | \"pageSize\" | \"offset\" | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"nearPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesNearPoint};\n */\nexport interface IFindPlacesNearPointResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesNearPointResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlacesNearPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches places that are within a given radius of a geographic point.\n * You must supply the `x` and `y` coordinates of the point that you wish\n * to search from. You can either specify a search radius, or use the\n * default (500 meters). You could use this method to search for places\n * around a user's GPS position, or a location clicked on a map.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * When a query results in more than [pageSize] places, the response will contain the property\n * `pagination` in addition to place results. If `pagination` exists, an additional method\n * `response.nextPage()` can be used to get the next page of results.\n *\n * ```js\n * import { findPlacesNearPoint } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await findPlacesNearPoint({\n * x: -3.1883,\n * y: 55.9533,\n * radius: 100,\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\");\n * });\n *\n * console.log(response);\n * ```\n */\nexport function findPlacesNearPoint(\n requestOptions: IFindPlacesNearPointOptions\n): Promise<IFindPlacesNearPointResponse> {\n const options = appendCustomParams<IFindPlacesNearPointOptions>(\n requestOptions,\n [\"x\", \"y\", \"radius\", \"categoryIds\", \"pageSize\", \"offset\", \"searchText\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/near-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesNearPointResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesNearPoint(nextOptions);\n };\n }\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl, hasNextPage, getNextPageParams } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"withinExtentGet\"][\"parameters\"][\"query\"],\n | \"xmin\"\n | \"ymin\"\n | \"xmax\"\n | \"ymax\"\n | \"categoryIds\"\n | \"pageSize\"\n | \"offset\"\n | \"searchText\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"withinExtentGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findPlacesWithinExtent};\n */\nexport interface IFindPlacesWithinExtentResponse extends successResponse {\n nextPage?: () => Promise<IFindPlacesWithinExtentResponse>;\n}\n\n/**\n * Options for {@linkcode findPlacesNearPoint}.\n */\nexport interface IFindPlaceWithinExtentOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * Searches the world-wide set of places for those that are within an\n * extent, or bounding box. You must supply the `xmin`, `ymin`, `xmax` and\n * `ymax` coordinates of the extent. You could use this endpoint to search\n * for places in the visible extent of a user's screen.\n *\n * The returned places contain basic data such as name, category and\n * location. You can use the {@linkcode getPlace} method to get additional\n * details for a given place.\n *\n * You can also refine the results by supplying additional search parameters,\n * including:\n *\n * - A list of category Ids, see {@linkcode searchCategories} or {@linkcode getCategories}.\n * - A partial name filter with `name` option\n *\n * As this request can return many results, pagination is supported.\n * When a query results in more than [pageSize] places, the response will contain the property\n * `pagination` in addition to place results. If `pagination` exists, an additional method\n * `response.nextPage()` can be used to get the next page of results.\n *\n * ```\n * import { findPlacesWithinExtent } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findPlacesWithinExtent({\n * xmin: -118.013334,\n * ymin: 33.78193,\n * xmax: -117.795753,\n * ymax: 33.873337,\n * categoryIds: [\"13002\"],\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findPlacesWithinExtent(\n requestOptions: IFindPlaceWithinExtentOptions\n): Promise<IFindPlacesWithinExtentResponse> {\n const options = appendCustomParams<IFindPlaceWithinExtentOptions>(\n requestOptions,\n [\n \"xmin\",\n \"ymin\",\n \"xmax\",\n \"ymax\",\n \"categoryIds\",\n \"pageSize\",\n \"offset\",\n \"searchText\"\n ],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/places/within-extent`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindPlacesWithinExtentResponse = {\n ...response\n };\n\n if (hasNextPage(response)) {\n r.nextPage = () => {\n const nextOptions = {\n ...requestOptions,\n ...getNextPageParams(requestOptions.offset, requestOptions.pageSize)\n };\n return findPlacesWithinExtent(nextOptions);\n };\n }\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"categoriesGet\"][\"parameters\"][\"query\"],\n \"filter\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategories};\n */\nexport interface IGetCategoriesResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategories}.\n */\nexport interface IGetCategoriesOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * The ArcGIS Places service has many categories (or types) of place, from\n * art museums to zoos. This endpoint returns all the categories including\n * their label and `categoryId`. The category Id can be used to search for\n * types of places with a `places/near-point` or `places/within-extent`\n * request.\n *\n * Categories also have information on their `parent`. This allows you to\n * search for specific categories such as \"French Restaurant\" - or to\n * look for more generic types such as \"Restaurant\".\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = await getCategories({\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response.categories);\n * ```\n */\nexport function getCategories(\n requestOptions: IGetCategoriesOptions\n): Promise<IGetCategoriesResponse> {\n const options = appendCustomParams<IGetCategoriesOptions>(\n requestOptions,\n [\"filter\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/categories`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = operations[\"categoriesCategoryIdGet\"][\"parameters\"][\"query\"];\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"categoriesCategoryIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getCategory};\n */\nexport interface IGetCategoryResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getCategory}.\n */\nexport interface IGetCategoryOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n categoryId: string;\n}\n\n/**\n * Returns details about a single category by Id.\n *\n * ```js\n * import { getCategories } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const response = getCategory({\n * categoryId: \"10000\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(response);\n * ```\n **/\nexport function getCategory(\n requestOptions: IGetCategoryOptions\n): Promise<IGetCategoryResponse> {\n const { categoryId } = requestOptions;\n\n const options = appendCustomParams<IGetCategoryOptions>(requestOptions, [], {\n ...requestOptions\n });\n\n return request(`${baseUrl}/categories/${categoryId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"placeIdGet\"][\"parameters\"][\"query\"],\n \"requestedFields\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"placeIdGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode getPlace};\n */\nexport interface IGetPlaceResponse extends successResponse {}\n\n/**\n * Options for {@linkcode getPlace}.\n */\nexport interface IGetPlaceOptions\n extends Omit<IRequestOptions, \"httpMethod\">,\n queryParams {\n placeId: string;\n}\n\n/**\n * Returns a single place, including additional details, such as:\n *\n * - contact details\n * - address\n * - price information\n * - user rating\n * - opening hours\n *\n * This endpoint can be used to fetch additional details for a specific\n * place, returned from a places search request.\n *\n * Note that some fields, such as opening hours, are not available for\n * every place. Where a field is not available it will be omitted from the\n * response and you will not be charged for this data.\n *\n * ```js\n * import { getPlaceDetails } from \"@esri/arcgis-rest-places\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const place = getPlaceDetails({\n * placeId: \"e78051acc722c55ab11ba930d8dd7772\",\n * authentication: ApiKeyManager.fromKey(\"YOUR_API_KEY\")\n * });\n *\n * console.log(place);\n * ```\n */\nexport function getPlaceDetails(\n requestOptions: IGetPlaceOptions\n): Promise<IGetPlaceResponse> {\n const { placeId } = requestOptions;\n\n const options = appendCustomParams<IGetPlaceOptions>(\n requestOptions,\n [\"requestedFields\"],\n {\n ...requestOptions\n }\n );\n\n return request(`${baseUrl}/places/${placeId}`, {\n ...options,\n httpMethod: \"GET\"\n });\n}\n"],"names":["baseUrl","hasNextPage","response","links","next","pagination","nextUrl","getNextPageParams","currentOffset","currentPageSize","offset","pageSize","findPlacesNearPoint","requestOptions","options","appendCustomParams","request","httpMethod","then","r","nextPage","findPlacesWithinExtent","categoryId","placeId"],"mappings":";;;;;gVAAO,MAAMA,EACX,gFAEcC,EAAYC,WAC1B,mBAASA,eAAAA,EAAUC,4BAAOC,oBAAUF,eAAAA,EAAUG,iCAAYC,QAC5D,UAEgBC,EAAkBC,EAAgB,EAAGC,EAAkB,IACrE,MAAO,CACLC,OAAQF,EAAgBC,EACxBE,SAAUF,EAEd,gCC0DgBG,EACdC,GAEA,MAAMC,EAAUC,qBACdF,EACA,CAAC,IAAK,IAAK,SAAU,cAAe,WAAY,SAAU,+BAErDA,IAIP,OACEG,UAAQ,GAAGhB,qDACNc,IACHG,WAAY,SAEdC,MAAMhB,IACN,MAAMiB,mBACDjB,GAaL,OAVID,EAAYC,KACdiB,EAAEC,SAAW,IAKJR,iCAHFC,GACAN,EAAkBM,EAAeH,OAAQG,EAAeF,aAM1DQ,CAAC,GAEZ,oCCzBgBE,EACdR,GAEA,MAAMC,EAAUC,qBACdF,EACA,CACE,OACA,OACA,OACA,OACA,cACA,WACA,SACA,+BAGGA,IAIP,OACEG,UAAQ,GAAGhB,wDACNc,IACHG,WAAY,SAEdC,MAAMhB,IACN,MAAMiB,mBACDjB,GAYL,OATID,EAAYC,KACdiB,EAAEC,SAAW,IAKJC,iCAHFR,GACAN,EAAkBM,EAAeH,OAAQG,EAAeF,aAK1DQ,CAAC,GAEZ,2BChEEN,GAEA,MAAMC,EAAUC,qBACdF,EACA,CAAC,2BAEIA,IAIP,OAAOG,UAAQ,GAAGhB,8CACbc,IACHG,WAAY,QAEhB,yBCtBEJ,GAEA,MAAMS,WAAEA,GAAeT,EAEjBC,EAAUC,qBAAwCF,EAAgB,oBACnEA,IAGL,OAAOG,UAAQ,GAAGhB,gBAAsBsB,mCACnCR,IACHG,WAAY,QAEhB,6BCIEJ,GAEA,MAAMU,QAAEA,GAAYV,EAEdC,EAAUC,qBACdF,EACA,CAAC,oCAEIA,IAIP,OAAOG,UAAQ,GAAGhB,YAAkBuB,mCAC/BT,IACHG,WAAY,QAEhB"}