PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / trunk
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress vtrunk
5.6.8 5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / abilities / bookings / get-booking.php
latepoint / lib / abilities / bookings Last commit date
abstract-booking-ability.php 2 weeks ago approve-booking.php 4 months ago cancel-booking.php 4 months ago change-booking-status.php 2 weeks ago create-booking.php 4 months ago delete-booking.php 2 weeks ago get-booking-stats.php 2 weeks ago get-booking-statuses.php 4 months ago get-booking.php 2 weeks ago get-bookings-for-date.php 4 months ago get-bookings-per-day.php 2 weeks ago get-upcoming-bookings.php 4 months ago list-bookings.php 4 months ago reschedule-booking.php 2 weeks ago update-booking.php 2 weeks ago
get-booking.php
44 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; }
4
5 class LatePointAbilityGetBooking extends LatePointAbstractBookingAbility {
6
7 protected function configure(): void {
8 $this->id = 'latepoint/get-booking';
9 $this->label = __( 'Get booking', 'latepoint' );
10 $this->description = __( 'Returns a single booking by ID with all related data.', 'latepoint' );
11 $this->permission = 'booking__view';
12 $this->read_only = true;
13 }
14
15 public function get_input_schema(): array {
16 return [
17 'type' => 'object',
18 'properties' => [
19 'id' => [
20 'type' => 'integer',
21 'description' => __( 'Booking ID.', 'latepoint' ),
22 ],
23 ],
24 'required' => [ 'id' ],
25 ];
26 }
27
28 public function get_output_schema(): array {
29 return $this->booking_output_schema();
30 }
31
32 public function execute( array $args ) {
33 $booking = new OsBookingModel( (int) $args['id'] );
34 if ( $booking->is_new_record() ) {
35 return new WP_Error( 'not_found', __( 'Booking not found.', 'latepoint' ), [ 'status' => 404 ] );
36 }
37 $auth = $this->authorize_record( $booking, 'view' );
38 if ( is_wp_error( $auth ) ) {
39 return $auth;
40 }
41 return $this->serialize_booking( $booking );
42 }
43 }
44