52 lines
1.6 KiB
Go
52 lines
1.6 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 DriverJourney struct {
|
|
User User `json:"user"`
|
|
|
|
Car Car `json:"car,omitempty"`
|
|
RegularAvailabilitySlot []RegularAvailabilitySlot `json:"regular_availabilities,omitempty"`
|
|
PunctualAvailabilitySlot []PunctualAvailabilitySlot `json:"punctual_availabilities,omitempty"`
|
|
// Driver departure datetime as a UNIX UTC timestamp in seconds.
|
|
DriverDepartureDate int64 `json:"driver_departure_Date"`
|
|
DriverDepartureAddress string `json:"driver_departure_Address,omitempty"`
|
|
Price Price `json:"price,omitempty"`
|
|
}
|
|
|
|
// AssertDriverJourneyRequired checks if the required fields are not zero-ed
|
|
func AssertDriverJourneyRequired(obj DriverJourney) error {
|
|
elements := map[string]interface{}{
|
|
"user": obj.User,
|
|
"driverDepartureDate": obj.DriverDepartureDate,
|
|
}
|
|
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 := AssertCarRequired(obj.Car); err != nil {
|
|
return err
|
|
}
|
|
if err := AssertPriceRequired(obj.Price); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// AssertDriverJourneyConstraints checks if the values respects the defined constraints
|
|
func AssertDriverJourneyConstraints(obj DriverJourney) error {
|
|
return nil
|
|
}
|