66
77
88class ArrivalApiClient (ApiBaseClient ):
9- """
10- A client class to interact with the Navitia API for fetching arrival information.
9+ """Client class to interact with the Navitia API for fetching arrival information.
1110
1211 See https://doc.navitia.io/#arrivals
13-
14- Methods
15- -------
16- _get_departure_objects_from_response(response: Any) -> Sequence[Arrival]
17- A static method to transform raw API response data into a list of Arrival objects.
18-
19- _get_departures(url: str, filters: dict) -> Tuple[Sequence[Arrival], Pagination]
20- Internal method to fetch departures based on a given URL and filters.
21-
22- list_arrivals_by_region_id_and_path(region_id: str, resource_path: str, from_datetime: datetime = datetime.now(), duration: int = 86400, depth: int = 1, forbidden_uris: Optional[Sequence[str]] = None, data_freshness: str = "realtime", disable_geojson: bool = False, direction_type: str = "all") -> Tuple[Sequence[Arrival], Pagination]
23- Retrieves a list of arrivals for a specific region and resource path.
24-
25- list_arrivals_by_coordinates(region_lon: float, region_lat: float, lon: float, lat: float, from_datetime: datetime = datetime.now(), duration: int = 86400, depth: int = 1, forbidden_uris: Optional[Sequence[str]] = None, data_freshness: str = "realtime", disable_geojson: bool = False, direction_type: str = "all") -> Tuple[Sequence[Arrival], Pagination]
26- Retrieves a list of arrivals for specific coordinates.
2712 """
2813
2914 @staticmethod
3015 def _get_arrival_objects_from_response (
3116 response : Any ,
3217 ) -> Sequence [Arrival ]:
33- """
34- Converts raw response data into a list of Arrival objects.
18+ """Convert raw response data into a list of Arrival objects.
3519
36- Parameters
37- ----------
38- response : Any
39- The raw response data from the API containing arrivals' information.
20+ Args:
21+ response: The raw response data from the API containing arrivals' information.
4022
41- Returns
42- -------
43- Sequence[Arrival]
23+ Returns:
4424 A list of Arrival objects created from the raw response data.
4525 """
4626
@@ -53,19 +33,13 @@ def _get_arrival_objects_from_response(
5333 def _get_arrivals (
5434 self , url : str , filters : dict
5535 ) -> Tuple [Sequence [Arrival ], Pagination ]:
56- """
57- Internal method to fetch departures based on a given URL and filters.
58-
59- Parameters
60- ----------
61- url : str
62- The URL for the API request.
63- filters : dict
64- The filters to apply to the API request.
65-
66- Returns
67- -------
68- Tuple[Sequence[Arrival], Pagination]
36+ """Fetch arrivals based on a given URL and filters.
37+
38+ Args:
39+ url: The URL for the API request.
40+ filters: The filters to apply to the API request.
41+
42+ Returns:
6943 A tuple containing a list of Arrival objects and a Pagination object for managing result pages.
7044 """
7145 results = self .get_navitia_api (url + self ._generate_filter_query (filters ))
@@ -79,20 +53,14 @@ def list_arrivals_by_region_id_and_path(
7953 resource_path : str ,
8054 request : ArrivalRequest ,
8155 ) -> Tuple [Sequence [Arrival ], Pagination ]:
82- """
83- Retrieves a list of arrivals for a specific region and resource path.
84-
85- Parameters
86- ----------
87- region_id : str
88- The identifier of the region to fetch arrivals from.
89- resource_path : str
90- The resource path within the region to fetch arrivals for.
56+ """Retrieve a list of arrivals for a specific region and resource path.
9157
58+ Args:
59+ region_id: The identifier of the region to fetch arrivals from.
60+ resource_path: The resource path within the region to fetch arrivals for.
61+ request: The ArrivalRequest containing filters and parameters for the query.
9262
93- Returns
94- -------
95- Tuple[Sequence[Arrival], Pagination]
63+ Returns:
9664 A tuple containing a list of Arrival objects and a Pagination object for managing result pages.
9765 """
9866 request_url = (
@@ -109,23 +77,16 @@ def list_arrivals_by_coordinates(
10977 lat : float ,
11078 request : ArrivalRequest ,
11179 ) -> Tuple [Sequence [Arrival ], Pagination ]:
112- """
113- Retrieves a list of arrivals for specific coordinates.
114-
115- Parameters
116- ----------
117- region_lon : float
118- The longitude of the region to fetch arrivals from.
119- region_lat : float
120- The latitude of the region to fetch arrivals from.
121- lon : float
122- The longitude of the specific location to fetch arrivals for.
123- lat : float
124- The latitude of the specific location to fetch arrivals for.
125-
126- Returns
127- -------
128- Tuple[Sequence[Arrival], Pagination]
80+ """Retrieve a list of arrivals for specific coordinates.
81+
82+ Args:
83+ region_lon: The longitude of the region to fetch arrivals from.
84+ region_lat: The latitude of the region to fetch arrivals from.
85+ lon: The longitude of the specific location to fetch arrivals for.
86+ lat: The latitude of the specific location to fetch arrivals for.
87+ request: The ArrivalRequest containing filters and parameters for the query.
88+
89+ Returns:
12990 A tuple containing a list of Arrival objects and a Pagination object for managing result pages.
13091 """
13192 # List of objects near the resource, navitia guesses the region from coordinates
0 commit comments