# -*- coding: utf-8 -*-

"""
    test_meraki

    This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""

from test_meraki.api_helper import APIHelper
from test_meraki.configuration import Configuration
from test_meraki.controllers.base_controller import BaseController
from test_meraki.http.auth.custom_header_auth import CustomHeaderAuth

class WirelessHealthController(BaseController):

    """A Controller to access Endpoints in the test_meraki API."""


    def get_network_clients_connection_stats(self,
                                             network_id,
                                             t_0=None,
                                             t_1=None,
                                             timespan=None,
                                             ssid=None,
                                             vlan=None,
                                             ap_tag=None):
        """Does a GET request to /networks/{networkId}/clients/connectionStats.

        Aggregated connectivity info for this network, grouped by clients

        Args:
            network_id (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/clients/connectionStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_clients_latency_stats(self,
                                          network_id,
                                          t_0=None,
                                          t_1=None,
                                          timespan=None,
                                          ssid=None,
                                          vlan=None,
                                          ap_tag=None,
                                          fields=None):
        """Does a GET request to /networks/{networkId}/clients/latencyStats.

        Aggregated latency info for this network, grouped by clients

        Args:
            network_id (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag
            fields (string, optional): Partial selection: If present, this
                call will return only the selected fields of
                ["rawDistribution", "avg"]. All fields will be returned by
                default. Selected fields must be entered as a comma separated
                string.

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/clients/latencyStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag,
            'fields': fields
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_client_connection_stats(self,
                                            network_id,
                                            client_id,
                                            t_0=None,
                                            t_1=None,
                                            timespan=None,
                                            ssid=None,
                                            vlan=None,
                                            ap_tag=None):
        """Does a GET request to /networks/{networkId}/clients/{clientId}/connectionStats.

        Aggregated connectivity info for a given client on this network.
        Clients are identified by their MAC.

        Args:
            network_id (string): TODO: type description here. Example: 
            client_id (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/clients/{clientId}/connectionStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'clientId': client_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_client_latency_stats(self,
                                         network_id,
                                         client_id,
                                         t_0=None,
                                         t_1=None,
                                         timespan=None,
                                         ssid=None,
                                         vlan=None,
                                         ap_tag=None,
                                         fields=None):
        """Does a GET request to /networks/{networkId}/clients/{clientId}/latencyStats.

        Aggregated latency info for a given client on this network. Clients
        are identified by their MAC.

        Args:
            network_id (string): TODO: type description here. Example: 
            client_id (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag
            fields (string, optional): Partial selection: If present, this
                call will return only the selected fields of
                ["rawDistribution", "avg"]. All fields will be returned by
                default. Selected fields must be entered as a comma separated
                string.

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/clients/{clientId}/latencyStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'clientId': client_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag,
            'fields': fields
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_connection_stats(self,
                                     network_id,
                                     t_0=None,
                                     t_1=None,
                                     timespan=None,
                                     ssid=None,
                                     vlan=None,
                                     ap_tag=None):
        """Does a GET request to /networks/{networkId}/connectionStats.

        Aggregated connectivity info for this network

        Args:
            network_id (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/connectionStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_devices_connection_stats(self,
                                             network_id,
                                             t_0=None,
                                             t_1=None,
                                             timespan=None,
                                             ssid=None,
                                             vlan=None,
                                             ap_tag=None):
        """Does a GET request to /networks/{networkId}/devices/connectionStats.

        Aggregated connectivity info for this network, grouped by node

        Args:
            network_id (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/devices/connectionStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_devices_latency_stats(self,
                                          network_id,
                                          t_0=None,
                                          t_1=None,
                                          timespan=None,
                                          ssid=None,
                                          vlan=None,
                                          ap_tag=None,
                                          fields=None):
        """Does a GET request to /networks/{networkId}/devices/latencyStats.

        Aggregated latency info for this network, grouped by node

        Args:
            network_id (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag
            fields (string, optional): Partial selection: If present, this
                call will return only the selected fields of
                ["rawDistribution", "avg"]. All fields will be returned by
                default. Selected fields must be entered as a comma separated
                string.

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/devices/latencyStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag,
            'fields': fields
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_device_connection_stats(self,
                                            network_id,
                                            serial,
                                            t_0=None,
                                            t_1=None,
                                            timespan=None,
                                            ssid=None,
                                            vlan=None,
                                            ap_tag=None):
        """Does a GET request to /networks/{networkId}/devices/{serial}/connectionStats.

        Aggregated connectivity info for a given AP on this network

        Args:
            network_id (string): TODO: type description here. Example: 
            serial (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/devices/{serial}/connectionStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'serial': serial
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_device_latency_stats(self,
                                         network_id,
                                         serial,
                                         t_0=None,
                                         t_1=None,
                                         timespan=None,
                                         ssid=None,
                                         vlan=None,
                                         ap_tag=None,
                                         fields=None):
        """Does a GET request to /networks/{networkId}/devices/{serial}/latencyStats.

        Aggregated latency info for a given AP on this network

        Args:
            network_id (string): TODO: type description here. Example: 
            serial (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag
            fields (string, optional): Partial selection: If present, this
                call will return only the selected fields of
                ["rawDistribution", "avg"]. All fields will be returned by
                default. Selected fields must be entered as a comma separated
                string.

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/devices/{serial}/latencyStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'serial': serial
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag,
            'fields': fields
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_failed_connections(self,
                                       network_id,
                                       t_0=None,
                                       t_1=None,
                                       timespan=None,
                                       ssid=None,
                                       vlan=None,
                                       ap_tag=None,
                                       serial=None,
                                       client_id=None):
        """Does a GET request to /networks/{networkId}/failedConnections.

        List of all failed client connection events on this network in a given
        time range

        Args:
            network_id (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag
            serial (string, optional): Filter by AP
            client_id (string, optional): Filter by client MAC

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/failedConnections'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag,
            'serial': serial,
            'clientId': client_id
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_latency_stats(self,
                                  network_id,
                                  t_0=None,
                                  t_1=None,
                                  timespan=None,
                                  ssid=None,
                                  vlan=None,
                                  ap_tag=None,
                                  fields=None):
        """Does a GET request to /networks/{networkId}/latencyStats.

        Aggregated latency info for this network

        Args:
            network_id (string): TODO: type description here. Example: 
            t_0 (string, optional): The beginning of the timespan for the
                data. The maximum lookback period is 180 days from today.
            t_1 (string, optional): The end of the timespan for the data. t1
                can be a maximum of 7 days after t0.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameters t0 and t1. The value must be in seconds and be less
                than or equal to 7 days.
            ssid (int, optional): Filter results by SSID
            vlan (int, optional): Filter results by VLAN
            ap_tag (string, optional): Filter results by AP Tag
            fields (string, optional): Partial selection: If present, this
                call will return only the selected fields of
                ["rawDistribution", "avg"]. All fields will be returned by
                default. Selected fields must be entered as a comma separated
                string.

        Returns:
            object: Response from the API. Successful operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/networks/{networkId}/latencyStats'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            't0': t_0,
            't1': t_1,
            'timespan': timespan,
            'ssid': ssid,
            'vlan': vlan,
            'apTag': ap_tag,
            'fields': fields
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body
