How to use the @esri/arcgis-rest-request.appendCustomParams function in @esri/arcgis-rest-request

To help you get started, we’ve selected a few @esri/arcgis-rest-request examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / arcgis-rest-js / packages / arcgis-rest-feature-layer / src / delete.ts View on Github external
export function deleteFeatures(
  requestOptions: IDeleteFeaturesOptions
): Promise<{ deleteResults: IEditFeatureResult[] }> {
  const url = `${cleanUrl(requestOptions.url)}/deleteFeatures`;

  // edit operations POST only
  const options = appendCustomParams(
    requestOptions,
    [
      "where",
      "objectIds",
      "gdbVersion",
      "returnEditMoment",
      "rollbackOnFailure"
    ],
    { params: { ...requestOptions.params } }
  );

  return request(url, options);
}
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / items / create.ts View on Github external
const owner = determineOwner(requestOptions);
  const baseUrl = `${getPortalUrl(requestOptions)}/content/users/${owner}`;
  let url = `${baseUrl}/addItem`;

  if (requestOptions.folderId) {
    url = `${baseUrl}/${requestOptions.folderId}/addItem`;
  }

  requestOptions.params = {
    ...requestOptions.params,
    ...serializeItem(requestOptions.item)
  };

  // serialize the item into something Portal will accept
  const options = appendCustomParams(
    requestOptions,
    [
      "owner",
      "folderId",
      "file",
      "dataUrl",
      "text",
      "async",
      "multipart",
      "filename",
      "overwrite"
    ],
    {
      params: { ...requestOptions.params }
    }
  );
github Esri / arcgis-rest-js / packages / arcgis-rest-feature-layer / src / add.ts View on Github external
export function addFeatures(
  requestOptions: IAddFeaturesOptions
): Promise<{ addResults: IEditFeatureResult[] }> {
  const url = `${cleanUrl(requestOptions.url)}/addFeatures`;

  // edit operations are POST only
  const options = appendCustomParams(
    requestOptions,
    ["features", "gdbVersion", "returnEditMoment", "rollbackOnFailure"],
    { params: { ...requestOptions.params } }
  );

  return request(url, options);
}
github Esri / arcgis-rest-js / packages / arcgis-rest-feature-layer / src / queryRelated.ts View on Github external
export function queryRelated(
  requestOptions: IQueryRelatedRequestOptions
): Promise {
  const options = appendCustomParams(
    requestOptions,
    ["objectIds", "relationshipId", "definitionExpression", "outFields"],
    {
      httpMethod: "GET",
      params: {
        // set default query parameters
        definitionExpression: "1=1",
        outFields: "*",
        relationshipId: 0,
        ...requestOptions.params
      }
    }
  );

  return request(
    `${cleanUrl(requestOptions.url)}/queryRelatedRecords`,
github Esri / arcgis-rest-js / packages / arcgis-rest-feature-layer / src / update.ts View on Github external
export function updateFeatures(
  requestOptions: IUpdateFeaturesOptions
): Promise<{ updateResults: IEditFeatureResult[] }> {
  const url = `${cleanUrl(requestOptions.url)}/updateFeatures`;

  // edit operations are POST only
  const options = appendCustomParams(
    requestOptions,
    ["features", "gdbVersion", "returnEditMoment", "rollbackOnFailure"],
    { params: { ...requestOptions.params } }
  );

  return request(url, options);
}
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / groups / get.ts View on Github external
export function searchGroupUsers(
  id: string,
  searchOptions?: ISearchGroupUsersOptions
): Promise {
  const url = `${getPortalUrl(searchOptions)}/community/groups/${id}/userlist`;
  const options = appendCustomParams(
    searchOptions || {},
    ["name", "num", "start", "sortField", "sortOrder", "joined", "memberType"],
    {
      httpMethod: "GET"
    }
  );
  return request(url, options);
}
github Esri / arcgis-rest-js / packages / arcgis-rest-geocoding / src / geocode.ts View on Github external
export function geocode(
  address: string | IGeocodeOptions
): Promise {
  let options: IGeocodeOptions = {};
  let endpoint: string;

  if (typeof address === "string") {
    options.params = { singleLine: address };
    endpoint = ARCGIS_ONLINE_GEOCODING_URL;
  } else {
    endpoint = address.endpoint || ARCGIS_ONLINE_GEOCODING_URL;
    options = appendCustomParams(
      address,
      [
        "singleLine",
        "address",
        "address2",
        "address3",
        "neighborhood",
        "city",
        "subregion",
        "region",
        "postal",
        "postalExt",
        "countryCode",
        "outFields",
        "magicKey"
      ],
github Esri / arcgis-rest-js / packages / arcgis-rest-feature-layer / src / query.ts View on Github external
export function queryFeatures(
  requestOptions: IQueryFeaturesOptions
): Promise {
  const queryOptions = appendCustomParams(
    requestOptions,
    [
      "where",
      "objectIds",
      "relationParam",
      "time",
      "distance",
      "units",
      "outFields",
      "geometry",
      "geometryType",
      "spatialRel",
      "returnGeometry",
      "maxAllowableOffset",
      "geometryPrecision",
      "inSR",
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / util / generic-search.ts View on Github external
export function genericSearch(
  search: string | ISearchOptions | SearchQueryBuilder,
  searchType: "item" | "group" | "user"
): Promise> {
  let url: string;
  let options: IRequestOptions;
  if (typeof search === "string" || search instanceof SearchQueryBuilder) {
    options = {
      httpMethod: "GET",
      params: {
        q: search
      }
    };
  } else {
    options = appendCustomParams(
      search,
      ["q", "num", "start", "sortField", "sortOrder"],
      {
        httpMethod: "GET"
      }
    );
  }

  let path = searchType === "item" ? "/search" : "/community/groups";
  switch (searchType) {
    case "item":
      path = "/search";
      break;
    case "group":
      path = "/community/groups";
      break;