abstract-booking-ability.php
1 week ago
approve-booking.php
4 months ago
cancel-booking.php
4 months ago
change-booking-status.php
1 week ago
create-booking.php
4 months ago
delete-booking.php
1 week ago
get-booking-stats.php
1 week ago
get-booking-statuses.php
4 months ago
get-booking.php
1 week ago
get-bookings-for-date.php
4 months ago
get-bookings-per-day.php
1 week ago
get-upcoming-bookings.php
4 months ago
list-bookings.php
4 months ago
reschedule-booking.php
1 week ago
update-booking.php
1 week ago
get-booking-statuses.php
51 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; } |
| 4 | |
| 5 | class LatePointAbilityGetBookingStatuses extends LatePointAbstractBookingAbility { |
| 6 | |
| 7 | protected function configure(): void { |
| 8 | $this->id = 'latepoint/get-booking-statuses'; |
| 9 | $this->label = __( 'Get booking statuses', 'latepoint' ); |
| 10 | $this->description = __( 'Returns the list of valid booking status values and their labels.', '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 | ]; |
| 20 | } |
| 21 | |
| 22 | public function get_output_schema(): array { |
| 23 | return [ |
| 24 | 'type' => 'object', |
| 25 | 'properties' => [ |
| 26 | 'statuses' => [ |
| 27 | 'type' => 'array', |
| 28 | 'items' => [ |
| 29 | 'type' => 'object', |
| 30 | 'properties' => [ |
| 31 | 'value' => [ 'type' => 'string' ], |
| 32 | 'label' => [ 'type' => 'string' ], |
| 33 | ], |
| 34 | ], |
| 35 | ], |
| 36 | ], |
| 37 | ]; |
| 38 | } |
| 39 | |
| 40 | public function execute( array $args ) { |
| 41 | $statuses = []; |
| 42 | foreach ( OsBookingHelper::get_statuses_list() as $value => $label ) { |
| 43 | $statuses[] = [ |
| 44 | 'value' => $value, |
| 45 | 'label' => $label, |
| 46 | ]; |
| 47 | } |
| 48 | return [ 'statuses' => $statuses ]; |
| 49 | } |
| 50 | } |
| 51 |