Skip to content

Commit

Permalink
docs(snippets): add CRUD feature service snippets and fix geocoder ones
Browse files Browse the repository at this point in the history
AFFECTS PACKAGES:
@esri/arcgis-rest-feature-service
@esri/arcgis-rest-geocoder

ISSUES CLOSED: #190
  • Loading branch information
jgravois committed May 14, 2018
1 parent fbc4f3c commit 7143f06
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 8 deletions.
39 changes: 39 additions & 0 deletions packages/arcgis-rest-feature-service/src/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ export interface IAddFeaturesResult {
/**
* Add features
*
* ```js
* import { addFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* addFeatures({
* url,
* adds: [{
* geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
* attributes: { status: "alive" }
* }]
* });
* ```
*
* @param requestOptions - Options for the request
* @returns A Promise that will resolve with the addFeatures response.
*/
Expand Down Expand Up @@ -233,6 +247,20 @@ export interface IUpdateFeaturesResult {
/**
* Update features
*
* ```js
* import { updateFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* updateFeatures({
* url,
* updates: [{
* geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
* attributes: { status: "alive" }
* }]
* });
* ```
*
* @param requestOptions - Options for the request
* @returns A Promise that will resolve with the updateFeatures response.
*/
Expand Down Expand Up @@ -282,6 +310,17 @@ export interface IDeleteFeaturesResult {
/**
* Delete features
*
* ```js
* import { deleteFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* deleteFeatures({
* url,
* deletes: [1,2,3]
* });
* ```
*
* @param deleteFeaturesRequestOptions - Options for the request
* @returns A Promise that will resolve with the deleteFeatures response.
*/
Expand Down
16 changes: 8 additions & 8 deletions packages/arcgis-rest-geocoder/src/geocoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface IGeocodeParams extends IParams {
/**
* You can create an autocomplete experience by making a call to suggest with partial text and then passing through the magicKey and complete address that are returned to geocode.
* ```js
* import { suggest, geocode } from '@esri/arcgis-geocoder';
* import { suggest, geocode } from '@esri/arcgis-rest-geocoder';
* suggest("LAX")
* .then((response) => {
* response.suggestions[2].magicKey; // => "dHA9MCNsb2M9Mjk3ODc2MCNsbmc9MzMjcGw9ODkxNDg4I2xicz0xNDoxNDc4MTI1MA=="
Expand Down Expand Up @@ -105,7 +105,7 @@ export interface ISuggestRequestOptions extends IEndpointRequestOptions {
/**
* You can create an autocomplete experience by making a call to suggest with partial text and then passing through the magicKey and complete address that are returned to geocode.
* ```js
* import { suggest, geocode } from '@esri/arcgis-geocoder';
* import { suggest, geocode } from '@esri/arcgis-rest-geocoder';
* suggest("LAX")
* .then((response) => {
* response.suggestions[2].magicKey; // => "dHA9MCNsb2M9Mjk3ODc2MCNsbmc9MzMjcGw9ODkxNDg4I2xicz0xNDoxNDc4MTI1MA=="
Expand Down Expand Up @@ -167,7 +167,7 @@ export interface IGetGeocodeServiceResponse {
* Used to determine the location of a single address or point of interest
*
* ```js
* import { geocode } from '@esri/arcgis-geocoder';
* import { geocode } from '@esri/arcgis-rest-geocoder';
*
* geocode("LAX")
* .then((response) => {
Expand Down Expand Up @@ -227,7 +227,7 @@ export function geocode(
* Used to return a placename suggestion for a partial string
*
* ```js
* import { suggest } from '@esri/arcgis-geocoder';
* import { suggest } from '@esri/arcgis-rest-geocoder';
*
* suggest("Starb")
* .then((response) => {
Expand Down Expand Up @@ -266,7 +266,7 @@ export function suggest(
* Used to determine the address of a location.
*
* ```js
* import { reverseGeocode } from '@esri/arcgis-geocoder';
* import { reverseGeocode } from '@esri/arcgis-rest-geocoder';
*
* // long, lat
* reverseGeocode([-118.409,33.943 ])
Expand Down Expand Up @@ -316,8 +316,8 @@ export function reverseGeocode(
* Used to geocode a batch of addresses
*
* ```js
* import { bulkGeocode } from '@esri/arcgis-geocoder';
* import { ApplicationSession } from '@esri/arcgis-auth';
* import { bulkGeocode } from '@esri/arcgis-rest-geocoder';
* import { ApplicationSession } from '@esri/arcgis-rest-auth';
*
* const addresses = [
* { "OBJECTID": 1, "SingleLine": "380 New York Street 92373" },
Expand Down Expand Up @@ -375,7 +375,7 @@ export function bulkGeocode(
* Used to fetch metadata from a geocoding service.
*
* ```js
* import { getGeocoderServiceInfo } from '@esri/arcgis-geocoder';
* import { getGeocoderServiceInfo } from '@esri/arcgis-rest-geocoder';
*
* getGeocoderServiceInfo()
* .then((response) => {
Expand Down

0 comments on commit 7143f06

Please sign in to comment.