@@ -100,13 +100,45 @@ public function get_account_details() {
100100 /**
101101 * Get monitor info.
102102 *
103- * @param [type] $monitors [description].
104- * @param [type] $types [description].
105- * @param [type] $statuses [description].
106- * @return [type] [description].
103+ * @param [String] $search [description].
104+ * @param [type] $monitors [description].
105+ * @param [type] $custom_up_ratio [description].
106+ * @param [Int] $logs [description].
107+ * @param [Int] $response_times [description].
108+ * @param [Int] $response_time_average [description].
109+ * @param [Int] $alert_contacts [description].
110+ * @param [Int] $show_alert_contacts [description].
111+ * @param [Int] $show_timezone [description].
112+ * @return [type] [description]
107113 */
108- protected function get_monitors ( $ monitors = null , $ types = null , $ statuses = null ) {
109- return true ;
114+ public function get_monitors ( $ search = '' , $ monitors = null , $ custom_up_ratio = null , $ logs = 0 , $ response_times = 0 , $ response_time_average = 0 , $ alert_contacts = 0 , $ show_alert_contacts = 0 , $ show_timezone = 0 ) {
115+ $ request = $ this ->base_uri . '/getMonitors ' ;
116+
117+ $ request .= '?logs= ' . $ logs . '&responseTimes= ' . $ response_times . '&responseTimesAverage= ' . $ response_time_average . '&alertContacts= ' . $ alert_contacts . '&showMonitorAlertContacts= ' . $ show_alert_contacts . '&showTimezone= ' . $ show_timezone ;
118+
119+ if ( ! empty ( $ search ) ) {
120+ $ request .= '&search= ' . htmlspecialchars ( $ search );
121+ }
122+ if ( ! empty ( $ monitors ) ) {
123+ $ request .= '&monitors= ' . $ this ->get_implode ( $ monitors );
124+ }
125+ if ( ! empty ( $ custom_up_ratio ) ) {
126+ $ request .= '&customUptimeRatio= ' . $ this ->get_implode ( $ custom_up_ratio );
127+ }
128+ $ result = $ this ->fetch ( $ request );
129+ $ limit = $ result ->limit ;
130+ $ offset = $ result ->offset ;
131+ $ total = $ result ->total ;
132+
133+ while ( ($ limit * $ offset ) + $ limit < $ total ) {
134+ $ result ->limit = ($ limit * $ offset ) + $ limit ;
135+ $ offset ++;
136+ $ append = $ this ->fetch ( $ request .'&offset= ' .($ offset * $ limit ) );
137+ $ result ->monitors ->monitor = array_merge ( $ result ->monitors ->monitor , $ append ->monitors ->monitor );
138+ }
139+ $ result ->limit = ( $ limit * $ offset ) + $ limit ;
140+
141+ return $ result ;
110142 }
111143
112144 /**
0 commit comments