guard( 'manage_pointics', 'manage_options' ); if ( $check ) { return $check; } $ready = $this->pointics_tables_ready(); if ( $ready ) { return $this->steer( $ready ); } if ( $channel_id <= 0 ) { return $this->steer( [ 'error' => __( 'channel_id must be a positive integer. Use pointics-list-channels to find it.', 'aisentic' ), 'code' => 'validation', 'status' => 422, ] ); } try { $request = new \WP_REST_Request( 'GET' ); $request->set_param( 'id', $channel_id ); $controller = pointics_container()->make( \Pointics\Api\Controllers\Channels_Controller::class ); $data = $this->extract_response( $controller->get_channel( $request ), __( 'Failed to get the Pointics channel.', 'aisentic' ), 'pointics-get-channel' ); if ( $this->is_error( $data ) ) { return $data; } return $this->shape_channel( $data ); } catch ( \Throwable $e ) { Log::error( 'Pointics_Get_Channel_Tool error', [ 'error' => $e->getMessage() ] ); return $this->steer( [ 'error' => __( 'Failed to get the Pointics channel.', 'aisentic' ), 'code' => 'internal', 'status' => null, ] ); } } }