/** * Get the webhook for the given ID * * @since 2.2 * @param int $id webhook ID * @param array $fields * @return array */ public function get_conversation($id, $fields = null) { $id = $this->validate_request($id, 'post', 'read'); if (is_wp_error($id)) { return $id; } $_G = $this->server->params['GET']; // GET $offset = array_key_exists('offset', $_G) ? $_G['offset'] : 0; $count = array_key_exists('count', $_G) ? $_G['count'] : 50; $result = array(); $exporter_instance = new SpotIM_Export_Conversation($id, $count, $offset); $post_result = $exporter_instance->export(); if ($post_result && !$exporter_instance->is_empty()) { $result = $post_result; } return array('metadata' => array('left_comments' => $exporter_instance->total_comments_count->approved - $exporter_instance->get_comment_count()), 'conversation' => $result); }