searchEvents

Function
import { getEventQueryFromType, searchEvents } from "@esri/hub-events";
// event types are "upcoming" | "past" | "cancelled" | "draft"
const searchOptions: IQueryFeaturesOptions = getEventQueryFromType("upcoming", {
  url: eventsUrl,
  authentication
});
searchEvents(searchOptions)
  .then(response => {
    // {
    //   data: [{
    //     id: "4",
    //     type: "events",
    //     attributes: {title: "Vision Zero", siteId: "CityofX", ...},
    //     geometry: {
    //       "x": -74.310680054965559,
    //       "y": 40.723010058860787
    //     }
    //   }],
    //   included: [{
    //     id: "CityofX",
    //     type: "sites",
    //     attributes: { id: "CityofX", url: "https://foo/bar"}
    //   }]
    // }
  });

Query for events from ArcGIS Hub.

Parameters

Parameter Type Default Notes
requestOptions Required IQueryFeaturesOptions

request options that may include authentication

Available requestOptions

Property Type Notes

Returns

A Promise that will resolve with decorated features from the event feature service for a Hub enabled ArcGIS Online organization.

Promise<{
data:
IEventResourceObject[]
included:
IEventResourceObject[]
}>

Function defined in events/src/search.ts:56