pub struct BookingsResource<'a> { /* private fields */ }Expand description
client.bookings()
Implementations§
Source§impl<'a> BookingsResource<'a>
impl<'a> BookingsResource<'a>
Sourcepub fn answer(
&self,
booking_id: impl Display,
answer: impl Display,
) -> Result<BookingBase>
pub fn answer( &self, booking_id: impl Display, answer: impl Display, ) -> Result<BookingBase>
Answer a booking request
PUT /bookings/{bookingId}/{answer}
Changes the status of the entire booking: approve sets approved (2), reject sets rejected (3), and reset sets pending (1). cancel is a legacy alias for reject. Requires permission to update the booking to the target status.
§Example
let booking = client.bookings().answer(8, "approve")?;
println!("{}", booking.title);Sourcepub fn create(&self, body: &BookingCreate) -> Result<BookingBase>
pub fn create(&self, body: &BookingCreate) -> Result<BookingBase>
Create a resource booking
POST /bookings
Creates an independent booking for one resource. Requires permission to create bookings with the requested status. Resources with needsAppointment=true return 422. Automatic approval and conflicts can change the returned statusId.
§Example
let body = models::BookingCreate {
end_date: DateOrDateTime::DateTime("2026-09-20T09:30:00Z".parse()?),
start_date: DateOrDateTime::DateTime("2026-09-20T08:00:00Z".parse()?),
resource_id: 7,
show_in_cal: true,
status_id: 1,
title: "Band rehearsal".into(),
..Default::default()
};
let result = client.bookings().create(&body)?;
println!("{}", result.title);Sourcepub fn delete(&self, booking_id: impl Display) -> Result<()>
pub fn delete(&self, booking_id: impl Display) -> Result<()>
Delete a booking series
DELETE /bookings/{bookingId}
Deletes the complete booking, including all occurrences. To remove only an occurrence, update the independent booking’s exceptions or the linked appointment. Allowed for the booking creator, users with permission to administer bookings for the resource, or its resource administrators.
§Example
client.bookings().delete(8)?;Sourcepub fn get(&self, booking_id: impl Display) -> Result<BookingWithIncludes>
pub fn get(&self, booking_id: impl Display) -> Result<BookingWithIncludes>
Get a booking series
GET /bookings/{bookingId}
Returns the stored booking and every calculated occurrence of its series, indexed by local start date. Requires permission to view its resource. Booking details may be anonymized. Use include[] to request conflicts or involved persons.
Use Self::get_with to pass query parameters.
§Example
let booking = client.bookings().get(8)?;
println!("{:?}", booking);Sourcepub fn get_with(
&self,
booking_id: impl Display,
query: &GetBookingsIdQuery,
) -> Result<BookingWithIncludes>
pub fn get_with( &self, booking_id: impl Display, query: &GetBookingsIdQuery, ) -> Result<BookingWithIncludes>
Get a booking series
Like Self::get, with query parameters.
GET /bookings/{bookingId}
Returns the stored booking and every calculated occurrence of its series, indexed by local start date. Requires permission to view its resource. Booking details may be anonymized. Use include[] to request conflicts or involved persons.
Sourcepub fn list(
&self,
query: &GetBookingsQuery,
) -> Result<Vec<BookingCalculatedWithIncludes>>
pub fn list( &self, query: &GetBookingsQuery, ) -> Result<Vec<BookingCalculatedWithIncludes>>
List booking occurrences
GET /bookings
Returns occurrences overlapping the requested date range for the selected resources. The same recurring booking ID can appear more than once with different booking.calculated dates. from and to are inclusive local dates. Requires permission to view every selected resource. Booking details may be anonymized.
§Example
let query = GetBookingsQuery {
resource_ids: Some(vec![42]),
..Default::default()
};
for booking in client.bookings().list(&query)? {
println!("{:?}", booking);
}Sourcepub fn preview_conflicts(
&self,
body: &BookingConflictRequestBody,
) -> Result<Vec<BookingConflict>>
pub fn preview_conflicts( &self, body: &BookingConflictRequestBody, ) -> Result<Vec<BookingConflict>>
Preview conflicts for a new booking
POST /bookings/conflicts
Calculates overlapping occurrences of other pending or approved bookings for the proposed resource and schedule. Does not create a booking or reserve availability. Returns the conflicting occurrences, whose titles may be anonymized. Adjacent timed bookings do not conflict. Repeated overlaps can return the same conflicting occurrence more than once.
§Example
let body = models::BookingConflictRequestBody {
end_date: DateOrDateTime::DateTime("2026-09-20T09:30:00Z".parse()?),
start_date: DateOrDateTime::DateTime("2026-09-20T08:00:00Z".parse()?),
resource_id: 7,
..Default::default()
};
for booking in client.bookings().preview_conflicts(&body)? {
println!("{}", booking.title);
}Sourcepub fn preview_conflicts_for(
&self,
booking_id: impl Display,
body: &BookingConflictUpdate,
) -> Result<Vec<BookingConflict>>
pub fn preview_conflicts_for( &self, booking_id: impl Display, body: &BookingConflictUpdate, ) -> Result<Vec<BookingConflict>>
Preview conflicts for an existing booking
POST /bookings/{bookingId}/conflicts
Calculates conflicts for a replacement schedule using the stored booking’s resource. The booking itself is excluded; resourceId in the request is not used. Requires permission to update the booking. No changes are saved. Returns the conflicting occurrences, whose titles may be anonymized. Adjacent timed bookings do not conflict. Repeated overlaps can return the same conflicting occurrence more than once.
§Example
let body = models::BookingConflictUpdate {
end_date: DateOrDateTime::DateTime("2026-09-20T09:30:00Z".parse()?),
start_date: DateOrDateTime::DateTime("2026-09-20T08:00:00Z".parse()?),
..Default::default()
};
for booking in client.bookings().preview_conflicts_for(8, &body)? {
println!("{}", booking.title);
}Sourcepub fn split(
&self,
booking_id: impl Display,
body: &BookingSplitCreate,
) -> Result<BookingBase>
pub fn split( &self, booking_id: impl Display, body: &BookingSplitCreate, ) -> Result<BookingBase>
Split and replace a booking occurrence
POST /bookings/{bookingId}
Removes one date or the remainder of an independent series and creates a replacement booking. splitDate identifies the original occurrence. Appointment-linked bookings cannot be split here. Requires permission to update the booking. Automatic approval and conflicts can change the returned statusId.
§Example
let body = models::BookingSplitCreate {
end_date: DateOrDateTime::DateTime("2026-09-20T09:30:00Z".parse()?),
start_date: DateOrDateTime::DateTime("2026-09-20T08:00:00Z".parse()?),
resource_id: 7,
show_in_cal: true,
status_id: 1,
title: "Band rehearsal".into(),
split_date: "2026-09-20".parse()?,
split_until_end: false,
..Default::default()
};
let booking = client.bookings().split(8, &body)?;
println!("{}", booking.title);Sourcepub fn update(
&self,
booking_id: impl Display,
body: &Value,
) -> Result<BookingBase>
pub fn update( &self, booking_id: impl Display, body: &Value, ) -> Result<BookingBase>
Update a resource booking
PUT /bookings/{bookingId}
Replaces an independent booking. For an appointment-linked booking, only statusId and description are processed; update its resource and schedule through the appointment APIs. Requires permission to update the booking. Automatic approval and conflicts can change the returned statusId.
§Example
let body = serde_json::json!({
"endDate": "2026-09-20T09:30:00Z",
"startDate": "2026-09-20T08:00:00Z",
"resourceId": 7,
"showInCal": true,
"statusId": 1,
"title": "Band rehearsal"
});
let result = client.bookings().update(8, &body)?;
println!("{}", result.title);