array( 'type' => 'integer', 'minimum' => 1, 'description' => __( 'The event ID.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'id' ); } protected function output_properties(): array { return array( 'event' => array( 'type' => 'object' ), ); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ); } protected function suggested_abilities(): array { return array( array( 'slug' => 'events/update-event', 'reason' => __( 'Change its dates, venue, organizers or cost.', 'acrossai-abilities-manager' ), ), array( 'slug' => 'events/list-events', 'reason' => __( 'Find related events at the same venue or in the same category.', 'acrossai-abilities-manager' ), ), ); } protected function run( array $input ) { $id = (int) $input['id']; $event = Event_Repository::require_post( $id, 'event' ); if ( is_wp_error( $event ) ) { return $event; } $row = Event_Repository::describe_event( $id ); if ( null === $row ) { return new WP_Error( 'event_unreadable', __( 'The Events Calendar could not decorate that event.', 'acrossai-abilities-manager' ) ); } return array( 'event' => $row, 'message' => sprintf( /* translators: 1: event title, 2: start date */ __( '"%1$s" starts %2$s.', 'acrossai-abilities-manager' ), $row['title'], $row['start_date'] ), ); } }