PluginProbe
Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager / 0.0.3
Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager v0.0.3
0.0.11 0.0.10 0.0.9 0.0.8 0.0.7 0.0.6 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5
cookiez / modules / reviews / classes / feedback-client.php

feedback-client.php in Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager 0.0.3, at modules/reviews/classes/feedback-client.php

38 lines 753 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Cookiez\Modules\Reviews\Classes;
4
5 use Cookiez\Classes\Services\Client;
6 use Exception;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly
10 }
11
12 class Feedback_Client {
13
14 private const SERVICE_ENDPOINT = 'feedback/reviews';
15
16 /**
17 * Send request to the service to submit the feedback.
18 *
19 * @param array<string, mixed> $params Request payload.
20 *
21 * @return mixed
22 * @throws Exception When the request fails.
23 */
24 public static function post_feedback( $params ) {
25 $response = Client::get_instance()->make_request(
26 'POST',
27 self::SERVICE_ENDPOINT,
28 $params
29 );
30
31 if ( empty( $response ) || is_wp_error( $response ) ) {
32 throw new Exception( 'Failed to add the feedback.' );
33 }
34
35 return $response;
36 }
37 }
38