# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class AgentList(BaseModel):
# 
#     def __init__(
#             self,
#             agents=None,
#             pagination=None
#     ):
#         self._agents = None
#         self.agents = agents
#         self._pagination = None
#         self.pagination = pagination
# 
#     @property
#     def agents(self):
#         return self._agents
# 
#     @agents.setter
#     @BaseModel._model_list(Agent)
#     def agents(self, agents):
#         self._agents = agents
# 
#     @property
#     def pagination(self):
#         return self._pagination
# 
#     @pagination.setter
#     @BaseModel._model(FilterPagination)
#     def pagination(self, pagination):
#         self._pagination = pagination
# 
# class Agent(BaseModel):
# 
#     def __init__(
#             self,
#             distro=None,
#             id=None,
#             ip=None,
#             last_scanned=None,
#             name=None,
#             platform=None,
#             uuid=None,
#             linked_on=None,
#             last_connect=None,
#             plugin_feed_id=None,
#             core_build=None,
#             core_version=None,
#             groups=None,
#             status=None
#     ):
#         self.distro = distro
#         self.id = id
#         self.ip = ip
#         self.last_scanned = last_scanned
#         self.name = name
#         self.platform = platform
#         self.uuid = uuid
#         self.linked_on = linked_on
#         self.last_connect = last_connect
#         self.plugin_feed_id = plugin_feed_id
#         self.core_build = core_build
#         self.core_version = core_version
#         self.groups = groups
#         self.status = status


from tenable_io.api.base import BaseApi
from tenable_io.api.models import AgentList, Agent
    def list(self, scanner_id=1, offset=None, limit=None, sort=None, f=None, ft=None, w=None, wf=None):
        """Lists agents for the given scanner.

        :param scanner_id: The scanner ID.
        :param offset: The starting record to retrieve, defaults to 0 if not defined.
        :param limit: The number of records to retrieve, API will defaults to 50 if not defined.
        :param sort: The sort order of the returned records.
        :param f: Apply a filter in the format '<field_name>:<operation>:<value>'.
        :param ft: Filter type. ("and" or "or").
        :param w: Wildcard filter text.
        :param wf: A comma delimited subset of wildcard_fields to search when applying the wildcard filter.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.AgentList`.
        """
        params = {
            'offset': offset,
            'limit': limit,
            'sort': sort,
            'f': f,
            'ft': ft,
            'w': w,
            'wf': wf
        }
        params = {k: v for k, v in params.items() if v is not None}
        response = self._client.get('scanners/%(scanner_id)s/agents',
                                    path_params={
                                        'scanner_id': scanner_id
                                    },
                                    params=params,
                                    flatten_params=False)

# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class AgentList(BaseModel):
# 
#     def __init__(
#             self,
#             agents=None,
#             pagination=None
#     ):
#         self._agents = None
#         self.agents = agents
#         self._pagination = None
#         self.pagination = pagination
# 
#     @property
#     def agents(self):
#         return self._agents
# 
#     @agents.setter
#     @BaseModel._model_list(Agent)
#     def agents(self, agents):
#         self._agents = agents
# 
#     @property
#     def pagination(self):
#         return self._pagination
# 
#     @pagination.setter
#     @BaseModel._model(FilterPagination)
#     def pagination(self, pagination):
#         self._pagination = pagination
# 
# class Agent(BaseModel):
# 
#     def __init__(
#             self,
#             distro=None,
#             id=None,
#             ip=None,
#             last_scanned=None,
#             name=None,
#             platform=None,
#             uuid=None,
#             linked_on=None,
#             last_connect=None,
#             plugin_feed_id=None,
#             core_build=None,
#             core_version=None,
#             groups=None,
#             status=None
#     ):
#         self.distro = distro
#         self.id = id
#         self.ip = ip
#         self.last_scanned = last_scanned
#         self.name = name
#         self.platform = platform
#         self.uuid = uuid
#         self.linked_on = linked_on
#         self.last_connect = last_connect
#         self.plugin_feed_id = plugin_feed_id
#         self.core_build = core_build
#         self.core_version = core_version
#         self.groups = groups
#         self.status = status


# Path: tenable_io/api/agents.py
from tenable_io.api.base import BaseApi
from tenable_io.api.models import AgentList, Agent

    def list(self, scanner_id=1, offset=None, limit=None, sort=None, f=None, ft=None, w=None, wf=None):
        """Lists agents for the given scanner.

        :param scanner_id: The scanner ID.
        :param offset: The starting record to retrieve, defaults to 0 if not defined.
        :param limit: The number of records to retrieve, API will defaults to 50 if not defined.
        :param sort: The sort order of the returned records.
        :param f: Apply a filter in the format '<field_name>:<operation>:<value>'.
        :param ft: Filter type. ("and" or "or").
        :param w: Wildcard filter text.
        :param wf: A comma delimited subset of wildcard_fields to search when applying the wildcard filter.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.AgentList`.
        """
        params = {
            'offset': offset,
            'limit': limit,
            'sort': sort,
            'f': f,
            'ft': ft,
            'w': w,
            'wf': wf
        }
        params = {k: v for k, v in params.items() if v is not None}
        response = self._client.get('scanners/%(scanner_id)s/agents',
                                    path_params={
                                        'scanner_id': scanner_id
                                    },
                                    params=params,
                                    flatten_params=False)

        return AgentList.from_json(response.text)