Skip to content
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

Allow specifying allowed/banned rental networks in the Transmodel API #4459

Merged
merged 2 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/sandbox/TransmodelApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
[#4232](https://github.com/opentripplanner/OpenTripPlanner/pull/4232)
- Fix issue when ServiceJourney is created by an updater and expose necessary information via DSJ
[#4365](https://github.com/opentripplanner/OpenTripPlanner/pull/4365)
- Allow specifying allowed/banned rental networks in trip query
[#4459](https://github.com/opentripplanner/OpenTripPlanner/pull/4459)

## Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.opentripplanner.ext.transmodelapi.mapping.TransitIdMapper;
import org.opentripplanner.ext.transmodelapi.model.PlanResponse;
import org.opentripplanner.ext.transmodelapi.model.TransmodelTransportSubmode;
Expand Down Expand Up @@ -203,6 +204,16 @@ private RouteRequest createRequest(DataFetchingEnvironment environment) {
// callWith.argument("banned.quays", quays -> request.setBannedStops(mappingUtil.prepareListOfFeedScopedId((List<String>) quays)));
// callWith.argument("banned.quaysHard", quaysHard -> request.setBannedStopsHard(mappingUtil.prepareListOfFeedScopedId((List<String>) quaysHard)));

callWith.argument(
"whiteListed.rentalNetworks",
(List<String> networks) -> request.journey().rental().setAllowedNetworks(Set.copyOf(networks))
);

callWith.argument(
"banned.rentalNetworks",
(List<String> networks) -> request.journey().rental().setBannedNetworks(Set.copyOf(networks))
);

// callWith.argument("heuristicStepsPerMainStep", (Integer v) -> request.heuristicStepsPerMainStep = v);
// callWith.argument("compactLegsByReversedSearch", (Boolean v) -> { /* not used any more */ });
// callWith.argument("banFirstServiceJourneysFromReuseNo", (Integer v) -> request.banFirstTripsFromReuseNo = v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ public class BannedInputType {
"Set of ids of service journeys that should not be used."
)
)
.field(
GqlUtil.newIdListInputField(
"rentalNetworks",
"Set of ids of rental networks that should not be allowed for renting vehicles."
)
)
.build();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Set;
import java.util.stream.Stream;
import org.opentripplanner.ext.transmodelapi.mapping.TransitIdMapper;
import org.opentripplanner.ext.transmodelapi.support.GqlUtil;
import org.opentripplanner.model.TripTimeOnDate;
import org.opentripplanner.transit.model.framework.FeedScopedId;
import org.opentripplanner.transit.model.network.Route;
Expand All @@ -28,6 +29,12 @@ public class JourneyWhiteListed {
)
.field(newIdListInputField("lines", "Set of ids for lines that should be used"))
.field(newIdListInputField("authorities", "Set of ids for authorities that should be used"))
.field(
GqlUtil.newIdListInputField(
"rentalNetworks",
"Set of ids of rental networks that should be used for renting vehicles."
)
)
.build();

public final Set<FeedScopedId> authorityIds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ public static GraphQLFieldDefinition create(
GraphQLArgument
.newArgument()
.name("whiteListed")
.description("Whitelisted")
.description(
"Parameters for indicating the only authorities, lines or quays to be used in the trip patterns"
)
Expand Down