# -*- 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 BluetoothClientsController(BaseController):

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


    def get_network_bluetooth_clients(self,
                                      network_id,
                                      t_0=None,
                                      timespan=None,
                                      per_page=None,
                                      starting_after=None,
                                      ending_before=None,
                                      include_connectivity_history=None):
        """Does a GET request to /networks/{networkId}/bluetoothClients.

        List the Bluetooth clients seen by APs in 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 7 days from today.
            timespan (float, optional): The timespan for which the information
                will be fetched. If specifying timespan, do not specify
                parameter t0. The value must be in seconds and be less than or
                equal to 7 days. The default is 1 day.
            per_page (int, optional): The number of entries per page returned.
                Acceptable range is 5 - 1000. Default is 10.
            starting_after (string, optional): A token used by the server to
                indicate the start of the page. Often this is a timestamp or
                an ID but it is not limited to those. This parameter should
                not be defined by client applications. The link for the first,
                last, prev, or next page in the HTTP Link header should define
                it.
            ending_before (string, optional): A token used by the server to
                indicate the end of the page. Often this is a timestamp or an
                ID but it is not limited to those. This parameter should not
                be defined by client applications. The link for the first,
                last, prev, or next page in the HTTP Link header should define
                it.
            include_connectivity_history (bool, optional): Include the
                connectivity history for this client

        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}/bluetoothClients'
        _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,
            'timespan': timespan,
            'perPage': per_page,
            'startingAfter': starting_after,
            'endingBefore': ending_before,
            'includeConnectivityHistory': include_connectivity_history
        }
        _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_bluetooth_client(self,
                                     network_id,
                                     bluetooth_client_id,
                                     include_connectivity_history=None,
                                     connectivity_history_timespan=None):
        """Does a GET request to /networks/{networkId}/bluetoothClients/{bluetoothClientId}.

        Return a Bluetooth client. Bluetooth clients can be identified by
        their ID or their MAC.

        Args:
            network_id (string): TODO: type description here. Example: 
            bluetooth_client_id (string): TODO: type description here.
                Example: 
            include_connectivity_history (bool, optional): Include the
                connectivity history for this client
            connectivity_history_timespan (int, optional): The timespan, in
                seconds, for the connectivityHistory data. By default 1 day,
                86400, will be used.

        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}/bluetoothClients/{bluetoothClientId}'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'bluetoothClientId': bluetooth_client_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'includeConnectivityHistory': include_connectivity_history,
            'connectivityHistoryTimespan': connectivity_history_timespan
        }
        _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
