Appointment plugins

Appointment plugins should inherit from the base plugin.

Public Python API

Plugin base class

class openforms.appointments.base.BasePlugin(identifier: str)

Base Appointment plugin.

configuration_options

alias of openforms.appointments.base.EmptyOptions

abstract create_appointment(products: list[openforms.appointments.base.Product], location: openforms.appointments.base.Location, start_at: datetime.datetime, client: Union[openforms.appointments.base.CustomerDetails[openforms.appointments.base.F], openforms.appointments.base.Customer], remarks: str = '') str

Create an appointment.

Parameters
  • products – List of Product, as obtained from get_available_products().

  • location – An Location, as obtained from get_locations().

  • start_at – A datetime to start the appointment, as obtained from get_dates().

  • client – A Customer that holds client details.

  • remarks – A str for additional remarks, added to the appointment.

Returns

An appointment identifier as str.

Raises

AppointmentCreateFailed – If the appointment could not be created.

abstract delete_appointment(identifier: str) None

Delete an appointment.

Parameters

identifier – A string that represents the unique identification of the appointment.

Raises

AppointmentDeleteFailed – If the appointment could not be deleted.

abstract get_appointment_details(identifier: str) openforms.appointments.base.AppointmentDetails

Get appointment details.

Parameters

identifier – A string that represents the unique identification of the appointment.

Returns

AppointmentDetails.

abstract get_available_products(current_products: Optional[list[openforms.appointments.base.Product]] = None, location_id: str = '') list[openforms.appointments.base.Product]

Retrieve all available products and services to create an appointment for.

You can pass current_products to only retrieve available products in combination with the current_products.

Parameters
  • current_products – List of Product, as obtained from another get_available_products() call.

  • location_id – ID of the location to filter products on - plugins may support this.

Returns

List of Product

abstract get_dates(products: list[openforms.appointments.base.Product], location: openforms.appointments.base.Location, start_at: Optional[datetime.date] = None, end_at: Optional[datetime.date] = None) list[datetime.date]

Retrieve all available dates for given products and location.

Parameters
  • products – List of Product, as obtained from get_available_products().

  • location – An Location, as obtained from get_locations().

  • start_at – The start date to retrieve available dates for. Default: date.today().

  • end_at – The end date to retrieve available dates for. Default: 14 days after start_date.

Returns

List of date

abstract get_locations(products: Optional[list[openforms.appointments.base.Product]] = None) list[openforms.appointments.base.Location]

Retrieve all available locations.

Parameters

products – List of Product, as obtained from get_available_products(). If None or unspecified, all possible locations are returned. Otherwise, if the plugin supports it, locations are filtered given the products.

Returns

List of Location

abstract get_required_customer_fields(products: list[openforms.appointments.base.Product]) list[openforms.formio.typing.base.Component]

Given a list of products, return the additional required customer fields.

The fields are returned as a Form.io components array, including possible useful autocomplete attributes. This should make it easy to render the fields using existing tooling.

abstract get_times(products: list[openforms.appointments.base.Product], location: openforms.appointments.base.Location, day: datetime.date) list[datetime.datetime]

Retrieve all available times for given products, location and day.

Parameters
  • products – List of Product, as obtained from get_available_products.

  • location – An Location, as obtained from get_locations.

  • day – A date to retrieve available times for.

Returns

List of available datetime.

Module documentation