*/ protected function input_properties(): array { return array( 'id' => array( 'type' => 'integer', 'description' => __( 'Order id.', 'acrossai-abilities-manager' ) ), 'include_personal_data' => array( 'type' => 'boolean', 'default' => false, 'description' => __( 'Include the name, addresses, email and phone on the order.', 'acrossai-abilities-manager' ) ), ); } /** * @since 0.0.34 * @return array */ protected function required_input(): array { return array( 'id' ); } /** * @since 0.0.34 * @return array */ protected function output_properties(): array { return array( 'order' => array( 'type' => 'object', 'additionalProperties' => true ), ); } /** * @since 0.0.34 * @return array */ protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ); } /** * @since 0.0.34 * @param array $input Input. * @return array|WP_Error */ protected function run( array $input ) { $order = Order_Repository::load( (int) $input['id'] ); if ( is_wp_error( $order ) ) { return $order; } return array( 'order' => Order_Repository::shape( $order, ! empty( $input['include_personal_data'] ) ) ); } }