*/ protected function input_properties(): array { return array( 'category_id' => array( 'type' => 'integer', 'description' => __( 'Only cookies in this consent category. Omit for all of them.', 'acrossai-abilities-manager' ) ), ); } /** * @since 0.0.34 * @return array */ protected function required_input(): array { return array(); } /** * @since 0.0.34 * @return array */ protected function output_properties(): array { return array( 'cookies' => array( 'type' => 'array', 'items' => array( 'type' => 'object', 'additionalProperties' => true ) ), 'count' => array( 'type' => 'integer' ), ); } /** * @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 ) { $category = isset( $input['category_id'] ) ? (int) $input['category_id'] : null; $cookies = Consent_Repository::list_cookies( $category ); return array( 'cookies' => $cookies, 'count' => count( $cookies ), ); } }