From d8a2e6517f224e5c87e76bb79c243463342d3b6d Mon Sep 17 00:00:00 2001 From: Flora Hill Date: Mon, 8 Apr 2024 05:33:46 +0000 Subject: [PATCH] Tidy up table --- README.md | 51 +++++++++++++++++++++-------------------- src/lib.rs | 67 ++++++++++++++++++++---------------------------------- 2 files changed, 51 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 18cfc67..e0d83c9 100644 --- a/README.md +++ b/README.md @@ -9,28 +9,29 @@ ## Status 🟩 ; Complete, 🟦 ; To be tested ([you can help!](https://github.com/tascord/ptvrs/issues/new)), 🟨 ; Needs work, 🟥 ; Avoid use in current state ; ❌ Not implemented, yet. -| Feature | Endpoint
| Status | Notes | -|-------------------|----------------------------------------|--------|---------------------------------------| -| **Departures** | /departures/stop/{}
| 🟦 | | -| | /departures/route_type/{}/stop/{} | 🟦 | | -| **Directions** | /directions/{} | 🟦 | | -| | /directions/route/{} | 🟦 | | -| | /directions/{}/route_type/{} | 🟦 | | -| **Disruptions** | /disruptions/route/{} | 🟦 | | -| | /disruptions/route/{}/stop/{} | 🟦 | | -| | /disruptions/stop/{} | 🟦 | | -| | /disruptions/{} | 🟦 | | -| **Fare Estimate** | /fare_estimate/min_zone/{}/max_zone/{} | 🟥 | Not enough docs.
| -| **Outlets** | /outlets | 🟦 | | -| | /outlets/location/{}/{} | 🟦 | | -| **Patterns** | /pattern/run/{}/route_type/{} | 🟦 | | -| **Routes** | /routes | 🟨 | Types not yet concrete. See docs. | -| | /routes/{} | 🟨 | " | -| **Runs** | /runs/route/{}/route_type/{} | 🟨 | " | -| | /runs/{} | 🟨 | " | -| | /runs/{}/route_type/{} | 🟨 | " | -| | /runs/route/{} | 🟨 | " | -| **Search** | /search/{} | ❌ | Not implemented | -| **Stops** | /stops/{}/route_type/{} | ❌ | " | -| | /stops/route/{}/route_type/{ | ❌ | " | -| | /stops/location/{}/{} | ❌ | " | +| Feature | Endpoint | Status | Notes | +| ----------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------ | --------------------------------- | +| **Departures** | [/departures/route_type/stop/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.departures_stop) | 🟦 | | +| | [/departures/route_type/{}/stop/{}/route/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.departures_stop_route) | 🟦 | | +| **Directions** | [/directions/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.directions_id) | 🟦 | | +| | [/directions/route/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.directions_route) | 🟦 | | +| | [/directions/{}/route_type/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.directions_id_route) | 🟦 | | +| **Disruptions** | [/disruptions](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.disruptions) | 🟦 | | +| | [/disruptions/route/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.disruptions_route) | 🟦 | | +| | [/disruptions/route/{}/stop/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.disruptions_route_stop) | 🟦 | | +| | [/disruptions/stop/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.disruptions_stop) | 🟦 | | +| **Disruptions** | [/disruptions/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.disruptions_id) | 🟦 | | +| **Fare Estimate** | [/fare_estimate/min_zone/{}/max_zone/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.fare_estimate) | 🟥 | Not enough docs. | +| **Outlets** | [/outlets](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.outlets) | 🟦 | | +| | [/outlets/location/{}/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.outlets_lat_long) | 🟦 | | +| **Patterns** | [/pattern/run/{}/route_type/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.patterns_run_route) | 🟦 | | +| **Routes** | [/routes](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.routes) | 🟨 | Types not yet concrete. See docs. | +| | [/routes/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.routes_id) | 🟨 | " | +| **Runs** | [/runs/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.runs_ref) | 🟨 | " | +| | [/runs/route/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.runs_id) | 🟨 | " | +| | [/runs/{}/route_type/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.runs_ref_type) | 🟨 | " | +| | [/runs/route/{}/route_type/{}](https://docs.rs/ptv/latest/ptv/struct.Client.html#method.runs_id_type) | 🟨 | " | +| **Search** | /search/{} | ❌ | Not implemented | +| **Stops** | /stops/{}/route_type/{} | ❌ | " | +| | /stops/route/{}/route_type/{} | ❌ | " | +| | /stops/location/{}/{} | ❌ | " | diff --git a/src/lib.rs b/src/lib.rs index c6c2aff..c18cd7f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,16 +91,16 @@ impl Client { /* > Directions */ - /// View directions that a route travels in - pub async fn directions_route(&self, route_id: i32) -> Result { - self.rq(format!("v3/directions/route/{}", route_id)).await - } - /// View all routes for a direction of travel pub async fn directions_id(&self, direction_id: i32) -> Result { self.rq(format!("v3/directions/{}", direction_id)).await } + /// View directions that a route travels in + pub async fn directions_route(&self, route_id: i32) -> Result { + self.rq(format!("v3/directions/route/{}", route_id)).await + } + /// View all routes of a particular type for a direction of travel pub async fn directions_id_route( &self, @@ -109,8 +109,7 @@ impl Client { ) -> Result { self.rq(format!( "v3/directions/{}/route_type/{}", - direction_id, - route_type + direction_id, route_type )) .await } @@ -248,60 +247,44 @@ impl Client { /* > Runs */ - /// View all trip/service runs for a specific route ID - pub async fn runs_id( - &self, - run_id: i32, - options: RunsIdOpts, - ) -> Result { - self.rq(format!( - "v3/runs/route/{}?{}", - run_id, - to_query(options) - )) - .await + /// View all trip/service runs for a specific run_ref + pub async fn runs_ref(&self, run_ref: String, options: RunsRefOpts) -> Result { + self.rq(format!("v3/runs/{}?{}", run_ref, to_query(options))) + .await } - /// View all trip/service runs for a specific run ID and route type - pub async fn runs_id_type( - &self, - run_id: i32, - route_type: RouteType, - options: RunsIdOpts, - ) -> Result { - self.rq(format!( - "v3/runs/route/{}/route_type/{}?{}", - run_id, - route_type, - to_query(options) - )) - .await + /// View all trip/service runs for a specific route ID + pub async fn runs_id(&self, run_id: i32, options: RunsIdOpts) -> Result { + self.rq(format!("v3/runs/route/{}?{}", run_id, to_query(options))) + .await } - /// View all trip/service runs for a specific run_ref - pub async fn runs_ref( + /// View all trip/service runs for a specific run_ref and route type + pub async fn runs_ref_type( &self, run_ref: String, + route_type: RouteType, options: RunsRefOpts, ) -> Result { self.rq(format!( - "v3/runs/{}?{}", + "v3/runs/{}/route_type/{}?{}", run_ref, + route_type, to_query(options) )) .await } - /// View all trip/service runs for a specific run_ref and route type - pub async fn runs_ref_type( + /// View all trip/service runs for a specific run ID and route type + pub async fn runs_id_type( &self, - run_ref: String, + run_id: i32, route_type: RouteType, - options: RunsRefOpts, + options: RunsIdOpts, ) -> Result { self.rq(format!( - "v3/runs/{}/route_type/{}?{}", - run_ref, + "v3/runs/route/{}/route_type/{}?{}", + run_id, route_type, to_query(options) ))