Getting resources in a specific city of a specific type - gomeddo/js-sdk GitHub Wiki
Simple example of using the resource request to filter on parent and type.
import GoMeddo from "@gomeddo/sdk";
// Create a new GoMeddo object
const gm = new GoMeddo(apiKey)
// Id of the resource Amsterdam that is assumed
// to be the ancestor resource for all the resources in Amsterdam
const amsterdamResourceId = 'amsterdamResourceId'
// Id of the Room resource type.
const roomResourceTypeId = 'roomResourceTypeId'
// Create a new resource request object with buildResourceRequest.
const resourceResult = await gm.buildResourceRequest()
// Filter on resources that have amsterdamResource
// as an ancestor and the amsterdamResource resource itself.
.includeAllResourcesAt(amsterdamResourceId)
// Filter resource with the type roomResourceType
.withType(roomResourceTypeId)
// Run the actual request and build the ResourceResult object.
.getResults()
console.log(resourceResult.getResourceIds())