import Booker25API from './api/booker25-api-requests'; import ResourceResult from './resource-result'; import { ConditionElement } from './s-objects/s-object'; /** * Resource request by default will request all resources in an org. * Methods can be used to filter and narow down the resources being requested. */ export default class ResourceRequest { private readonly api; private readonly standardFields; private readonly additionalFields; private readonly parents; private readonly types; private readonly condition; private startOfRange; private endOfRange; private fetchServices; constructor(api: Booker25API); /** * Set the resource request to fetch specific resource and their children. * Can be called multiple times and the ids will be added. * * @param parentIds The Ids of the resources you want to retrieve. Child resources will also be retrieved. * @returns The updated resource request. */ includeAllResourcesAt(...parentIds: string[]): ResourceRequest; /** * Filter the resources to only include resources of the specific type or types * * @param typeIds the ids of the resource types to include. * @returns The updated resource request. */ withType(...typeIds: string[]): ResourceRequest; /** * Filter the resources on field values using conditions. * * @param conditions The conditions to filter on. Multiple conditions wil be combined using AND. * @returns The updated resource request. */ withCondition(...conditions: ConditionElement[]): ResourceRequest; /** * Request an additional field to be returned for the resources * * @param fieldName The api name of the field to request * @returns The updated resource request. */ withAdditionalField(fieldName: string): ResourceRequest; /** * Request additional fields to be returned for the resources * * @param fieldName The api names of the fields to request * @returns The updated resource request. */ withAdditionalFields(fieldNames: Set | string[]): ResourceRequest; /** * Request on resources that are not fully booked between the two datetime. * The input datetimes are interpeted in GMT * When this is requested timeslots for the requested range are provided for each resource. * * @param startOfRange The start of the timeslot range * @param endOfRange The end of the timeslot range * @returns The updated resource request. */ withAvailableSlotsBetween(startOfRange: Date, endOfRange: Date): ResourceRequest; /** * Also fetch the services including slot for when the services are available * Only valid if withAvailableSlotsBetween has also been called. * * @param includeServices Whether to include the services or not * @returns The updated resource request. */ includeServices(includeServices: boolean): ResourceRequest; /** * Calls the booker25 APIs to construct the requested resources. * * @returns A ResourceResult object containing the requested resources. */ getResults(): Promise; private getStartingResourceScope; private getRequestedFields; }