*/ protected function input_properties(): array { return array( 'id' => array( 'type' => 'integer', 'description' => __( 'Product or variation id.', '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( 'product' => array( 'type' => 'object', 'additionalProperties' => true ), 'lookup_state' => 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 ) { $product = Product_Repository::load( (int) $input['id'] ); if ( is_wp_error( $product ) ) { return $product; } return array( 'product' => Product_Repository::shape( $product ), 'lookup_state' => Product_Repository::lookup_state( $product ), ); } }