get_id() ) { throw new Rest_Exception( serialize( new WP_Error( 'rest_post_invalid_id', __( 'Invalid group ID.', 'advanced-ads-pro' ), [ 'status' => 404 ] ) ) ); } } /** * Return group details for API response. * * @return array */ public function get_rest_response() { $ad_ids = $this->get_ordered_ad_ids(); return [ 'ID' => $this->get_id(), 'name' => $this->get_title(), 'type' => $this->get_type(), 'ads' => $ad_ids, 'ad_weights' => $this->get_ad_weights(), ]; } }