// Package motis provides primitives to interact with the openapi HTTP API. // // Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT. package motis import ( "context" "encoding/json" "fmt" "io" "net/http" "net/url" "strings" "time" "github.com/oapi-codegen/runtime" ) // Defines values for AlertCause. const ( ACCIDENT AlertCause = "ACCIDENT" CONSTRUCTION AlertCause = "CONSTRUCTION" DEMONSTRATION AlertCause = "DEMONSTRATION" HOLIDAY AlertCause = "HOLIDAY" MAINTENANCE AlertCause = "MAINTENANCE" MEDICALEMERGENCY AlertCause = "MEDICAL_EMERGENCY" OTHERCAUSE AlertCause = "OTHER_CAUSE" POLICEACTIVITY AlertCause = "POLICE_ACTIVITY" STRIKE AlertCause = "STRIKE" TECHNICALPROBLEM AlertCause = "TECHNICAL_PROBLEM" UNKNOWNCAUSE AlertCause = "UNKNOWN_CAUSE" WEATHER AlertCause = "WEATHER" ) // Defines values for AlertEffect. const ( ACCESSIBILITYISSUE AlertEffect = "ACCESSIBILITY_ISSUE" ADDITIONALSERVICE AlertEffect = "ADDITIONAL_SERVICE" DETOUR AlertEffect = "DETOUR" MODIFIEDSERVICE AlertEffect = "MODIFIED_SERVICE" NOEFFECT AlertEffect = "NO_EFFECT" NOSERVICE AlertEffect = "NO_SERVICE" OTHEREFFECT AlertEffect = "OTHER_EFFECT" REDUCEDSERVICE AlertEffect = "REDUCED_SERVICE" SIGNIFICANTDELAYS AlertEffect = "SIGNIFICANT_DELAYS" STOPMOVED AlertEffect = "STOP_MOVED" UNKNOWNEFFECT AlertEffect = "UNKNOWN_EFFECT" ) // Defines values for AlertSeverityLevel. const ( INFO AlertSeverityLevel = "INFO" SEVERE AlertSeverityLevel = "SEVERE" UNKNOWNSEVERITY AlertSeverityLevel = "UNKNOWN_SEVERITY" WARNING AlertSeverityLevel = "WARNING" ) // Defines values for Direction. const ( CIRCLECLOCKWISE Direction = "CIRCLE_CLOCKWISE" CIRCLECOUNTERCLOCKWISE Direction = "CIRCLE_COUNTERCLOCKWISE" CONTINUE Direction = "CONTINUE" DEPART Direction = "DEPART" ELEVATOR Direction = "ELEVATOR" HARDLEFT Direction = "HARD_LEFT" HARDRIGHT Direction = "HARD_RIGHT" LEFT Direction = "LEFT" RIGHT Direction = "RIGHT" SLIGHTLYLEFT Direction = "SLIGHTLY_LEFT" SLIGHTLYRIGHT Direction = "SLIGHTLY_RIGHT" STAIRS Direction = "STAIRS" UTURNLEFT Direction = "UTURN_LEFT" UTURNRIGHT Direction = "UTURN_RIGHT" ) // Defines values for ElevationCosts. const ( ElevationCostsHIGH ElevationCosts = "HIGH" ElevationCostsLOW ElevationCosts = "LOW" ElevationCostsNONE ElevationCosts = "NONE" ) // Defines values for FareMediaType. const ( FareMediaTypeCONTACTLESSEMV FareMediaType = "CONTACTLESS_EMV" FareMediaTypeMOBILEAPP FareMediaType = "MOBILE_APP" FareMediaTypeNONE FareMediaType = "NONE" FareMediaTypePAPERTICKET FareMediaType = "PAPER_TICKET" FareMediaTypeTRANSITCARD FareMediaType = "TRANSIT_CARD" ) // Defines values for FareTransferRule. const ( AAB FareTransferRule = "A_AB" AABB FareTransferRule = "A_AB_B" AB FareTransferRule = "AB" ) // Defines values for LocationType. const ( ADDRESS LocationType = "ADDRESS" PLACE LocationType = "PLACE" STOP LocationType = "STOP" ) // Defines values for Mode. const ( ModeAIRPLANE Mode = "AIRPLANE" ModeBIKE Mode = "BIKE" ModeBUS Mode = "BUS" ModeCAR Mode = "CAR" ModeCARPARKING Mode = "CAR_PARKING" ModeCOACH Mode = "COACH" ModeFERRY Mode = "FERRY" ModeHIGHSPEEDRAIL Mode = "HIGHSPEED_RAIL" ModeLONGDISTANCE Mode = "LONG_DISTANCE" ModeMETRO Mode = "METRO" ModeNIGHTRAIL Mode = "NIGHT_RAIL" ModeODM Mode = "ODM" ModeOTHER Mode = "OTHER" ModeRAIL Mode = "RAIL" ModeREGIONALFASTRAIL Mode = "REGIONAL_FAST_RAIL" ModeREGIONALRAIL Mode = "REGIONAL_RAIL" ModeRENTAL Mode = "RENTAL" ModeSUBWAY Mode = "SUBWAY" ModeTRAM Mode = "TRAM" ModeTRANSIT Mode = "TRANSIT" ModeWALK Mode = "WALK" ) // Defines values for PedestrianProfile. const ( FOOT PedestrianProfile = "FOOT" WHEELCHAIR PedestrianProfile = "WHEELCHAIR" ) // Defines values for PickupDropoffType. const ( PickupDropoffTypeNORMAL PickupDropoffType = "NORMAL" PickupDropoffTypeNOTALLOWED PickupDropoffType = "NOT_ALLOWED" ) // Defines values for RentalFormFactor. const ( RentalFormFactorBICYCLE RentalFormFactor = "BICYCLE" RentalFormFactorCAR RentalFormFactor = "CAR" RentalFormFactorCARGOBICYCLE RentalFormFactor = "CARGO_BICYCLE" RentalFormFactorMOPED RentalFormFactor = "MOPED" RentalFormFactorOTHER RentalFormFactor = "OTHER" RentalFormFactorSCOOTERSEATED RentalFormFactor = "SCOOTER_SEATED" RentalFormFactorSCOOTERSTANDING RentalFormFactor = "SCOOTER_STANDING" ) // Defines values for RentalPropulsionType. const ( COMBUSTION RentalPropulsionType = "COMBUSTION" COMBUSTIONDIESEL RentalPropulsionType = "COMBUSTION_DIESEL" ELECTRIC RentalPropulsionType = "ELECTRIC" ELECTRICASSIST RentalPropulsionType = "ELECTRIC_ASSIST" HUMAN RentalPropulsionType = "HUMAN" HYBRID RentalPropulsionType = "HYBRID" HYDROGENFUELCELL RentalPropulsionType = "HYDROGEN_FUEL_CELL" PLUGINHYBRID RentalPropulsionType = "PLUG_IN_HYBRID" ) // Defines values for RentalReturnConstraint. const ( ANYSTATION RentalReturnConstraint = "ANY_STATION" NONE RentalReturnConstraint = "NONE" ROUNDTRIPSTATION RentalReturnConstraint = "ROUNDTRIP_STATION" ) // Defines values for VertexType. const ( VertexTypeBIKESHARE VertexType = "BIKESHARE" VertexTypeNORMAL VertexType = "NORMAL" VertexTypeTRANSIT VertexType = "TRANSIT" ) // Defines values for StoptimesParamsDirection. const ( EARLIER StoptimesParamsDirection = "EARLIER" LATER StoptimesParamsDirection = "LATER" ) // Alert An alert, indicating some sort of incident in the public transit network. type Alert struct { // Cause Cause of this alert. Cause *AlertCause `json:"cause,omitempty"` // CauseDetail Description of the cause of the alert that allows for agency-specific language; // more specific than the Cause. CauseDetail *string `json:"causeDetail,omitempty"` // CommunicationPeriod Time when the alert should be shown to the user. // If missing, the alert will be shown as long as it appears in the feed. // If multiple ranges are given, the alert will be shown during all of them. CommunicationPeriod *[]TimeRange `json:"communicationPeriod,omitempty"` // DescriptionText Description for the alert. // This plain-text string will be formatted as the body of the alert (or shown on an explicit "expand" request by the user). // The information in the description should add to the information of the header. DescriptionText string `json:"descriptionText"` // Effect The effect of this problem on the affected entity. Effect *AlertEffect `json:"effect,omitempty"` // EffectDetail Description of the effect of the alert that allows for agency-specific language; // more specific than the Effect. EffectDetail *string `json:"effectDetail,omitempty"` // HeaderText Header for the alert. This plain-text string will be highlighted, for example in boldface. HeaderText string `json:"headerText"` // ImageAlternativeText Text describing the appearance of the linked image in the image field // (e.g., in case the image can't be displayed or the user can't see the image for accessibility reasons). // See the HTML spec for alt image text. ImageAlternativeText *string `json:"imageAlternativeText,omitempty"` // ImageMediaType IANA media type as to specify the type of image to be displayed. The type must start with "image/" ImageMediaType *string `json:"imageMediaType,omitempty"` // ImageUrl String containing an URL linking to an image. ImageUrl *string `json:"imageUrl,omitempty"` // ImpactPeriod Time when the services are affected by the disruption mentioned in the alert. ImpactPeriod *[]TimeRange `json:"impactPeriod,omitempty"` // SeverityLevel The severity of the alert. SeverityLevel *AlertSeverityLevel `json:"severityLevel,omitempty"` // TtsDescriptionText Text containing a description for the alert to be used for text-to-speech implementations. // This field is the text-to-speech version of description_text. // It should contain the same information as description_text but formatted such that it can be read as text-to-speech // (for example, abbreviations removed, numbers spelled out, etc.) TtsDescriptionText *string `json:"ttsDescriptionText,omitempty"` // TtsHeaderText Text containing the alert's header to be used for text-to-speech implementations. // This field is the text-to-speech version of header_text. // It should contain the same information as headerText but formatted such that it can read as text-to-speech // (for example, abbreviations removed, numbers spelled out, etc.) TtsHeaderText *string `json:"ttsHeaderText,omitempty"` // Url The URL which provides additional information about the alert. Url *string `json:"url,omitempty"` } // AlertCause Cause of this alert. type AlertCause string // AlertEffect The effect of this problem on the affected entity. type AlertEffect string // AlertSeverityLevel The severity of the alert. type AlertSeverityLevel string // Area Administrative area type Area struct { // AdminLevel [OpenStreetMap `admin_level`](https://wiki.openstreetmap.org/wiki/Key:admin_level) // of the area AdminLevel float32 `json:"adminLevel"` // Default Whether this area should be displayed as default area (area with admin level closest 7) Default *bool `json:"default,omitempty"` // Matched Whether this area was matched by the input text Matched bool `json:"matched"` // Name Name of the area Name string `json:"name"` // Unique Set for the first area after the `default` area that distinguishes areas // if the match is ambiguous regarding (`default` area + place name / street [+ house number]). Unique *bool `json:"unique,omitempty"` } // Direction defines model for Direction. type Direction string // Duration Object containing duration if a path was found or none if no path was found type Duration struct { // Duration duration in seconds if a path was found, otherwise missing Duration *float32 `json:"duration,omitempty"` } // ElevationCosts Different elevation cost profiles for street routing. // Using a elevation cost profile will prefer routes with a smaller incline and smaller difference in elevation, even if the routed way is longer. // // - `NONE`: Ignore elevation data for routing. This is the default behavior // - `LOW`: Add a low penalty for inclines. This will favor longer paths, if the elevation increase and incline are smaller. // - `HIGH`: Add a high penalty for inclines. This will favor even longer paths, if the elevation increase and incline are smaller. type ElevationCosts string // EncodedPolyline defines model for EncodedPolyline. type EncodedPolyline struct { // Length The number of points in the string Length int `json:"length"` // Points The encoded points of the polyline using the Google polyline encoding. Points string `json:"points"` // Precision The precision of the returned polyline (7 for /v1, 6 for /v2) // Be aware that with precision 7, coordinates with |longitude| > 107.37 are undefined/will overflow. Precision int `json:"precision"` } // FareMedia defines model for FareMedia. type FareMedia struct { // FareMediaName Name of the fare media. Required for transit cards and mobile apps. FareMediaName *string `json:"fareMediaName,omitempty"` FareMediaType FareMediaType `json:"fareMediaType"` } // FareMediaType defines model for FareMediaType. type FareMediaType string // FareProduct defines model for FareProduct. type FareProduct struct { // Amount The cost of the fare product. May be negative to represent transfer discounts. May be zero to represent a fare product that is free. Amount float32 `json:"amount"` // Currency ISO 4217 currency code. The currency of the cost of the fare product. Currency string `json:"currency"` Media *FareMedia `json:"media,omitempty"` // Name The name of the fare product as displayed to riders. Name string `json:"name"` RiderCategory *RiderCategory `json:"riderCategory,omitempty"` } // FareTransfer The concept is derived from: https://gtfs.org/documentation/schedule/reference/#fare_transfer_rulestxt // // Terminology: // - **Leg**: An itinerary leg as described by the `Leg` type of this API description. // - **Effective Fare Leg**: Itinerary legs can be joined together to form one *effective fare leg*. // - **Fare Transfer**: A fare transfer groups two or more effective fare legs. // - **A** is the first *effective fare leg* of potentially multiple consecutive legs contained in a fare transfer // - **B** is any *effective fare leg* following the first *effective fare leg* in this transfer // - **AB** are all changes between *effective fare legs* contained in this transfer // // The fare transfer rule is used to derive the final set of products of the itinerary legs contained in this transfer: // - A_AB means that any product from the first effective fare leg combined with the product attached to the transfer itself (AB) which can be empty (= free). Note that all subsequent effective fare leg products need to be ignored in this case. // - A_AB_B mean that a product for each effective fare leg needs to be purchased in a addition to the product attached to the transfer itself (AB) which can be empty (= free) // - AB only the transfer product itself has to be purchased. Note that all fare products attached to the contained effective fare legs need to be ignored in this case. // // An itinerary `Leg` references the index of the fare transfer and the index of the effective fare leg in this transfer it belongs to. type FareTransfer struct { // EffectiveFareLegProducts Lists all valid fare products for the effective fare legs. // This is an `array>` where the inner array // lists all possible fare products that would cover this effective fare leg. // Each "effective fare leg" can have multiple options for adult/child/weekly/monthly/day/one-way tickets etc. // You can see the outer array as AND (you need one ticket for each effective fare leg (`A_AB_B`), the first effective fare leg (`A_AB`) or no fare leg at all but only the transfer product (`AB`) // and the inner array as OR (you can choose which ticket to buy) EffectiveFareLegProducts [][]FareProduct `json:"effectiveFareLegProducts"` Rule *FareTransferRule `json:"rule,omitempty"` TransferProduct *FareProduct `json:"transferProduct,omitempty"` } // FareTransferRule defines model for FareTransferRule. type FareTransferRule string // Footpath footpath from one location to another type Footpath struct { // Default optional; missing if the GTFS did not contain a footpath // footpath duration in minutes according to GTFS (+heuristics) Default *float32 `json:"default,omitempty"` // Foot optional; missing if no path was found (timetable / osr) // footpath duration in minutes for the foot profile Foot *float32 `json:"foot,omitempty"` // FootRouted optional; missing if no path was found with foot routing // footpath duration in minutes for the foot profile FootRouted *float32 `json:"footRouted,omitempty"` To Place `json:"to"` // Wheelchair optional; missing if no path was found with the wheelchair profile // footpath duration in minutes for the wheelchair profile Wheelchair *float32 `json:"wheelchair,omitempty"` // WheelchairRouted optional; missing if no path was found with the wheelchair profile // footpath duration in minutes for the wheelchair profile WheelchairRouted *float32 `json:"wheelchairRouted,omitempty"` // WheelchairUsesElevator optional; missing if no path was found with the wheelchair profile // true if the wheelchair path uses an elevator WheelchairUsesElevator *bool `json:"wheelchairUsesElevator,omitempty"` } // Itinerary defines model for Itinerary. type Itinerary struct { // Duration journey duration in seconds Duration int `json:"duration"` // EndTime journey arrival time EndTime time.Time `json:"endTime"` // FareTransfers Fare information FareTransfers *[]FareTransfer `json:"fareTransfers,omitempty"` // Legs Journey legs Legs []Leg `json:"legs"` // StartTime journey departure time StartTime time.Time `json:"startTime"` // Transfers The number of transfers this trip has. Transfers int `json:"transfers"` } // Leg defines model for Leg. type Leg struct { AgencyId *string `json:"agencyId,omitempty"` AgencyName *string `json:"agencyName,omitempty"` AgencyUrl *string `json:"agencyUrl,omitempty"` // Alerts Alerts for this stop. Alerts *[]Alert `json:"alerts,omitempty"` // Cancelled Whether this trip is cancelled Cancelled *bool `json:"cancelled,omitempty"` // Distance For non-transit legs the distance traveled while traversing this leg in meters. Distance *float32 `json:"distance,omitempty"` // Duration Leg duration in seconds // // If leg is footpath: // The footpath duration is derived from the default footpath // duration using the query parameters `transferTimeFactor` and // `additionalTransferTime` as follows: // `leg.duration = defaultDuration * transferTimeFactor + additionalTransferTime.` // In case the defaultDuration is needed, it can be calculated by // `defaultDuration = (leg.duration - additionalTransferTime) / transferTimeFactor`. // Note that the default values are `transferTimeFactor = 1` and // `additionalTransferTime = 0` in case they are not explicitly // provided in the query. Duration int `json:"duration"` // EffectiveFareLegIndex Index into the `Itinerary.fareTransfers[fareTransferIndex].effectiveFareLegProducts` array // to identify which effective fare leg this itinerary leg belongs to EffectiveFareLegIndex *int `json:"effectiveFareLegIndex,omitempty"` // EndTime leg arrival time EndTime time.Time `json:"endTime"` // FareTransferIndex Index into `Itinerary.fareTransfers` array // to identify which fare transfer this leg belongs to FareTransferIndex *int `json:"fareTransferIndex,omitempty"` From Place `json:"from"` // Headsign For transit legs, the headsign of the bus or train being used. // For non-transit legs, null Headsign *string `json:"headsign,omitempty"` // InterlineWithPreviousLeg For transit legs, if the rider should stay on the vehicle as it changes route names. InterlineWithPreviousLeg *bool `json:"interlineWithPreviousLeg,omitempty"` // IntermediateStops For transit legs, intermediate stops between the Place where the leg originates // and the Place where the leg ends. For non-transit legs, null. IntermediateStops *[]Place `json:"intermediateStops,omitempty"` LegGeometry EncodedPolyline `json:"legGeometry"` // Mode # Street modes // // - `WALK` // - `BIKE` // - `RENTAL` Experimental. Expect unannounced breaking changes (without version bumps). // - `CAR` // - `CAR_PARKING` // - `ODM` // // # Transit modes // // - `TRANSIT`: translates to `RAIL,SUBWAY,TRAM,BUS,FERRY,AIRPLANE,COACH` // - `TRAM`: trams // - `SUBWAY`: subway trains // - `FERRY`: ferries // - `AIRPLANE`: airline flights // - `BUS`: short distance buses (does not include `COACH`) // - `COACH`: long distance buses (does not include `BUS`) // - `RAIL`: translates to `HIGHSPEED_RAIL,LONG_DISTANCE_RAIL,NIGHT_RAIL,REGIONAL_RAIL,REGIONAL_FAST_RAIL` // - `METRO`: metro trains // - `HIGHSPEED_RAIL`: long distance high speed trains (e.g. TGV) // - `LONG_DISTANCE`: long distance inter city trains // - `NIGHT_RAIL`: long distance night trains // - `REGIONAL_FAST_RAIL`: regional express routes that skip low traffic stops to be faster // - `REGIONAL_RAIL`: regional train Mode Mode `json:"mode"` // RealTime Whether there is real-time data about this leg RealTime bool `json:"realTime"` // Rental Vehicle rental Rental *Rental `json:"rental,omitempty"` RouteColor *string `json:"routeColor,omitempty"` RouteShortName *string `json:"routeShortName,omitempty"` RouteTextColor *string `json:"routeTextColor,omitempty"` RouteType *string `json:"routeType,omitempty"` // Scheduled Whether this leg was originally scheduled to run or is an additional service. // Scheduled times will equal realtime times in this case. Scheduled bool `json:"scheduled"` // ScheduledEndTime scheduled leg arrival time ScheduledEndTime time.Time `json:"scheduledEndTime"` // ScheduledStartTime scheduled leg departure time ScheduledStartTime time.Time `json:"scheduledStartTime"` // Source Filename and line number where this trip is from Source *string `json:"source,omitempty"` // StartTime leg departure time StartTime time.Time `json:"startTime"` // Steps A series of turn by turn instructions // used for walking, biking and driving. Steps *[]StepInstruction `json:"steps,omitempty"` To Place `json:"to"` TripId *string `json:"tripId,omitempty"` } // LocationType location type type LocationType string // Match GeoCoding match type Match struct { // Areas list of areas Areas []Area `json:"areas"` // HouseNumber house number HouseNumber *string `json:"houseNumber,omitempty"` // Id unique ID of the location Id string `json:"id"` // Lat latitude Lat float32 `json:"lat"` // Level level according to OpenStreetMap // (at the moment only for public transport) Level *float32 `json:"level,omitempty"` // Lon longitude Lon float32 `json:"lon"` // Name name of the location (transit stop / PoI / address) Name string `json:"name"` // Score score according to the internal scoring system (the scoring algorithm might change in the future) Score float32 `json:"score"` // Street street name Street *string `json:"street,omitempty"` // Tokens list of non-overlapping tokens that were matched Tokens []Token `json:"tokens"` // Type location type Type LocationType `json:"type"` // Zip zip code Zip *string `json:"zip,omitempty"` } // Mode # Street modes // // - `WALK` // - `BIKE` // - `RENTAL` Experimental. Expect unannounced breaking changes (without version bumps). // - `CAR` // - `CAR_PARKING` // - `ODM` // // # Transit modes // // - `TRANSIT`: translates to `RAIL,SUBWAY,TRAM,BUS,FERRY,AIRPLANE,COACH` // - `TRAM`: trams // - `SUBWAY`: subway trains // - `FERRY`: ferries // - `AIRPLANE`: airline flights // - `BUS`: short distance buses (does not include `COACH`) // - `COACH`: long distance buses (does not include `BUS`) // - `RAIL`: translates to `HIGHSPEED_RAIL,LONG_DISTANCE_RAIL,NIGHT_RAIL,REGIONAL_RAIL,REGIONAL_FAST_RAIL` // - `METRO`: metro trains // - `HIGHSPEED_RAIL`: long distance high speed trains (e.g. TGV) // - `LONG_DISTANCE`: long distance inter city trains // - `NIGHT_RAIL`: long distance night trains // - `REGIONAL_FAST_RAIL`: regional express routes that skip low traffic stops to be faster // - `REGIONAL_RAIL`: regional train type Mode string // PedestrianProfile Different accessibility profiles for pedestrians. type PedestrianProfile string // PickupDropoffType - `NORMAL` - entry/exit is possible normally // - `NOT_ALLOWED` - entry/exit is not allowed type PickupDropoffType string // Place defines model for Place. type Place struct { // Alerts Alerts for this stop. Alerts *[]Alert `json:"alerts,omitempty"` // Arrival arrival time Arrival *time.Time `json:"arrival,omitempty"` // Cancelled Whether this stop is cancelled due to the realtime situation. Cancelled *bool `json:"cancelled,omitempty"` // Departure departure time Departure *time.Time `json:"departure,omitempty"` // DropoffType - `NORMAL` - entry/exit is possible normally // - `NOT_ALLOWED` - entry/exit is not allowed DropoffType *PickupDropoffType `json:"dropoffType,omitempty"` // Lat latitude Lat float32 `json:"lat"` // Level level according to OpenStreetMap Level float32 `json:"level"` // Lon longitude Lon float32 `json:"lon"` // Name name of the transit stop / PoI / address Name string `json:"name"` // PickupType - `NORMAL` - entry/exit is possible normally // - `NOT_ALLOWED` - entry/exit is not allowed PickupType *PickupDropoffType `json:"pickupType,omitempty"` // ScheduledArrival scheduled arrival time ScheduledArrival *time.Time `json:"scheduledArrival,omitempty"` // ScheduledDeparture scheduled departure time ScheduledDeparture *time.Time `json:"scheduledDeparture,omitempty"` // ScheduledTrack scheduled track from the static schedule timetable dataset ScheduledTrack *string `json:"scheduledTrack,omitempty"` // StopId The ID of the stop. This is often something that users don't care about. StopId *string `json:"stopId,omitempty"` // Track The current track/platform information, updated with real-time updates if available. // Can be missing if neither real-time updates nor the schedule timetable contains track information. Track *string `json:"track,omitempty"` // VertexType - `NORMAL` - latitude / longitude coordinate or address // - `BIKESHARE` - bike sharing station // - `TRANSIT` - transit stop VertexType *VertexType `json:"vertexType,omitempty"` } // Reachable Object containing all reachable places by One-to-All search type Reachable struct { // All List of locations reachable by One-to-All All *[]ReachablePlace `json:"all,omitempty"` One *Place `json:"one,omitempty"` } // ReachablePlace Place reachable by One-to-All type ReachablePlace struct { // Duration Total travel duration Duration *int `json:"duration,omitempty"` // K k is the smallest number, for which a journey with the shortest duration and at most k-1 transfers exist. // You can think of k as the number of connections used. // // In more detail: // // k=0: No connection, e.g. for the one location // k=1: Direct connection // k=2: Connection with 1 transfer K *int `json:"k,omitempty"` Place *Place `json:"place,omitempty"` } // Rental Vehicle rental type Rental struct { FormFactor *RentalFormFactor `json:"formFactor,omitempty"` // FromStationName Name of the station where the vehicle is picked up (empty for free floating vehicles) FromStationName *string `json:"fromStationName,omitempty"` PropulsionType *RentalPropulsionType `json:"propulsionType,omitempty"` // RentalUriAndroid Rental URI for Android (deep link to the specific station or vehicle) RentalUriAndroid *string `json:"rentalUriAndroid,omitempty"` // RentalUriIOS Rental URI for iOS (deep link to the specific station or vehicle) RentalUriIOS *string `json:"rentalUriIOS,omitempty"` // RentalUriWeb Rental URI for web (deep link to the specific station or vehicle) RentalUriWeb *string `json:"rentalUriWeb,omitempty"` ReturnConstraint *RentalReturnConstraint `json:"returnConstraint,omitempty"` // StationName Name of the station StationName *string `json:"stationName,omitempty"` // SystemId Vehicle share system ID SystemId string `json:"systemId"` // SystemName Vehicle share system name SystemName *string `json:"systemName,omitempty"` // ToStationName Name of the station where the vehicle is returned (empty for free floating vehicles) ToStationName *string `json:"toStationName,omitempty"` // Url URL of the vehicle share system Url *string `json:"url,omitempty"` } // RentalFormFactor defines model for RentalFormFactor. type RentalFormFactor string // RentalPropulsionType defines model for RentalPropulsionType. type RentalPropulsionType string // RentalReturnConstraint defines model for RentalReturnConstraint. type RentalReturnConstraint string // RiderCategory defines model for RiderCategory. type RiderCategory struct { // EligibilityUrl URL to a web page providing detailed information about the rider category and/or its eligibility criteria. EligibilityUrl *string `json:"eligibilityUrl,omitempty"` // IsDefaultFareCategory Specifies if this category should be considered the default (i.e. the main category displayed to riders). IsDefaultFareCategory bool `json:"isDefaultFareCategory"` // RiderCategoryName Rider category name as displayed to the rider. RiderCategoryName string `json:"riderCategoryName"` } // StepInstruction defines model for StepInstruction. type StepInstruction struct { // Area Not implemented! // This step is on an open area, such as a plaza or train platform, // and thus the directions should say something like "cross" Area bool `json:"area"` // Distance The distance in meters that this step takes. Distance float32 `json:"distance"` // Exit Not implemented! // When exiting a highway or traffic circle, the exit name/number. Exit string `json:"exit"` // FromLevel level where this segment starts, based on OpenStreetMap data FromLevel float32 `json:"fromLevel"` // OsmWay OpenStreetMap way index OsmWay *int `json:"osmWay,omitempty"` Polyline EncodedPolyline `json:"polyline"` RelativeDirection Direction `json:"relativeDirection"` // StayOn Not implemented! // Indicates whether or not a street changes direction at an intersection. StayOn bool `json:"stayOn"` // StreetName The name of the street. StreetName string `json:"streetName"` // ToLevel level where this segment starts, based on OpenStreetMap data ToLevel float32 `json:"toLevel"` } // StopTime departure or arrival event at a stop type StopTime struct { AgencyId string `json:"agencyId"` AgencyName string `json:"agencyName"` AgencyUrl string `json:"agencyUrl"` // Cancelled Whether the departure/arrival is cancelled due to the realtime situation. Cancelled bool `json:"cancelled"` // Headsign For transit legs, the headsign of the bus or train being used. // For non-transit legs, null Headsign string `json:"headsign"` // Mode # Street modes // // - `WALK` // - `BIKE` // - `RENTAL` Experimental. Expect unannounced breaking changes (without version bumps). // - `CAR` // - `CAR_PARKING` // - `ODM` // // # Transit modes // // - `TRANSIT`: translates to `RAIL,SUBWAY,TRAM,BUS,FERRY,AIRPLANE,COACH` // - `TRAM`: trams // - `SUBWAY`: subway trains // - `FERRY`: ferries // - `AIRPLANE`: airline flights // - `BUS`: short distance buses (does not include `COACH`) // - `COACH`: long distance buses (does not include `BUS`) // - `RAIL`: translates to `HIGHSPEED_RAIL,LONG_DISTANCE_RAIL,NIGHT_RAIL,REGIONAL_RAIL,REGIONAL_FAST_RAIL` // - `METRO`: metro trains // - `HIGHSPEED_RAIL`: long distance high speed trains (e.g. TGV) // - `LONG_DISTANCE`: long distance inter city trains // - `NIGHT_RAIL`: long distance night trains // - `REGIONAL_FAST_RAIL`: regional express routes that skip low traffic stops to be faster // - `REGIONAL_RAIL`: regional train Mode Mode `json:"mode"` // PickupDropoffType - `NORMAL` - entry/exit is possible normally // - `NOT_ALLOWED` - entry/exit is not allowed PickupDropoffType PickupDropoffType `json:"pickupDropoffType"` Place Place `json:"place"` // RealTime Whether there is real-time data about this leg RealTime bool `json:"realTime"` RouteColor *string `json:"routeColor,omitempty"` RouteShortName string `json:"routeShortName"` RouteTextColor *string `json:"routeTextColor,omitempty"` // Source Filename and line number where this trip is from Source string `json:"source"` TripId string `json:"tripId"` } // TimeRange A time interval. // The interval is considered active at time t if t is greater than or equal to the start time and less than the end time. type TimeRange struct { // End If missing, the interval ends at plus infinity. // If a TimeRange is provided, either start or end must be provided - both fields cannot be empty. End *time.Time `json:"end,omitempty"` // Start If missing, the interval starts at minus infinity. // If a TimeRange is provided, either start or end must be provided - both fields cannot be empty. Start *time.Time `json:"start,omitempty"` } // Token Matched token range (from index, length) type Token = []float32 // TripInfo trip id and name type TripInfo struct { // RouteShortName trip display name RouteShortName string `json:"routeShortName"` // TripId trip ID (dataset trip id prefixed with the dataset tag) TripId string `json:"tripId"` } // TripSegment trip segment between two stops to show a trip on a map type TripSegment struct { // Arrival arrival time Arrival time.Time `json:"arrival"` // Departure departure time Departure time.Time `json:"departure"` // Distance distance in meters Distance float32 `json:"distance"` From Place `json:"from"` // Mode # Street modes // // - `WALK` // - `BIKE` // - `RENTAL` Experimental. Expect unannounced breaking changes (without version bumps). // - `CAR` // - `CAR_PARKING` // - `ODM` // // # Transit modes // // - `TRANSIT`: translates to `RAIL,SUBWAY,TRAM,BUS,FERRY,AIRPLANE,COACH` // - `TRAM`: trams // - `SUBWAY`: subway trains // - `FERRY`: ferries // - `AIRPLANE`: airline flights // - `BUS`: short distance buses (does not include `COACH`) // - `COACH`: long distance buses (does not include `BUS`) // - `RAIL`: translates to `HIGHSPEED_RAIL,LONG_DISTANCE_RAIL,NIGHT_RAIL,REGIONAL_RAIL,REGIONAL_FAST_RAIL` // - `METRO`: metro trains // - `HIGHSPEED_RAIL`: long distance high speed trains (e.g. TGV) // - `LONG_DISTANCE`: long distance inter city trains // - `NIGHT_RAIL`: long distance night trains // - `REGIONAL_FAST_RAIL`: regional express routes that skip low traffic stops to be faster // - `REGIONAL_RAIL`: regional train Mode Mode `json:"mode"` // Polyline Google polyline encoded coordinate sequence (with precision 5) where the trip travels on this segment. Polyline string `json:"polyline"` // RealTime Whether there is real-time data about this leg RealTime bool `json:"realTime"` RouteColor *string `json:"routeColor,omitempty"` // ScheduledArrival scheduled arrival time ScheduledArrival time.Time `json:"scheduledArrival"` // ScheduledDeparture scheduled departure time ScheduledDeparture time.Time `json:"scheduledDeparture"` To Place `json:"to"` Trips []TripInfo `json:"trips"` } // VertexType - `NORMAL` - latitude / longitude coordinate or address // - `BIKESHARE` - bike sharing station // - `TRANSIT` - transit stop type VertexType string // FootpathsParams defines parameters for Footpaths. type FootpathsParams struct { // Id location id Id string `form:"id" json:"id"` } // OneToAllParams defines parameters for OneToAll. type OneToAllParams struct { // One \`latitude,longitude[,level]\` tuple with // - latitude and longitude in degrees // - (optional) level: the OSM level (default: 0) // // OR // // stop id One string `form:"one" json:"one"` // Time Optional. Defaults to the current time. // // Departure time ($arriveBy=false) / arrival date ($arriveBy=true), Time *time.Time `form:"time,omitempty" json:"time,omitempty"` // MaxTravelTime maximum travel time in minutes MaxTravelTime int `form:"maxTravelTime" json:"maxTravelTime"` // ArriveBy true = all to one, // false = one to all ArriveBy *bool `form:"arriveBy,omitempty" json:"arriveBy,omitempty"` // MaxTransfers The maximum number of allowed transfers. // If not provided, the routing uses the server-side default value // which is hardcoded and very high to cover all use cases. // // *Warning*: Use with care. Setting this too low can lead to // optimal (e.g. the fastest) journeys not being found. // If this value is too low to reach the destination at all, // it can lead to slow routing performance. MaxTransfers *int `form:"maxTransfers,omitempty" json:"maxTransfers,omitempty"` // MinTransferTime Optional. Default is 0 minutes. // // Minimum transfer time for each transfer in minutes. MinTransferTime *int `form:"minTransferTime,omitempty" json:"minTransferTime,omitempty"` // AdditionalTransferTime Optional. Default is 0 minutes. // // Additional transfer time reserved for each transfer in minutes. AdditionalTransferTime *int `form:"additionalTransferTime,omitempty" json:"additionalTransferTime,omitempty"` // TransferTimeFactor Optional. Default is 1.0 // // Factor to multiply minimum required transfer times with. // Values smaller than 1.0 are not supported. TransferTimeFactor *float32 `form:"transferTimeFactor,omitempty" json:"transferTimeFactor,omitempty"` // MaxMatchingDistance Optional. Default is 25 meters. // // Maximum matching distance in meters to match geo coordinates to the street network. MaxMatchingDistance *float32 `form:"maxMatchingDistance,omitempty" json:"maxMatchingDistance,omitempty"` // UseRoutedTransfers Optional. Default is `false`. // // Whether to use transfers routed on OpenStreetMap data. UseRoutedTransfers *bool `form:"useRoutedTransfers,omitempty" json:"useRoutedTransfers,omitempty"` // PedestrianProfile Optional. Default is `FOOT`. // // Accessibility profile to use for pedestrian routing in transfers // between transit connections and the first and last mile respectively. PedestrianProfile *PedestrianProfile `form:"pedestrianProfile,omitempty" json:"pedestrianProfile,omitempty"` // ElevationCosts Optional. Default is `NONE`. // // Set an elevation cost profile, to penalize routes with incline. // - `NONE`: No additional costs for elevations. This is the default behavior // - `LOW`: Add a low cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if small detours are required. // - `HIGH`: Add a high cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if larger detours are required. // // As using an elevation costs profile will increase the travel duration, // routing through steep terrain may exceed the maximal allowed duration, // causing a location to appear unreachable. // Increasing the maximum travel time for these segments may resolve this issue. // // The profile is used for routing on both the first and last mile. // // Elevation cost profiles are currently used by following street modes: // - `BIKE` ElevationCosts *ElevationCosts `form:"elevationCosts,omitempty" json:"elevationCosts,omitempty"` // TransitModes Optional. Default is `TRANSIT` which allows all transit modes (no restriction). // Allowed modes for the transit part. If empty, no transit connections will be computed. // For example, this can be used to allow only `METRO,SUBWAY,TRAM`. TransitModes *[]Mode `form:"transitModes,omitempty" json:"transitModes,omitempty"` // PreTransitModes Optional. Default is `WALK`. The behavior depends on whether `arriveBy` is set: // - `arriveBy=true`: Currently not used // - `arriveBy=false`: Only applies if the `one` place is a coordinate (not a transit stop). // // A list of modes that are allowed to be used from the last transit stop to the `to` coordinate. Example: `WALK,BIKE_SHARING`. PreTransitModes *[]Mode `form:"preTransitModes,omitempty" json:"preTransitModes,omitempty"` // PostTransitModes Optional. Default is `WALK`. The behavior depends on whether `arriveBy` is set: // - `arriveBy=true`: Only applies if the `one` place is a coordinate (not a transit stop). // - `arriveBy=false`: Currently not used // // A list of modes that are allowed to be used from the last transit stop to the `to` coordinate. Example: `WALK,BIKE_SHARING`. PostTransitModes *[]Mode `form:"postTransitModes,omitempty" json:"postTransitModes,omitempty"` // RequireBikeTransport Optional. Default is `false`. // // If set to `true`, all used transit trips are required to allow bike carriage. RequireBikeTransport *bool `form:"requireBikeTransport,omitempty" json:"requireBikeTransport,omitempty"` // MaxPreTransitTime Optional. Default is 15min which is `900`. // - `arriveBy=true`: Currently not used // - `arriveBy=false`: Maximum time in seconds for the street leg at `one` location. MaxPreTransitTime *int `form:"maxPreTransitTime,omitempty" json:"maxPreTransitTime,omitempty"` // MaxPostTransitTime Optional. Default is 15min which is `900`. // - `arriveBy=true`: Maximum time in seconds for the street leg at `one` location. // - `arriveBy=false`: Currently not used MaxPostTransitTime *int `form:"maxPostTransitTime,omitempty" json:"maxPostTransitTime,omitempty"` } // GeocodeParams defines parameters for Geocode. type GeocodeParams struct { // Text the (potentially partially typed) address to resolve Text string `form:"text" json:"text"` // Language language tags as used in OpenStreetMap // (usually ISO 639-1, or ISO 639-2 if there's no ISO 639-1) Language *string `form:"language,omitempty" json:"language,omitempty"` // Type Optional. Default is all types. // // Only return results of the given types. // For example, this can be used to allow only `ADDRESS` and `STOP` results. Type *LocationType `form:"type,omitempty" json:"type,omitempty"` // Place Optional. Used for biasing results towards the coordinate. // // Format: latitude,longitude in degrees Place *string `form:"place,omitempty" json:"place,omitempty"` // PlaceBias Optional. Used for biasing results towards the coordinate. Higher number = higher bias. PlaceBias *float32 `form:"placeBias,omitempty" json:"placeBias,omitempty"` } // LevelsParams defines parameters for Levels. type LevelsParams struct { // Min latitude,longitude pair of the lower right coordinate Min string `form:"min" json:"min"` // Max latitude,longitude pair of the upper left coordinate Max string `form:"max" json:"max"` } // StopsParams defines parameters for Stops. type StopsParams struct { // Min latitude,longitude pair of the lower right coordinate Min string `form:"min" json:"min"` // Max latitude,longitude pair of the upper left coordinate Max string `form:"max" json:"max"` } // TripsParams defines parameters for Trips. type TripsParams struct { // Zoom current zoom level Zoom float32 `form:"zoom" json:"zoom"` // Min latitude,longitude pair of the lower right coordinate Min string `form:"min" json:"min"` // Max latitude,longitude pair of the upper left coordinate Max string `form:"max" json:"max"` // StartTime start of the time window StartTime time.Time `form:"startTime" json:"startTime"` // EndTime end if the time window EndTime time.Time `form:"endTime" json:"endTime"` } // OneToManyParams defines parameters for OneToMany. type OneToManyParams struct { // One geo location as latitude;longitude One string `form:"one" json:"one"` // Many geo locations as latitude;longitude,latitude;longitude,... Many []string `form:"many" json:"many"` // Mode routing profile to use (currently supported: \`WALK\`, \`BIKE\`, \`CAR\`) Mode Mode `form:"mode" json:"mode"` // Max maximum travel time in seconds Max float32 `form:"max" json:"max"` // MaxMatchingDistance maximum matching distance in meters to match geo coordinates to the street network MaxMatchingDistance float32 `form:"maxMatchingDistance" json:"maxMatchingDistance"` // ElevationCosts Optional. Default is `NONE`. // // Set an elevation cost profile, to penalize routes with incline. // - `NONE`: No additional costs for elevations. This is the default behavior // - `LOW`: Add a low cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if small detours are required. // - `HIGH`: Add a high cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if larger detours are required. // // As using an elevation costs profile will increase the travel duration, // routing through steep terrain may exceed the maximal allowed duration, // causing a location to appear unreachable. // Increasing the maximum travel time for these segments may resolve this issue. // // Elevation cost profiles are currently used by following street modes: // - `BIKE` ElevationCosts *ElevationCosts `form:"elevationCosts,omitempty" json:"elevationCosts,omitempty"` // ArriveBy true = many to one // false = one to many ArriveBy bool `form:"arriveBy" json:"arriveBy"` } // ReverseGeocodeParams defines parameters for ReverseGeocode. type ReverseGeocodeParams struct { // Place latitude, longitude in degrees Place string `form:"place" json:"place"` // Type Optional. Default is all types. // // Only return results of the given type. // For example, this can be used to allow only `ADDRESS` and `STOP` results. Type *LocationType `form:"type,omitempty" json:"type,omitempty"` } // StoptimesParams defines parameters for Stoptimes. type StoptimesParams struct { // StopId stop id of the stop to retrieve departures/arrivals for StopId string `form:"stopId" json:"stopId"` // Time Optional. Defaults to the current time. Time *time.Time `form:"time,omitempty" json:"time,omitempty"` // ArriveBy Optional. Default is `false`. // // - `arriveBy=true`: the parameters `date` and `time` refer to the arrival time // - `arriveBy=false`: the parameters `date` and `time` refer to the departure time ArriveBy *bool `form:"arriveBy,omitempty" json:"arriveBy,omitempty"` // Direction This parameter will be ignored in case `pageCursor` is set. // // Optional. Default is // - `LATER` for `arriveBy=false` // - `EARLIER` for `arriveBy=true` // // The response will contain the next `n` arrivals / departures // in case `EARLIER` is selected and the previous `n` // arrivals / departures if `LATER` is selected. Direction *StoptimesParamsDirection `form:"direction,omitempty" json:"direction,omitempty"` // Mode Optional. Default is all transit modes. // // Only return arrivals/departures of the given modes. Mode *[]Mode `form:"mode,omitempty" json:"mode,omitempty"` // N the number of events N int `form:"n" json:"n"` // Radius Optional. Radius in meters. // // Default is that only stop times of the parent of the stop itself // and all stops with the same name (+ their child stops) are returned. // // If set, all stops at parent stations and their child stops in the specified radius // are returned. Radius *int `form:"radius,omitempty" json:"radius,omitempty"` // PageCursor Use the cursor to go to the next "page" of stop times. // Copy the cursor from the last response and keep the original request as is. // This will enable you to search for stop times in the next or previous time-window. PageCursor *string `form:"pageCursor,omitempty" json:"pageCursor,omitempty"` } // StoptimesParamsDirection defines parameters for Stoptimes. type StoptimesParamsDirection string // PlanParams defines parameters for Plan. type PlanParams struct { // FromPlace \`latitude,longitude[,level]\` tuple with // - latitude and longitude in degrees // - (optional) level: the OSM level (default: 0) // // OR // // stop id FromPlace string `form:"fromPlace" json:"fromPlace"` // ToPlace \`latitude,longitude[,level]\` tuple with // - latitude and longitude in degrees // - (optional) level: the OSM level (default: 0) // // OR // // stop id ToPlace string `form:"toPlace" json:"toPlace"` // Via List of via stops to visit (only stop IDs, no coordinates allowed for now). // Also see the optional parameter `viaMinimumStay` to set a set a minimum stay duration for each via stop. Via *[]string `form:"via,omitempty" json:"via,omitempty"` // ViaMinimumStay Optional. If not set, the default is `0,0` - no stay required. // // For each `via` stop a minimum stay duration in minutes. // // The value `0` signals that it's allowed to stay in the same trip. // This enables via stays without counting a transfer and can lead // to better connections with less transfers. Transfer connections can // still be found with `viaMinimumStay=0`. ViaMinimumStay *[]int `form:"viaMinimumStay,omitempty" json:"viaMinimumStay,omitempty"` // Time Optional. Defaults to the current time. // // Departure time ($arriveBy=false) / arrival date ($arriveBy=true), Time *time.Time `form:"time,omitempty" json:"time,omitempty"` // MaxTransfers The maximum number of allowed transfers. // If not provided, the routing uses the server-side default value // which is hardcoded and very high to cover all use cases. // // *Warning*: Use with care. Setting this too low can lead to // optimal (e.g. the fastest) journeys not being found. // If this value is too low to reach the destination at all, // it can lead to slow routing performance. MaxTransfers *int `form:"maxTransfers,omitempty" json:"maxTransfers,omitempty"` // MaxTravelTime The maximum travel time in minutes. // If not provided, the routing to uses the value // hardcoded in the server which is usually quite high. // // *Warning*: Use with care. Setting this too low can lead to // optimal (e.g. the least transfers) journeys not being found. // If this value is too low to reach the destination at all, // it can lead to slow routing performance. MaxTravelTime *int `form:"maxTravelTime,omitempty" json:"maxTravelTime,omitempty"` // MinTransferTime Optional. Default is 0 minutes. // // Minimum transfer time for each transfer in minutes. MinTransferTime *int `form:"minTransferTime,omitempty" json:"minTransferTime,omitempty"` // AdditionalTransferTime Optional. Default is 0 minutes. // // Additional transfer time reserved for each transfer in minutes. AdditionalTransferTime *int `form:"additionalTransferTime,omitempty" json:"additionalTransferTime,omitempty"` // TransferTimeFactor Optional. Default is 1.0 // // Factor to multiply minimum required transfer times with. // Values smaller than 1.0 are not supported. TransferTimeFactor *float32 `form:"transferTimeFactor,omitempty" json:"transferTimeFactor,omitempty"` // MaxMatchingDistance Optional. Default is 25 meters. // // Maximum matching distance in meters to match geo coordinates to the street network. MaxMatchingDistance *float32 `form:"maxMatchingDistance,omitempty" json:"maxMatchingDistance,omitempty"` // PedestrianProfile Optional. Default is `FOOT`. // // Accessibility profile to use for pedestrian routing in transfers // between transit connections, on the first mile, and last mile. PedestrianProfile *PedestrianProfile `form:"pedestrianProfile,omitempty" json:"pedestrianProfile,omitempty"` // ElevationCosts Optional. Default is `NONE`. // // Set an elevation cost profile, to penalize routes with incline. // - `NONE`: No additional costs for elevations. This is the default behavior // - `LOW`: Add a low cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if small detours are required. // - `HIGH`: Add a high cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if larger detours are required. // // As using an elevation costs profile will increase the travel duration, // routing through steep terrain may exceed the maximal allowed duration, // causing a location to appear unreachable. // Increasing the maximum travel time for these segments may resolve this issue. // // The profile is used for direct routing, on the first mile, and last mile. // // Elevation cost profiles are currently used by following street modes: // - `BIKE` ElevationCosts *ElevationCosts `form:"elevationCosts,omitempty" json:"elevationCosts,omitempty"` // UseRoutedTransfers Optional. Default is `false`. // // Whether to use transfers routed on OpenStreetMap data. UseRoutedTransfers *bool `form:"useRoutedTransfers,omitempty" json:"useRoutedTransfers,omitempty"` // DetailedTransfers - true: Compute transfer polylines and step instructions. // - false: Only return basic information (start time, end time, duration) for transfers. DetailedTransfers bool `form:"detailedTransfers" json:"detailedTransfers"` // TransitModes Optional. Default is `TRANSIT` which allows all transit modes (no restriction). // Allowed modes for the transit part. If empty, no transit connections will be computed. // For example, this can be used to allow only `METRO,SUBWAY,TRAM`. TransitModes *[]Mode `form:"transitModes,omitempty" json:"transitModes,omitempty"` // DirectModes Optional. Default is `WALK` which will compute walking routes as direct connections. // // Modes used for direction connections from start to destination without using transit. // Results will be returned on the `direct` key. // // Note: Direct connections will only be returned on the first call. For paging calls, they can be omitted. // // Note: Transit connections that are slower than the fastest direct connection will not show up. // This is being used as a cut-off during transit routing to speed up the search. // To prevent this, it's possible to send two separate requests (one with only `transitModes` and one with only `directModes`). // // Only non-transit modes such as `WALK`, `BIKE`, `CAR`, `BIKE_SHARING`, etc. can be used. DirectModes *[]Mode `form:"directModes,omitempty" json:"directModes,omitempty"` // PreTransitModes Optional. Default is `WALK`. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directModes`). // // A list of modes that are allowed to be used from the `from` coordinate to the first transit stop. Example: `WALK,BIKE_SHARING`. PreTransitModes *[]Mode `form:"preTransitModes,omitempty" json:"preTransitModes,omitempty"` // PostTransitModes Optional. Default is `WALK`. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directModes`). // // A list of modes that are allowed to be used from the last transit stop to the `to` coordinate. Example: `WALK,BIKE_SHARING`. PostTransitModes *[]Mode `form:"postTransitModes,omitempty" json:"postTransitModes,omitempty"` // DirectRentalFormFactors Experimental. Expect unannounced breaking changes (without version bumps). // // Optional. Only applies to direct connections. // // A list of vehicle type form factors that are allowed to be used for direct connections. // If empty (the default), all form factors are allowed. // Example: `BICYCLE,SCOOTER_STANDING`. DirectRentalFormFactors *[]RentalFormFactor `form:"directRentalFormFactors,omitempty" json:"directRentalFormFactors,omitempty"` // PreTransitRentalFormFactors Experimental. Expect unannounced breaking changes (without version bumps). // // Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalFormFactors`). // // A list of vehicle type form factors that are allowed to be used from the `from` coordinate to the first transit stop. // If empty (the default), all form factors are allowed. // Example: `BICYCLE,SCOOTER_STANDING`. PreTransitRentalFormFactors *[]RentalFormFactor `form:"preTransitRentalFormFactors,omitempty" json:"preTransitRentalFormFactors,omitempty"` // PostTransitRentalFormFactors Experimental. Expect unannounced breaking changes (without version bumps). // // Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalFormFactors`). // // A list of vehicle type form factors that are allowed to be used from the last transit stop to the `to` coordinate. // If empty (the default), all form factors are allowed. // Example: `BICYCLE,SCOOTER_STANDING`. PostTransitRentalFormFactors *[]RentalFormFactor `form:"postTransitRentalFormFactors,omitempty" json:"postTransitRentalFormFactors,omitempty"` // DirectRentalPropulsionTypes Experimental. Expect unannounced breaking changes (without version bumps). // // Optional. Only applies to direct connections. // // A list of vehicle type form factors that are allowed to be used for direct connections. // If empty (the default), all propulsion types are allowed. // Example: `HUMAN,ELECTRIC,ELECTRIC_ASSIST`. DirectRentalPropulsionTypes *[]RentalPropulsionType `form:"directRentalPropulsionTypes,omitempty" json:"directRentalPropulsionTypes,omitempty"` // PreTransitRentalPropulsionTypes Experimental. Expect unannounced breaking changes (without version bumps). // // Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalPropulsionTypes`). // // A list of vehicle propulsion types that are allowed to be used from the `from` coordinate to the first transit stop. // If empty (the default), all propulsion types are allowed. // Example: `HUMAN,ELECTRIC,ELECTRIC_ASSIST`. PreTransitRentalPropulsionTypes *[]RentalPropulsionType `form:"preTransitRentalPropulsionTypes,omitempty" json:"preTransitRentalPropulsionTypes,omitempty"` // PostTransitRentalPropulsionTypes Experimental. Expect unannounced breaking changes (without version bumps). // // Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalPropulsionTypes`). // // A list of vehicle propulsion types that are allowed to be used from the last transit stop to the `to` coordinate. // If empty (the default), all propulsion types are allowed. // Example: `HUMAN,ELECTRIC,ELECTRIC_ASSIST`. PostTransitRentalPropulsionTypes *[]RentalPropulsionType `form:"postTransitRentalPropulsionTypes,omitempty" json:"postTransitRentalPropulsionTypes,omitempty"` // DirectRentalProviders Experimental. Expect unannounced breaking changes (without version bumps). // // Optional. Only applies to direct connections. // // A list of rental providers that are allowed to be used for direct connections. // If empty (the default), all providers are allowed. DirectRentalProviders *[]string `form:"directRentalProviders,omitempty" json:"directRentalProviders,omitempty"` // PreTransitRentalProviders Experimental. Expect unannounced breaking changes (without version bumps). // // Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalProviders`). // // A list of rental providers that are allowed to be used from the `from` coordinate to the first transit stop. // If empty (the default), all providers are allowed. PreTransitRentalProviders *[]string `form:"preTransitRentalProviders,omitempty" json:"preTransitRentalProviders,omitempty"` // PostTransitRentalProviders Experimental. Expect unannounced breaking changes (without version bumps). // // Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalProviders`). // // A list of rental providers that are allowed to be used from the last transit stop to the `to` coordinate. // If empty (the default), all providers are allowed. PostTransitRentalProviders *[]string `form:"postTransitRentalProviders,omitempty" json:"postTransitRentalProviders,omitempty"` // NumItineraries The minimum number of itineraries to compute. // This is only relevant if `timetableView=true`. // The default value is 5. NumItineraries *int `form:"numItineraries,omitempty" json:"numItineraries,omitempty"` // PageCursor Use the cursor to go to the next "page" of itineraries. // Copy the cursor from the last response and keep the original request as is. // This will enable you to search for itineraries in the next or previous time-window. PageCursor *string `form:"pageCursor,omitempty" json:"pageCursor,omitempty"` // TimetableView Optional. Default is `true`. // // Search for the best trip options within a time window. // If true two itineraries are considered optimal // if one is better on arrival time (earliest wins) // and the other is better on departure time (latest wins). // In combination with arriveBy this parameter cover the following use cases: // // `timetable=false` = waiting for the first transit departure/arrival is considered travel time: // - `arriveBy=true`: event (e.g. a meeting) starts at 10:00 am, // compute the best journeys that arrive by that time (maximizes departure time) // - `arriveBy=false`: event (e.g. a meeting) ends at 11:00 am, // compute the best journeys that depart after that time // // `timetable=true` = optimize "later departure" + "earlier arrival" and give all options over a time window: // - `arriveBy=true`: the time window around `date` and `time` refers to the arrival time window // - `arriveBy=false`: the time window around `date` and `time` refers to the departure time window TimetableView *bool `form:"timetableView,omitempty" json:"timetableView,omitempty"` // ArriveBy Optional. Default is `false`. // // - `arriveBy=true`: the parameters `date` and `time` refer to the arrival time // - `arriveBy=false`: the parameters `date` and `time` refer to the departure time ArriveBy *bool `form:"arriveBy,omitempty" json:"arriveBy,omitempty"` // SearchWindow Optional. Default is 2 hours which is `7200`. // // The length of the search-window in seconds. Default value two hours. // // - `arriveBy=true`: number of seconds between the earliest departure time and latest departure time // - `arriveBy=false`: number of seconds between the earliest arrival time and the latest arrival time SearchWindow *int `form:"searchWindow,omitempty" json:"searchWindow,omitempty"` // RequireBikeTransport Optional. Default is `false`. // // If set to `true`, all used transit trips are required to allow bike carriage. RequireBikeTransport *bool `form:"requireBikeTransport,omitempty" json:"requireBikeTransport,omitempty"` // MaxPreTransitTime Optional. Default is 15min which is `900`. // Maximum time in seconds for the first street leg. MaxPreTransitTime *int `form:"maxPreTransitTime,omitempty" json:"maxPreTransitTime,omitempty"` // MaxPostTransitTime Optional. Default is 15min which is `900`. // Maximum time in seconds for the last street leg. MaxPostTransitTime *int `form:"maxPostTransitTime,omitempty" json:"maxPostTransitTime,omitempty"` // MaxDirectTime Optional. Default is 30min which is `1800`. // Maximum time in seconds for direct connections. MaxDirectTime *int `form:"maxDirectTime,omitempty" json:"maxDirectTime,omitempty"` // FastestDirectFactor Optional. Experimental. Default is `1.0`. // Factor with which the duration of the fastest direct connection is multiplied. // Values > 1.0 allow connections that are slower than the fastest direct connection to be found. FastestDirectFactor *float32 `form:"fastestDirectFactor,omitempty" json:"fastestDirectFactor,omitempty"` // Timeout Optional. Query timeout in seconds. Timeout *int `form:"timeout,omitempty" json:"timeout,omitempty"` // Passengers Optional. Experimental. Number of passengers (e.g. for ODM or price calculation) Passengers *int `form:"passengers,omitempty" json:"passengers,omitempty"` // Luggage Optional. Experimental. Number of luggage pieces; base unit: airline cabin luggage (e.g. for ODM or price calculation) Luggage *int `form:"luggage,omitempty" json:"luggage,omitempty"` // WithFares Optional. Experimental. If set to true, the response will contain fare information. WithFares *bool `form:"withFares,omitempty" json:"withFares,omitempty"` } // TripParams defines parameters for Trip. type TripParams struct { // TripId trip identifier (e.g. from an itinerary leg or stop event) TripId string `form:"tripId" json:"tripId"` } // RequestEditorFn is the function signature for the RequestEditor callback function type RequestEditorFn func(ctx context.Context, req *http.Request) error // Doer performs HTTP requests. // // The standard http.Client implements this interface. type HttpRequestDoer interface { Do(req *http.Request) (*http.Response, error) } // Client which conforms to the OpenAPI3 specification for this service. type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn } // ClientOption allows setting custom parameters during construction type ClientOption func(*Client) error // Creates a new Client, with reasonable defaults func NewClient(server string, opts ...ClientOption) (*Client, error) { // create a client with sane default values client := Client{ Server: server, } // mutate client and add all optional params for _, o := range opts { if err := o(&client); err != nil { return nil, err } } // ensure the server URL always has a trailing slash if !strings.HasSuffix(client.Server, "/") { client.Server += "/" } // create httpClient, if not already present if client.Client == nil { client.Client = &http.Client{} } return &client, nil } // WithHTTPClient allows overriding the default Doer, which is // automatically created using http.Client. This is useful for tests. func WithHTTPClient(doer HttpRequestDoer) ClientOption { return func(c *Client) error { c.Client = doer return nil } } // WithRequestEditorFn allows setting up a callback function, which will be // called right before sending the request. This can be used to mutate the request. func WithRequestEditorFn(fn RequestEditorFn) ClientOption { return func(c *Client) error { c.RequestEditors = append(c.RequestEditors, fn) return nil } } // The interface specification for the client above. type ClientInterface interface { // Footpaths request Footpaths(ctx context.Context, params *FootpathsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // OneToAll request OneToAll(ctx context.Context, params *OneToAllParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Geocode request Geocode(ctx context.Context, params *GeocodeParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Initial request Initial(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // Levels request Levels(ctx context.Context, params *LevelsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Stops request Stops(ctx context.Context, params *StopsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Trips request Trips(ctx context.Context, params *TripsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // OneToMany request OneToMany(ctx context.Context, params *OneToManyParams, reqEditors ...RequestEditorFn) (*http.Response, error) // ReverseGeocode request ReverseGeocode(ctx context.Context, params *ReverseGeocodeParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Stoptimes request Stoptimes(ctx context.Context, params *StoptimesParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Plan request Plan(ctx context.Context, params *PlanParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Trip request Trip(ctx context.Context, params *TripParams, reqEditors ...RequestEditorFn) (*http.Response, error) } func (c *Client) Footpaths(ctx context.Context, params *FootpathsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewFootpathsRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) OneToAll(ctx context.Context, params *OneToAllParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewOneToAllRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) Geocode(ctx context.Context, params *GeocodeParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGeocodeRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) Initial(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewInitialRequest(c.Server) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) Levels(ctx context.Context, params *LevelsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewLevelsRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) Stops(ctx context.Context, params *StopsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewStopsRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) Trips(ctx context.Context, params *TripsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewTripsRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) OneToMany(ctx context.Context, params *OneToManyParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewOneToManyRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) ReverseGeocode(ctx context.Context, params *ReverseGeocodeParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewReverseGeocodeRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) Stoptimes(ctx context.Context, params *StoptimesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewStoptimesRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) Plan(ctx context.Context, params *PlanParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPlanRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) Trip(ctx context.Context, params *TripParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewTripRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // NewFootpathsRequest generates requests for Footpaths func NewFootpathsRequest(server string, params *FootpathsParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/debug/footpaths") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, params.Id); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewOneToAllRequest generates requests for OneToAll func NewOneToAllRequest(server string, params *OneToAllParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/experimental/one-to-all") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "one", runtime.ParamLocationQuery, params.One); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if params.Time != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "time", runtime.ParamLocationQuery, *params.Time); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxTravelTime", runtime.ParamLocationQuery, params.MaxTravelTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if params.ArriveBy != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "arriveBy", runtime.ParamLocationQuery, *params.ArriveBy); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxTransfers != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxTransfers", runtime.ParamLocationQuery, *params.MaxTransfers); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MinTransferTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "minTransferTime", runtime.ParamLocationQuery, *params.MinTransferTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.AdditionalTransferTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "additionalTransferTime", runtime.ParamLocationQuery, *params.AdditionalTransferTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.TransferTimeFactor != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "transferTimeFactor", runtime.ParamLocationQuery, *params.TransferTimeFactor); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxMatchingDistance != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxMatchingDistance", runtime.ParamLocationQuery, *params.MaxMatchingDistance); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.UseRoutedTransfers != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "useRoutedTransfers", runtime.ParamLocationQuery, *params.UseRoutedTransfers); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PedestrianProfile != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "pedestrianProfile", runtime.ParamLocationQuery, *params.PedestrianProfile); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.ElevationCosts != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "elevationCosts", runtime.ParamLocationQuery, *params.ElevationCosts); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.TransitModes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "transitModes", runtime.ParamLocationQuery, *params.TransitModes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PreTransitModes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "preTransitModes", runtime.ParamLocationQuery, *params.PreTransitModes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PostTransitModes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "postTransitModes", runtime.ParamLocationQuery, *params.PostTransitModes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.RequireBikeTransport != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "requireBikeTransport", runtime.ParamLocationQuery, *params.RequireBikeTransport); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxPreTransitTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxPreTransitTime", runtime.ParamLocationQuery, *params.MaxPreTransitTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxPostTransitTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxPostTransitTime", runtime.ParamLocationQuery, *params.MaxPostTransitTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGeocodeRequest generates requests for Geocode func NewGeocodeRequest(server string, params *GeocodeParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/geocode") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "text", runtime.ParamLocationQuery, params.Text); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if params.Language != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "language", runtime.ParamLocationQuery, *params.Language); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Type != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "type", runtime.ParamLocationQuery, *params.Type); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Place != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "place", runtime.ParamLocationQuery, *params.Place); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PlaceBias != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "placeBias", runtime.ParamLocationQuery, *params.PlaceBias); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewInitialRequest generates requests for Initial func NewInitialRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/map/initial") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewLevelsRequest generates requests for Levels func NewLevelsRequest(server string, params *LevelsParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/map/levels") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "min", runtime.ParamLocationQuery, params.Min); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "max", runtime.ParamLocationQuery, params.Max); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewStopsRequest generates requests for Stops func NewStopsRequest(server string, params *StopsParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/map/stops") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "min", runtime.ParamLocationQuery, params.Min); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "max", runtime.ParamLocationQuery, params.Max); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewTripsRequest generates requests for Trips func NewTripsRequest(server string, params *TripsParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/map/trips") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "zoom", runtime.ParamLocationQuery, params.Zoom); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "min", runtime.ParamLocationQuery, params.Min); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "max", runtime.ParamLocationQuery, params.Max); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "startTime", runtime.ParamLocationQuery, params.StartTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "endTime", runtime.ParamLocationQuery, params.EndTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewOneToManyRequest generates requests for OneToMany func NewOneToManyRequest(server string, params *OneToManyParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/one-to-many") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "one", runtime.ParamLocationQuery, params.One); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "many", runtime.ParamLocationQuery, params.Many); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "mode", runtime.ParamLocationQuery, params.Mode); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "max", runtime.ParamLocationQuery, params.Max); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxMatchingDistance", runtime.ParamLocationQuery, params.MaxMatchingDistance); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if params.ElevationCosts != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "elevationCosts", runtime.ParamLocationQuery, *params.ElevationCosts); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "arriveBy", runtime.ParamLocationQuery, params.ArriveBy); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewReverseGeocodeRequest generates requests for ReverseGeocode func NewReverseGeocodeRequest(server string, params *ReverseGeocodeParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/reverse-geocode") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "place", runtime.ParamLocationQuery, params.Place); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if params.Type != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "type", runtime.ParamLocationQuery, *params.Type); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewStoptimesRequest generates requests for Stoptimes func NewStoptimesRequest(server string, params *StoptimesParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/stoptimes") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "stopId", runtime.ParamLocationQuery, params.StopId); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if params.Time != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "time", runtime.ParamLocationQuery, *params.Time); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.ArriveBy != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "arriveBy", runtime.ParamLocationQuery, *params.ArriveBy); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Direction != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "direction", runtime.ParamLocationQuery, *params.Direction); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Mode != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "mode", runtime.ParamLocationQuery, *params.Mode); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "n", runtime.ParamLocationQuery, params.N); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if params.Radius != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "radius", runtime.ParamLocationQuery, *params.Radius); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PageCursor != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "pageCursor", runtime.ParamLocationQuery, *params.PageCursor); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewPlanRequest generates requests for Plan func NewPlanRequest(server string, params *PlanParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/plan") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "fromPlace", runtime.ParamLocationQuery, params.FromPlace); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "toPlace", runtime.ParamLocationQuery, params.ToPlace); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if params.Via != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "via", runtime.ParamLocationQuery, *params.Via); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.ViaMinimumStay != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "viaMinimumStay", runtime.ParamLocationQuery, *params.ViaMinimumStay); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Time != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "time", runtime.ParamLocationQuery, *params.Time); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxTransfers != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxTransfers", runtime.ParamLocationQuery, *params.MaxTransfers); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxTravelTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxTravelTime", runtime.ParamLocationQuery, *params.MaxTravelTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MinTransferTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "minTransferTime", runtime.ParamLocationQuery, *params.MinTransferTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.AdditionalTransferTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "additionalTransferTime", runtime.ParamLocationQuery, *params.AdditionalTransferTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.TransferTimeFactor != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "transferTimeFactor", runtime.ParamLocationQuery, *params.TransferTimeFactor); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxMatchingDistance != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxMatchingDistance", runtime.ParamLocationQuery, *params.MaxMatchingDistance); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PedestrianProfile != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "pedestrianProfile", runtime.ParamLocationQuery, *params.PedestrianProfile); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.ElevationCosts != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "elevationCosts", runtime.ParamLocationQuery, *params.ElevationCosts); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.UseRoutedTransfers != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "useRoutedTransfers", runtime.ParamLocationQuery, *params.UseRoutedTransfers); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if queryFrag, err := runtime.StyleParamWithLocation("form", true, "detailedTransfers", runtime.ParamLocationQuery, params.DetailedTransfers); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } if params.TransitModes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "transitModes", runtime.ParamLocationQuery, *params.TransitModes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.DirectModes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "directModes", runtime.ParamLocationQuery, *params.DirectModes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PreTransitModes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "preTransitModes", runtime.ParamLocationQuery, *params.PreTransitModes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PostTransitModes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "postTransitModes", runtime.ParamLocationQuery, *params.PostTransitModes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.DirectRentalFormFactors != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "directRentalFormFactors", runtime.ParamLocationQuery, *params.DirectRentalFormFactors); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PreTransitRentalFormFactors != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "preTransitRentalFormFactors", runtime.ParamLocationQuery, *params.PreTransitRentalFormFactors); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PostTransitRentalFormFactors != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "postTransitRentalFormFactors", runtime.ParamLocationQuery, *params.PostTransitRentalFormFactors); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.DirectRentalPropulsionTypes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "directRentalPropulsionTypes", runtime.ParamLocationQuery, *params.DirectRentalPropulsionTypes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PreTransitRentalPropulsionTypes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "preTransitRentalPropulsionTypes", runtime.ParamLocationQuery, *params.PreTransitRentalPropulsionTypes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PostTransitRentalPropulsionTypes != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", false, "postTransitRentalPropulsionTypes", runtime.ParamLocationQuery, *params.PostTransitRentalPropulsionTypes); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.DirectRentalProviders != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "directRentalProviders", runtime.ParamLocationQuery, *params.DirectRentalProviders); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PreTransitRentalProviders != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "preTransitRentalProviders", runtime.ParamLocationQuery, *params.PreTransitRentalProviders); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PostTransitRentalProviders != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "postTransitRentalProviders", runtime.ParamLocationQuery, *params.PostTransitRentalProviders); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.NumItineraries != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "numItineraries", runtime.ParamLocationQuery, *params.NumItineraries); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PageCursor != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "pageCursor", runtime.ParamLocationQuery, *params.PageCursor); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.TimetableView != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "timetableView", runtime.ParamLocationQuery, *params.TimetableView); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.ArriveBy != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "arriveBy", runtime.ParamLocationQuery, *params.ArriveBy); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.SearchWindow != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "searchWindow", runtime.ParamLocationQuery, *params.SearchWindow); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.RequireBikeTransport != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "requireBikeTransport", runtime.ParamLocationQuery, *params.RequireBikeTransport); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxPreTransitTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxPreTransitTime", runtime.ParamLocationQuery, *params.MaxPreTransitTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxPostTransitTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxPostTransitTime", runtime.ParamLocationQuery, *params.MaxPostTransitTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.MaxDirectTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "maxDirectTime", runtime.ParamLocationQuery, *params.MaxDirectTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.FastestDirectFactor != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "fastestDirectFactor", runtime.ParamLocationQuery, *params.FastestDirectFactor); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Timeout != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "timeout", runtime.ParamLocationQuery, *params.Timeout); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Passengers != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "passengers", runtime.ParamLocationQuery, *params.Passengers); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Luggage != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "luggage", runtime.ParamLocationQuery, *params.Luggage); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.WithFares != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "withFares", runtime.ParamLocationQuery, *params.WithFares); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewTripRequest generates requests for Trip func NewTripRequest(server string, params *TripParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v1/trip") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if queryFrag, err := runtime.StyleParamWithLocation("form", true, "tripId", runtime.ParamLocationQuery, params.TripId); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { for _, r := range c.RequestEditors { if err := r(ctx, req); err != nil { return err } } for _, r := range additionalEditors { if err := r(ctx, req); err != nil { return err } } return nil } // ClientWithResponses builds on ClientInterface to offer response payloads type ClientWithResponses struct { ClientInterface } // NewClientWithResponses creates a new ClientWithResponses, which wraps // Client with return type handling func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { client, err := NewClient(server, opts...) if err != nil { return nil, err } return &ClientWithResponses{client}, nil } // WithBaseURL overrides the baseURL. func WithBaseURL(baseURL string) ClientOption { return func(c *Client) error { newBaseURL, err := url.Parse(baseURL) if err != nil { return err } c.Server = newBaseURL.String() return nil } } // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { // FootpathsWithResponse request FootpathsWithResponse(ctx context.Context, params *FootpathsParams, reqEditors ...RequestEditorFn) (*FootpathsResponse, error) // OneToAllWithResponse request OneToAllWithResponse(ctx context.Context, params *OneToAllParams, reqEditors ...RequestEditorFn) (*OneToAllResponse, error) // GeocodeWithResponse request GeocodeWithResponse(ctx context.Context, params *GeocodeParams, reqEditors ...RequestEditorFn) (*GeocodeResponse, error) // InitialWithResponse request InitialWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*InitialResponse, error) // LevelsWithResponse request LevelsWithResponse(ctx context.Context, params *LevelsParams, reqEditors ...RequestEditorFn) (*LevelsResponse, error) // StopsWithResponse request StopsWithResponse(ctx context.Context, params *StopsParams, reqEditors ...RequestEditorFn) (*StopsResponse, error) // TripsWithResponse request TripsWithResponse(ctx context.Context, params *TripsParams, reqEditors ...RequestEditorFn) (*TripsResponse, error) // OneToManyWithResponse request OneToManyWithResponse(ctx context.Context, params *OneToManyParams, reqEditors ...RequestEditorFn) (*OneToManyResponse, error) // ReverseGeocodeWithResponse request ReverseGeocodeWithResponse(ctx context.Context, params *ReverseGeocodeParams, reqEditors ...RequestEditorFn) (*ReverseGeocodeResponse, error) // StoptimesWithResponse request StoptimesWithResponse(ctx context.Context, params *StoptimesParams, reqEditors ...RequestEditorFn) (*StoptimesResponse, error) // PlanWithResponse request PlanWithResponse(ctx context.Context, params *PlanParams, reqEditors ...RequestEditorFn) (*PlanResponse, error) // TripWithResponse request TripWithResponse(ctx context.Context, params *TripParams, reqEditors ...RequestEditorFn) (*TripResponse, error) } type FootpathsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { // Footpaths all outgoing footpaths of this location Footpaths []Footpath `json:"footpaths"` Place Place `json:"place"` } } // Status returns HTTPResponse.Status func (r FootpathsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r FootpathsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type OneToAllResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Reachable } // Status returns HTTPResponse.Status func (r OneToAllResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r OneToAllResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GeocodeResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Match } // Status returns HTTPResponse.Status func (r GeocodeResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GeocodeResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type InitialResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { // Lat latitude Lat float32 `json:"lat"` // Lon longitude Lon float32 `json:"lon"` // Zoom zoom level Zoom float32 `json:"zoom"` } } // Status returns HTTPResponse.Status func (r InitialResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r InitialResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type LevelsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]float32 } // Status returns HTTPResponse.Status func (r LevelsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r LevelsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type StopsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Place } // Status returns HTTPResponse.Status func (r StopsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r StopsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type TripsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]TripSegment } // Status returns HTTPResponse.Status func (r TripsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r TripsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type OneToManyResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Duration } // Status returns HTTPResponse.Status func (r OneToManyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r OneToManyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type ReverseGeocodeResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Match } // Status returns HTTPResponse.Status func (r ReverseGeocodeResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ReverseGeocodeResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type StoptimesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { // NextPageCursor Use the cursor to get the next page of results. Insert the cursor into the request and post it to get the next page. // The next page is a set of stop times AFTER the last stop time in this result. NextPageCursor string `json:"nextPageCursor"` // PreviousPageCursor Use the cursor to get the previous page of results. Insert the cursor into the request and post it to get the previous page. // The previous page is a set of stop times BEFORE the first stop time in the result. PreviousPageCursor string `json:"previousPageCursor"` // StopTimes list of stop times StopTimes []StopTime `json:"stopTimes"` } } // Status returns HTTPResponse.Status func (r StoptimesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r StoptimesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type PlanResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { // DebugOutput debug statistics DebugOutput map[string]int `json:"debugOutput"` // Direct Direct trips by `WALK`, `BIKE`, `CAR`, etc. without time-dependency. // The starting time (`arriveBy=false`) / arrival time (`arriveBy=true`) is always the queried `time` parameter (set to \"now\" if not set). // But all `direct` connections are meant to be independent of absolute times. Direct []Itinerary `json:"direct"` From Place `json:"from"` // Itineraries list of itineraries Itineraries []Itinerary `json:"itineraries"` // NextPageCursor Use the cursor to get the next page of results. Insert the cursor into the request and post it to get the next page. // The next page is a set of itineraries departing AFTER the last itinerary in this result. NextPageCursor string `json:"nextPageCursor"` // PreviousPageCursor Use the cursor to get the previous page of results. Insert the cursor into the request and post it to get the previous page. // The previous page is a set of itineraries departing BEFORE the first itinerary in the result for a depart after search. When using the default sort order the previous set of itineraries is inserted before the current result. PreviousPageCursor string `json:"previousPageCursor"` // RequestParameters the routing query RequestParameters map[string]string `json:"requestParameters"` To Place `json:"to"` } } // Status returns HTTPResponse.Status func (r PlanResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r PlanResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type TripResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Itinerary } // Status returns HTTPResponse.Status func (r TripResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r TripResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // FootpathsWithResponse request returning *FootpathsResponse func (c *ClientWithResponses) FootpathsWithResponse(ctx context.Context, params *FootpathsParams, reqEditors ...RequestEditorFn) (*FootpathsResponse, error) { rsp, err := c.Footpaths(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseFootpathsResponse(rsp) } // OneToAllWithResponse request returning *OneToAllResponse func (c *ClientWithResponses) OneToAllWithResponse(ctx context.Context, params *OneToAllParams, reqEditors ...RequestEditorFn) (*OneToAllResponse, error) { rsp, err := c.OneToAll(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseOneToAllResponse(rsp) } // GeocodeWithResponse request returning *GeocodeResponse func (c *ClientWithResponses) GeocodeWithResponse(ctx context.Context, params *GeocodeParams, reqEditors ...RequestEditorFn) (*GeocodeResponse, error) { rsp, err := c.Geocode(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGeocodeResponse(rsp) } // InitialWithResponse request returning *InitialResponse func (c *ClientWithResponses) InitialWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*InitialResponse, error) { rsp, err := c.Initial(ctx, reqEditors...) if err != nil { return nil, err } return ParseInitialResponse(rsp) } // LevelsWithResponse request returning *LevelsResponse func (c *ClientWithResponses) LevelsWithResponse(ctx context.Context, params *LevelsParams, reqEditors ...RequestEditorFn) (*LevelsResponse, error) { rsp, err := c.Levels(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseLevelsResponse(rsp) } // StopsWithResponse request returning *StopsResponse func (c *ClientWithResponses) StopsWithResponse(ctx context.Context, params *StopsParams, reqEditors ...RequestEditorFn) (*StopsResponse, error) { rsp, err := c.Stops(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseStopsResponse(rsp) } // TripsWithResponse request returning *TripsResponse func (c *ClientWithResponses) TripsWithResponse(ctx context.Context, params *TripsParams, reqEditors ...RequestEditorFn) (*TripsResponse, error) { rsp, err := c.Trips(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseTripsResponse(rsp) } // OneToManyWithResponse request returning *OneToManyResponse func (c *ClientWithResponses) OneToManyWithResponse(ctx context.Context, params *OneToManyParams, reqEditors ...RequestEditorFn) (*OneToManyResponse, error) { rsp, err := c.OneToMany(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseOneToManyResponse(rsp) } // ReverseGeocodeWithResponse request returning *ReverseGeocodeResponse func (c *ClientWithResponses) ReverseGeocodeWithResponse(ctx context.Context, params *ReverseGeocodeParams, reqEditors ...RequestEditorFn) (*ReverseGeocodeResponse, error) { rsp, err := c.ReverseGeocode(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseReverseGeocodeResponse(rsp) } // StoptimesWithResponse request returning *StoptimesResponse func (c *ClientWithResponses) StoptimesWithResponse(ctx context.Context, params *StoptimesParams, reqEditors ...RequestEditorFn) (*StoptimesResponse, error) { rsp, err := c.Stoptimes(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseStoptimesResponse(rsp) } // PlanWithResponse request returning *PlanResponse func (c *ClientWithResponses) PlanWithResponse(ctx context.Context, params *PlanParams, reqEditors ...RequestEditorFn) (*PlanResponse, error) { rsp, err := c.Plan(ctx, params, reqEditors...) if err != nil { return nil, err } return ParsePlanResponse(rsp) } // TripWithResponse request returning *TripResponse func (c *ClientWithResponses) TripWithResponse(ctx context.Context, params *TripParams, reqEditors ...RequestEditorFn) (*TripResponse, error) { rsp, err := c.Trip(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseTripResponse(rsp) } // ParseFootpathsResponse parses an HTTP response from a FootpathsWithResponse call func ParseFootpathsResponse(rsp *http.Response) (*FootpathsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &FootpathsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { // Footpaths all outgoing footpaths of this location Footpaths []Footpath `json:"footpaths"` Place Place `json:"place"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseOneToAllResponse parses an HTTP response from a OneToAllWithResponse call func ParseOneToAllResponse(rsp *http.Response) (*OneToAllResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &OneToAllResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest Reachable if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseGeocodeResponse parses an HTTP response from a GeocodeWithResponse call func ParseGeocodeResponse(rsp *http.Response) (*GeocodeResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GeocodeResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest []Match if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseInitialResponse parses an HTTP response from a InitialWithResponse call func ParseInitialResponse(rsp *http.Response) (*InitialResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &InitialResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { // Lat latitude Lat float32 `json:"lat"` // Lon longitude Lon float32 `json:"lon"` // Zoom zoom level Zoom float32 `json:"zoom"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseLevelsResponse parses an HTTP response from a LevelsWithResponse call func ParseLevelsResponse(rsp *http.Response) (*LevelsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &LevelsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest []float32 if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseStopsResponse parses an HTTP response from a StopsWithResponse call func ParseStopsResponse(rsp *http.Response) (*StopsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &StopsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest []Place if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseTripsResponse parses an HTTP response from a TripsWithResponse call func ParseTripsResponse(rsp *http.Response) (*TripsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &TripsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest []TripSegment if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseOneToManyResponse parses an HTTP response from a OneToManyWithResponse call func ParseOneToManyResponse(rsp *http.Response) (*OneToManyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &OneToManyResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest []Duration if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseReverseGeocodeResponse parses an HTTP response from a ReverseGeocodeWithResponse call func ParseReverseGeocodeResponse(rsp *http.Response) (*ReverseGeocodeResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ReverseGeocodeResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest []Match if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseStoptimesResponse parses an HTTP response from a StoptimesWithResponse call func ParseStoptimesResponse(rsp *http.Response) (*StoptimesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &StoptimesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { // NextPageCursor Use the cursor to get the next page of results. Insert the cursor into the request and post it to get the next page. // The next page is a set of stop times AFTER the last stop time in this result. NextPageCursor string `json:"nextPageCursor"` // PreviousPageCursor Use the cursor to get the previous page of results. Insert the cursor into the request and post it to get the previous page. // The previous page is a set of stop times BEFORE the first stop time in the result. PreviousPageCursor string `json:"previousPageCursor"` // StopTimes list of stop times StopTimes []StopTime `json:"stopTimes"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParsePlanResponse parses an HTTP response from a PlanWithResponse call func ParsePlanResponse(rsp *http.Response) (*PlanResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &PlanResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { // DebugOutput debug statistics DebugOutput map[string]int `json:"debugOutput"` // Direct Direct trips by `WALK`, `BIKE`, `CAR`, etc. without time-dependency. // The starting time (`arriveBy=false`) / arrival time (`arriveBy=true`) is always the queried `time` parameter (set to \"now\" if not set). // But all `direct` connections are meant to be independent of absolute times. Direct []Itinerary `json:"direct"` From Place `json:"from"` // Itineraries list of itineraries Itineraries []Itinerary `json:"itineraries"` // NextPageCursor Use the cursor to get the next page of results. Insert the cursor into the request and post it to get the next page. // The next page is a set of itineraries departing AFTER the last itinerary in this result. NextPageCursor string `json:"nextPageCursor"` // PreviousPageCursor Use the cursor to get the previous page of results. Insert the cursor into the request and post it to get the previous page. // The previous page is a set of itineraries departing BEFORE the first itinerary in the result for a depart after search. When using the default sort order the previous set of itineraries is inserted before the current result. PreviousPageCursor string `json:"previousPageCursor"` // RequestParameters the routing query RequestParameters map[string]string `json:"requestParameters"` To Place `json:"to"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseTripResponse parses an HTTP response from a TripWithResponse call func ParseTripResponse(rsp *http.Response) (*TripResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &TripResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest Itinerary if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil }