solidarity-service/interoperability/solidarity-api/server/openapi/model_passenger_trip_reques...

64 lines
1.9 KiB
Go
Raw Normal View History

2023-10-20 11:41:39 +00:00
/*
* Solidarity Mobility API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type PassengerTripRequest struct {
User User `json:"user"`
DestinationAddress string `json:"destination_address"`
DestinationLatitude float64 `json:"destination_latitude"`
DestinationLongitude float64 `json:"destination_longitude"`
DepartureAddress string `json:"departure_address"`
DepartureLatitude float64 `json:"departure_latitude"`
DepartureLongitude float64 `json:"departure_longitude"`
// Departure datetime using a UNIX UTC timestamp in seconds.
DepartureDate int32 `json:"departure_date"`
Preferences Preferences `json:"preferences,omitempty"`
}
// AssertPassengerTripRequestRequired checks if the required fields are not zero-ed
func AssertPassengerTripRequestRequired(obj PassengerTripRequest) error {
elements := map[string]interface{}{
2023-10-20 11:47:51 +00:00
"user": obj.User,
"destination_address": obj.DestinationAddress,
"destination_latitude": obj.DestinationLatitude,
2023-10-20 11:41:39 +00:00
"destination_longitude": obj.DestinationLongitude,
2023-10-20 11:47:51 +00:00
"departure_address": obj.DepartureAddress,
"departure_latitude": obj.DepartureLatitude,
"departure_longitude": obj.DepartureLongitude,
"departure_date": obj.DepartureDate,
2023-10-20 11:41:39 +00:00
}
for name, el := range elements {
if isZero := IsZeroValue(el); isZero {
return &RequiredError{Field: name}
}
}
if err := AssertUserRequired(obj.User); err != nil {
return err
}
if err := AssertPreferencesRequired(obj.Preferences); err != nil {
return err
}
return nil
}
// AssertPassengerTripRequestConstraints checks if the values respects the defined constraints
func AssertPassengerTripRequestConstraints(obj PassengerTripRequest) error {
return nil
}