Published
Edited
Mar 13, 2020
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
stae = require('https://bundle.run/stae@2.0.1')
Insert cell
api = stae.createClient({key:Secret("STAE_API_KEY")})
Insert cell
Insert cell
Insert cell
Insert cell
places = await api.place.find({
options: {
// The API returns a default of 100 results on every request made. Use the limit field to define how many results you want.
limit: 200
}})
Insert cell
Insert cell
place = await api.place.find({
options: {
search: object.message,
limit: 200
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
incident = await api.place.dataType.datum.find({
placeId: place.results[0].id,
dataTypeId: 'traffic-incident',
options: {
orderings: [
{ direction: 'desc', value: { field: 'data.startedAt' } }
]
}
})
Insert cell
Insert cell
Insert cell
Insert cell
traffic = await api.place.dataType.datum.find({
placeId: place.results[0].id,
dataTypeId: 'traffic-jam',
options: {
orderings: [
{ direction: 'desc', value: { field: 'data.startedAt' } }
]
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
incidentDatum = await api.place.dataType.datum.findById({
placeId: place.results[0].id,
dataTypeId: 'traffic-incident',
datumId: incident.results[1].id
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
writer = stae.createClient({ key: '327913ab-0362-422e-adcd-08479ea335bf' })
Insert cell
Insert cell
await writer.source.datum.create({
sourceId: 'f7b96365-7074-4a25-8ab5-f8467a8d4c7c',
data: {
id: '0405201912103000',
operators: ['Openbox', 'Stae'],
hours: '9AM to 6PM, 5 days a week',
type: 'Marquises Car',
available: true,
location: {
type: 'Point',
coordinates: [-73.99048715829849,40.744050339871116]
}
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more