# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# class BaseRequest(object):
# 
#     def as_payload(self, filter_=None):
#         return payload_filter(self.__dict__, filter_)
# 
# Path: tenable_io/api/models.py
# class Network(BaseModel):
# 
#     def __init__(
#             self,
#             owner_uuid=None,
#             created=None,
#             modified=None,
#             scanner_count=None,
#             uuid=None,
#             name=None,
#             description=None,
#             is_default=None,
#             created_by=None,
#             created_at=None,
#             modified_by=None,
#             created_in_seconds=None,
#             modified_in_seconds=None,
#     ):
#         self.owner_uuid = owner_uuid
#         self.created = created
#         self.modified = modified
#         self.scanner_count = scanner_count
#         self.uuid = uuid
#         self.name = name
#         self.description = description
#         self.is_default = is_default
#         self.created_by = created_by
#         self.created_at = created_at
#         self.modified_by = modified_by
#         self.created_in_seconds = created_in_seconds
#         self.modified_in_seconds = modified_in_seconds
# 
# class NetworkList(BaseModel):
# 
#     def __init__(
#             self,
#             networks=None,
#             pagination=None,
#     ):
#         self._networks = None
#         self.networks = networks
#         self._pagination = None
#         self.pagination = pagination
# 
#     @property
#     def networks(self):
#         return self._networks
# 
#     @networks.setter
#     @BaseModel._model_list(Network)
#     def networks(self, networks):
#         self._networks = networks
# 
#     @property
#     def pagination(self):
#         return self._pagination
# 
#     @pagination.setter
#     @BaseModel._model(FilterPagination)
#     def pagination(self, pagination):
#         self._pagination = pagination
# 
# class ScannerList(BaseModel):
# 
#     def __init__(
#             self,
#             scanners=None
#     ):
#         self._scanners = None
#         self.scanners = scanners
# 
#     @property
#     def scanners(self):
#         return self._scanners
# 
#     @scanners.setter
#     @BaseModel._model_list(Scanner)
#     def scanners(self, scanners):
#         self._scanners = scanners


from tenable_io.api.base import BaseApi, BaseRequest
from tenable_io.api.models import Network, NetworkList, ScannerList
    def create(self, network_request):
        """Creates a network object that you associate with scanners and scanner groups.

        :param network_request: An instance of :class:`NetworkRequest`.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.Network`.
        """
        response = self._client.post('networks', network_request)
        return Network.from_json(response.text)

    def list(self, f=None, ft='and', limit=None, offset=0, sort=None, includeDeleted=False):
        """Returns a list of Networks.

        :param f: A list of :class:`tenable_io.api.models.AssetFilter` instances.
        :param ft: The action to apply if multiple 'f' parameters are provided. Supported values are **and** and **or**.
        :param limit: The maximum number of records to be retrieved.
        :param offset: The offset from request.
        :param sort: A list of fields on which the results are sorted.
        :param includeDeleted: boolean - whether the response should include deleted networks.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.NetworkList`.
        """
        fgen = (i.field + ':' + i.operator + ':' + i.value for i in f) if f is not None else None
        response = self._client.get('networks',
                                    params={'f': '&'.join(fgen) if fgen is not None else None,
                                            'ft': ft if fgen is not None else None,
                                            'limit': limit,
                                            'offset': offset,
                                            'sort': ','.join(sort) if sort is not None else None,
                                            'includeDeleted': includeDeleted})

# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# class BaseRequest(object):
# 
#     def as_payload(self, filter_=None):
#         return payload_filter(self.__dict__, filter_)
# 
# Path: tenable_io/api/models.py
# class Network(BaseModel):
# 
#     def __init__(
#             self,
#             owner_uuid=None,
#             created=None,
#             modified=None,
#             scanner_count=None,
#             uuid=None,
#             name=None,
#             description=None,
#             is_default=None,
#             created_by=None,
#             created_at=None,
#             modified_by=None,
#             created_in_seconds=None,
#             modified_in_seconds=None,
#     ):
#         self.owner_uuid = owner_uuid
#         self.created = created
#         self.modified = modified
#         self.scanner_count = scanner_count
#         self.uuid = uuid
#         self.name = name
#         self.description = description
#         self.is_default = is_default
#         self.created_by = created_by
#         self.created_at = created_at
#         self.modified_by = modified_by
#         self.created_in_seconds = created_in_seconds
#         self.modified_in_seconds = modified_in_seconds
# 
# class NetworkList(BaseModel):
# 
#     def __init__(
#             self,
#             networks=None,
#             pagination=None,
#     ):
#         self._networks = None
#         self.networks = networks
#         self._pagination = None
#         self.pagination = pagination
# 
#     @property
#     def networks(self):
#         return self._networks
# 
#     @networks.setter
#     @BaseModel._model_list(Network)
#     def networks(self, networks):
#         self._networks = networks
# 
#     @property
#     def pagination(self):
#         return self._pagination
# 
#     @pagination.setter
#     @BaseModel._model(FilterPagination)
#     def pagination(self, pagination):
#         self._pagination = pagination
# 
# class ScannerList(BaseModel):
# 
#     def __init__(
#             self,
#             scanners=None
#     ):
#         self._scanners = None
#         self.scanners = scanners
# 
#     @property
#     def scanners(self):
#         return self._scanners
# 
#     @scanners.setter
#     @BaseModel._model_list(Scanner)
#     def scanners(self, scanners):
#         self._scanners = scanners


# Path: tenable_io/api/networks.py
from tenable_io.api.base import BaseApi, BaseRequest
from tenable_io.api.models import Network, NetworkList, ScannerList

    def create(self, network_request):
        """Creates a network object that you associate with scanners and scanner groups.

        :param network_request: An instance of :class:`NetworkRequest`.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.Network`.
        """
        response = self._client.post('networks', network_request)
        return Network.from_json(response.text)

    def list(self, f=None, ft='and', limit=None, offset=0, sort=None, includeDeleted=False):
        """Returns a list of Networks.

        :param f: A list of :class:`tenable_io.api.models.AssetFilter` instances.
        :param ft: The action to apply if multiple 'f' parameters are provided. Supported values are **and** and **or**.
        :param limit: The maximum number of records to be retrieved.
        :param offset: The offset from request.
        :param sort: A list of fields on which the results are sorted.
        :param includeDeleted: boolean - whether the response should include deleted networks.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.NetworkList`.
        """
        fgen = (i.field + ':' + i.operator + ':' + i.value for i in f) if f is not None else None
        response = self._client.get('networks',
                                    params={'f': '&'.join(fgen) if fgen is not None else None,
                                            'ft': ft if fgen is not None else None,
                                            'limit': limit,
                                            'offset': offset,
                                            'sort': ','.join(sort) if sort is not None else None,
                                            'includeDeleted': includeDeleted})

        return NetworkList.from_json(response.text)