/
v3_departure.go
116 lines (86 loc) · 3.39 KB
/
v3_departure.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// V3Departure v3 departure
// swagger:model V3.Departure
type V3Departure struct {
// Indicates if the metropolitan train service is at the platform at the time of query; returns false for other modes
AtPlatform bool `json:"at_platform,omitempty"`
// Chronological sequence of the departure for the run on the route. Order ascendingly by this field to get chronological order (earliest first) of departures with the same route_id and run_id.
DepartureSequence int32 `json:"departure_sequence,omitempty"`
// Direction of travel identifier
DirectionID int32 `json:"direction_id,omitempty"`
// Disruption information identifier(s)
DisruptionIds []int64 `json:"disruption_ids"`
// Real-time estimate of departure time and date in ISO 8601 UTC format
// Format: date-time
EstimatedDepartureUtc strfmt.DateTime `json:"estimated_departure_utc,omitempty"`
// Flag indicating special condition for run (e.g. RR Reservations Required, GC Guaranteed Connection, DOO Drop Off Only, PUO Pick Up Only, MO Mondays only, TU Tuesdays only, WE Wednesdays only, TH Thursdays only, FR Fridays only, SS School days only; ignore E flag)
Flags string `json:"flags,omitempty"`
// Platform number at stop (metropolitan train only; returns null for other modes)
PlatformNumber string `json:"platform_number,omitempty"`
// Route identifier
RouteID int32 `json:"route_id,omitempty"`
// Trip/service run identifier
RunID int32 `json:"run_id,omitempty"`
// Scheduled (i.e. timetabled) departure time and date in ISO 8601 UTC format
// Format: date-time
ScheduledDepartureUtc strfmt.DateTime `json:"scheduled_departure_utc,omitempty"`
// Stop identifier
StopID int32 `json:"stop_id,omitempty"`
}
// Validate validates this v3 departure
func (m *V3Departure) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEstimatedDepartureUtc(formats); err != nil {
res = append(res, err)
}
if err := m.validateScheduledDepartureUtc(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *V3Departure) validateEstimatedDepartureUtc(formats strfmt.Registry) error {
if swag.IsZero(m.EstimatedDepartureUtc) { // not required
return nil
}
if err := validate.FormatOf("estimated_departure_utc", "body", "date-time", m.EstimatedDepartureUtc.String(), formats); err != nil {
return err
}
return nil
}
func (m *V3Departure) validateScheduledDepartureUtc(formats strfmt.Registry) error {
if swag.IsZero(m.ScheduledDepartureUtc) { // not required
return nil
}
if err := validate.FormatOf("scheduled_departure_utc", "body", "date-time", m.ScheduledDepartureUtc.String(), formats); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *V3Departure) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *V3Departure) UnmarshalBinary(b []byte) error {
var res V3Departure
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}