Skip to content

Commit

Permalink
Merge pull request #521 from Esri/refactor/params-to-options
Browse files Browse the repository at this point in the history
Refactor feature-layer/ I*Params to I*Options
  • Loading branch information
tomwayson authored Apr 18, 2019
2 parents 9028d82 + 1ecd4a9 commit 7a3a47c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 44 deletions.
13 changes: 2 additions & 11 deletions packages/arcgis-rest-feature-layer/src/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,13 @@ import {

import { IFeature } from "@esri/arcgis-rest-types";

import {
ILayerRequestOptions,
IEditFeaturesParams,
IEditFeatureResult
} from "./helpers";
import { ISharedEditOptions, IEditFeatureResult } from "./helpers";

/**
* Add features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.
*
* @param url - Feature service url.
* @param features - Array of JSON features to add.
* @param params - Query parameters to be sent to the feature service via the request.
*/
export interface IAddFeaturesRequestOptions
extends IEditFeaturesParams,
ILayerRequestOptions {
export interface IAddFeaturesRequestOptions extends ISharedEditOptions {
/**
* Array of JSON features to add.
*/
Expand Down
19 changes: 4 additions & 15 deletions packages/arcgis-rest-feature-layer/src/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,18 @@ import {
appendCustomParams
} from "@esri/arcgis-rest-request";
import {
ILayerRequestOptions,
IEditFeaturesParams,
ISharedEditOptions,
IEditFeatureResult,
ISharedQueryParams
ISharedQueryOptions
} from "./helpers";

/**
* Delete features parameters.
*/
export interface IDeleteFeaturesParams
extends IEditFeaturesParams,
ISharedQueryParams {}

/**
* Delete features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.
*
* @param url - Feature service url.
* @param objectIds - Array of objectIds to delete.
* @param params - Query parameters to be sent to the feature service via the request.
*/
export interface IDeleteFeaturesRequestOptions
extends IDeleteFeaturesParams,
ILayerRequestOptions {
extends ISharedEditOptions,
ISharedQueryOptions {
/**
* Array of objectIds to delete.
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/arcgis-rest-feature-layer/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface ILayerRequestOptions extends IRequestOptions {
url: string;
}

export interface ISharedQueryParams {
export interface ISharedQueryOptions extends ILayerRequestOptions {
where?: string;
geometry?: IGeometry;
geometryType?: GeometryType;
Expand All @@ -37,9 +37,9 @@ export interface IEditFeatureResult {
}

/**
* Common add and update features parameters.
* Common add, update, and delete features options.
*/
export interface IEditFeaturesParams {
export interface ISharedEditOptions extends ILayerRequestOptions {
/**
* The geodatabase version to apply the edits.
*/
Expand Down
6 changes: 2 additions & 4 deletions packages/arcgis-rest-feature-layer/src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
IExtent
} from "@esri/arcgis-rest-types";

import { ILayerRequestOptions, ISharedQueryParams } from "./helpers";
import { ILayerRequestOptions, ISharedQueryOptions } from "./helpers";

/**
* Request options to fetch a feature by id.
Expand Down Expand Up @@ -45,9 +45,7 @@ export interface IStatisticDefinition {
/**
* feature query request options. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.
*/
export interface IQueryFeaturesRequestOptions
extends ISharedQueryParams,
ILayerRequestOptions {
export interface IQueryFeaturesRequestOptions extends ISharedQueryOptions {
objectIds?: number[];
relationParam?: string;
// NOTE: either time=1199145600000 or time=1199145600000, 1230768000000
Expand Down
13 changes: 2 additions & 11 deletions packages/arcgis-rest-feature-layer/src/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,13 @@ import {

import { IFeature } from "@esri/arcgis-rest-types";

import {
ILayerRequestOptions,
IEditFeaturesParams,
IEditFeatureResult
} from "./helpers";
import { ISharedEditOptions, IEditFeatureResult } from "./helpers";

/**
* Update features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.
*
* @param url - Feature service url.
* @param features - Array of JSON features to update.
* @param params - Query parameters to be sent to the feature service via the request.
*/
export interface IUpdateFeaturesRequestOptions
extends IEditFeaturesParams,
ILayerRequestOptions {
export interface IUpdateFeaturesRequestOptions extends ISharedEditOptions {
/**
* Array of JSON features to update.
*/
Expand Down

0 comments on commit 7a3a47c

Please sign in to comment.