*/ protected function input_properties(): array { return array( 'id' => array( 'type' => 'integer', 'description' => __( 'Category id, from consent/list-categories.', 'acrossai-abilities-manager' ) ), 'name' => array( 'description' => __( 'A string, or a map keyed by language code. Languages not supplied keep their current name.', 'acrossai-abilities-manager' ) ), 'description' => array( 'description' => __( 'A string, or a map keyed by language code.', 'acrossai-abilities-manager' ) ), 'visible' => array( 'type' => 'boolean', 'description' => __( 'Whether the category is shown in the preference centre.', 'acrossai-abilities-manager' ) ), 'priority' => array( 'type' => 'integer', 'description' => __( 'Ordering within the preference centre.', 'acrossai-abilities-manager' ) ), 'sell_personal_data' => array( 'type' => 'boolean', 'description' => __( 'Whether this category counts as selling or sharing personal information, which matters under US state laws.', '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( 'category' => array( 'type' => 'object', 'additionalProperties' => true ), 'banner_refreshed' => array( 'type' => 'boolean' ), 'languages' => array( 'type' => 'object', 'additionalProperties' => true ), 'rendered' => array( 'type' => 'boolean' ), 'pending_rebuild' => array( 'type' => 'boolean' ), ); } /** * @since 0.0.34 * @return array */ protected function annotations(): array { return array( 'readonly' => false, 'destructive' => false, 'idempotent' => false, ); } /** * @since 0.0.34 * @param array $input Input. * @return array|WP_Error */ protected function run( array $input ) { $fields = $input; unset( $fields['id'] ); if ( array() === $fields ) { return new WP_Error( 'invalid_input', __( 'Nothing to change. Supply at least one field besides the id.', 'acrossai-abilities-manager' ) ); } return Consent_Repository::update_category( (int) $input['id'], $fields ); } }