ReservationRequest - gomeddo/js-sdk GitHub Wiki
Object that allows you to add different filters before sending a request for reservations to the GoMeddo salesforce Rest API.
Example
const reservationResult = gm.buildReservationRequest()
.includeAllResourcesAt(sfId1, sfId2)
.withType('Event')
.withStatus('Completed')
.withContact(new Contact('GoMeddo', 'App', '[email protected]'))
.withEndDatetimeAfter(new Date())
.getResults()
withIds
Syntax
withIds(sfId1)
withIds(sfId1, sfId2)
withIds(sfId1, sfId2, /* … ,*/ sfIdN)
Parameters:
sfIdN
The Ids of the reservations you want to retrieve.
Return value: The updated reservation request.
Description
Only return reservations with the specified ids.
withType
Syntax
withType(sfIdOrName1)
withType(sfIdOrName1, sfIdOrName2)
withType(sfIdOrName1, sfIdOrName2, /* … ,*/ sfIdOrNameN)
Parameters:
sfIdOrNameN
The Ids/Names of the reservation types you want to filter on.
Return value: The updated reservation request.
Description
Only return reservations of the specified types.
withStatus
Syntax
withStatus(sfIdOrName1)
withStatus(sfIdOrName1, sfIdOrName2)
withStatus(sfIdOrName1, sfIdOrName2, /* … ,*/ sfIdOrNameN)
Parameters:
sfIdOrNameN
The Ids/Names of the reservation statuses you want to filter on.
Return value: The updated reservation request.
Description
Only return reservations with the specified statuses
withEndDatetimeAfter
Syntax
withEndDatetimeAfter(date)
Parameters:
date
JS Date object
Return value: The updated reservation request.
Description
Filter reservations to only include reservations that end after the given date (GMT)
withStartDatetimeBefore
Syntax
withStartDatetimeBefore(date)
Parameters:
date
JS Date object
Return value: The updated reservation request.
Description
Filter reservations to only include reservations that start before the given date (GMT)
withLead
Syntax
withLead(lead)
Parameters:
lead
A Lead object either with an Id or with other fields.
Return value: The updated reservation request.
Description
Only return reservations linked to this lead. If an Id is provided it will use that in the filter. Otherwise it will look for reservations that are linked to a lead that match the fields provided.
withContact
Syntax
withContact(contact)
Parameters:
contact
A Contact object either with an Id or with other fields.
Return value: The updated reservation request.
Description
Only return reservations linked to this contact. If an Id is provided it will use that in the filter. Otherwise it will look for reservations that are linked to a contact that match the fields provided.
linkedToReservationContacts
Syntax
linkedToReservationContacts()
Return value: A ReservationContactRequest that can then be used to add conditions to the reservation contacts you want to search for.
Description
Only return reservations linked to the matching reservation contacts.
withResource
Syntax
withResource(resource)
Parameters:
resource
A Resource object either with an Id or with other fields.
Return value: The updated reservation request.
Description
Only return reservations linked to this resource. If an Id is provided it will use that in the filter. Otherwise it will look for reservations that are linked to a resource that match the fields provided.
withCondition
Syntax
withCondition(conditionObject1)
withCondition(conditionObject1, conditionObject2)
withCondition(conditionObject1, conditionObject2, /* … ,*/ conditionObjectN)
Parameters:
conditionObjectN
The condition(s) you want to filter on. Of type Condition.
Return value: The updated reservation request.
Description
Only return reservation that match the conditions. Multiple conditions will be combined using AND.
includeAdditionalField
Syntax
includeAdditionalField(fieldname)
Parameters:
fieldname
The fieldname of a field in salesforce on reservation you want to be returned from the request
Return value: The updated reservation request.
Description
Add this field to the list of fields requested from the salesforce endpoint.
includeAdditionalFields
Syntax
includeAdditionalFields(fieldnameList)
Parameters:
fieldnameList
The fieldnames of fields in salesforce on reservation you want to be returned from the request
Return value: The updated reservation request.
Description
Add these fields to the list of fields requested from the salesforce endpoint.
getResults
Syntax
await getResults()
Return value: A ReservationResult object with the reservations matching the request.
Description
async
Calls the GoMeddo APIs to construct the requested reservations.