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

68 lines
1.8 KiB
Go

/*
* 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{}{
"user": obj.User,
"destination_address": obj.DestinationAddress,
"destination_latitude": obj.DestinationLatitude,
"destination_longitude": obj.DestinationLongitude,
"departure_address": obj.DepartureAddress,
"departure_latitude": obj.DepartureLatitude,
"departure_longitude": obj.DepartureLongitude,
"departure_date": obj.DepartureDate,
}
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
}