Skip to main content

BookingsResource

Struct BookingsResource 

Source
pub struct BookingsResource<'a> { /* private fields */ }
Expand description

client.bookings()

Implementations§

Source§

impl<'a> BookingsResource<'a>

Source

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);
Source

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);
Source

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)?;
Source

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);
Source

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.

Source

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);
}
Source

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);
}
Source

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);
}
Source

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);
Source

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);

Trait Implementations§

Source§

impl<'a> Clone for BookingsResource<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for BookingsResource<'a>

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for BookingsResource<'a>

§

impl<'a> !UnwindSafe for BookingsResource<'a>

§

impl<'a> Forget for BookingsResource<'a>

§

impl<'a> Freeze for BookingsResource<'a>

§

impl<'a> Move for BookingsResource<'a>

§

impl<'a> Send for BookingsResource<'a>

§

impl<'a> Sync for BookingsResource<'a>

§

impl<'a> Unpin for BookingsResource<'a>

§

impl<'a> UnsafeUnpin for BookingsResource<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more