diff --git a/go.mod b/go.mod index 836cbe2..f8c990d 100644 --- a/go.mod +++ b/go.mod @@ -3,41 +3,59 @@ module git.coopgo.io/coopgo-platform/multimodal-routing go 1.23.3 require ( - git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20240919052743-201e803c6a4e // indirect + git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429082239-a95cd6eb5523 // indirect git.coopgo.io/coopgo-platform/libvalhalla-go v0.0.0-20241230164352-d46c349d51d7 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/getkin/kin-openapi v0.127.0 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/schema v1.2.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/invopop/yaml v0.3.1 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect + github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 // indirect github.com/paulmach/orb v0.9.0 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect + github.com/speakeasy-api/openapi-overlay v0.9.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.19.0 // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect + github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect go.mongodb.org/mongo-driver v1.11.1 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.29.0 // indirect golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect + golang.org/x/mod v0.22.0 // indirect golang.org/x/net v0.31.0 // indirect + golang.org/x/sync v0.9.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.20.0 // indirect + golang.org/x/tools v0.27.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect google.golang.org/grpc v1.68.0 // indirect google.golang.org/protobuf v1.35.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +tool github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen diff --git a/go.sum b/go.sum index 6defe54..665fa9a 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,15 @@ git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20240919052743-201e803c6a4e h1:grG21iRInke5CjRyHs9I+38ZVeDXRG82xB654+vqeVc= git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20240919052743-201e803c6a4e/go.mod h1:c9aJwNtY4PJuqAFYZ9afnx46UAZtWJ3P8ICZM02/DBA= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429064616-fe30c3fc1228 h1:t9ttlSkWkeaGhYHl2QHHNp3RepYWjamDJoPLwpaqsE4= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429064616-fe30c3fc1228/go.mod h1:c9aJwNtY4PJuqAFYZ9afnx46UAZtWJ3P8ICZM02/DBA= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429065325-88e3bae68584 h1:sg3C7EQ6XutIZLWdOmCFSRQX6GClPCHwK33tbKRCdHI= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429065325-88e3bae68584/go.mod h1:c9aJwNtY4PJuqAFYZ9afnx46UAZtWJ3P8ICZM02/DBA= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429065904-9f0dd430e8f2 h1:IbSRXJVcJq4AQARv97hKsNHuyx4b+fd3mMt/WWQA11s= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429065904-9f0dd430e8f2/go.mod h1:c9aJwNtY4PJuqAFYZ9afnx46UAZtWJ3P8ICZM02/DBA= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429082100-30a3d18277d1 h1:y7Di7qSG81pEAJVrMekKaHQgV74M4C/rg5cFsuenIzI= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429082100-30a3d18277d1/go.mod h1:c9aJwNtY4PJuqAFYZ9afnx46UAZtWJ3P8ICZM02/DBA= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429082239-a95cd6eb5523 h1:hXoUOEZ+umiyR0SzYbGacJxiUbW4puw4phmkfTVfqPU= +git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250429082239-a95cd6eb5523/go.mod h1:c9aJwNtY4PJuqAFYZ9afnx46UAZtWJ3P8ICZM02/DBA= git.coopgo.io/coopgo-platform/libvalhalla-go v0.0.0-20241230105518-1d3838339ae6 h1:8vCeARJDo7GUhN4wLiQQeKETssGpjhewMnPuzhZfFE4= git.coopgo.io/coopgo-platform/libvalhalla-go v0.0.0-20241230105518-1d3838339ae6/go.mod h1:VH5hNBKEZQlr1cgFd7sDMh9iGtoaINbyDmT++sUkTx0= git.coopgo.io/coopgo-platform/libvalhalla-go v0.0.0-20241230113846-3c63ee618ed8 h1:DlPSwmrt805bn506sL7BVH382QNSuJIl1SCsGE3i754= @@ -14,25 +24,58 @@ git.coopgo.io/coopgo-platform/libvalhalla-go v0.0.0-20241230163259-b858b0fb1932 git.coopgo.io/coopgo-platform/libvalhalla-go v0.0.0-20241230163259-b858b0fb1932/go.mod h1:VH5hNBKEZQlr1cgFd7sDMh9iGtoaINbyDmT++sUkTx0= git.coopgo.io/coopgo-platform/libvalhalla-go v0.0.0-20241230164352-d46c349d51d7 h1:yPiQrN0BxU+tLsDKojZv3sI/A3RtnrSd7hOJhBHZyqg= git.coopgo.io/coopgo-platform/libvalhalla-go v0.0.0-20241230164352-d46c349d51d7/go.mod h1:VH5hNBKEZQlr1cgFd7sDMh9iGtoaINbyDmT++sUkTx0= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/getkin/kin-openapi v0.127.0 h1:Mghqi3Dhryf3F8vR370nN67pAERW+3a95vomb3MAREY= +github.com/getkin/kin-openapi v0.127.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc= github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/invopop/yaml v0.3.1 h1:f0+ZpmhfBSS4MhG+4HYseMdJhoeeopbSKbq5Rpeelso= +github.com/invopop/yaml v0.3.1/go.mod h1:PMOp3nn4/12yEZUFfmOuNHJsZToEEOwoWsT+D81KkeA= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= @@ -41,6 +84,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -50,12 +95,30 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 h1:ykgG34472DWey7TSjd8vIfNykXgjOgYJZoQbKfEeY/Q= +github.com/oapi-codegen/oapi-codegen/v2 v2.4.1/go.mod h1:N5+lY1tiTDV3V1BeHtOxeWXHoPVeApvsvjJqegfoaz8= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/paulmach/orb v0.9.0 h1:MwA1DqOKtvCgm7u9RZ/pnYejTeDJPnr0+0oFajBbJqk= github.com/paulmach/orb v0.9.0/go.mod h1:SudmOk85SXtmXAB3sLGyJ6tZy/8pdfrV0o6ef98Xc30= github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= +github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= @@ -67,8 +130,11 @@ github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3 github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/speakeasy-api/openapi-overlay v0.9.0 h1:Wrz6NO02cNlLzx1fB093lBlYxSI54VRhy1aSutx0PQg= +github.com/speakeasy-api/openapi-overlay v0.9.0/go.mod h1:f5FloQrHA7MsxYg9djzMD5h6dxrHjVVByWKh7an8TRc= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= @@ -78,12 +144,16 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= +github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= @@ -108,23 +178,40 @@ golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+h golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -133,6 +220,7 @@ golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -142,7 +230,10 @@ golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o= +golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -152,14 +243,31 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/handlers/carpool.go b/handlers/carpool.go index b094677..f5a7152 100644 --- a/handlers/carpool.go +++ b/handlers/carpool.go @@ -52,8 +52,8 @@ func NewCarpoolRoutingHandler(cfg *viper.Viper) (*CarpoolRoutingHandler, error) } // TODO add options (WithTimeDelta, etc...) -func (h CarpoolRoutingHandler) Search(results chan *geojson.FeatureCollection, wg *sync.WaitGroup, departure geojson.Feature, destination geojson.Feature, departureDate time.Time) error { - defer wg.Done() +func (h CarpoolRoutingHandler) Search(results chan *geojson.FeatureCollection, departure geojson.Feature, destination geojson.Feature, departureDate time.Time) error { + defer close(results) defaultTimeDelta := 3600 * time.Second defaultDepartureRadius := int64(10) @@ -70,6 +70,7 @@ func (h CarpoolRoutingHandler) Search(results chan *geojson.FeatureCollection, w r, err := api.GetDriverJourneys(departure.Point().Lat(), departure.Point().Lon(), destination.Point().Lat(), destination.Point().Lon(), departureDate, &defaultTimeDelta, defaultDepartureRadius, defaultDestinationRadius, defaultCount) if err != nil { log.Error().Err(err).Str("operator", api.GetOperatorId()).Msg("error in carpool api request") + return } for _, journey := range r { // Departure diff --git a/handlers/handlers.go b/handlers/handlers.go index 5ce704b..be89728 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -6,7 +6,6 @@ import ( "time" "github.com/paulmach/orb/geojson" - "github.com/rs/zerolog/log" "github.com/spf13/viper" ) @@ -31,17 +30,16 @@ func (h *MultimodalRoutingHandler) Search(departure geojson.Feature, destination var wg sync.WaitGroup // Carpool - wg.Add(1) - go h.Carpool.Search(ch, &wg, departure, destination, departureDate) + go h.Carpool.Search(ch, departure, destination, departureDate) + wg.Add(1) go func() { - wg.Wait() - close(ch) + defer wg.Done() + for journey := range ch { + journeys = append(journeys, journey) + } }() - for journey := range ch { - log.Debug().Any("journey", journey).Msg("Received from channel") - journeys = append(journeys, journey) - } + wg.Wait() return journeys, nil } diff --git a/libs/carpool/blablacardaily.go b/libs/carpool/blablacardaily.go index fdb152c..45624bd 100644 --- a/libs/carpool/blablacardaily.go +++ b/libs/carpool/blablacardaily.go @@ -34,7 +34,7 @@ type BBCDailyResult struct { Distance *int64 `json:"distance"` PickupLatitude *float64 `json:"pickup_latitude"` PickupLongitude *float64 `json:"pickup_longitude"` - PickupDatetime time.Time `json:"pickup_datetime"` + PickupDatetime *string `json:"pickup_datetime"` DropoffLatitude *float64 `json:"dropoff_latitude"` DropoffLongitude *float64 `json:"dropoff_longitude"` DropoffDatetime *string `json:"dropoff_datetime"` @@ -95,6 +95,12 @@ func (api *BBCDailyCarpoolAPI) GetDriverJourneys( Currency: &r.Price.Currency, } } + i, err := strconv.ParseInt(*r.PickupDatetime, 10, 64) + if err != nil { + log.Error().Err(err).Msg("error in string ot int conversion") + } + pd := time.Unix(i, 0) + pickupDatetime := ocss.OCSSTime(pd) driverJourney := ocss.DriverJourney{ DriverTrip: ocss.DriverTrip{ Driver: ocss.User{ @@ -117,7 +123,7 @@ func (api *BBCDailyCarpoolAPI) GetDriverJourneys( }, JourneySchedule: ocss.JourneySchedule{ ID: r.ID, - PassengerPickupDate: ocss.OCSSTime(r.PickupDatetime), + PassengerPickupDate: pickupDatetime, WebUrl: r.WebURL, }, AvailableSteats: r.AvailableSeats, @@ -160,8 +166,6 @@ func blablacarDailySearch(url string, access_token string, departure_latitude fl q.Add("departure_timedelta", fmt.Sprintf("%v", departure_timedelta.Abs().Seconds())) req.URL.RawQuery = q.Encode() - log.Debug().Str("url", req.URL.String()).Msg("Request to BBCDaily") - resp, err := http.DefaultClient.Do(req) if err != nil { log.Error().Err(err).Msg("error in BBCDaily request") @@ -176,7 +180,7 @@ func blablacarDailySearch(url string, access_token string, departure_latitude fl if err2 != nil { log.Error().Err(err2).Msg("error reading json string") } - log.Error().Err(err).Any("resp body", body).Msg("cannot read json response to blablacardaily API") + log.Error().Err(err).Bytes("resp body", body).Any("status", resp.Status).Msg("cannot read json response to blablacardaily API") return nil, err } diff --git a/libs/transit/motis/cfg.yaml b/libs/transit/motis/cfg.yaml new file mode 100644 index 0000000..e459f53 --- /dev/null +++ b/libs/transit/motis/cfg.yaml @@ -0,0 +1,5 @@ +package: motis +generate: + client: true + models: true +output: gen.go diff --git a/libs/transit/motis/gen.go b/libs/transit/motis/gen.go new file mode 100644 index 0000000..98f1610 --- /dev/null +++ b/libs/transit/motis/gen.go @@ -0,0 +1,4238 @@ +// 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 +} diff --git a/libs/transit/motis/motis.go b/libs/transit/motis/motis.go new file mode 100644 index 0000000..270394e --- /dev/null +++ b/libs/transit/motis/motis.go @@ -0,0 +1,3 @@ +package motis + +//go:generate go tool oapi-codegen -config cfg.yaml openapi.yaml diff --git a/libs/transit/motis/openapi.yaml b/libs/transit/motis/openapi.yaml new file mode 100644 index 0000000..fbb0420 --- /dev/null +++ b/libs/transit/motis/openapi.yaml @@ -0,0 +1,2437 @@ +openapi: 3.1.0 +info: + title: MOTIS API + description: This is the MOTIS routing API. + contact: + email: felix@triptix.tech + license: + name: MIT + url: https://opensource.org/license/mit + version: v2 +externalDocs: + description: Find out more about MOTIS + url: https://github.com/motis-project/motis +servers: + - url: https://api.transitous.org +paths: + /api/v2/plan: + get: + tags: + - routing + summary: Computes optimal connections from one place to another. + operationId: plan + parameters: + - name: fromPlace + in: query + required: true + description: | + \`latitude,longitude[,level]\` tuple with + - latitude and longitude in degrees + - (optional) level: the OSM level (default: 0) + + OR + + stop id + schema: + type: string + + - name: toPlace + in: query + required: true + description: | + \`latitude,longitude[,level]\` tuple with + - latitude and longitude in degrees + - (optional) level: the OSM level (default: 0) + + OR + + stop id + schema: + type: string + + - name: via + in: query + required: false + description: | + 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. + schema: + type: array + maxItems: 2 + items: + type: string + explode: false + + - name: viaMinimumStay + in: query + required: false + description: | + 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`. + schema: + default: [0, 0] + type: array + maxItems: 2 + items: + type: integer + explode: false + + - name: time + in: query + required: false + description: | + Optional. Defaults to the current time. + + Departure time ($arriveBy=false) / arrival date ($arriveBy=true), + schema: + type: string + format: date-time + + - name: maxTransfers + in: query + required: false + description: | + 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. + schema: + type: integer + + - name: maxTravelTime + in: query + required: false + description: | + 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. + schema: + type: integer + + - name: minTransferTime + in: query + required: false + description: | + Optional. Default is 0 minutes. + + Minimum transfer time for each transfer in minutes. + schema: + type: integer + default: 0 + + - name: additionalTransferTime + in: query + required: false + description: | + Optional. Default is 0 minutes. + + Additional transfer time reserved for each transfer in minutes. + schema: + type: integer + default: 0 + + - name: transferTimeFactor + in: query + required: false + description: | + Optional. Default is 1.0 + + Factor to multiply minimum required transfer times with. + Values smaller than 1.0 are not supported. + schema: + type: number + default: 1.0 + + - name: maxMatchingDistance + in: query + required: false + description: | + Optional. Default is 25 meters. + + Maximum matching distance in meters to match geo coordinates to the street network. + schema: + type: number + default: 25 + + - name: pedestrianProfile + in: query + required: false + description: | + Optional. Default is `FOOT`. + + Accessibility profile to use for pedestrian routing in transfers + between transit connections, on the first mile, and last mile. + schema: + $ref: "#/components/schemas/PedestrianProfile" + default: FOOT + + - name: elevationCosts + in: query + required: false + description: | + 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` + schema: + $ref: "#/components/schemas/ElevationCosts" + default: NONE + + - name: useRoutedTransfers + in: query + required: false + description: | + Optional. Default is `false`. + + Whether to use transfers routed on OpenStreetMap data. + schema: + type: boolean + default: false + + - name: detailedTransfers + in: query + required: true + description: | + - true: Compute transfer polylines and step instructions. + - false: Only return basic information (start time, end time, duration) for transfers. + schema: + type: boolean + default: true + + - name: transitModes + in: query + required: false + description: | + 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`. + schema: + default: + - TRANSIT + type: array + items: + $ref: "#/components/schemas/Mode" + explode: false + + - name: directModes + in: query + required: false + description: | + 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. + schema: + default: + - WALK + type: array + items: + $ref: "#/components/schemas/Mode" + explode: false + + - name: preTransitModes + in: query + required: false + description: | + 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`. + schema: + default: + - WALK + type: array + items: + $ref: "#/components/schemas/Mode" + explode: false + + - name: postTransitModes + in: query + required: false + description: | + 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`. + schema: + default: + - WALK + type: array + items: + $ref: "#/components/schemas/Mode" + explode: false + + - name: directRentalFormFactors + in: query + required: false + description: | + 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`. + schema: + type: array + items: + $ref: "#/components/schemas/RentalFormFactor" + explode: false + + - name: preTransitRentalFormFactors + in: query + required: false + description: | + 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`. + schema: + type: array + items: + $ref: "#/components/schemas/RentalFormFactor" + explode: false + + - name: postTransitRentalFormFactors + in: query + required: false + description: | + 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`. + schema: + type: array + items: + $ref: "#/components/schemas/RentalFormFactor" + explode: false + + - name: directRentalPropulsionTypes + in: query + required: false + description: | + 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`. + schema: + type: array + items: + $ref: "#/components/schemas/RentalPropulsionType" + explode: false + + - name: preTransitRentalPropulsionTypes + in: query + required: false + description: | + 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`. + schema: + type: array + items: + $ref: "#/components/schemas/RentalPropulsionType" + explode: false + + - name: postTransitRentalPropulsionTypes + in: query + required: false + description: | + 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`. + schema: + type: array + items: + $ref: "#/components/schemas/RentalPropulsionType" + explode: false + + - name: directRentalProviders + in: query + required: false + description: | + 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. + schema: + type: array + items: + type: string + + - name: preTransitRentalProviders + in: query + required: false + description: | + 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. + schema: + type: array + items: + type: string + + - name: postTransitRentalProviders + in: query + required: false + description: | + 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. + schema: + type: array + items: + type: string + + - name: numItineraries + in: query + required: false + description: | + The minimum number of itineraries to compute. + This is only relevant if `timetableView=true`. + The default value is 5. + schema: + type: integer + default: 5 + + - name: pageCursor + in: query + required: false + description: | + 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. + schema: + type: string + + - name: timetableView + in: query + required: false + description: | + 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 + schema: + type: boolean + default: true + + - name: arriveBy + in: query + required: false + schema: + type: boolean + default: false + description: | + 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 + + - name: searchWindow + in: query + required: false + description: | + 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 + schema: + type: integer + default: 7200 + minimum: 0 + + - name: requireBikeTransport + in: query + required: false + schema: + type: boolean + default: false + description: | + Optional. Default is `false`. + + If set to `true`, all used transit trips are required to allow bike carriage. + + - name: maxPreTransitTime + in: query + required: false + description: | + Optional. Default is 15min which is `900`. + Maximum time in seconds for the first street leg. + schema: + type: integer + default: 900 + minimum: 0 + + - name: maxPostTransitTime + in: query + required: false + description: | + Optional. Default is 15min which is `900`. + Maximum time in seconds for the last street leg. + schema: + type: integer + default: 900 + minimum: 0 + + - name: maxDirectTime + in: query + required: false + description: | + Optional. Default is 30min which is `1800`. + Maximum time in seconds for direct connections. + schema: + type: integer + default: 1800 + minimum: 0 + + - name: fastestDirectFactor + in: query + required: false + description: | + 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. + schema: + type: number + default: 1.0 + minimum: 0 + + - name: timeout + in: query + required: false + description: Optional. Query timeout in seconds. + schema: + type: integer + minimum: 0 + + - name: passengers + in: query + required: false + description: Optional. Experimental. Number of passengers (e.g. for ODM or price calculation) + schema: + type: integer + minimum: 1 + + - name: luggage + in: query + required: false + description: | + Optional. Experimental. Number of luggage pieces; base unit: airline cabin luggage (e.g. for ODM or price calculation) + schema: + type: integer + minimum: 1 + + - name: withFares + in: query + required: false + description: Optional. Experimental. If set to true, the response will contain fare information. + schema: + type: boolean + default: false + responses: + "200": + description: routing result + content: + application/json: + schema: + type: object + required: + - requestParameters + - debugOutput + - from + - to + - direct + - itineraries + - previousPageCursor + - nextPageCursor + properties: + requestParameters: + description: "the routing query" + type: object + additionalProperties: + type: string + debugOutput: + description: "debug statistics" + type: object + additionalProperties: + type: integer + from: + $ref: "#/components/schemas/Place" + to: + $ref: "#/components/schemas/Place" + direct: + description: | + 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. + type: array + items: + $ref: "#/components/schemas/Itinerary" + itineraries: + description: list of itineraries + type: array + items: + $ref: "#/components/schemas/Itinerary" + previousPageCursor: + description: | + 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. + type: string + nextPageCursor: + description: | + 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. + type: string + + /api/v1/one-to-many: + get: + tags: + - routing + summary: | + Street routing from one to many places or many to one. + The order in the response array corresponds to the order of coordinates of the \`many\` parameter in the query. + operationId: oneToMany + parameters: + - name: one + in: query + required: true + description: geo location as latitude;longitude + schema: + type: string + - name: many + in: query + required: true + description: geo locations as latitude;longitude,latitude;longitude,... + schema: + type: array + items: + type: string + - name: mode + in: query + required: true + description: | + routing profile to use (currently supported: \`WALK\`, \`BIKE\`, \`CAR\`) + schema: + $ref: "#/components/schemas/Mode" + - name: max + in: query + required: true + description: maximum travel time in seconds + schema: + type: number + - name: maxMatchingDistance + in: query + required: true + description: maximum matching distance in meters to match geo coordinates to the street network + schema: + type: number + - name: elevationCosts + in: query + required: false + description: | + 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` + schema: + $ref: "#/components/schemas/ElevationCosts" + default: NONE + - name: arriveBy + in: query + required: true + description: | + true = many to one + false = one to many + schema: + type: boolean + responses: + 200: + description: | + A list of durations. + If no path was found, the object is empty. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Duration" + + /api/experimental/one-to-all: + get: + tags: + - routing + summary: | + Computes all reachable locations from a given stop within a set duration. + Each result entry will contain the fastest travel duration and the number of connections used. + operationId: oneToAll + parameters: + - name: one + in: query + required: true + description: | + \`latitude,longitude[,level]\` tuple with + - latitude and longitude in degrees + - (optional) level: the OSM level (default: 0) + + OR + + stop id + schema: + type: string + - name: time + in: query + required: false + description: | + Optional. Defaults to the current time. + + Departure time ($arriveBy=false) / arrival date ($arriveBy=true), + schema: + type: string + format: date-time + - name: maxTravelTime + in: query + required: true + description: maximum travel time in minutes + schema: + type: integer + - name: arriveBy + in: query + required: false + description: | + true = all to one, + false = one to all + schema: + type: boolean + default: false + - name: maxTransfers + in: query + required: false + description: | + 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. + schema: + type: integer + - name: minTransferTime + in: query + required: false + description: | + Optional. Default is 0 minutes. + + Minimum transfer time for each transfer in minutes. + schema: + type: integer + default: 0 + + - name: additionalTransferTime + in: query + required: false + description: | + Optional. Default is 0 minutes. + + Additional transfer time reserved for each transfer in minutes. + schema: + type: integer + default: 0 + + - name: transferTimeFactor + in: query + required: false + description: | + Optional. Default is 1.0 + + Factor to multiply minimum required transfer times with. + Values smaller than 1.0 are not supported. + schema: + type: number + default: 1.0 + + - name: maxMatchingDistance + in: query + required: false + description: | + Optional. Default is 25 meters. + + Maximum matching distance in meters to match geo coordinates to the street network. + schema: + type: number + default: 25 + + - name: useRoutedTransfers + in: query + required: false + description: | + Optional. Default is `false`. + + Whether to use transfers routed on OpenStreetMap data. + schema: + type: boolean + default: false + - name: pedestrianProfile + in: query + required: false + description: | + Optional. Default is `FOOT`. + + Accessibility profile to use for pedestrian routing in transfers + between transit connections and the first and last mile respectively. + schema: + $ref: "#/components/schemas/PedestrianProfile" + default: FOOT + + - name: elevationCosts + in: query + required: false + description: | + 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` + schema: + $ref: "#/components/schemas/ElevationCosts" + default: NONE + + - name: transitModes + in: query + required: false + description: | + 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`. + schema: + default: + - TRANSIT + type: array + items: + $ref: "#/components/schemas/Mode" + explode: false + + - name: preTransitModes + in: query + required: false + description: | + 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`. + schema: + default: + - WALK + type: array + items: + $ref: "#/components/schemas/Mode" + explode: false + + - name: postTransitModes + in: query + required: false + description: | + 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`. + schema: + default: + - WALK + type: array + items: + $ref: "#/components/schemas/Mode" + explode: false + + - name: requireBikeTransport + in: query + required: false + schema: + type: boolean + default: false + description: | + Optional. Default is `false`. + + If set to `true`, all used transit trips are required to allow bike carriage. + + - name: maxPreTransitTime + in: query + required: false + description: | + 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. + schema: + type: integer + default: 900 + minimum: 0 + + - name: maxPostTransitTime + in: query + required: false + description: | + 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 + schema: + type: integer + default: 900 + minimum: 0 + + responses: + 200: + description: | + The starting position and a list of all reachable stops + If no paths are found, the reachable list is empty. + content: + application/json: + schema: + $ref: "#/components/schemas/Reachable" + + /api/v1/reverse-geocode: + get: + tags: + - geocode + summary: Translate coordinates to the closest address(es)/places/stops. + operationId: reverseGeocode + parameters: + - name: place + in: query + required: true + description: latitude, longitude in degrees + schema: + type: string + - name: type + in: query + required: false + description: | + 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. + schema: + $ref: "#/components/schemas/LocationType" + responses: + 200: + description: A list of guesses to resolve the coordinates to a location + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Match" + + /api/v1/geocode: + get: + tags: + - geocode + summary: Autocompletion & geocoding that resolves user input addresses including coordinates + operationId: geocode + parameters: + - name: text + in: query + required: true + description: the (potentially partially typed) address to resolve + schema: + type: string + + - name: language + in: query + required: false + description: | + language tags as used in OpenStreetMap + (usually ISO 639-1, or ISO 639-2 if there's no ISO 639-1) + schema: + type: string + + - name: type + in: query + required: false + description: | + 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. + schema: + $ref: "#/components/schemas/LocationType" + + - name: place + in: query + required: false + description: | + Optional. Used for biasing results towards the coordinate. + + Format: latitude,longitude in degrees + schema: + type: string + + - name: placeBias + in: query + required: false + description: | + Optional. Used for biasing results towards the coordinate. Higher number = higher bias. + schema: + type: number + default: 1 + + responses: + 200: + description: A list of guesses to resolve the text to a location + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Match" + + /api/v2/trip: + get: + tags: + - timetable + summary: Get a trip as itinerary + operationId: trip + parameters: + - name: tripId + in: query + schema: + type: string + required: true + description: trip identifier (e.g. from an itinerary leg or stop event) + responses: + 200: + description: the requested trip as itinerary + content: + application/json: + schema: + $ref: "#/components/schemas/Itinerary" + + /api/v1/stoptimes: + get: + tags: + - timetable + summary: Get the next N departures or arrivals of a stop sorted by time + operationId: stoptimes + parameters: + - name: stopId + in: query + schema: + type: string + required: true + description: stop id of the stop to retrieve departures/arrivals for + + - name: time + in: query + required: false + description: | + Optional. Defaults to the current time. + schema: + type: string + format: date-time + + - name: arriveBy + in: query + required: false + schema: + type: boolean + default: false + description: | + 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 + + - name: direction + in: query + required: false + schema: + type: string + enum: + - EARLIER + - LATER + description: | + 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. + + - name: mode + in: query + schema: + type: array + items: + $ref: "#/components/schemas/Mode" + default: + - TRANSIT + description: | + Optional. Default is all transit modes. + + Only return arrivals/departures of the given modes. + + - name: n + in: query + schema: + type: integer + required: true + description: the number of events + + - name: radius + in: query + schema: + type: integer + required: false + description: | + 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. + + - name: pageCursor + in: query + required: false + description: | + 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. + schema: + type: string + responses: + 200: + description: A list of departures/arrivals + content: + application/json: + schema: + type: object + required: + - stopTimes + - previousPageCursor + - nextPageCursor + properties: + stopTimes: + description: list of stop times + type: array + items: + $ref: "#/components/schemas/StopTime" + previousPageCursor: + description: | + 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. + type: string + nextPageCursor: + description: | + 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. + type: string + + /api/v1/map/trips: + get: + tags: + - map + operationId: trips + summary: | + Given a area frame (box defined by top right and bottom left corner) and a time frame, + it returns all trips and their respective shapes that operate in this area + time frame. + Trips are filtered by zoom level. On low zoom levels, only long distance trains will be shown + while on high zoom levels, also metros, buses and trams will be returned. + parameters: + - name: zoom + in: query + required: true + description: current zoom level + schema: + type: number + - name: min + in: query + required: true + description: latitude,longitude pair of the lower right coordinate + schema: + type: string + - name: max + in: query + required: true + description: latitude,longitude pair of the upper left coordinate + schema: + type: string + - name: startTime + in: query + required: true + description: start of the time window + schema: + type: string + format: date-time + - name: endTime + in: query + required: true + description: end if the time window + schema: + type: string + format: date-time + responses: + "200": + description: a list of trips + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/TripSegment" + + /api/v1/map/initial: + get: + tags: + - map + operationId: initial + summary: initial location to view the map at after loading based on where public transport should be visible + responses: + "200": + description: latitude, longitude and zoom level to set the map to + content: + application/json: + schema: + type: object + required: + - lat + - lon + - zoom + properties: + lat: + description: latitude + type: number + lon: + description: longitude + type: number + zoom: + description: zoom level + type: number + + /api/v1/map/stops: + get: + tags: + - map + summary: Get all stops for a map section + operationId: stops + parameters: + - name: min + in: query + required: true + description: latitude,longitude pair of the lower right coordinate + schema: + type: string + - name: max + in: query + required: true + description: latitude,longitude pair of the upper left coordinate + schema: + type: string + responses: + "200": + description: array of stop places in the selected map section + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Place" + + /api/v1/map/levels: + get: + tags: + - map + summary: Get all available levels for a map section + operationId: levels + parameters: + - name: min + in: query + required: true + description: latitude,longitude pair of the lower right coordinate + schema: + type: string + - name: max + in: query + required: true + description: latitude,longitude pair of the upper left coordinate + schema: + type: string + responses: + "200": + description: array of available levels + content: + application/json: + schema: + type: array + items: + type: number + + /api/debug/footpaths: + get: + tags: + - debug + summary: Prints all footpaths of a timetable location (track, bus stop, etc.) + operationId: footpaths + parameters: + - name: id + in: query + required: true + description: location id + schema: + type: string + responses: + "200": + description: list of outgoing footpaths of this location + content: + application/json: + schema: + type: object + required: + - place + - footpaths + properties: + place: + $ref: "#/components/schemas/Place" + footpaths: + description: all outgoing footpaths of this location + type: array + items: + $ref: "#/components/schemas/Footpath" + +components: + schemas: + AlertCause: + description: Cause of this alert. + type: string + enum: + - UNKNOWN_CAUSE + - OTHER_CAUSE + - TECHNICAL_PROBLEM + - STRIKE + - DEMONSTRATION + - ACCIDENT + - HOLIDAY + - WEATHER + - MAINTENANCE + - CONSTRUCTION + - POLICE_ACTIVITY + - MEDICAL_EMERGENCY + + AlertEffect: + description: The effect of this problem on the affected entity. + type: string + enum: + - NO_SERVICE + - REDUCED_SERVICE + - SIGNIFICANT_DELAYS + - DETOUR + - ADDITIONAL_SERVICE + - MODIFIED_SERVICE + - OTHER_EFFECT + - UNKNOWN_EFFECT + - STOP_MOVED + - NO_EFFECT + - ACCESSIBILITY_ISSUE + + AlertSeverityLevel: + description: The severity of the alert. + type: string + enum: + - UNKNOWN_SEVERITY + - INFO + - WARNING + - SEVERE + + TimeRange: + description: | + 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: object + properties: + start: + description: | + 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. + type: string + format: date-time + end: + description: | + 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. + type: string + format: date-time + + Alert: + description: An alert, indicating some sort of incident in the public transit network. + type: object + required: + - headerText + - descriptionText + properties: + communicationPeriod: + description: | + 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. + type: array + items: + $ref: "#/components/schemas/TimeRange" + impactPeriod: + description: Time when the services are affected by the disruption mentioned in the alert. + type: array + items: + $ref: "#/components/schemas/TimeRange" + cause: + $ref: "#/components/schemas/AlertCause" + causeDetail: + type: string + description: | + Description of the cause of the alert that allows for agency-specific language; + more specific than the Cause. + effect: + $ref: "#/components/schemas/AlertEffect" + effectDetail: + type: string + description: | + Description of the effect of the alert that allows for agency-specific language; + more specific than the Effect. + url: + type: string + description: The URL which provides additional information about the alert. + headerText: + type: string + description: | + Header for the alert. This plain-text string will be highlighted, for example in boldface. + descriptionText: + type: string + description: | + 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. + ttsHeaderText: + type: string + description: | + 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.) + ttsDescriptionText: + type: string + description: | + 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.) + severityLevel: + description: Severity of the alert. + $ref: "#/components/schemas/AlertSeverityLevel" + imageUrl: + description: String containing an URL linking to an image. + type: string + imageMediaType: + description: | + IANA media type as to specify the type of image to be displayed. The type must start with "image/" + type: string + imageAlternativeText: + description: | + 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. + type: string + + Duration: + description: Object containing duration if a path was found or none if no path was found + type: object + properties: + duration: + type: number + description: duration in seconds if a path was found, otherwise missing + + Area: + description: Administrative area + type: object + required: + - name + - adminLevel + - matched + properties: + name: + type: string + description: Name of the area + adminLevel: + type: number + description: | + [OpenStreetMap `admin_level`](https://wiki.openstreetmap.org/wiki/Key:admin_level) + of the area + matched: + type: boolean + description: Whether this area was matched by the input text + unique: + type: boolean + description: | + 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]). + default: + type: boolean + description: Whether this area should be displayed as default area (area with admin level closest 7) + + Token: + description: Matched token range (from index, length) + type: array + minItems: 2 + maxItems: 2 + items: + type: number + + LocationType: + description: location type + type: string + enum: + - ADDRESS + - PLACE + - STOP + + Match: + description: GeoCoding match + type: object + required: + - type + - name + - id + - lat + - lon + - tokens + - areas + - score + properties: + type: + $ref: "#/components/schemas/LocationType" + tokens: + description: list of non-overlapping tokens that were matched + type: array + items: + $ref: "#/components/schemas/Token" + name: + description: name of the location (transit stop / PoI / address) + type: string + id: + description: unique ID of the location + type: string + lat: + description: latitude + type: number + lon: + description: longitude + type: number + level: + description: | + level according to OpenStreetMap + (at the moment only for public transport) + type: number + street: + description: street name + type: string + houseNumber: + description: house number + type: string + zip: + description: zip code + type: string + areas: + description: list of areas + type: array + items: + $ref: "#/components/schemas/Area" + score: + description: score according to the internal scoring system (the scoring algorithm might change in the future) + type: number + + ElevationCosts: + description: | + 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: string + enum: + - NONE + - LOW + - HIGH + + PedestrianProfile: + description: Different accessibility profiles for pedestrians. + type: string + enum: + - FOOT + - WHEELCHAIR + + Mode: + description: | + # 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: string + enum: + # === Street === + - WALK + - BIKE + - RENTAL + - CAR + - CAR_PARKING + - ODM + # === Transit === + - TRANSIT + - TRAM + - SUBWAY + - FERRY + - AIRPLANE + - METRO + - BUS + - COACH + - RAIL + - HIGHSPEED_RAIL + - LONG_DISTANCE + - NIGHT_RAIL + - REGIONAL_FAST_RAIL + - REGIONAL_RAIL + - OTHER + + VertexType: + type: string + description: | + - `NORMAL` - latitude / longitude coordinate or address + - `BIKESHARE` - bike sharing station + - `TRANSIT` - transit stop + enum: + - NORMAL + - BIKESHARE + - TRANSIT + + PickupDropoffType: + type: string + description: | + - `NORMAL` - entry/exit is possible normally + - `NOT_ALLOWED` - entry/exit is not allowed + enum: + - NORMAL + - NOT_ALLOWED + + Place: + type: object + required: + - name + - lat + - lon + - level + properties: + name: + description: name of the transit stop / PoI / address + type: string + stopId: + description: The ID of the stop. This is often something that users don't care about. + type: string + lat: + description: latitude + type: number + lon: + description: longitude + type: number + level: + description: level according to OpenStreetMap + type: number + arrival: + description: arrival time + type: string + format: date-time + departure: + description: departure time + type: string + format: date-time + scheduledArrival: + description: scheduled arrival time + type: string + format: date-time + scheduledDeparture: + description: scheduled departure time + type: string + format: date-time + scheduledTrack: + description: scheduled track from the static schedule timetable dataset + type: string + track: + description: | + 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. + type: string + vertexType: + $ref: "#/components/schemas/VertexType" + pickupType: + description: Type of pickup. It could be disallowed due to schedule, skipped stops or cancellations. + $ref: "#/components/schemas/PickupDropoffType" + dropoffType: + description: Type of dropoff. It could be disallowed due to schedule, skipped stops or cancellations. + $ref: "#/components/schemas/PickupDropoffType" + cancelled: + description: Whether this stop is cancelled due to the realtime situation. + type: boolean + alerts: + description: Alerts for this stop. + type: array + items: + $ref: "#/components/schemas/Alert" + + ReachablePlace: + description: Place reachable by One-to-All + type: object + properties: + place: + $ref: "#/components/schemas/Place" + description: Place reached by One-to-All + duration: + type: integer + description: Total travel duration + k: + type: integer + description: | + 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 + + Reachable: + description: Object containing all reachable places by One-to-All search + type: object + properties: + one: + $ref: "#/components/schemas/Place" + description: One location used in One-to-All search + all: + description: List of locations reachable by One-to-All + type: array + items: + $ref: "#/components/schemas/ReachablePlace" + + StopTime: + description: departure or arrival event at a stop + type: object + required: + - place + - mode + - realTime + - headsign + - agencyId + - agencyName + - agencyUrl + - tripId + - routeShortName + - pickupDropoffType + - cancelled + - source + properties: + place: + $ref: "#/components/schemas/Place" + description: information about the stop place and time + mode: + $ref: "#/components/schemas/Mode" + description: Transport mode for this leg + realTime: + description: Whether there is real-time data about this leg + type: boolean + headsign: + description: | + For transit legs, the headsign of the bus or train being used. + For non-transit legs, null + type: string + agencyId: + type: string + agencyName: + type: string + agencyUrl: + type: string + routeColor: + type: string + routeTextColor: + type: string + tripId: + type: string + routeShortName: + type: string + pickupDropoffType: + description: Type of pickup (for departures) or dropoff (for arrivals), may be disallowed either due to schedule, skipped stops or cancellations + $ref: "#/components/schemas/PickupDropoffType" + cancelled: + description: Whether the departure/arrival is cancelled due to the realtime situation. + type: boolean + source: + description: Filename and line number where this trip is from + type: string + + TripInfo: + description: trip id and name + type: object + required: + - tripId + - routeShortName + properties: + tripId: + description: trip ID (dataset trip id prefixed with the dataset tag) + type: string + routeShortName: + description: trip display name + type: string + + TripSegment: + description: trip segment between two stops to show a trip on a map + type: object + required: + - trips + - mode + - distance + - from + - to + - departure + - arrival + - scheduledArrival + - scheduledDeparture + - realTime + - polyline + properties: + trips: + type: array + items: + $ref: "#/components/schemas/TripInfo" + routeColor: + type: string + mode: + $ref: "#/components/schemas/Mode" + description: Transport mode for this leg + distance: + type: number + description: distance in meters + from: + $ref: "#/components/schemas/Place" + to: + $ref: "#/components/schemas/Place" + departure: + description: departure time + type: string + format: date-time + arrival: + description: arrival time + type: string + format: date-time + scheduledDeparture: + description: scheduled departure time + type: string + format: date-time + scheduledArrival: + description: scheduled arrival time + type: string + format: date-time + realTime: + description: Whether there is real-time data about this leg + type: boolean + polyline: + description: Google polyline encoded coordinate sequence (with precision 5) where the trip travels on this segment. + type: string + + Direction: + type: string + enum: + - DEPART + - HARD_LEFT + - LEFT + - SLIGHTLY_LEFT + - CONTINUE + - SLIGHTLY_RIGHT + - RIGHT + - HARD_RIGHT + - CIRCLE_CLOCKWISE + - CIRCLE_COUNTERCLOCKWISE + - STAIRS + - ELEVATOR + - UTURN_LEFT + - UTURN_RIGHT + + EncodedPolyline: + type: object + required: + - points + - precision + - length + properties: + points: + description: The encoded points of the polyline using the Google polyline encoding. + type: string + precision: + description: | + 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. + type: integer + length: + description: The number of points in the string + type: integer + minimum: 0 + + StepInstruction: + type: object + required: + - fromLevel + - toLevel + - polyline + - relativeDirection + - distance + - streetName + - exit + - stayOn + - area + properties: + relativeDirection: + $ref: "#/components/schemas/Direction" + distance: + description: The distance in meters that this step takes. + type: number + fromLevel: + description: level where this segment starts, based on OpenStreetMap data + type: number + toLevel: + description: level where this segment starts, based on OpenStreetMap data + type: number + osmWay: + description: OpenStreetMap way index + type: integer + polyline: + $ref: "#/components/schemas/EncodedPolyline" + streetName: + description: The name of the street. + type: string + exit: + description: | + Not implemented! + When exiting a highway or traffic circle, the exit name/number. + type: string + stayOn: + description: | + Not implemented! + Indicates whether or not a street changes direction at an intersection. + type: boolean + area: + description: | + 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" + type: boolean + + RentalFormFactor: + type: string + enum: + - BICYCLE + - CARGO_BICYCLE + - CAR + - MOPED + - SCOOTER_STANDING + - SCOOTER_SEATED + - OTHER + + RentalPropulsionType: + type: string + enum: + - HUMAN + - ELECTRIC_ASSIST + - ELECTRIC + - COMBUSTION + - COMBUSTION_DIESEL + - HYBRID + - PLUG_IN_HYBRID + - HYDROGEN_FUEL_CELL + + RentalReturnConstraint: + type: string + enum: + - NONE + - ANY_STATION + - ROUNDTRIP_STATION + + Rental: + description: Vehicle rental + type: object + required: + - systemId + properties: + systemId: + type: string + description: Vehicle share system ID + systemName: + type: string + description: Vehicle share system name + url: + type: string + description: URL of the vehicle share system + stationName: + type: string + description: Name of the station + fromStationName: + type: string + description: Name of the station where the vehicle is picked up (empty for free floating vehicles) + toStationName: + type: string + description: Name of the station where the vehicle is returned (empty for free floating vehicles) + rentalUriAndroid: + type: string + description: Rental URI for Android (deep link to the specific station or vehicle) + rentalUriIOS: + type: string + description: Rental URI for iOS (deep link to the specific station or vehicle) + rentalUriWeb: + type: string + description: Rental URI for web (deep link to the specific station or vehicle) + formFactor: + $ref: "#/components/schemas/RentalFormFactor" + propulsionType: + $ref: "#/components/schemas/RentalPropulsionType" + returnConstraint: + $ref: "#/components/schemas/RentalReturnConstraint" + + Leg: + type: object + required: + - mode + - startTime + - endTime + - scheduledStartTime + - scheduledEndTime + - realTime + - scheduled + - duration + - from + - to + - legGeometry + properties: + mode: + $ref: "#/components/schemas/Mode" + description: Transport mode for this leg + from: + $ref: "#/components/schemas/Place" + to: + $ref: "#/components/schemas/Place" + duration: + description: | + 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. + type: integer + startTime: + type: string + format: date-time + description: leg departure time + endTime: + type: string + format: date-time + description: leg arrival time + scheduledStartTime: + type: string + format: date-time + description: scheduled leg departure time + scheduledEndTime: + type: string + format: date-time + description: scheduled leg arrival time + realTime: + description: Whether there is real-time data about this leg + type: boolean + scheduled: + description: | + Whether this leg was originally scheduled to run or is an additional service. + Scheduled times will equal realtime times in this case. + type: boolean + distance: + description: For non-transit legs the distance traveled while traversing this leg in meters. + type: number + interlineWithPreviousLeg: + description: For transit legs, if the rider should stay on the vehicle as it changes route names. + type: boolean + headsign: + description: | + For transit legs, the headsign of the bus or train being used. + For non-transit legs, null + type: string + routeColor: + type: string + routeTextColor: + type: string + routeType: + type: string + agencyName: + type: string + agencyUrl: + type: string + agencyId: + type: string + tripId: + type: string + routeShortName: + type: string + cancelled: + description: Whether this trip is cancelled + type: boolean + source: + description: Filename and line number where this trip is from + type: string + intermediateStops: + description: | + For transit legs, intermediate stops between the Place where the leg originates + and the Place where the leg ends. For non-transit legs, null. + type: array + items: + $ref: "#/components/schemas/Place" + legGeometry: + $ref: "#/components/schemas/EncodedPolyline" + steps: + description: | + A series of turn by turn instructions + used for walking, biking and driving. + type: array + items: + $ref: "#/components/schemas/StepInstruction" + rental: + $ref: "#/components/schemas/Rental" + fareTransferIndex: + type: integer + description: | + Index into `Itinerary.fareTransfers` array + to identify which fare transfer this leg belongs to + effectiveFareLegIndex: + type: integer + description: | + Index into the `Itinerary.fareTransfers[fareTransferIndex].effectiveFareLegProducts` array + to identify which effective fare leg this itinerary leg belongs to + alerts: + description: Alerts for this stop. + type: array + items: + $ref: "#/components/schemas/Alert" + + RiderCategory: + type: object + required: + - riderCategoryName + - isDefaultFareCategory + properties: + riderCategoryName: + description: Rider category name as displayed to the rider. + type: string + isDefaultFareCategory: + description: Specifies if this category should be considered the default (i.e. the main category displayed to riders). + type: boolean + eligibilityUrl: + description: URL to a web page providing detailed information about the rider category and/or its eligibility criteria. + type: string + + FareMediaType: + type: string + enum: + [ + "NONE", + "PAPER_TICKET", + "TRANSIT_CARD", + "CONTACTLESS_EMV", + "MOBILE_APP", + ] + enumDescriptions: + NONE: No fare media involved (e.g., cash payment) + PAPER_TICKET: Physical paper ticket + TRANSIT_CARD: Physical transit card with stored value + CONTACTLESS_EMV: cEMV (contactless payment) + MOBILE_APP: Mobile app with virtual transit cards/passes + + FareMedia: + type: object + required: + - fareMediaType + properties: + fareMediaName: + description: Name of the fare media. Required for transit cards and mobile apps. + type: string + fareMediaType: + description: The type of fare media. + $ref: "#/components/schemas/FareMediaType" + + FareProduct: + type: object + required: + - name + - amount + - currency + properties: + name: + description: The name of the fare product as displayed to riders. + type: string + amount: + description: The cost of the fare product. May be negative to represent transfer discounts. May be zero to represent a fare product that is free. + type: number + currency: + description: ISO 4217 currency code. The currency of the cost of the fare product. + type: string + riderCategory: + $ref: "#/components/schemas/RiderCategory" + media: + $ref: "#/components/schemas/FareMedia" + + FareTransferRule: + type: string + enum: + - A_AB + - A_AB_B + - AB + + FareTransfer: + type: object + description: | + 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. + required: + - effectiveFareLegProducts + properties: + rule: + $ref: "#/components/schemas/FareTransferRule" + transferProduct: + $ref: "#/components/schemas/FareProduct" + effectiveFareLegProducts: + description: | + 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) + + type: array + items: + type: array + items: + $ref: "#/components/schemas/FareProduct" + + Itinerary: + type: object + required: + - duration + - startTime + - endTime + - transfers + - legs + properties: + duration: + description: journey duration in seconds + type: integer + startTime: + type: string + format: date-time + description: journey departure time + endTime: + type: string + format: date-time + description: journey arrival time + transfers: + type: integer + description: The number of transfers this trip has. + legs: + description: Journey legs + type: array + items: + $ref: "#/components/schemas/Leg" + fareTransfers: + description: Fare information + type: array + items: + $ref: "#/components/schemas/FareTransfer" + + Footpath: + description: footpath from one location to another + type: object + required: + - to + properties: + to: + $ref: "#/components/schemas/Place" + default: + type: number + description: | + optional; missing if the GTFS did not contain a footpath + footpath duration in minutes according to GTFS (+heuristics) + foot: + type: number + description: | + optional; missing if no path was found (timetable / osr) + footpath duration in minutes for the foot profile + footRouted: + type: number + description: | + optional; missing if no path was found with foot routing + footpath duration in minutes for the foot profile + wheelchair: + type: number + description: | + optional; missing if no path was found with the wheelchair profile + footpath duration in minutes for the wheelchair profile + wheelchairRouted: + type: number + description: | + optional; missing if no path was found with the wheelchair profile + footpath duration in minutes for the wheelchair profile + wheelchairUsesElevator: + type: boolean + description: | + optional; missing if no path was found with the wheelchair profile + true if the wheelchair path uses an elevator