diff --git a/navitia_client/client/apis/public_transportation_apis/commercial_mode_apis.py b/navitia_client/client/apis/public_transportation_apis/commercial_mode_apis.py index f69fc3c..d9ee92f 100644 --- a/navitia_client/client/apis/public_transportation_apis/commercial_mode_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/commercial_mode_apis.py @@ -7,46 +7,13 @@ class CommercialModeApiClient(ApiBaseClient, EntityApi[CommercialMode]): - """ - API client for handling 'CommercialMode' entities in the Navitia API. + """API client for handling 'CommercialMode' entities in the Navitia API. See https://doc.navitia.io/#pt-ref Attributes: - entity_name (str): The name of the entity. + entity_name: The name of the entity. get_navitia_api: A method to get the Navitia API. - - Methods: - _get_entity_from_response(raw_entity_response: Any) -> Sequence[CommercialMode]: - Extracts CommercialMode entities from the API response. - - list_entity_collection_from_region( - region_id: str, - request: BasePTEntityRequest, - ) -> Tuple[Sequence[CommercialMode], Pagination]: - Lists commercial modes from a specified region. - - get_entity_by_id( - region_id: str, - object_id: str, - request: BasePTEntityRequest, - ) -> Tuple[Sequence[CommercialMode], Pagination]: - Retrieves a specific commercial mode by its ID from a specified region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - request: BasePTEntityRequest, - ) -> Tuple[Sequence[CommercialMode], Pagination]: - Lists commercial modes from specified coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - request: BasePTEntityRequest, - ) -> Tuple[Sequence[CommercialMode], Pagination]: - Retrieves a specific commercial mode by its ID from specified coordinates. """ entity_name: str = "commercial_modes" @@ -54,14 +21,13 @@ class CommercialModeApiClient(ApiBaseClient, EntityApi[CommercialMode]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[CommercialMode]: - """ - Extracts CommercialMode entities from the API response. + """Extract CommercialMode entities from the API response. - Parameters: - raw_entity_response (Any): The raw response from the API. + Args: + raw_entity_response: The raw response from the API. Returns: - Sequence[CommercialMode]: A sequence of CommercialMode objects. + A sequence of CommercialMode objects. """ entities = [] for entity in raw_entity_response: @@ -73,15 +39,14 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[CommercialMode], Pagination]: - """ - Lists commercial modes from a specified region. + """List commercial modes from a specified region. - Parameters: - region_id (str): The ID of the region. - request (BasePTEntityRequest): Request parameters for filtering. + Args: + region_id: The ID of the region. + request: Request parameters for filtering. Returns: - Tuple[Sequence[CommercialMode], Pagination]: A tuple containing a sequence of CommercialMode objects and Pagination object. + A tuple containing a sequence of CommercialMode objects and Pagination object. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}" return self._get_entity_results(url, self.entity_name, request.to_filters()) @@ -92,16 +57,15 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[CommercialMode], Pagination]: - """ - Retrieves a specific commercial mode by its ID from a specified region. + """Retrieve a specific commercial mode by its ID from a specified region. - Parameters: - region_id (str): The ID of the region. - object_id (str): The ID of the commercial mode. - request (BasePTEntityRequest): Request parameters for filtering. + Args: + region_id: The ID of the region. + object_id: The ID of the commercial mode. + request: Request parameters for filtering. Returns: - Tuple[Sequence[CommercialMode], Pagination]: A tuple containing a sequence of CommercialMode objects and Pagination object. + A tuple containing a sequence of CommercialMode objects and Pagination object. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" return self._get_entity_results(url, self.entity_name, request.to_filters()) @@ -112,16 +76,15 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[CommercialMode], Pagination]: - """ - Lists commercial modes from specified coordinates. + """List commercial modes from specified coordinates. - Parameters: - lon (float): The longitude coordinate. - lat (float): The latitude coordinate. - request (BasePTEntityRequest): Request parameters for filtering. + Args: + lon: The longitude coordinate. + lat: The latitude coordinate. + request: Request parameters for filtering. Returns: - Tuple[Sequence[CommercialMode], Pagination]: A tuple containing a sequence of CommercialMode objects and Pagination object. + A tuple containing a sequence of CommercialMode objects and Pagination object. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" return self._get_entity_results(url, self.entity_name, request.to_filters()) @@ -133,17 +96,16 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[CommercialMode], Pagination]: - """ - Retrieves a specific commercial mode by its ID from specified coordinates. + """Retrieve a specific commercial mode by its ID from specified coordinates. - Parameters: - lon (float): The longitude coordinate. - lat (float): The latitude coordinate. - object_id (str): The ID of the commercial mode. - request (BasePTEntityRequest): Request parameters for filtering. + Args: + lon: The longitude coordinate. + lat: The latitude coordinate. + object_id: The ID of the commercial mode. + request: Request parameters for filtering. Returns: - Tuple[Sequence[CommercialMode], Pagination]: A tuple containing a sequence of CommercialMode objects and Pagination object. + A tuple containing a sequence of CommercialMode objects and Pagination object. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}" return self._get_entity_results(url, self.entity_name, request.to_filters()) diff --git a/navitia_client/client/apis/public_transportation_apis/company_apis.py b/navitia_client/client/apis/public_transportation_apis/company_apis.py index a021623..1d8ad41 100644 --- a/navitia_client/client/apis/public_transportation_apis/company_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/company_apis.py @@ -7,70 +7,13 @@ class CompanyApiClient(ApiBaseClient, EntityApi[Company]): - """ - API client for handling 'Company' entities in the Navitia API. + """API client for handling 'Company' entities in the Navitia API. See https://doc.navitia.io/#pt-ref - Attributes - ---------- - entity_name : str - Name of the entity, defaults to "companies". - get_navitia_api : method - Method inherited from ApiBaseClient to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[Company]: - Static method to extract Company entities from the raw API response. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Company], Pagination]: - List companies for a given region. - - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Company], Pagination]: - Get a company by its ID in a given region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Company], Pagination]: - List companies for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Company], Pagination]: - Get a company by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity, defaults to "companies". + get_navitia_api: Method inherited from ApiBaseClient to get the Navitia API. """ entity_name: str = "companies" @@ -78,17 +21,12 @@ class CompanyApiClient(ApiBaseClient, EntityApi[Company]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[Company]: - """ - Static method to extract Company entities from the raw API response. + """Extract Company entities from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing company data. + Args: + raw_entity_response: Raw API response containing company data. - Returns - ------- - Sequence[Company] + Returns: List of company instances. """ entities = [] @@ -101,37 +39,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Company], Pagination]: - """ - List companies for a given region. + """List companies for a given region. - Parameters - ---------- - region_id : str - ID of the region. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : str, optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Company], Pagination] + Returns: List of companies and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}" @@ -143,39 +57,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Company], Pagination]: - """ - Get a company by its ID in a given region. + """Get a company by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the company. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : str, optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + object_id: ID of the company. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Company], Pagination] + Returns: List of companies and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" @@ -187,39 +76,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[Company], Pagination]: - """ - List companies for given geographic coordinates. + """List companies for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : str, optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Company], Pagination] + Returns: List of companies and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" @@ -232,41 +96,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Company], Pagination]: - """ - Get a company by its ID for given geographic coordinates. + """Get a company by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the company. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : str, optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the company. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Company], Pagination] + Returns: List of companies and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}" diff --git a/navitia_client/client/apis/public_transportation_apis/disruption_apis.py b/navitia_client/client/apis/public_transportation_apis/disruption_apis.py index e5a99c0..21b44ba 100644 --- a/navitia_client/client/apis/public_transportation_apis/disruption_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/disruption_apis.py @@ -9,70 +9,13 @@ class DisruptionApiClient(ApiBaseClient, EntityApi[Disruption]): - """ - API client for handling 'Disruption' entities in the Navitia API. + """API client for handling 'Disruption' entities in the Navitia API. See https://doc.navitia.io/#pt-ref - Attributes - ---------- - entity_name : str - Name of the entity, defaults to "disruptions". - get_navitia_api : method - Method inherited from ApiBaseClient to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[Disruption]: - Static method to extract Disruption entities from the raw API response. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Disruption], Pagination]: - List disruptions for a given region. - - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Disruption], Pagination]: - Get a disruption by its ID in a given region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Disruption], Pagination]: - List disruptions for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Disruption], Pagination]: - Get a disruption by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity, defaults to "disruptions". + get_navitia_api: Method inherited from ApiBaseClient to get the Navitia API. """ entity_name: str = "disruptions" @@ -80,17 +23,12 @@ class DisruptionApiClient(ApiBaseClient, EntityApi[Disruption]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[Disruption]: - """ - Static method to extract Disruption entities from the raw API response. + """Extract Disruption entities from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing disruption data. + Args: + raw_entity_response: Raw API response containing disruption data. - Returns - ------- - Sequence[Disruption] + Returns: List of disruption instances. """ entities = [] @@ -103,37 +41,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Disruption], Pagination]: - """ - List disruptions for a given region. + """List disruptions for a given region. - Parameters - ---------- - region_id : str - ID of the region. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : str, optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Disruption], Pagination] + Returns: List of disruptions and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}" @@ -145,39 +59,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Disruption], Pagination]: - """ - Get a disruption by its ID in a given region. + """Get a disruption by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the disruption. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : str, optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + object_id: ID of the disruption. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Disruption], Pagination] + Returns: List of disruptions and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" @@ -189,39 +78,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[Disruption], Pagination]: - """ - List disruptions for given geographic coordinates. + """List disruptions for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : str, optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Disruption], Pagination] + Returns: List of disruptions and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" @@ -234,41 +98,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Disruption], Pagination]: - """ - Get a disruption by its ID for given geographic coordinates. + """Get a disruption by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the disruption. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : str, optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the disruption. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Disruption], Pagination] + Returns: List of disruptions and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}" diff --git a/navitia_client/client/apis/public_transportation_apis/entity_apis.py b/navitia_client/client/apis/public_transportation_apis/entity_apis.py index de5daef..cb22a1f 100644 --- a/navitia_client/client/apis/public_transportation_apis/entity_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/entity_apis.py @@ -27,78 +27,14 @@ class EntityApi(Generic[TEntity], ABC): - """ - Abstract base class for API clients dealing with entities in the Navitia API. - - Attributes - ---------- - entity_name : str - Name of the entity. - get_navitia_api : method - Method to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[TEntity]: - Static method to extract entity instances from the raw API response. - - _generate_filter_query(filters: dict[str, Any]) -> str: - Generate query string from provided filters. - - _get_entity_results( - url: str, - entity: str, - filters: dict[str, Any] - ) -> Tuple[Sequence[TEntity], Pagination]: - Fetch entity results from the API. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[TEntity], Pagination]: - Abstract method to list entities for a given region. + """Abstract base class for API clients dealing with entities in the Navitia API. - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[TEntity], Pagination]: - Abstract method to get an entity by its ID in a given region. + This class provides common functionality for all PT entity API clients including + methods to fetch entities by region, coordinates, or ID. - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[TEntity], Pagination]: - Abstract method to list entities for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[TEntity], Pagination]: - Abstract method to get an entity by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity. + get_navitia_api: Method to get the Navitia API. """ entity_name: str @@ -107,34 +43,24 @@ class EntityApi(Generic[TEntity], ABC): @staticmethod @abstractmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[TEntity]: - """ - Static method to extract entity instances from the raw API response. + """Extract entity instances from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing entity data. + Args: + raw_entity_response: Raw API response containing entity data. - Returns - ------- - Sequence[TEntity] + Returns: List of entity instances. """ raise NotImplementedError @staticmethod def _generate_filter_query(filters: dict[str, Any]) -> str: - """ - Generate query string from provided filters. + """Generate query string from provided filters. - Parameters - ---------- - filters : dict[str, Any] - Dictionary of filters. + Args: + filters: Dictionary of filters. - Returns - ------- - str + Returns: Query string. """ filter_query = "&".join([f"{key}={value}" for key, value in filters.items()]) @@ -143,21 +69,14 @@ def _generate_filter_query(filters: dict[str, Any]) -> str: def _get_entity_results( self, url: str, entity: str, filters: dict[str, Any] ) -> Tuple[Sequence[TEntity], Pagination]: - """ - Fetch entity results from the API. + """Fetch entity results from the API. - Parameters - ---------- - url : str - API endpoint URL. - entity : str - Name of the entity. - filters : dict[str, Any] - Dictionary of filters. + Args: + url: API endpoint URL. + entity: Name of the entity. + filters: Dictionary of filters. - Returns - ------- - Tuple[Sequence[TEntity], Pagination] + Returns: List of entity instances and pagination information. """ query_string = self._generate_filter_query(filters) @@ -172,19 +91,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[TEntity], Pagination]: - """ - List entities for a given region. + """List entities for a given region. - Parameters - ---------- - region_id : str - ID of the region. - request : BasePTEntityRequest - Request parameters for filtering. + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[TEntity], Pagination] + Returns: List of entities and pagination information. """ raise NotImplementedError @@ -196,21 +109,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[TEntity], Pagination]: - """ - Get an entity by its ID in a given region. + """Get an entity by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the entity. - request : BasePTEntityRequest - Request parameters for filtering. + Args: + region_id: ID of the region. + object_id: ID of the entity. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[TEntity], Pagination] + Returns: List of entities and pagination information. """ raise NotImplementedError @@ -222,21 +128,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[TEntity], Pagination]: - """ - List entities for given geographic coordinates. + """List entities for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - request : BasePTEntityRequest - Request parameters for filtering. + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[TEntity], Pagination] + Returns: List of entities and pagination information. """ raise NotImplementedError @@ -249,23 +148,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[TEntity], Pagination]: - """ - Get an entity by its ID for given geographic coordinates. + """Get an entity by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the entity. - request : BasePTEntityRequest - Request parameters for filtering. + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the entity. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[TEntity], Pagination] + Returns: List of entities and pagination information. """ raise NotImplementedError diff --git a/navitia_client/client/apis/public_transportation_apis/line_apis.py b/navitia_client/client/apis/public_transportation_apis/line_apis.py index 6321959..5b57ba7 100644 --- a/navitia_client/client/apis/public_transportation_apis/line_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/line_apis.py @@ -7,70 +7,13 @@ class LineApiClient(ApiBaseClient, EntityApi[Line]): - """ - API client for handling 'Line' entities in the Navitia API. + """API client for handling 'Line' entities in the Navitia API. See https://doc.navitia.io/#pt-ref - Attributes - ---------- - entity_name : str - Name of the entity ('lines'). - get_navitia_api : method - Method to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[Line]: - Static method to extract Line instances from the raw API response. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Line], Pagination]: - List lines for a given region. - - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Line], Pagination]: - Get a line by its ID in a given region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Line], Pagination]: - List lines for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Line], Pagination]: - Get a line by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity ('lines'). + get_navitia_api: Method to get the Navitia API. """ entity_name: str = "lines" @@ -78,17 +21,12 @@ class LineApiClient(ApiBaseClient, EntityApi[Line]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[Line]: - """ - Static method to extract Line instances from the raw API response. + """Extract Line entities from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing Line data. + Args: + raw_entity_response: Raw API response containing line data. - Returns - ------- - Sequence[Line] + Returns: List of Line instances. """ entities = [] @@ -101,37 +39,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Line], Pagination]: - """ - List lines for a given region. + """List lines for a given region. - Parameters - ---------- - region_id : str - ID of the region. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Line], Pagination] + Returns: List of Line instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}" @@ -143,39 +57,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Line], Pagination]: - """ - Get a line by its ID in a given region. + """Get a line by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the line. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + object_id: ID of the line. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Line], Pagination] + Returns: List of Line instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" @@ -187,39 +76,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[Line], Pagination]: - """ - List lines for given geographic coordinates. + """List lines for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Line], Pagination] + Returns: List of Line instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" @@ -232,41 +96,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Line], Pagination]: - """ - Get a line by its ID for given geographic coordinates. + """Get a line by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the line. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Line headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the line. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Line], Pagination] + Returns: List of Line instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}" diff --git a/navitia_client/client/apis/public_transportation_apis/network_apis.py b/navitia_client/client/apis/public_transportation_apis/network_apis.py index ef9ef8a..185680c 100644 --- a/navitia_client/client/apis/public_transportation_apis/network_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/network_apis.py @@ -7,70 +7,13 @@ class NetworkApiClient(ApiBaseClient, EntityApi[Network]): - """ - API client for handling 'Network' entities in the Navitia API. + """API client for handling 'Network' entities in the Navitia API. See https://doc.navitia.io/#pt-ref - Attributes - ---------- - entity_name : str - Name of the entity ('networks'). - get_navitia_api : method - Method to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[Network]: - Static method to extract Network instances from the raw API response. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Network], Pagination]: - List networks for a given region. - - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Network], Pagination]: - Get a network by its ID in a given region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Network], Pagination]: - List networks for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Network], Pagination]: - Get a network by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity ('networks'). + get_navitia_api: Method to get the Navitia API. """ entity_name: str = "networks" @@ -78,17 +21,12 @@ class NetworkApiClient(ApiBaseClient, EntityApi[Network]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[Network]: - """ - Static method to extract Network instances from the raw API response. + """Extract Network entities from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing Network data. + Args: + raw_entity_response: Raw API response containing network data. - Returns - ------- - Sequence[Network] + Returns: List of Network instances. """ entities = [] @@ -101,37 +39,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Network], Pagination]: - """ - List networks for a given region. + """List networks for a given region. - Parameters - ---------- - region_id : str - ID of the region. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Network headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Network], Pagination] + Returns: List of Network instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}" @@ -143,39 +57,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Network], Pagination]: - """ - Get a network by its ID in a given region. + """Get a network by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the network. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Network headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + object_id: ID of the network. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Network], Pagination] + Returns: List of Network instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" @@ -187,39 +76,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[Network], Pagination]: - """ - List networks for given geographic coordinates. + """List networks for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Network headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Network], Pagination] + Returns: List of Network instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" @@ -232,41 +96,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Network], Pagination]: - """ - Get a network by its ID for given geographic coordinates. + """Get a network by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the network. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Network headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the network. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Network], Pagination] + Returns: List of Network instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}" diff --git a/navitia_client/client/apis/public_transportation_apis/physical_mode_apis.py b/navitia_client/client/apis/public_transportation_apis/physical_mode_apis.py index 498d991..1f63021 100644 --- a/navitia_client/client/apis/public_transportation_apis/physical_mode_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/physical_mode_apis.py @@ -7,70 +7,13 @@ class PhysicalModeApiClient(ApiBaseClient, EntityApi[PhysicalMode]): - """ - API client for handling 'PhysicalMode' entities in the Navitia API. + """API client for handling 'PhysicalMode' entities in the Navitia API. See https://doc.navitia.io/#pt-ref - Attributes - ---------- - entity_name : str - Name of the entity ('physical_modes'). - get_navitia_api : method - Method to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[PhysicalMode]: - Static method to extract PhysicalMode instances from the raw API response. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[PhysicalMode], Pagination]: - List physical modes for a given region. - - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[PhysicalMode], Pagination]: - Get a physical mode by its ID in a given region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[PhysicalMode], Pagination]: - List physical modes for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[PhysicalMode], Pagination]: - Get a physical mode by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity ('physical_modes'). + get_navitia_api: Method to get the Navitia API. """ entity_name: str = "physical_modes" @@ -78,17 +21,12 @@ class PhysicalModeApiClient(ApiBaseClient, EntityApi[PhysicalMode]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[PhysicalMode]: - """ - Static method to extract PhysicalMode instances from the raw API response. + """Extract PhysicalMode entities from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing PhysicalMode data. + Args: + raw_entity_response: Raw API response containing physical mode data. - Returns - ------- - Sequence[PhysicalMode] + Returns: List of PhysicalMode instances. """ entities = [] @@ -101,37 +39,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[PhysicalMode], Pagination]: - """ - List physical modes for a given region. + """List physical modes for a given region. - Parameters - ---------- - region_id : str - ID of the region. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Physical mode headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[PhysicalMode], Pagination] + Returns: List of PhysicalMode instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}" @@ -143,39 +57,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[PhysicalMode], Pagination]: - """ - Get a physical mode by its ID in a given region. + """Get a physical mode by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the physical mode. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Physical mode headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + object_id: ID of the physical mode. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[PhysicalMode], Pagination] + Returns: List of PhysicalMode instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" @@ -187,39 +76,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[PhysicalMode], Pagination]: - """ - List physical modes for given geographic coordinates. + """List physical modes for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Physical mode headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[PhysicalMode], Pagination] + Returns: List of PhysicalMode instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" @@ -232,41 +96,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[PhysicalMode], Pagination]: - """ - Get a physical mode by its ID for given geographic coordinates. + """Get a physical mode by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the physical mode. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Physical mode headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the physical mode. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[PhysicalMode], Pagination] + Returns: List of PhysicalMode instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}" diff --git a/navitia_client/client/apis/public_transportation_apis/route_apis.py b/navitia_client/client/apis/public_transportation_apis/route_apis.py index 6831a1b..67f530d 100644 --- a/navitia_client/client/apis/public_transportation_apis/route_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/route_apis.py @@ -7,70 +7,13 @@ class RouteApiClient(ApiBaseClient, EntityApi[Route]): - """ - API client for handling 'Route' entities in the Navitia API. + """API client for handling 'Route' entities in the Navitia API. See https://doc.navitia.io/#pt-ref - Attributes - ---------- - entity_name : str - Name of the entity ('routes'). - get_navitia_api : method - Method to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[Route]: - Static method to extract Route instances from the raw API response. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Route], Pagination]: - List routes for a given region. - - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Route], Pagination]: - Get a route by its ID in a given region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Route], Pagination]: - List routes for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[Route], Pagination]: - Get a route by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity ('routes'). + get_navitia_api: Method to get the Navitia API. """ entity_name: str = "routes" @@ -78,17 +21,12 @@ class RouteApiClient(ApiBaseClient, EntityApi[Route]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[Route]: - """ - Static method to extract Route instances from the raw API response. + """Extract Route entities from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing Route data. + Args: + raw_entity_response: Raw API response containing route data. - Returns - ------- - Sequence[Route] + Returns: List of Route instances. """ entities = [] @@ -101,37 +39,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Route], Pagination]: - """ - List routes for a given region. + """List routes for a given region. - Parameters - ---------- - region_id : str - ID of the region. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Route headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Route], Pagination] + Returns: List of Route instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}" @@ -143,39 +57,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Route], Pagination]: - """ - Get a route by its ID in a given region. + """Get a route by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the route. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Route headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + object_id: ID of the route. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Route], Pagination] + Returns: List of Route instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" @@ -187,39 +76,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[Route], Pagination]: - """ - List routes for given geographic coordinates. + """List routes for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Route headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Route], Pagination] + Returns: List of Route instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" @@ -232,41 +96,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[Route], Pagination]: - """ - Get a route by its ID for given geographic coordinates. + """Get a route by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the route. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Route headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the route. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[Route], Pagination] + Returns: List of Route instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}" diff --git a/navitia_client/client/apis/public_transportation_apis/stop_area_apis.py b/navitia_client/client/apis/public_transportation_apis/stop_area_apis.py index 1985076..2d09d1c 100644 --- a/navitia_client/client/apis/public_transportation_apis/stop_area_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/stop_area_apis.py @@ -7,70 +7,13 @@ class StopAreaApiClient(ApiBaseClient, EntityApi[StopArea]): - """ - API client for handling 'StopArea' entities in the Navitia API. + """API client for handling 'StopArea' entities in the Navitia API. See https://doc.navitia.io/#pt-ref - Attributes - ---------- - entity_name : str - Name of the entity ('stop_areas'). - get_navitia_api : method - Method to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[StopArea]: - Static method to extract StopArea instances from the raw API response. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[StopArea], Pagination]: - List stop areas for a given region. - - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[StopArea], Pagination]: - Get a stop area by its ID in a given region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[StopArea], Pagination]: - List stop areas for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[StopArea], Pagination]: - Get a stop area by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity ('stop_areas'). + get_navitia_api: Method to get the Navitia API. """ entity_name: str = "stop_areas" @@ -78,17 +21,12 @@ class StopAreaApiClient(ApiBaseClient, EntityApi[StopArea]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[StopArea]: - """ - Static method to extract StopArea instances from the raw API response. + """Extract StopArea entities from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing StopArea data. + Args: + raw_entity_response: Raw API response containing stop area data. - Returns - ------- - Sequence[StopArea] + Returns: List of StopArea instances. """ entities = [] @@ -101,37 +39,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[StopArea], Pagination]: - """ - List stop areas for a given region. + """List stop areas for a given region. - Parameters - ---------- - region_id : str - ID of the region. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Stop area headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[StopArea], Pagination] + Returns: List of StopArea instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}" @@ -143,39 +57,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[StopArea], Pagination]: - """ - Get a stop area by its ID in a given region. + """Get a stop area by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the stop area. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Stop area headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + object_id: ID of the stop area. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[StopArea], Pagination] + Returns: List of StopArea instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" @@ -187,39 +76,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[StopArea], Pagination]: - """ - List stop areas for given geographic coordinates. + """List stop areas for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Stop area headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[StopArea], Pagination] + Returns: List of StopArea instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" @@ -232,41 +96,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[StopArea], Pagination]: - """ - Get a stop area by its ID for given geographic coordinates. + """Get a stop area by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the stop area. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Stop area headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the stop area. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[StopArea], Pagination] + Returns: List of StopArea instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}" diff --git a/navitia_client/client/apis/public_transportation_apis/stop_point_apis.py b/navitia_client/client/apis/public_transportation_apis/stop_point_apis.py index c4767c0..2124e32 100644 --- a/navitia_client/client/apis/public_transportation_apis/stop_point_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/stop_point_apis.py @@ -7,70 +7,13 @@ class StopPointApiClient(ApiBaseClient, EntityApi[StopPoint]): - """ - API client for handling 'StopPoint' entities in the Navitia API. + """API client for handling 'StopPoint' entities in the Navitia API. See https://doc.navitia.io/#pt-ref - Attributes - ---------- - entity_name : str - Name of the entity ('stop_points'). - get_navitia_api : method - Method to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[StopPoint]: - Static method to extract StopPoint instances from the raw API response. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[StopPoint], Pagination]: - List stop points for a given region. - - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[StopPoint], Pagination]: - Get a stop point by its ID in a given region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[StopPoint], Pagination]: - List stop points for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[StopPoint], Pagination]: - Get a stop point by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity ('stop_points'). + get_navitia_api: Method to get the Navitia API. """ entity_name: str = "stop_points" @@ -78,17 +21,12 @@ class StopPointApiClient(ApiBaseClient, EntityApi[StopPoint]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[StopPoint]: - """ - Static method to extract StopPoint instances from the raw API response. + """Extract StopPoint entities from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing StopPoint data. + Args: + raw_entity_response: Raw API response containing stop point data. - Returns - ------- - Sequence[StopPoint] + Returns: List of StopPoint instances. """ entities = [] @@ -101,37 +39,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[StopPoint], Pagination]: - """ - List stop points for a given region. + """List stop points for a given region. - Parameters - ---------- - region_id : str - ID of the region. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Stop point headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[StopPoint], Pagination] + Returns: List of StopPoint instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}" @@ -143,39 +57,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[StopPoint], Pagination]: - """ - Get a stop point by its ID in a given region. + """Get a stop point by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the stop point. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Stop point headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + object_id: ID of the stop point. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[StopPoint], Pagination] + Returns: List of StopPoint instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" @@ -187,39 +76,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[StopPoint], Pagination]: - """ - List stop points for given geographic coordinates. + """List stop points for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Stop point headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[StopPoint], Pagination] + Returns: List of StopPoint instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" @@ -232,41 +96,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[StopPoint], Pagination]: - """ - Get a stop point by its ID for given geographic coordinates. + """Get a stop point by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the stop point. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Stop point headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the stop point. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[StopPoint], Pagination] + Returns: List of StopPoint instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}" diff --git a/navitia_client/client/apis/public_transportation_apis/vehicle_journey_apis.py b/navitia_client/client/apis/public_transportation_apis/vehicle_journey_apis.py index aee94a4..8d3d8b5 100644 --- a/navitia_client/client/apis/public_transportation_apis/vehicle_journey_apis.py +++ b/navitia_client/client/apis/public_transportation_apis/vehicle_journey_apis.py @@ -7,70 +7,13 @@ class VehicleJourneyApiClient(ApiBaseClient, EntityApi[VehicleJourney]): - """ - API client for handling 'VehicleJourney' entities in the Navitia API. + """API client for handling 'VehicleJourney' entities in the Navitia API. See https://doc.navitia.io/#pt-ref - Attributes - ---------- - entity_name : str - Name of the entity ('stop_points'). - get_navitia_api : method - Method to get the Navitia API. - - Methods - ------- - _get_entity_from_response(raw_entity_response: Any) -> Sequence[VehicleJourney]: - Static method to extract VehicleJourney instances from the raw API response. - - list_entity_collection_from_region( - region_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[VehicleJourney], Pagination]: - List vehicle journeys for a given region. - - get_entity_by_id( - region_id: str, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[VehicleJourney], Pagination]: - Get a vehicle journey by its ID in a given region. - - list_entity_collection_from_coordinates( - lon: float, - lat: float, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[VehicleJourney], Pagination]: - List vehicle journeys for given geographic coordinates. - - get_entity_by_id_and_coordinates( - lon: float, - lat: float, - object_id: str, - start_page: int = 0, - count: int = 25, - depth: int = 1, - odt: str = "all", - distance: int = 200, - headsign: Optional[str] = None - ) -> Tuple[Sequence[VehicleJourney], Pagination]: - Get a vehicle journey by its ID for given geographic coordinates. + Attributes: + entity_name: Name of the entity ('vehicle_journeys'). + get_navitia_api: Method to get the Navitia API. """ entity_name: str = "vehicle_journeys" @@ -78,17 +21,12 @@ class VehicleJourneyApiClient(ApiBaseClient, EntityApi[VehicleJourney]): @staticmethod def _get_entity_from_response(raw_entity_response: Any) -> Sequence[VehicleJourney]: - """ - Static method to extract VehicleJourney instances from the raw API response. + """Extract VehicleJourney entities from the raw API response. - Parameters - ---------- - raw_entity_response : Any - Raw API response containing VehicleJourney data. + Args: + raw_entity_response: Raw API response containing vehicle journey data. - Returns - ------- - Sequence[VehicleJourney] + Returns: List of VehicleJourney instances. """ entities = [] @@ -101,37 +39,13 @@ def list_entity_collection_from_region( region_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[VehicleJourney], Pagination]: - """ - List vehicle journeys for a given region. + """List vehicle journeys for a given region. - Parameters - ---------- - region_id : str - ID of the region. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[VehicleJourney], Pagination] + Returns: List of VehicleJourney instances and pagination information. """ @@ -144,39 +58,14 @@ def get_entity_by_id( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[VehicleJourney], Pagination]: - """ - Get a vehicle journey by its ID in a given region. + """Get a vehicle journey by its ID in a given region. - Parameters - ---------- - region_id : str - ID of the region. - object_id : str - ID of the vehicle journey. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + region_id: ID of the region. + object_id: ID of the vehicle journey. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[VehicleJourney], Pagination] + Returns: List of VehicleJourney instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{region_id}/{self.entity_name}/{object_id}" @@ -188,39 +77,14 @@ def list_entity_collection_from_coordinates( lat: float, request: BasePTEntityRequest, ) -> Tuple[Sequence[VehicleJourney], Pagination]: - """ - List vehicle journeys for given geographic coordinates. + """List vehicle journeys for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[VehicleJourney], Pagination] + Returns: List of VehicleJourney instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}" @@ -233,41 +97,15 @@ def get_entity_by_id_and_coordinates( object_id: str, request: BasePTEntityRequest, ) -> Tuple[Sequence[VehicleJourney], Pagination]: - """ - Get a vehicle journey by its ID for given geographic coordinates. + """Get a vehicle journey by its ID for given geographic coordinates. - Parameters - ---------- - lon : float - Longitude. - lat : float - Latitude. - object_id : str - ID of the vehicle journey. - start_page : int, optional - Starting page number (default is 0). - count : int, optional - Number of items per page (default is 25). - depth : int, optional - Search depth (default is 1). - disable_geojson : bool, optional - Whether to disable GeoJSON in the response (default is False). - odt : str, optional - ODT type filter (default is "all"). - distance : int, optional - Maximum search distance (default is 200). - headsign : Optional[str], optional - Headsign. - since : Optional[str], optional - Filter objects active after this datetime (format: YYYYMMDDThhmmss). - until : Optional[str], optional - Filter objects active before this datetime (format: YYYYMMDDThhmmss). - disable_disruption : bool, optional - Whether to disable disruptions in the response (default is False). + Args: + lon: Longitude. + lat: Latitude. + object_id: ID of the vehicle journey. + request: Request parameters for filtering. - Returns - ------- - Tuple[Sequence[VehicleJourney], Pagination] + Returns: List of VehicleJourney instances and pagination information. """ url = f"{self.base_navitia_url}/coverage/{lon};{lat}/{self.entity_name}/{object_id}"