Add MOTIS server
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
5
libs/transit/motis/cfg.yaml
Normal file
5
libs/transit/motis/cfg.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
package: motis
|
||||
generate:
|
||||
client: true
|
||||
models: true
|
||||
output: gen.go
|
||||
4238
libs/transit/motis/gen.go
Normal file
4238
libs/transit/motis/gen.go
Normal file
File diff suppressed because it is too large
Load Diff
3
libs/transit/motis/motis.go
Normal file
3
libs/transit/motis/motis.go
Normal file
@@ -0,0 +1,3 @@
|
||||
package motis
|
||||
|
||||
//go:generate go tool oapi-codegen -config cfg.yaml openapi.yaml
|
||||
2437
libs/transit/motis/openapi.yaml
Normal file
2437
libs/transit/motis/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user