-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rental system to GraphQL API #5909
Changes from 17 commits
01df869
d8b5fc7
7f69e90
d88617c
814846e
778d0de
fa4627f
5ef5fb5
e6603e1
aa8d4ae
8a77828
f70c31d
8523e34
3c81fca
41df32c
b64b08a
9a3edc1
7ab29bc
3eaa5d0
b9a0c82
87bda74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.opentripplanner.apis.gtfs.datafetchers; | ||
|
||
import graphql.schema.DataFetcher; | ||
import graphql.schema.DataFetchingEnvironment; | ||
import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers; | ||
import org.opentripplanner.service.vehiclerental.model.VehicleRentalSystem; | ||
|
||
public class VehicleRentalSystemImpl implements GraphQLDataFetchers.GraphQLVehicleRentalSystem { | ||
|
||
@Override | ||
public DataFetcher<String> url() { | ||
return environment -> getSource(environment).url; | ||
} | ||
|
||
private VehicleRentalSystem getSource(DataFetchingEnvironment environment) { | ||
return environment.getSource(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1183,6 +1183,8 @@ type QueryType { | |
nearest places related to bicycling. | ||
""" | ||
filterByModes: [Mode], | ||
"Only include vehicle rental networks that match one of the given network names." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the term "network name" is confusing here. Is it the network id? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While updating it, I noticed we could also make the list items non null so I did it in the same commit 87bda74 |
||
filterByNetwork: [String], | ||
"Only return places that are one of these types, e.g. `STOP` or `VEHICLE_RENT`" | ||
filterByPlaceTypes: [FilterPlaceType], | ||
first: Int, | ||
|
@@ -1746,6 +1748,8 @@ type RentalVehicle implements Node & PlaceInterface { | |
rentalUris: VehicleRentalUris | ||
"ID of the vehicle in the format of network:id" | ||
vehicleId: String | ||
"The vehicle rental system information." | ||
vehicleRentalSystem: VehicleRentalSystem | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to discuss in the developer meeting what to do with the naming of this field/type and if it's already too late to create a type for this. |
||
"The type of the rental vehicle (scooter, bicycle, car...)" | ||
vehicleType: RentalVehicleType | ||
} | ||
|
@@ -2464,13 +2468,20 @@ type VehicleRentalStation implements Node & PlaceInterface { | |
spacesAvailable: Int @deprecated(reason : "Use `availableSpaces` instead, which also contains the space vehicle types") | ||
"ID of the vehicle in the format of network:id" | ||
stationId: String | ||
"The vehicle rental system information." | ||
vehicleRentalSystem: VehicleRentalSystem | ||
""" | ||
Number of vehicles currently available on the rental station. | ||
See field `allowPickupNow` to know if is currently possible to pick up a vehicle. | ||
""" | ||
vehiclesAvailable: Int @deprecated(reason : "Use `availableVehicles` instead, which also contains vehicle types") | ||
} | ||
|
||
type VehicleRentalSystem { | ||
"The rental vehicle operator's system URL." | ||
url: String | ||
} | ||
|
||
type VehicleRentalUris { | ||
""" | ||
A URI that can be passed to an Android app with an {@code android.intent.action.VIEW} Android | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to expose core model classes directly in the API. Can you please add an Impl (=mapper) class just like
RentalVehicleImpl
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a mapper.