Documentation
¶
Index ¶
- Variables
- type Alert
- type AlertActivePeriod
- type AlertActivityType
- type AlertCauseType
- type AlertEffectType
- type AlertInclude
- type AlertInformedEntity
- type AlertLifecycleType
- type AlertService
- func (s *AlertService) GetAlert(id string, config *GetAlertRequestConfig) (*Alert, *http.Response, error)
- func (s *AlertService) GetAlertWithContext(ctx context.Context, id string, config *GetAlertRequestConfig) (*Alert, *http.Response, error)
- func (s *AlertService) GetAllAlerts(config *GetAllAlertsRequestConfig) ([]*Alert, *http.Response, error)
- func (s *AlertService) GetAllAlertsWithContext(ctx context.Context, config *GetAllAlertsRequestConfig) ([]*Alert, *http.Response, error)
- type AlertsSortByType
- type BadRequestError
- type BikesAllowedType
- type Client
- type ClientConfig
- type FacilitiesSortByType
- type Facility
- type FacilityInclude
- type FacilityProperty
- type FacilityService
- func (s *FacilityService) GetAllFacilities(config *GetAllFacilitiesRequestConfig) ([]*Facility, *http.Response, error)
- func (s *FacilityService) GetAllFacilitiesWithContext(ctx context.Context, config *GetAllFacilitiesRequestConfig) ([]*Facility, *http.Response, error)
- func (s *FacilityService) GetFacility(id string, config *GetFacilityRequestConfig) (*Facility, *http.Response, error)
- func (s *FacilityService) GetFacilityWithContext(ctx context.Context, id string, config *GetFacilityRequestConfig) (*Facility, *http.Response, error)
- type FacilityType
- type GetAlertRequestConfig
- type GetAllAlertsRequestConfig
- type GetAllFacilitiesRequestConfig
- type GetAllLinesRequestConfig
- type GetAllPredictionsRequestConfig
- type GetAllRoutePatternsRequestConfig
- type GetAllRoutesRequestConfig
- type GetAllSchedulesRequestConfig
- type GetAllServicesRequestConfig
- type GetAllShapesRequestConfig
- type GetAllStopsRequestConfig
- type GetAllTripsRequestConfig
- type GetAllVehiclesRequestConfig
- type GetFacilityRequestConfig
- type GetLineRequestConfig
- type GetRoutePatternRequestConfig
- type GetRouteRequestConfig
- type GetServiceRequestConfig
- type GetShapeRequestConfig
- type GetStopRequestConfig
- type GetTripRequestConfig
- type GetVehicleRequestConfig
- type JSONURL
- type Line
- type LineInclude
- type LineService
- func (s *LineService) GetAllLines(config *GetAllLinesRequestConfig) ([]*Line, *http.Response, error)
- func (s *LineService) GetAllLinesWithContext(ctx context.Context, config *GetAllLinesRequestConfig) ([]*Line, *http.Response, error)
- func (s *LineService) GetLine(id string, config *GetLineRequestConfig) (*Line, *http.Response, error)
- func (s *LineService) GetLineWithContext(ctx context.Context, id string, config *GetLineRequestConfig) (*Line, *http.Response, error)
- type LinesSortByType
- type Prediction
- type PredictionInclude
- type PredictionScheduleRelationshipType
- type PredictionService
- type PredictionsSortByType
- type Route
- type RouteInclude
- type RoutePattern
- type RoutePatternInclude
- type RoutePatternTypicalityType
- type RoutePatternsService
- func (s *RoutePatternsService) GetAllRoutePatterns(config *GetAllRoutePatternsRequestConfig) ([]*RoutePattern, *http.Response, error)
- func (s *RoutePatternsService) GetAllRoutePatternsWithContext(ctx context.Context, config *GetAllRoutePatternsRequestConfig) ([]*RoutePattern, *http.Response, error)
- func (s *RoutePatternsService) GetRoutePattern(id string, config *GetRoutePatternRequestConfig) (*RoutePattern, *http.Response, error)
- func (s *RoutePatternsService) GetRoutePatternWithContext(ctx context.Context, id string, config *GetRoutePatternRequestConfig) (*RoutePattern, *http.Response, error)
- type RoutePatternsSortByType
- type RouteService
- func (s *RouteService) GetAllRoutes(config *GetAllRoutesRequestConfig) ([]*Route, *http.Response, error)
- func (s *RouteService) GetAllRoutesWithContext(ctx context.Context, config *GetAllRoutesRequestConfig) ([]*Route, *http.Response, error)
- func (s *RouteService) GetRoute(id string, config *GetRouteRequestConfig) (*Route, *http.Response, error)
- func (s *RouteService) GetRouteWithContext(ctx context.Context, id string, config *GetRouteRequestConfig) (*Route, *http.Response, error)
- type RouteType
- type RoutesSortByType
- type Schedule
- type ScheduleInclude
- type SchedulePickupType
- type ScheduleService
- type ScheduleTimepoint
- type ScheduleTypicality
- type SchedulesSortByType
- type Service
- type ServicesService
- func (s *ServicesService) GetAllServices(config *GetAllServicesRequestConfig) ([]*Service, *http.Response, error)
- func (s *ServicesService) GetAllServicesWithContext(ctx context.Context, config *GetAllServicesRequestConfig) ([]*Service, *http.Response, error)
- func (s *ServicesService) GetService(id string, config *GetServiceRequestConfig) (*Service, *http.Response, error)
- func (s *ServicesService) GetServiceWithContext(ctx context.Context, id string, config *GetServiceRequestConfig) (*Service, *http.Response, error)
- type ServicesSortByType
- type Shape
- type ShapeInclude
- type ShapeService
- func (s *ShapeService) GetAllShapes(config *GetAllShapesRequestConfig) ([]*Shape, *http.Response, error)
- func (s *ShapeService) GetAllShapesWithContext(ctx context.Context, config *GetAllShapesRequestConfig) ([]*Shape, *http.Response, error)
- func (s *ShapeService) GetShape(id string, config *GetShapeRequestConfig) (*Shape, *http.Response, error)
- func (s *ShapeService) GetShapeWithContext(ctx context.Context, id string, config *GetShapeRequestConfig) (*Shape, *http.Response, error)
- type ShapesSortByType
- type Stop
- type StopInclude
- type StopLocationType
- type StopService
- func (s *StopService) GetAllStops(config *GetAllStopsRequestConfig) ([]*Stop, *http.Response, error)
- func (s *StopService) GetAllStopsWithContext(ctx context.Context, config *GetAllStopsRequestConfig) ([]*Stop, *http.Response, error)
- func (s *StopService) GetStop(id string, config *GetStopRequestConfig) (*Stop, *http.Response, error)
- func (s *StopService) GetStopWithContext(ctx context.Context, id string, config *GetStopRequestConfig) (*Stop, *http.Response, error)
- type StopsSortByType
- type TimeISO8601
- type Trip
- type TripInclude
- type TripService
- func (s *TripService) GetAllTrips(config GetAllTripsRequestConfig) ([]*Trip, *http.Response, error)
- func (s *TripService) GetAllTripsWithContext(ctx context.Context, config GetAllTripsRequestConfig) ([]*Trip, *http.Response, error)
- func (s *TripService) GetTrip(id string, config GetTripRequestConfig) (*Trip, *http.Response, error)
- func (s *TripService) GetTripWithContext(ctx context.Context, id string, config GetTripRequestConfig) (*Trip, *http.Response, error)
- type TripsSortByType
- type Vehicle
- type VehicleInclude
- type VehicleService
- func (s *VehicleService) GetAllVehicles(config *GetAllVehiclesRequestConfig) ([]*Vehicle, *http.Response, error)
- func (s *VehicleService) GetAllVehiclesWithContext(ctx context.Context, config *GetAllVehiclesRequestConfig) ([]*Vehicle, *http.Response, error)
- func (s *VehicleService) GetVehicle(id string, config *GetVehicleRequestConfig) (*Vehicle, *http.Response, error)
- func (s *VehicleService) GetVehicleWithContext(ctx context.Context, id string, config *GetVehicleRequestConfig) (*Vehicle, *http.Response, error)
- type VehicleStatus
- type VehiclesSortByType
- type Weekday
- type WheelchairBoardingType
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { ID string `jsonapi:"primary,alert"` URL *JSONURL `jsonapi:"attr,url"` // A URL for extra details, such as outline construction or maintenance plans UpdatedAt TimeISO8601 `jsonapi:"attr,updated_at"` // Date/Time alert last updated Timeframe *string `jsonapi:"attr,timeframe"` // Summarizes when an alert is in effect. ShortHeader string `jsonapi:"attr,short_header"` // A shortened version of */attributes/header. Severity int `jsonapi:"attr,severity"` // How severe the alert it from least (0) to most (10) severe. ServiceEffect string `jsonapi:"attr,service_effect"` // Summarizes the service and the impact to that service Lifecycle AlertLifecycleType `jsonapi:"attr,lifecycle"` // Identifies whether alert is a new or old, in effect or upcoming InformedEntity []AlertInformedEntity `jsonapi:"attr,informed_entity"` // Object representing a particular part of the system affected by an alert Header string `jsonapi:"attr,header"` // This plain-text string will be highlighted, for example in boldface Effect AlertEffectType `jsonapi:"attr,effect"` // The effect of this problem on the affected entity Description *string `jsonapi:"attr,description"` // This plain-text string will be formatted as the body of the alert (or shown on an explicit “expand” request by the user). The information in the description should add to the information of the header CreatedAt TimeISO8601 `jsonapi:"attr,created_at"` // Date/Time alert created Cause AlertCauseType `jsonapi:"attr,cause"` // What is causing the alert Banner *string `jsonapi:"attr,banner"` // Set if alert is meant to be displayed prominently, such as the top of every page ActivePeriod []AlertActivePeriod `jsonapi:"attr,active_period"` // Date/Time ranges when alert is active }
Alert holds all the info about a given MBTA Alert
type AlertActivePeriod ¶
type AlertActivePeriod struct { Start TimeISO8601 `json:"start"` // Start Date End *TimeISO8601 `json:"end"` // End Date }
AlertActivePeriod Date/Time ranges when alert is active
type AlertActivityType ¶
type AlertActivityType string
AlertActivityType An activity affected by an alert
const ( // AlertActivityBoard Boarding a vehicle. Any passenger trip includes boarding a vehicle and exiting from a vehicle AlertActivityBoard AlertActivityType = "BOARD" // AlertActivityBringingBike Bringing a bicycle while boarding or exiting AlertActivityBringingBike AlertActivityType = "BRINGING_BIKE" // AlertActivityExit Exiting from a vehicle (disembarking). Any passenger trip includes boarding a vehicle and exiting a vehicle AlertActivityExit AlertActivityType = "EXIT" // AlertActivityParkCar Parking a car at a garage or lot in a station AlertActivityParkCar AlertActivityType = "PARK_CAR" // AlertActivityRide Riding through a stop without boarding or exiting… Not every passenger trip will include this – a passenger may board at one stop and exit at the next stop AlertActivityRide AlertActivityType = "RIDE" // AlertActivityStoreBike Storing a bicycle at a station AlertActivityStoreBike AlertActivityType = "STORE_BIKE" // AlertActivityUsingEscalator Using an escalator while boarding or exiting (should only be used for customers who specifically want to avoid stairs.) AlertActivityUsingEscalator AlertActivityType = "USING_ESCALATOR" // AlertActivityUsingWheelchair Using a wheelchair while boarding or exiting. Note that this applies to something that specifically affects customers who use a wheelchair to board or exit; a delay should not include this as an affected activity unless it specifically affects customers using wheelchairs AlertActivityUsingWheelchair AlertActivityType = "USING_WHEELCHAIR" // AlertActivityFilterAll Filter by all Activities AlertActivityFilterAll AlertActivityType = "ALL" )
type AlertCauseType ¶
type AlertCauseType string
AlertCauseType What is causing the alert
const ( AlertCauseAccident AlertCauseType = "ACCIDENT" AlertCauseAmtrak AlertCauseType = "AMTRAK" AlertCauseAnEarlierMechanicalProblem AlertCauseType = "AN_EARLIER_MECHANICAL_PROBLEM" AlertCauseAnEarlierSignalProblem AlertCauseType = "AN_EARLIER_SIGNAL_PROBLEM" AlertCauseAutosImpedingService AlertCauseType = "AUTOS_IMPEDING_SERVICE" AlertCauseCoastGuardRestriction AlertCauseType = "COAST_GUARD_RESTRICTION" AlertCauseCongestion AlertCauseType = "CONGESTION" AlertCauseConstruction AlertCauseType = "CONSTRUCTION" AlertCauseCrossingMalfunction AlertCauseType = "CROSSING_MALFUNCTION" AlertCauseDemonstration AlertCauseType = "DEMONSTRATION" AlertCauseDisabledBus AlertCauseType = "DISABLED_BUS" AlertCauseDisabledTrain AlertCauseType = "DISABLED_TRAIN" AlertCauseDrawbridgeBeingRaised AlertCauseType = "DRAWBRIDGE_BEING_RAISED" AlertCauseElectricalWork AlertCauseType = "ELECTRICAL_WORK" AlertCauseFire AlertCauseType = "FIRE" AlertCauseFog AlertCauseType = "FOG" AlertCauseFreightTrainInterference AlertCauseType = "FREIGHT_TRAIN_INTERFERENCE" AlertCauseHazmatCondition AlertCauseType = "HAZMAT_CONDITION" AlertCauseHeavyRidership AlertCauseType = "HEAVY_RIDERSHIP" AlertCauseHighWinds AlertCauseType = "HIGH_WINDS" AlertCauseHoliday AlertCauseType = "HOLIDAY" AlertCauseHurricane AlertCauseType = "HURRICANE" AlertCauseIceInHarbor AlertCauseType = "ICE_IN_HARBOR" AlertCauseMaintenance AlertCauseType = "MAINTENANCE" AlertCauseMechanicalProblem AlertCauseType = "MECHANICAL_PROBLEM" AlertCauseMedicalEmergency AlertCauseType = "MEDICAL_EMERGENCY" AlertCauseParade AlertCauseType = "PARADE" AlertCausePoliceAction AlertCauseType = "POLICE_ACTION" AlertCausePowerProblem AlertCauseType = "POWER_PROBLEM" AlertCauseSevereWeather AlertCauseType = "SEVERE_WEATHER" AlertCauseSignalProblem AlertCauseType = "SIGNAL_PROBLEM" AlertCauseSlipperyRail AlertCauseType = "SLIPPERY_RAIL" AlertCauseSnow AlertCauseType = "SNOW" AlertCauseSpecialEvent AlertCauseType = "SPECIAL_EVENT" AlertCauseSpeedRestriction AlertCauseType = "SPEED_RESTRICTION" AlertCauseSwitchProblem AlertCauseType = "SWITCH_PROBLEM" AlertCauseTieReplacement AlertCauseType = "TIE_REPLACEMENT" AlertCauseTrackProblem AlertCauseType = "TRACK_PROBLEM" AlertCauseTrackWork AlertCauseType = "TRACK_WORK" AlertCauseTraffic AlertCauseType = "TRAFFIC" AlertCauseUnknownCause AlertCauseType = "UNKNOWN_CAUSE" AlertCauseUnrulyPassenger AlertCauseType = "UNRULY_PASSENGER" AlertCauseWeather AlertCauseType = "WEATHER" )
type AlertEffectType ¶
type AlertEffectType string
AlertEffectType The effect of this problem on the affected entity
const ( AlertEffectAccessIssue AlertEffectType = "ACCESS_ISSUE" AlertEffectAdditionalService AlertEffectType = "ADDITIONAL_SERVICE" AlertEffectAmberAlert AlertEffectType = "AMBER_ALERT" AlertEffectBikeIssue AlertEffectType = "BIKE_ISSUE" AlertEffectCancellation AlertEffectType = "CANCELLATION" AlertEffectDelay AlertEffectType = "DELAY" AlertEffectDetour AlertEffectType = "DETOUR" AlertEffectDockClosure AlertEffectType = "DOCK_CLOSURE" AlertEffectDockIssue AlertEffectType = "DOCK_ISSUE" AlertEffectElevatorClosure AlertEffectType = "ELEVATOR_CLOSURE" AlertEffectEscalatorClosure AlertEffectType = "ESCALATOR_CLOSURE" AlertEffectExtraService AlertEffectType = "EXTRA_SERVICE" AlertEffectFacilityIssue AlertEffectType = "FACILITY_ISSUE" AlertEffectModifiedService AlertEffectType = "MODIFIED_SERVICE" AlertEffectNoService AlertEffectType = "NO_SERVICE" AlertEffectOtherEffect AlertEffectType = "OTHER_EFFECT" AlertEffectParkingClosure AlertEffectType = "PARKING_CLOSURE" AlertEffectParkingIssue AlertEffectType = "PARKING_ISSUE" AlertEffectPolicyChange AlertEffectType = "POLICY_CHANGE" AlertEffectScheduleChange AlertEffectType = "SCHEDULE_CHANGE" AlertEffectServiceChange AlertEffectType = "SERVICE_CHANGE" AlertEffectShuttle AlertEffectType = "SHUTTLE" AlertEffectSnowRoute AlertEffectType = "SNOW_ROUTE" AlertEffectStationClosure AlertEffectType = "STATION_CLOSURE" AlertEffectStationIssue AlertEffectType = "STATION_ISSUE" AlertEffectStopClosure AlertEffectType = "STOP_CLOSURE" AlertEffectStopMove AlertEffectType = "STOP_MOVE" AlertEffectStopMoved AlertEffectType = "STOP_MOVED" AlertEffectSummary AlertEffectType = "SUMMARY" AlertEffectSuspension AlertEffectType = "SUSPENSION" AlertEffectTrackChange AlertEffectType = "TRACK_CHANGE" AlertEffectUnknownEffect AlertEffectType = "UNKNOWN_EFFECT" )
type AlertInclude ¶
type AlertInclude string
AlertInclude all of the includes for a alert request
const ( AlertIncludeStops AlertInclude = includeStops AlertIncludeRoutes AlertInclude = includeRoutes AlertIncludeTrips AlertInclude = includeTrips AlertIncludeFacilities AlertInclude = includeFacilities )
type AlertInformedEntity ¶
type AlertInformedEntity struct { TripID *string `json:"trip"` StopID *string `json:"stop"` RouteType *RouteType `json:"route_type"` RouteID *string `json:"route"` FacilityID *string `json:"facility"` DirectionID *int `json:"direction_id"` Activities []AlertActivityType `json:"activities"` }
AlertInformedEntity Object representing a particular part of the system affected by an alert
type AlertLifecycleType ¶
type AlertLifecycleType string
AlertLifecycleType Identifies whether alert is a new or old, in effect or upcoming
const ( AlertLifecycleNew AlertLifecycleType = "NEW" AlertLifecycleOngoing AlertLifecycleType = "ONGOING" AlertLifecycleOngoingUpcoming AlertLifecycleType = "ONGOING_UPCOMING" AlertLifecycleUpcoming AlertLifecycleType = "UPCOMING" )
type AlertService ¶
type AlertService service
AlertService handling all of the alert related API calls
func (*AlertService) GetAlert ¶
func (s *AlertService) GetAlert(id string, config *GetAlertRequestConfig) (*Alert, *http.Response, error)
GetAlert return an alert from the mbta API
func (*AlertService) GetAlertWithContext ¶
func (s *AlertService) GetAlertWithContext(ctx context.Context, id string, config *GetAlertRequestConfig) (*Alert, *http.Response, error)
GetAlertWithContext return an alert from the mbta API given a context
func (*AlertService) GetAllAlerts ¶
func (s *AlertService) GetAllAlerts(config *GetAllAlertsRequestConfig) ([]*Alert, *http.Response, error)
GetAllAlerts returns all alerts from the mbta API
func (*AlertService) GetAllAlertsWithContext ¶
func (s *AlertService) GetAllAlertsWithContext(ctx context.Context, config *GetAllAlertsRequestConfig) ([]*Alert, *http.Response, error)
GetAllAlertsWithContext returns all alerts from the mbta API given a context
type AlertsSortByType ¶
type AlertsSortByType string
AlertsSortByType all of the possible ways to sort by for a GetAllAlerts request
const ( AlertsSortByActivePeriodAscending AlertsSortByType = "active_period" AlertsSortByActivePeriodDescending AlertsSortByType = "-active_period" AlertsSortByBannerDesending AlertsSortByType = "banner" AlertsSortByBannerDescending AlertsSortByType = "-banner" AlertsSortByCauseAscending AlertsSortByType = "cause" AlertsSortByCauseDescending AlertsSortByType = "-cause" AlertsSortByCreatedAtAscending AlertsSortByType = "created_at" AlertsSortByCreatedAtDescending AlertsSortByType = "-created_at" AlertsSortByDescriptionAscending AlertsSortByType = "description" AlertsSortByDescriptionDescending AlertsSortByType = "-description" AlertsSortByEffectAscending AlertsSortByType = "effect" AlertsSortByEffectDescending AlertsSortByType = "-effect" AlertsSortByHeaderAscending AlertsSortByType = "header" AlertsSortByHeaderDescending AlertsSortByType = "-header" AlertsSortByInformedEntityAscending AlertsSortByType = "informed_entity" AlertsSortByInformedEntityDescending AlertsSortByType = "-informed_entity" AlertsSortByLifecycleAscending AlertsSortByType = "lifecycle" AlertsSortByLifecycleDescending AlertsSortByType = "-lifecycle" AlertsSortByServiceEffectAscending AlertsSortByType = "service_effect" AlertsSortByServiceEffectDescending AlertsSortByType = "-service_effect" AlertsSortBySeverityAscending AlertsSortByType = "severity" AlertsSortBySeverityDescending AlertsSortByType = "-severity" AlertsSortByShortHeaderAscending AlertsSortByType = "short_header" AlertsSortByShortHeaderDescending AlertsSortByType = "-short_header" AlertsSortByTimeframeAscending AlertsSortByType = "timeframe" AlertsSortByTimeframeDescending AlertsSortByType = "-timeframe" AlertsSortByUpdatedAtAscending AlertsSortByType = "updated_at" AlertsSortByUpdatedAtDescending AlertsSortByType = "-updated_at" AlertsSortByURLAscending AlertsSortByType = "url" AlertsSortByURLDescending AlertsSortByType = "-url" )
type BadRequestError ¶
type BadRequestError struct { SourceParameter string // The name of parameter that caused the error Detail string // A short, human-readable summary of the problem Code string // An application-specific error code }
BadRequestError error type holding the returned info about the bad request
func (BadRequestError) Error ¶
func (e BadRequestError) Error() string
type BikesAllowedType ¶
type BikesAllowedType int
BikesAllowedType enum for whether or not bikes are allowed
const ( // BikesAllowedNoInfo No information BikesAllowedNoInfo BikesAllowedType = iota // BikesAllowedYes Vehicle being used on this particular trip can accommodate at least one bicycle BikesAllowedYes // BikesAllowedNo No bicycles are allowed on this trip BikesAllowedNo )
type Client ¶
type Client struct { APIKey string BaseURL *url.URL UserAgent string Alerts *AlertService Facilities *FacilityService Lines *LineService Predictions *PredictionService Routes *RouteService RoutePatterns *RoutePatternsService Schedules *ScheduleService Services *ServicesService Shapes *ShapeService Stops *StopService Trips *TripService Vehicles *VehicleService // contains filtered or unexported fields }
Client the client for the MBTA API
func NewClient ¶
func NewClient(config ClientConfig) *Client
NewClient creates a new Client using the given config options
type ClientConfig ¶
ClientConfig the options for creating a Client
type FacilitiesSortByType ¶
type FacilitiesSortByType string
FacilitiesSortByType all of the possible ways to sort by for a GetAllFacilities request
const ( FacilitiesSortByLatitudeAscending FacilitiesSortByType = "latitude" FacilitiesSortByLatitudeDescending FacilitiesSortByType = "-latitude" FacilitiesSortByLongitudeAscending FacilitiesSortByType = "longitude" FacilitiesSortByLongitudeDescending FacilitiesSortByType = "-longitude" FacilitiesSortByNameAscending FacilitiesSortByType = "name" FacilitiesSortByNameDescending FacilitiesSortByType = "-name" FacilitiesSortByPropertiesAscending FacilitiesSortByType = "properties" FacilitiesSortByPropertiesDescending FacilitiesSortByType = "-properties" FacilitiesSortByShortNameAscending FacilitiesSortByType = "short_name" FacilitiesSortByShortNameDescending FacilitiesSortByType = "-short_name" FacilitiesSortByTypeAscending FacilitiesSortByType = "type" FacilitiesSortByTypeDescending FacilitiesSortByType = "-type" )
type Facility ¶
type Facility struct { ID string `jsonapi:"primary,facility"` Type FacilityType `jsonapi:"attr,type"` // The type of the facility ShortName string `jsonapi:"attr,short_name"` // Short name of the facility Properties []FacilityProperty `jsonapi:"attr,properties"` // Name/value pair for additional facility information Name string `jsonapi:"attr,name"` // Name of the facility Longitude *float64 `jsonapi:"attr,longitude"` // Longitude of the facility. Degrees East, in the WGS-84 coordinate system Latitude *float64 `jsonapi:"attr,latitude"` // Latitude of the facility. Degrees North, in the WGS-84 coordinate system Stop *Stop `jsonapi:"relation,stop"` // Stop that the current facility is linked with. Only includes id by default, use Include config option to get all data }
Facility holds all info about a given MBTA Facility
type FacilityInclude ¶
type FacilityInclude string
FacilityInclude all of the includes for a facility request
const (
FacilityIncludeStop FacilityInclude = includeStop
)
type FacilityProperty ¶
type FacilityProperty struct { Name string `json:"name"` // The name of the property Value string `json:"value"` // The value of the property }
FacilityProperty Name/value pair for additional facility information
func (*FacilityProperty) UnmarshalJSON ¶
func (f *FacilityProperty) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshal into FacilityProperty
type FacilityService ¶
type FacilityService service
FacilityService service handling all of the facility related API calls Note: This spec is not yet finalized by the MBTA, so this may change/break depending on what the MBTA does.
func (*FacilityService) GetAllFacilities ¶
func (s *FacilityService) GetAllFacilities(config *GetAllFacilitiesRequestConfig) ([]*Facility, *http.Response, error)
GetAllFacilities returns all facilities from the mbta API
func (*FacilityService) GetAllFacilitiesWithContext ¶
func (s *FacilityService) GetAllFacilitiesWithContext(ctx context.Context, config *GetAllFacilitiesRequestConfig) ([]*Facility, *http.Response, error)
GetAllFacilitiesWithContext returns all facilities from the mbta API given a context
func (*FacilityService) GetFacility ¶
func (s *FacilityService) GetFacility(id string, config *GetFacilityRequestConfig) (*Facility, *http.Response, error)
GetFacility returns a facility from the mbta API
func (*FacilityService) GetFacilityWithContext ¶
func (s *FacilityService) GetFacilityWithContext(ctx context.Context, id string, config *GetFacilityRequestConfig) (*Facility, *http.Response, error)
GetFacilityWithContext returns a facility from the mbta API given a context
type FacilityType ¶
type FacilityType string
FacilityType enum for the possible facility types
const ( FacilityBikeStorage FacilityType = "BIKE_STORAGE" FacilityBridgePlate FacilityType = "BRIDGE_PLATE" FacilityElectricCarChargers FacilityType = "ELECTRIC_CAR_CHARGERS" FacilityElevatedSubplatform FacilityType = "ELEVATED_SUBPLATFORM" FacilityElevator FacilityType = "ELEVATOR" FacilityEscalator FacilityType = "ESCALATOR" FacilityFareMediaAssistanceFacility FacilityType = "FARE_MEDIA_ASSISTANCE_FACILITY" FacilityFareMediaAssistant FacilityType = "FARE_MEDIA_ASSISTANT" FacilityFareVendingMachine FacilityType = "FARE_VENDING_MACHINE" FacilityFareVendingRetailer FacilityType = "FARE_VENDING_RETAILER" FacilityFullyElevatedPlatform FacilityType = "FULLY_ELEVATED_PLATFORM" FacilityOther FacilityType = "OTHER" FacilityParkingArea FacilityType = "PARKING_AREA" FacilityPickDrop FacilityType = "PICK_DROP" FacilityPortableBoardingLift FacilityType = "PORTABLE_BOARDING_LIFT" FacilityRamp FacilityType = "RAMP" FacilityTaxiStand FacilityType = "TAXI_STAND" FacilityTicketWindow FacilityType = "TICKET_WINDOW" )
type GetAlertRequestConfig ¶
type GetAlertRequestConfig struct { Fields []string `url:"fields[alert],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []AlertInclude `url:"include,comma,omitempty"` // Include extra data in response }
GetAlertRequestConfig extra options for the GetAlert request
type GetAllAlertsRequestConfig ¶
type GetAllAlertsRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort AlertsSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any RoutesSortByType Fields []string `url:"fields[alert],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []AlertInclude `url:"include,comma,omitempty"` // Include extra data in response FilterActivity []AlertActivityType `url:"filter[activity],comma,omitempty"` // Filter to alerts for only those activities If the filter is not given OR it is empty, then defaults to ["BOARD", "EXIT", “RIDE”]. If the value AlertActivityFilterAll is used then all alerts will be returned, not just those with the default activities FilterRouteType []RouteType `url:"filter[route_type],comma,omitempty"` // Filter by route_type FilterDirectionID string `url:"filter[direction_id],omitempty"` // Filter by direction of travel along the route FilterRouteIDs []string `url:"filter[route],omitempty"` // Filter by route IDs FilterStopIDs []string `url:"filter[stop],omitempty"` // Filter by stop IDs FilterTripIDs []string `url:"filter[trip],omitempty"` // Filter by trip IDs FilterFacilityIDs []string `url:"filter[facility],omitempty"` // Filter by facility IDs FilterIDs []string `url:"filter[id],comma,omitempty"` // Filter by multiple IDs FilterBanner string `url:"filter[banner],comma,omitempty"` // When combined with other filters, filters by alerts with or without a banner. MUST be “true” or "false" FilterDateTime *TimeISO8601 `url:"filter[datetime],omitempty"` // Filter to alerts that are active at a given time. Additionally, set `TimeISO8601.Now = true` to filter to alerts that are currently active. FilterLifecycle []string `url:"filter[lifecycle],comma,omitempty"` // Filters by an alert’s lifecycle FilterSeverity []string `url:"filter[severity],comma,omitempty"` // Filters alerts by list of severities }
GetAllAlertsRequestConfig extra options for the GetAllAlerts request
type GetAllFacilitiesRequestConfig ¶
type GetAllFacilitiesRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort FacilitiesSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any StopsSortByType Fields []string `url:"fields[facility],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []FacilityInclude `url:"include,comma,omitempty"` // Include extra data in response FilterStopIDs []string `url:"filter[stop],comma,omitempty"` // Filter by stop ID FilterTypes []string `url:"filter[type],comma,omitempty"` // Filter by multiple types }
GetAllFacilitiesRequestConfig extra options for the GetAllFacilities request
type GetAllLinesRequestConfig ¶
type GetAllLinesRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort LinesSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any RoutesSortByType Fields []string `url:"fields[line],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []LineInclude `url:"include,comma,omitempty"` // Include extra data in response FilterIDs []string `url:"filter[id],comma,omitempty"` // Filter by multiple IDs }
GetAllLinesRequestConfig extra options for the GetAllLines request
type GetAllPredictionsRequestConfig ¶
type GetAllPredictionsRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort PredictionsSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any PredictionsSortByType Fields []string `url:"fields[prediction],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []PredictionInclude `url:"include,comma,omitempty"` // Include extra data in response FilterLatitude string `url:"filter[latitude],omitempty"` // Latitude/Longitude must be both present or both absent FilterLongitude string `url:"filter[longitude],omitempty"` // Latitude/Longitude must be both present or both absent FilterRadius string `url:"filter[radius],omitempty"` // Radius accepts a floating point number, and the default is 0.01. For example, if you query for: latitude: 42, longitude: -71, radius: 0.05 then you will filter between latitudes 41.95 and 42.05, and longitudes -70.95 and -71.05 FilterDirectionID string `url:"filter[direction_id],omitempty"` // Filter by Direction ID (Either "0" or "1") FilterRouteType []string `url:"filter[route_type],comma,omitempty"` // Filter by route_type FilterRouteIDs []string `url:"filter[route],comma,omitempty"` // Filter by route IDs FilterStopIDs []string `url:"filter[stop],comma,omitempty"` // Filter by stop IDs FilterTripIDs []string `url:"filter[trip],comma,omitempty"` // Filter by trip IDs }
GetAllPredictionsRequestConfig extra options for the GetAllPredictions request
type GetAllRoutePatternsRequestConfig ¶
type GetAllRoutePatternsRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort RoutePatternsSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any RoutesSortByType Include []RoutePatternInclude `url:"include,comma,omitempty"` // Include extra data in response FilterDirectionID string `url:"filter[direction_id],omitempty"` // Filter by Direction ID (Either "0" or "1") FilterIDs []string `url:"filter[id],comma,omitempty"` // Filter by multiple IDs FilterRouteIDs []string `url:"filter[route],comma,omitempty"` // Filter by stops }
GetAllRoutePatternsRequestConfig extra options for the GetAllRoutePatterns request
type GetAllRoutesRequestConfig ¶
type GetAllRoutesRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort RoutesSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any RoutesSortByType Include []RouteInclude `url:"include,comma,omitempty"` // Include extra data in response Fields []string `url:"fields[route],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types FilterDirectionID string `url:"filter[direction_id],omitempty"` // Filter by Direction ID (Either "0" or "1") FilterDate string `url:"filter[data],omitempty"` // Filter by date that route is active FilterIDs []string `url:"filter[id],comma,omitempty"` // Filter by multiple IDs FilterStop string `url:"filter[stop],omitempty"` // Filter by stops FilterRouteTypes []RouteType `url:"filter[type],comma,omitempty"` // Filter by different route types }
GetAllRoutesRequestConfig extra options for the GetAllRoutes request
type GetAllSchedulesRequestConfig ¶
type GetAllSchedulesRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort SchedulesSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any SchedulesSortByType Fields []string `url:"fields[schedule],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []ScheduleInclude `url:"include,comma,omitempty"` // Include extra data in response (trip, stop, prediction, or route) FilterDates []TimeISO8601 `url:"filter[date],comma,omitempty"` // Filter by multiple dates FilterDirectionID string `url:"filter[direction_id],omitempty"` // Filter by Direction ID (Either "0" or "1") FilterMinTime []string `url:"filter[min_time],comma,omitempty"` // Time before which schedule should not be returned. To filter times after midnight use more than 24 hours. For example, min_time=24:00 will return schedule information for the next calendar day, since that service is considered part of the current service day. Additionally, min_time=00:00&max_time=02:00 will not return anything. The time format is HH:MM. FilterMaxTime []string `url:"filter[max_time],comma,omitempty"` // Time after which schedule should not be returned. To filter times after midnight use more than 24 hours. For example, min_time=24:00 will return schedule information for the next calendar day, since that service is considered part of the current service day. Additionally, min_time=00:00&max_time=02:00 will not return anything. The time format is HH:MM. FilterRouteIDs []string `url:"filter[route],comma,omitempty"` // Filter by route IDs FilterStopIDs []string `url:"filter[stop],comma,omitempty"` // Filter by stop IDs FilterTripIDs []string `url:"filter[trip],comma,omitempty"` // Filter by trip IDs FilterStopSequence string `url:"filter[stop_sequence],omitempty"` // Filter by the index of the stop in the trip. Symbolic values `first` and `last` can be used instead of numeric sequence number too. }
GetAllSchedulesRequestConfig extra options for the GetAllSchedules request
type GetAllServicesRequestConfig ¶
type GetAllServicesRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort ServicesSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any RoutesSortByType Fields []string `url:"fields[service],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types FilterIDs []string `url:"filter[id],comma,omitempty"` // Filter by multiple IDs FilterRoutes []Route `url:"filter[route],comma,omitempty"` // Filter by Routes }
GetAllServicesRequestConfig extra options for GetAllServices Request
type GetAllShapesRequestConfig ¶
type GetAllShapesRequestConfig struct { PageOffset int `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit int `url:"page[limit],omitempty"` // Max number of elements to return Sort ShapesSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any /data/{index}/attributes key. Assumes ascending; may be prefixed with '-' for descending Fields []string `url:"fields[shape],comma,omitempty"` // Fields to include with the response. Multiple fields MUST be a comma-separated (U+002C COMMA, “,”) list. Note that fields can also be selected for included data types: see the V3 API Best Practices (https://www.mbta.com/developers/v3-api/best-practices) for an example. Include []ShapeInclude `url:"include,comma,omitempty"` // Can include choose to include route and stop. FilterRoute []string `url:"filter[route],comma,omitempty"` // Filter by /data/{index}/relationships/route/data/id. FilterDirectionID string `url:"filter[direction_id],omitempty"` // Filter by direction of travel along the route. }
GetAllShapesRequestConfig holds the request info for the GetAllShapes function
type GetAllStopsRequestConfig ¶
type GetAllStopsRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort StopsSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any StopsSortByType Fields []string `url:"fields[stop],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []StopInclude `url:"include,comma,omitempty"` // Include extra data in response (parentstation) FilterDirectionID string `url:"filter[direction_id],omitempty"` // Filter by Direction ID (Either "0" or "1") FilterLatitude string `url:"filter[latitude],omitempty"` // Latitude in degrees North in the WGS-84 coordinate system to search filter[radius] degrees around with filter[longitude] FilterLongitude string `url:"filter[longitude],omitempty"` // Longitude in degrees East in the WGS-84 coordinate system to search filter[radius] degrees around with filter[latitude] FilterRadius string `url:"filter[radius],omitempty"` // The distance is in degrees as if latitude and longitude were on a flat 2D plane and normal Pythagorean distance was calculated. Over the region MBTA serves, 0.02 degrees is approximately 1 mile. Defaults to 0.01 degrees (approximately a half mile) FilterIDs []string `url:"filter[id],comma,omitempty"` // Filter by multiple IDs FilterRouteTypes []RouteType `url:"filter[route_type],comma,omitempty"` // Filter by route type(s) FilterRouteIDs []string `url:"filter[route],comma,omitempty"` // Filter by route IDs. If the vehicle is on a multi-route trip, it will be returned for any of the routes FilterLocationType []string `url:"filter[location_type],comma,omitempty"` // Filter by location type }
GetAllStopsRequestConfig extra options for the GetAllStops request
type GetAllTripsRequestConfig ¶
type GetAllTripsRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort TripsSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any TripsSortByType Fields []string `url:"fields[trip],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []TripInclude `url:"include,comma,omitempty"` // Include extra data in response (route, vehicle, service, shape, route_pattern, predictions) FilterDate *TimeISO8601 `url:"filter[date],omitempty"` // Filter by trips on a particular date The active date is the service date. Trips that begin between midnight and 3am are considered part of the previous service day FilterDirectionID string `url:"filter[direction_id],omitempty"` // Filter by direction of travel along the route FilterRouteIDs []string `url:"filter[route],comma,omitempty"` // Filter by route id(s) FilterRoutePatternIDs []string `url:"filter[route_pattern],comma,omitempty"` // Filter by route pattern id(s) FilterIDs []string `url:"filter[id],comma,omitempty"` // Filter by id(s) FilterNames []string `url:"filter[name],comma,omitempty"` // Filter by names }
GetAllTripsRequestConfig extra options for the GetAllTrips request
type GetAllVehiclesRequestConfig ¶
type GetAllVehiclesRequestConfig struct { PageOffset string `url:"page[offset],omitempty"` // Offset (0-based) of first element in the page PageLimit string `url:"page[limit],omitempty"` // Max number of elements to return Sort VehiclesSortByType `url:"sort,omitempty"` // Results can be sorted by the id or any VehiclesSortByType Fields []string `url:"fields[vehicle],comma,omitempty"` // Fields to include with the response. Multiple fields MUST be a comma-separated (U+002C COMMA, “,”) list. Note that fields can also be selected for included data types Include []VehicleInclude `url:"include,comma,omitempty"` // Include extra data in response (trip, stop, or route) FilterIDs []string `url:"filter[id],comma,omitempty"` // Filter by multiple IDs FilterTripIDs []string `url:"filter[trip],comma,omitempty"` // Filter by trip IDs FilterLabels []string `url:"filter[label],comma,omitempty"` // Filter by label FilterRouteIDs []string `url:"filter[route],comma,omitempty"` // Filter by route IDs. If the vehicle is on a multi-route trip, it will be returned for any of the routes FilterDirectionID string `url:"filter[direction_id],omitempty"` // Filter by Direction ID (Either "0" or "1") FilterRouteTypes []RouteType `url:"filter[route_type],comma,omitempty"` // Filter by route type(s) }
GetAllVehiclesRequestConfig extra options for the GetAllVehicles request
type GetFacilityRequestConfig ¶
type GetFacilityRequestConfig struct { Fields []string `url:"fields[facility],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []StopInclude `url:"include,comma,omitempty"` // Include extra data in response (parentstation) }
GetFacilityRequestConfig extra options for the GetFacility request
type GetLineRequestConfig ¶
type GetLineRequestConfig struct { Fields []string `url:"fields[line],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []LineInclude `url:"include,comma,omitempty"` // Include extra data in response }
GetLineRequestConfig extra options for the GetLine request
type GetRoutePatternRequestConfig ¶
type GetRoutePatternRequestConfig struct {
Include []RouteInclude `url:"include,comma,omitempty"` // Include extra data in response
}
GetRoutePatternRequestConfig extra options for GetRoutePattern request
type GetRouteRequestConfig ¶
type GetRouteRequestConfig struct { Fields []string `url:"fields[route],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []RouteInclude `url:"include,comma,omitempty"` // Include extra data in response }
GetRouteRequestConfig extra options for GetRoute request
type GetServiceRequestConfig ¶
type GetServiceRequestConfig struct {
Fields []string `url:"fields[service],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types
}
GetServiceRequestConfig extra options for GetService Request
type GetShapeRequestConfig ¶
type GetShapeRequestConfig struct { Fields []string `url:"fields[shape],comma,omitempty"` // Fields to include with the response. Multiple fields MUST be a comma-separated (U+002C COMMA, “,”) list. Note that fields can also be selected for included data types: see the V3 API Best Practices for an example. Include []ShapeInclude `url:"include,comma,omitempty"` // Can include choose to include route and stop. }
GetShapeRequestConfig holds the request info for the GetShape function
type GetStopRequestConfig ¶
type GetStopRequestConfig struct { Fields []string `url:"fields[stop],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []StopInclude `url:"include,comma,omitempty"` // Include extra data in response (parentstation) }
GetStopRequestConfig extra options for the GetStop request
type GetTripRequestConfig ¶
type GetTripRequestConfig struct { Fields []string `url:"fields[trip],comma,omitempty"` // Fields to include with the response. Note that fields can also be selected for included data types Include []TripInclude `url:"include,comma,omitempty"` // Include extra data in response (route, vehicle, service, shape, route_pattern, predictions) }
GetTripRequestConfig extra options for the GetTrip request
type GetVehicleRequestConfig ¶
type GetVehicleRequestConfig struct { Fields []string `url:"fields[vehicle],comma,omitempty"` // Fields to include with the response. Multiple fields MUST be a comma-separated (U+002C COMMA, “,”) list. Note that fields can also be selected for included data types Include []VehicleInclude `url:"include,comma,omitempty"` // Include extra data in response (trip, stop, or route) }
GetVehicleRequestConfig extra options for the GetVehicle request
type JSONURL ¶
JSONURL wraps a url.URL to be parsed from JSON
func (*JSONURL) UnmarshalJSON ¶
UnmarshalJSON unmarshals a JSON string URL into a url.URL
type Line ¶
type Line struct { ID string `jsonapi:"primary,line"` Color string `jsonapi:"attr,color"` LongName string `jsonapi:"attr,long_name"` ShortName string `jsonapi:"attr,short_name"` SortOrder int `jsonapi:"attr,sort_order"` TextColor string `jsonapi:"attr,text_color"` Routes []*Route `jsonapi:"relation,route"` }
Line holds all the info about a given MBTA Route
type LineService ¶
type LineService service
LineService handling all of the route related API calls
func (*LineService) GetAllLines ¶
func (s *LineService) GetAllLines(config *GetAllLinesRequestConfig) ([]*Line, *http.Response, error)
GetAllLines returns all lines from the mbta API
func (*LineService) GetAllLinesWithContext ¶
func (s *LineService) GetAllLinesWithContext(ctx context.Context, config *GetAllLinesRequestConfig) ([]*Line, *http.Response, error)
GetAllLinesWithContext returns all lines from the mbta API given a context
func (*LineService) GetLine ¶
func (s *LineService) GetLine(id string, config *GetLineRequestConfig) (*Line, *http.Response, error)
GetLine return a line from the mbta API
func (*LineService) GetLineWithContext ¶
func (s *LineService) GetLineWithContext(ctx context.Context, id string, config *GetLineRequestConfig) (*Line, *http.Response, error)
GetLineWithContext return a line from the mbta API given a context
type LinesSortByType ¶
type LinesSortByType string
LinesSortByType all of the possible ways to sort by for a GetAllLines request
const ( LinesSortByColorAscending LinesSortByType = "color" LinesSortByColorDescending LinesSortByType = "-color" LinesSortByLongNameDesending LinesSortByType = "long_name" LinesSortByLongNameDescending LinesSortByType = "-long_name" LinesSortByShortNameAscending LinesSortByType = "short_name" LinesSortByShortNameDescending LinesSortByType = "-short_name" LinesSortBySortOrderAscending LinesSortByType = "sort_order" LinesSortBySortOrderDescending LinesSortByType = "-sort_order" LinesSortByTextColorAscending LinesSortByType = "text_color" LinesSortByTextColorDescending LinesSortByType = "-text_color" )
type Prediction ¶
type Prediction struct { ID string `jsonapi:"primary,prediction"` ArrivalTime *TimeISO8601 `jsonapi:"attr,arrival_time"` // Time when the trip arrives at the given stop DepartureTime *TimeISO8601 `jsonapi:"attr,departure_time"` // Time when the trip departs the given stop DirectionID int `jsonapi:"attr,direction_id"` // Direction in which trip is traveling: 0 or 1. ScheduleRelationship *PredictionScheduleRelationshipType `jsonapi:"attr,schedule_relationship"` // How the predicted stop relates to the Model.Schedule.t stops. Status *string `jsonapi:"attr,status"` // Status of the schedule StopSequence int `jsonapi:"attr,stop_sequence"` // The sequence the stop_id is arrived at during the trip_id. The stop sequence is monotonically increasing along the trip, but the stop_sequence along the trip_id are not necessarily consecutive Route *Route `jsonapi:"relation,route"` // Route that the prediction is linked with. Only includes id by default, use Include config option to get all data Schedule *Schedule `jsonapi:"relation,schedule"` // Schedule that the prediction is linked with. Only includes id by default, use Include config option to get all data Stop *Stop `jsonapi:"relation,stop"` // Stop that the prediction is linked with. Only includes id by default, use Include config option to get all data Trip *Trip `jsonapi:"relation,trip"` // Trip that the prediction is linked with. Only includes id by default, use Include config option to get all data Vehicle *Vehicle `jsonapi:"relation,vehicle"` // Vehicle that the prediction is linked with. Only includes id by default, use Include config option to get all data Alerts []*Alert `jsonapi:"relation,alerts"` }
Prediction holds all info about a given MBTA prediction
type PredictionInclude ¶
type PredictionInclude string
PredictionInclude all of the includes for a prediction request
const ( PredictionIncludeSchedule PredictionInclude = includeSchedule PredictionIncludeStop PredictionInclude = includeStop PredictionIncludeRoute PredictionInclude = includeRoute PredictionIncludeTrip PredictionInclude = includeTrip PredictionIncludeVehicle PredictionInclude = includeVehicle PredictionIncludeAlerts PredictionInclude = includeAlerts )
type PredictionScheduleRelationshipType ¶
type PredictionScheduleRelationshipType string
PredictionScheduleRelationshipType possible values for the ScheduleRelationship field in a Prediction
const ( ScheduleRelationshipAdded PredictionScheduleRelationshipType = "ADDED" ScheduleRelationshipCancelled PredictionScheduleRelationshipType = "CANCELLED" ScheduleRelationshipNoData PredictionScheduleRelationshipType = "NO_DATA" ScheduleRelationshipSkipped PredictionScheduleRelationshipType = "SKIPPED" ScheduleRelationshipUnscheduled PredictionScheduleRelationshipType = "UNSCHEDULED" )
type PredictionService ¶
type PredictionService service
PredictionService service handling all of the prediction related API calls
func (*PredictionService) GetAllPredictions ¶
func (s *PredictionService) GetAllPredictions(config *GetAllPredictionsRequestConfig) ([]*Prediction, *http.Response, error)
GetAllPredictions returns all predictions from the mbta API NOTE: A filter MUST be present for any predictions to be returned.
func (*PredictionService) GetAllPredictionsWithContext ¶
func (s *PredictionService) GetAllPredictionsWithContext(ctx context.Context, config *GetAllPredictionsRequestConfig) ([]*Prediction, *http.Response, error)
GetAllPredictionsWithContext returns all predictions from the mbta API given a context NOTE: A filter MUST be present for any predictions to be returned.
type PredictionsSortByType ¶
type PredictionsSortByType string
PredictionsSortByType all of the possible ways to sort by for a GetAllPredictions request
const ( PredictionsSortByArrivalTimeAscending PredictionsSortByType = "arrival_time" PredictionsSortByArrivalTimeDescending PredictionsSortByType = "-arrival_time" PredictionsSortByDepartureTimeAscending PredictionsSortByType = "departure_time" PredictionsSortByDepartureTimeDescending PredictionsSortByType = "-departure_time" PredictionsSortByDirectionIDAscending PredictionsSortByType = "direction_id" PredictionsSortByDirectionIDDescending PredictionsSortByType = "-direction_id" PredictionsSortByScheduleRelationshipAscending PredictionsSortByType = "schedule_relationship" PredictionsSortByScheduleRelationshipDescending PredictionsSortByType = "-schedule_relationship" PredictionsSortByStatusAscending PredictionsSortByType = "status" PredictionsSortByStatusDescending PredictionsSortByType = "-status" PredictionsSortByStopSequenceAscending PredictionsSortByType = "stop_sequence" PredictionsSortByStopSequenceDescending PredictionsSortByType = "-stop_sequence" )
type Route ¶
type Route struct { ID string `jsonapi:"primary,route"` Color string `jsonapi:"attr,color"` Description string `jsonapi:"attr,description"` DirectionDestinations []string `jsonapi:"attr,direction_destinations"` DirectionNames []string `jsonapi:"attr,direction_names"` LongName string `jsonapi:"attr,long_name"` SortOrder int `jsonapi:"attr,sort_order"` TextColor string `jsonapi:"attr,text_color"` Type RouteType `jsonapi:"attr,type"` ShortName string `jsonapi:"attr,short_name"` Line *Line `jsonapi:"relation,line"` }
Route holds all the info about a given MBTA Route
type RouteInclude ¶
type RouteInclude string
RouteInclude all of the includes for a route request
const ( RouteIncludeLine RouteInclude = includeLine RouteIncludeStop RouteInclude = includeStop RouteIncludeRoutePatterns RouteInclude = includeRoutePatterns )
type RoutePattern ¶
type RoutePattern struct { ID string `jsonapi:"primary,route_pattern"` Typicality RoutePatternTypicalityType `jsonapi:"attr,typicality"` // Explains how common the route pattern is. For the MBTA, this is within the context of the entire route TimeDesc *string `jsonapi:"attr,time_desc"` // User-facing description of when the route pattern operate. Not all route patterns will include a time description SortOrder int `jsonapi:"attr,sort_order"` // Can be used to order the route patterns in a way which is ideal for presentation to customers. Route patterns with smaller sort_order values should be displayed before those with larger values Name string `jsonapi:"attr,name"` // User-facing description of where trips on the route pattern serve. These names are published in the form `Destination, Destination via Street or Landmark, Origin - Destination, or Origin - Destination via Street or Landmark`. Note that names for bus and subway route patterns currently do not include the origin location, but will in the future DirectionID int `jsonapi:"attr,direction_id"` // Direction in which trip is traveling: 0 or 1 RepresentativeTrip *Trip `jsonapi:"relation,representative_trip"` // A trip that can be considered a canonical trip for the route pattern. This trip can be used to deduce a pattern’s canonical set of stops and shape. Only includes id by default, use Include config option to get all data Route *Route `jsonapi:"relation,route"` // The route that this pattern belongs to. Only includes id by default, use Include config option to get all data }
RoutePattern holds all the info about a given MBTA route-pattern
type RoutePatternInclude ¶
type RoutePatternInclude string
RoutePatternInclude all of the includes for a route-pattern request
const ( RoutePatternIncludeRoute RoutePatternInclude = includeLine RoutePatternIncludeRepresentativeTrip RoutePatternInclude = includeRepresentativeTrip )
type RoutePatternTypicalityType ¶
type RoutePatternTypicalityType int
RoutePatternTypicalityType Explains how common the route pattern is. For the MBTA, this is within the context of the entire route
const ( // RoutePatternTypicalityNotDefined Not defined RoutePatternTypicalityNotDefined RoutePatternTypicalityType = iota // RoutePatternTypicalityTypical Typical. Pattern is common for the route. Most routes will have only one such pattern per direction. A few routes may have more than 1, such as the Red Line (with one branch to Ashmont and another to Braintree); routes with more than 2 are rare RoutePatternTypicalityTypical // RoutePatternTypicalityDeviation Pattern is a deviation from the regular route RoutePatternTypicalityDeviation // RoutePatternTypicalityHighlyAtypical Pattern represents a highly atypical pattern for the route, such as a special routing which only runs a handful of times per day RoutePatternTypicalityHighlyAtypical // RoutePatternTypicalityDiversionFromNormal Diversions from normal service, such as planned detours, bus shuttles, or snow routes RoutePatternTypicalityDiversionFromNormal )
type RoutePatternsService ¶
type RoutePatternsService service
RoutePatternsService handling all of the route-patterns related API calls
func (*RoutePatternsService) GetAllRoutePatterns ¶
func (s *RoutePatternsService) GetAllRoutePatterns(config *GetAllRoutePatternsRequestConfig) ([]*RoutePattern, *http.Response, error)
GetAllRoutePatterns returns all routes from the mbta API
func (*RoutePatternsService) GetAllRoutePatternsWithContext ¶
func (s *RoutePatternsService) GetAllRoutePatternsWithContext(ctx context.Context, config *GetAllRoutePatternsRequestConfig) ([]*RoutePattern, *http.Response, error)
GetAllRoutePatternsWithContext returns all routes from the mbta API given a context
func (*RoutePatternsService) GetRoutePattern ¶
func (s *RoutePatternsService) GetRoutePattern(id string, config *GetRoutePatternRequestConfig) (*RoutePattern, *http.Response, error)
GetRoutePattern return a route from the mbta API
func (*RoutePatternsService) GetRoutePatternWithContext ¶
func (s *RoutePatternsService) GetRoutePatternWithContext(ctx context.Context, id string, config *GetRoutePatternRequestConfig) (*RoutePattern, *http.Response, error)
GetRoutePatternWithContext return a route from the mbta API given a context
type RoutePatternsSortByType ¶
type RoutePatternsSortByType string
RoutePatternsSortByType all of the possible ways to sort by for a GetAllRoutePatterns request
const ( RoutePatternsSortByDirectionIDAscending RoutePatternsSortByType = "direction_id" RoutePatternsSortByDirectionIDDescending RoutePatternsSortByType = "-direction_id" RoutePatternsSortByNameAscending RoutePatternsSortByType = "name" RoutePatternsSortByNameDescending RoutePatternsSortByType = "-name" RoutePatternsSortBySortOrderAscending RoutePatternsSortByType = "sort_order" RoutePatternsSortBySortOrderDescending RoutePatternsSortByType = "-sort_order" RoutePatternsSortByTimeDescAscending RoutePatternsSortByType = "time_desc" RoutePatternsSortByTimeDescDescending RoutePatternsSortByType = "-time_desc" RoutePatternsSortByTypicalityAscending RoutePatternsSortByType = "typicality" RoutePatternsSortByTypicalityDescending RoutePatternsSortByType = "-typicality" )
type RouteService ¶
type RouteService service
RouteService handling all of the route related API calls
func (*RouteService) GetAllRoutes ¶
func (s *RouteService) GetAllRoutes(config *GetAllRoutesRequestConfig) ([]*Route, *http.Response, error)
GetAllRoutes returns all routes from the mbta API
func (*RouteService) GetAllRoutesWithContext ¶
func (s *RouteService) GetAllRoutesWithContext(ctx context.Context, config *GetAllRoutesRequestConfig) ([]*Route, *http.Response, error)
GetAllRoutesWithContext returns all routes from the mbta API given a context
func (*RouteService) GetRoute ¶
func (s *RouteService) GetRoute(id string, config *GetRouteRequestConfig) (*Route, *http.Response, error)
GetRoute return a route from the mbta API
func (*RouteService) GetRouteWithContext ¶
func (s *RouteService) GetRouteWithContext(ctx context.Context, id string, config *GetRouteRequestConfig) (*Route, *http.Response, error)
GetRouteWithContext return a route from the mbta API given a context
type RouteType ¶
type RouteType int
RouteType enum for possible Route types (see https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#routestxt)
type RoutesSortByType ¶
type RoutesSortByType string
RoutesSortByType all of the possible ways to sort by for a GetAllRoutes request
const ( RoutesSortByColorAscending RoutesSortByType = "color" RoutesSortByColorDescending RoutesSortByType = "-color" RoutesSortByDescriptionAscending RoutesSortByType = "description" RoutesSortByDescriptionDescending RoutesSortByType = "-description" RoutesSortByDirectionDestinationAscending RoutesSortByType = "direction_destinations" RoutesSortByDirectionDestinationDescending RoutesSortByType = "-direction_destinations" RoutesSortByDirectionNameAscending RoutesSortByType = "direction_names" RoutesSortByDirectionNameDescending RoutesSortByType = "-direction_names" RoutesSortByFareClassAscending RoutesSortByType = "fare_class" RoutesSortByFareClassDescending RoutesSortByType = "-fare_class" RoutesSortByLongNameDesending RoutesSortByType = "long_name" RoutesSortByLongNameDescending RoutesSortByType = "-long_name" RoutesSortByShortNameAscending RoutesSortByType = "short_name" RoutesSortByShortNameDescending RoutesSortByType = "-short_name" RoutesSortBySortOrderAscending RoutesSortByType = "sort_order" RoutesSortBySortOrderDescending RoutesSortByType = "-sort_order" RoutesSortByTextColorAscending RoutesSortByType = "text_color" RoutesSortByTextColorDescending RoutesSortByType = "-text_color" RoutesSortByTypeAscending RoutesSortByType = "type" RoutesSortByTypeDescending RoutesSortByType = "-type" )
type Schedule ¶
type Schedule struct { ID string `jsonapi:"primary,schedule"` ArrivalTime TimeISO8601 `jsonapi:"attr,arrival_time"` // Time when the trip arrives at the given stop DepartureTime TimeISO8601 `jsonapi:"attr,departure_time"` // Time when the trip departs the given stop DirectionID int `jsonapi:"attr,direction_id"` // Direction in which trip is traveling: 0 or 1. DropOffType SchedulePickupType `jsonapi:"attr,drop_off_type"` // How the vehicle arrives at stop_id PickupType SchedulePickupType `jsonapi:"attr,pickup_type"` // How the vehicle departs from stop_id. StopSequence int `jsonapi:"attr,stop_sequence"` // The sequence the stop_id is arrived at during the trip_id. The stop sequence is monotonically increasing along the trip, but the stop_sequence along the trip_id are not necessarily consecutive Timepoint ScheduleTimepoint `jsonapi:"attr,timepoint"` // whether the given times are exact or estimates Route *Route `jsonapi:"relation,route"` // Route that the current schedule is linked with. Only includes id by default, use Include config option to get all data Stop *Stop `jsonapi:"relation,stop"` // Stop that the schedule is linked with. Only includes id by default, use Include config option to get all data Trip *Trip `jsonapi:"relation,trip"` // Trip that the current schedule is linked with. Only includes id by default, use Include config option to get all data Prediction *Prediction `jsonapi:"relation,prediction"` }
Schedule holds all info about a given MBTA schedule
type ScheduleInclude ¶
type ScheduleInclude string
ScheduleInclude all of the includes for a schedule request
const ( ScheduleIncludePrediction ScheduleInclude = includePrediction ScheduleIncludeRoute ScheduleInclude = includeRoute ScheduleIncludeStop ScheduleInclude = includeStop ScheduleIncludeTrip ScheduleInclude = includeTrip )
type SchedulePickupType ¶
type SchedulePickupType int
SchedulePickupType whether times are exact or estimates
const ( SchedulePickupRegular SchedulePickupType = iota SchedulePickupNotAvailable SchedulePickupMustPhoneAgency SchedulePickupMustCoordinateWithDriver )
type ScheduleService ¶
type ScheduleService service
ScheduleService service handling all of the schedule related API calls
func (*ScheduleService) GetAllSchedules ¶
func (s *ScheduleService) GetAllSchedules(config *GetAllSchedulesRequestConfig) ([]*Schedule, *http.Response, error)
GetAllSchedules returns all schedules for a particular route, stop or trip from the mbta API NOTE: filter[route], filter[stop], or filter[trip] MUST be present for any schedules to be returned.
func (*ScheduleService) GetAllSchedulesWithContext ¶
func (s *ScheduleService) GetAllSchedulesWithContext(ctx context.Context, config *GetAllSchedulesRequestConfig) ([]*Schedule, *http.Response, error)
GetAllSchedulesWithContext returns all schedules for a particular route, stop or trip from the mbta API given a context NOTE: filter[route], filter[stop], or filter[trip] MUST be present for any schedules to be returned.
type ScheduleTimepoint ¶
type ScheduleTimepoint bool
ScheduleTimepoint whether times are exact or estimates
const ( ScheduleTimepointExact ScheduleTimepoint = true ScheduleTimepointEstimates ScheduleTimepoint = false )
type ScheduleTypicality ¶
type ScheduleTypicality int
ScheduleTypicality Describes how well this schedule represents typical service for the listed schedule_type
const ( Undefined ScheduleTypicality = iota Typical SupplementalExtra ReducedHoliday PlannedMajorChange UnplannedMajorReduction )
type SchedulesSortByType ¶
type SchedulesSortByType string
SchedulesSortByType all of the possible ways to sort by for a GetAllSchedules request
const ( SchedulesSortByArrivalTimeAscending SchedulesSortByType = "arrival_time" SchedulesSortByArrivalTimeDescending SchedulesSortByType = "-arrival_time" SchedulesSortByDepartureTimeAscending SchedulesSortByType = "departure_time" SchedulesSortByDepartureTimeDescending SchedulesSortByType = "-departure_time" SchedulesSortByDirectionIDAscending SchedulesSortByType = "direction_id" SchedulesSortByDirectionIDDescending SchedulesSortByType = "-direction_id" SchedulesSortByDropOffTypeAscending SchedulesSortByType = "drop_off_type" SchedulesSortByDropOffTypeDescending SchedulesSortByType = "-drop_off_type" SchedulesSortByPickupTypeAscending SchedulesSortByType = "pickup_type" SchedulesSortByPickupTypeDescending SchedulesSortByType = "-pickup_type" SchedulesSortByStopSequenceAscending SchedulesSortByType = "stop_sequence" SchedulesSortByStopSequenceDescending SchedulesSortByType = "-stop_sequence" SchedulesSortByTimepointAscending SchedulesSortByType = "timepoint" SchedulesSortByTimepointDescending SchedulesSortByType = "-timepoint" )
type Service ¶
type Service struct { ID string `jsonapi:"primary,service"` AddedDates []TimeISO8601 `jsonapi:"attr,added_dates"` AddedDatesNotes []*string `jsonapi:"attr,added_dates_notes"` Description string `jsonapi:"attr,description"` EndDate TimeISO8601 `jsonapi:"attr,end_date"` RemovedDates []TimeISO8601 `jsonapi:"attr,removed_dates"` RemovedDatesNotes []string `jsonapi:"attr,removed_dates_notes"` ScheduleName string `jsonapi:"attr,schedule_name"` ScheduleType string `jsonapi:"attr,schedule_type"` ScheduleTypicality ScheduleTypicality `jsonapi:"attr,schedule_typicality"` StartDate TimeISO8601 `jsonapi:"attr,start_date"` ValidDays []Weekday `jsonapi:"attr,valid_days"` }
Service holds all the info about a given MBTA Service
type ServicesService ¶
type ServicesService service
func (*ServicesService) GetAllServices ¶
func (s *ServicesService) GetAllServices(config *GetAllServicesRequestConfig) ([]*Service, *http.Response, error)
GetAllServices returns all services from the mbta API
func (*ServicesService) GetAllServicesWithContext ¶
func (s *ServicesService) GetAllServicesWithContext(ctx context.Context, config *GetAllServicesRequestConfig) ([]*Service, *http.Response, error)
GetAllServicesWithContext returns all services from the mbta API given a context
func (*ServicesService) GetService ¶
func (s *ServicesService) GetService(id string, config *GetServiceRequestConfig) (*Service, *http.Response, error)
GetService returns a service from the mbta API
func (*ServicesService) GetServiceWithContext ¶
func (s *ServicesService) GetServiceWithContext(ctx context.Context, id string, config *GetServiceRequestConfig) (*Service, *http.Response, error)
GetServiceWithContext returns a service from the mbta API given a context
type ServicesSortByType ¶
type ServicesSortByType string
ServicesSortByType all possible ways to sort /services request
const ( ServicesSortAddedDatesByAscending ServicesSortByType = "added_dates" ServicesSortAddedDatesByDescending ServicesSortByType = "-added_dates" ServicesSortAddedDatesNotesByAscending ServicesSortByType = "added_dates_notes" ServicesSortAddedDatesNotesByDescending ServicesSortByType = "-added_dates_notes" ServicesSortDescriptionByAscending ServicesSortByType = "description" ServicesSortDescriptionByDescending ServicesSortByType = "-description" ServicesSortEndDateByAscending ServicesSortByType = "end_date" ServicesSortEndDateByDescending ServicesSortByType = "-end_date" ServicesSortRemovedDatesByAscending ServicesSortByType = "removed_dates" ServicesSortRemovedDatesByDescending ServicesSortByType = "-removed_dates" ServicesSortRemovedDatesNotesByAscending ServicesSortByType = "removed_dates_notes" ServicesSortRemovedDatesNotesByDescending ServicesSortByType = "-removed_dates_notes" ServicesSortScheduleNameByAscending ServicesSortByType = "schedule_name" ServicesSortScheduleNameByDescending ServicesSortByType = "-schedule_name" ServicesSortScheduleTypeByAscending ServicesSortByType = "schedule_type" ServicesSortScheduleTypeByDescending ServicesSortByType = "-schedule_type" ServicesSortScheduleTypicalityByAscending ServicesSortByType = "schedule_typicality" ServicesSortScheduleTypicalityByDescending ServicesSortByType = "-schedule_typicality" ServicesSortStartDateByAscending ServicesSortByType = "start_date" ServicesSortStartDateByDescending ServicesSortByType = "-start_date" ServicesSortValidDaysByAscending ServicesSortByType = "valid_days" ServicesSortValidDaysByDescending ServicesSortByType = "-valid_days" )
type Shape ¶
type Shape struct { ID string `jsonapi:"primary,shape"` Priority int `jsonapi:"attr,priority"` Polyline string `jsonapi:"attr,polyline"` Name string `jsonapi:"attr,name"` DirectionID int `jsonapi:"attr,direction_id"` Stops []*Stop `jsonapi:"relation,stops"` Route *Route `jsonapi:"relation,route"` }
Shape holds all the info about an MBTA shape
type ShapeInclude ¶
type ShapeInclude string
ShapeInclude is an enumerable for all the includes for shape
const ( ShapeIncludeRoutes ShapeInclude = includeRoute ShapeIncludeStops ShapeInclude = includeStop )
type ShapeService ¶
type ShapeService service
ShapeService handles all of the shape related API calls
func (*ShapeService) GetAllShapes ¶
func (s *ShapeService) GetAllShapes(config *GetAllShapesRequestConfig) ([]*Shape, *http.Response, error)
GetAllShapes gets all the shapes based on the config info
func (*ShapeService) GetAllShapesWithContext ¶
func (s *ShapeService) GetAllShapesWithContext(ctx context.Context, config *GetAllShapesRequestConfig) ([]*Shape, *http.Response, error)
GetAllShapesWithContext gets all the shapes based on the config info and accepts a context
func (*ShapeService) GetShape ¶
func (s *ShapeService) GetShape(id string, config *GetShapeRequestConfig) (*Shape, *http.Response, error)
GetShape gets the shape with the specified ID
func (*ShapeService) GetShapeWithContext ¶
func (s *ShapeService) GetShapeWithContext(ctx context.Context, id string, config *GetShapeRequestConfig) (*Shape, *http.Response, error)
GetShapeWithContext gets the shape with the specified ID and accepts context
type ShapesSortByType ¶
type ShapesSortByType string
ShapesSortByType is an enumerable for all the ways you can sort shapes
const ( ShapesSortByDirectionIDAscending ShapesSortByType = "direction_id" ShapesSortByDirectionIDDecending ShapesSortByType = "-direction_id" ShapesSortByNameAscending ShapesSortByType = "name" ShapesSortByNameDecending ShapesSortByType = "-name" ShapesSortByPolylineAscending ShapesSortByType = "polyline" ShapesSortByPolylineDecending ShapesSortByType = "-polyline" ShapesSortByPriorityAscending ShapesSortByType = "priority" ShapesSortByPriorityDecending ShapesSortByType = "-priority" )
type Stop ¶
type Stop struct { ID string `jsonapi:"primary,stop"` Address *string `jsonapi:"attr,address"` // A street address for the station Description *string `jsonapi:"attr,description"` // Description of the stop Latitude float64 `jsonapi:"attr,latitude"` // Degrees North, in the WGS-84 coordinate system LocationType StopLocationType `jsonapi:"attr,location_type"` // The type of the stop Longitude float64 `jsonapi:"attr,longitude"` // Degrees East, in the WGS-84 coordinate system Name string `jsonapi:"attr,name"` // Name of a stop or station in the local and tourist vernacular PlatformCode *string `jsonapi:"attr,platform_code"` // A short code representing the platform/track (like a number or letter) PlatformName *string `jsonapi:"attr,platform_name"` // A textual description of the platform or track WheelchairBoarding WheelchairBoardingType `jsonapi:"attr,wheelchair_boarding"` // Whether there are any vehicles with wheelchair boarding or paths to stops that are wheelchair acessible ParentStation *Stop `jsonapi:"relation,parent_station"` // The link to the parent station. Only includes id by default, use IncludeParentStation config option to get all data }
Stop holds all info about a given MBTA Stop
type StopInclude ¶
type StopInclude string
StopInclude all of the includes for a stop request
const (
StopIncludeParentStation StopInclude = includeParentStation
)
type StopLocationType ¶
type StopLocationType int
StopLocationType enum for the possible stop location types
const ( // StopLocationStop A location where passengers board or disembark from a transit vehicle StopLocationStop StopLocationType = iota // StopLocationStation A physical structure or area that contains one or more stops StopLocationStation // StopLocationStationEntranceExit A location where passengers can enter or exit a station from the street StopLocationStationEntranceExit )
type StopService ¶
type StopService service
StopService service handling all of the stop related API calls
func (*StopService) GetAllStops ¶
func (s *StopService) GetAllStops(config *GetAllStopsRequestConfig) ([]*Stop, *http.Response, error)
GetAllStops returns all stops from the mbta API
func (*StopService) GetAllStopsWithContext ¶
func (s *StopService) GetAllStopsWithContext(ctx context.Context, config *GetAllStopsRequestConfig) ([]*Stop, *http.Response, error)
GetAllStopsWithContext returns all stops from the mbta API given a context
func (*StopService) GetStop ¶
func (s *StopService) GetStop(id string, config *GetStopRequestConfig) (*Stop, *http.Response, error)
GetStop returns a stop from the mbta API
func (*StopService) GetStopWithContext ¶
func (s *StopService) GetStopWithContext(ctx context.Context, id string, config *GetStopRequestConfig) (*Stop, *http.Response, error)
GetStopWithContext returns a stop from the mbta API given a context
type StopsSortByType ¶
type StopsSortByType string
StopsSortByType all of the possible ways to sort by for a GetAllStops request
const ( StopsSortByAddressAscending StopsSortByType = "address" StopsSortByAddressDescending StopsSortByType = "-address" StopsSortByDescriptionAscending StopsSortByType = "description" StopsSortByDescriptionDescending StopsSortByType = "-description" StopsSortByLatitudeAscending StopsSortByType = "latitude" StopsSortByLatitudeDescending StopsSortByType = "-latitude" StopsSortByLocationTypeAscending StopsSortByType = "location_type" StopsSortByLocationTypeDescending StopsSortByType = "-location_type" StopsSortByLongitudeAscending StopsSortByType = "longitude" StopsSortByLongitudeDescending StopsSortByType = "-longitude" StopsSortByNameAscending StopsSortByType = "name" StopsSortByNameDescending StopsSortByType = "-name" StopsSortByPlatformCodeAscending StopsSortByType = "platform_code" StopsSortByPlatformCodeDescending StopsSortByType = "-platform_code" StopsSortByPlatformNameAscending StopsSortByType = "platform_name" StopsSortByPlatformNameDescending StopsSortByType = "-platform_name" StopsSortByWheelchairBoardingAscending StopsSortByType = "wheelchair_boarding" StopsSortByWheelchairBoardingDescending StopsSortByType = "-wheelchair_boarding" StopsSortByDistanceAscending StopsSortByType = "distance" StopsSortByDistanceDescending StopsSortByType = "-distance" )
type TimeISO8601 ¶
TimeISO8601 wrapper for a time.Time struct so that the Unmarshal works
func (*TimeISO8601) EncodeValues ¶
func (t *TimeISO8601) EncodeValues(key string, v *url.Values) error
EncodeValues implement the "github.com/google/go-querystring/query" interface for encoding
func (*TimeISO8601) FormatOnlyDate ¶
func (t *TimeISO8601) FormatOnlyDate() string
FormatOnlyDate format the time as ISO8601 with only the date
func (*TimeISO8601) MarshalJSON ¶
func (t *TimeISO8601) MarshalJSON() ([]byte, error)
MarshalJSON marshal time.Time as ISO8601
func (*TimeISO8601) UnmarshalJSON ¶
func (t *TimeISO8601) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshal time.Time as ISO8601
type Trip ¶
type Trip struct { ID string `jsonapi:"primary,trip"` WheelchairAccessible WheelchairBoardingType `jsonapi:"attr,wheelchair_accessible"` // Indicator of wheelchair accessibility Name string `jsonapi:"attr,name"` // The text that appears in schedules and sign boards to identify the trip to passengers Headsign string `jsonapi:"attr,headsign"` // The text that appears on a sign that identifies the trip’s destination to passengers DirectionID int `jsonapi:"attr,direction_id"` // Direction in which trip is traveling: 0 or 1. BlockID string `jsonapi:"attr,block_id"` // ID used to group sequential trips with the same vehicle for a given service_id BikesAllowed BikesAllowedType `jsonapi:"attr,bikes_allowed"` // Indicator of whether or not bikes are allowed on this trip Route *Route `jsonapi:"relation,route"` // Trip that the current trip is linked with. Only includes id by default, use Include config option to get all data RoutePattern *RoutePattern `jsonapi:"relation,route_pattern"` Service *Service `jsonapi:"relation,service"` Shape *Shape `jsonapi:"relation,shape"` }
Trip holds all info about a given MBTA Trip
type TripInclude ¶
type TripInclude string
TripInclude all of the includes for a trip request
const ( TripIncludeRoute TripInclude = includeRoute TripIncludeVehicle TripInclude = includeVehicle TripIncludeService TripInclude = includeService TripIncludeShape TripInclude = includeShape TripIncludeRoutePattern TripInclude = includeRoutePattern TripIncludePredictions TripInclude = includePredictions )
type TripService ¶
type TripService service
TripService service handling all of the trip related API calls
func (*TripService) GetAllTrips ¶
func (s *TripService) GetAllTrips(config GetAllTripsRequestConfig) ([]*Trip, *http.Response, error)
GetAllTrips returns all vehicles from the mbta API
func (*TripService) GetAllTripsWithContext ¶
func (s *TripService) GetAllTripsWithContext(ctx context.Context, config GetAllTripsRequestConfig) ([]*Trip, *http.Response, error)
GetAllTripsWithContext returns all vehicles from the mbta API given a context
func (*TripService) GetTrip ¶
func (s *TripService) GetTrip(id string, config GetTripRequestConfig) (*Trip, *http.Response, error)
GetTrip returns a vehicle from the mbta API
func (*TripService) GetTripWithContext ¶
func (s *TripService) GetTripWithContext(ctx context.Context, id string, config GetTripRequestConfig) (*Trip, *http.Response, error)
GetTripWithContext returns a vehicle from the mbta API given a context
type TripsSortByType ¶
type TripsSortByType string
TripsSortByType all of the possible ways to sort by for a GetAllTrips request
const ( TripsSortByBikesAllowedAscending TripsSortByType = "bikes_allowed" TripsSortByBikesAllowedDescending TripsSortByType = "-bikes_allowed" TripsSortByBlockIDAscending TripsSortByType = "block_id" TripsSortByBlockIDDescending TripsSortByType = "-block_id" TripsSortByDirectionIDAscending TripsSortByType = "direction_id" TripsSortByDirectionIDDescending TripsSortByType = "-direction_id" TripsSortByHeadsignAscending TripsSortByType = "headsign" TripsSortByHeadsignDescending TripsSortByType = "-headsign" TripsSortByNameAscending TripsSortByType = "name" TripsSortByNameDescending TripsSortByType = "-name" TripsSortByWheelchairAccessibleAscending TripsSortByType = "wheelchair_accessible" TripsSortByWheelchairAccessibleDescending TripsSortByType = "-wheelchair_accessible" )
type Vehicle ¶
type Vehicle struct { ID string `jsonapi:"primary,vehicle"` Bearing float32 `jsonapi:"attr,bearing"` // Bearing, in degrees, clockwise from True North, i.e., 0 is North and 90 is East CurrentStatus VehicleStatus `jsonapi:"attr,current_status"` // Status of vehicle relative to the stops CurrentStopSequence int `jsonapi:"attr,current_stop_sequence"` // not sure on this one yet DirectionID int `jsonapi:"attr,direction_id"` // Direction in which trip is traveling: 0 or 1. Label string `jsonapi:"attr,label"` // User visible label, such as the one of on the signage on the vehicle Latitude float64 `jsonapi:"attr,latitude"` // Degrees North, in the WGS-84 coordinate system Longitude float64 `jsonapi:"attr,longitude"` // Degrees East, in the WGS-84 coordinate system Speed *float32 `jsonapi:"attr,speed"` // meters per second UpdatedAt TimeISO8601 `jsonapi:"attr,updated_at"` // Time at which vehicle information was last updated. Format is ISO8601 Route *Route `jsonapi:"relation,route"` // Route that the current vehicle is on. Only includes id by default, use Include config option to get all data Stop *Stop `jsonapi:"relation,stop"` // Stop that the vehicle is at. Only includes id by default, use Include config option to get all data Trip *Trip `jsonapi:"relation,trip"` // Trip that the current vehicle is on. Only includes id by default, use Include config option to get all data }
Vehicle holds all info about a given MBTA vehicle
type VehicleInclude ¶
type VehicleInclude string
VehicleInclude all of the includes for a vehicle request
const ( VehicleIncludeTrip VehicleInclude = includeTrip VehicleIncludeStop VehicleInclude = includeStop VehicleIncludeRoute VehicleInclude = includeRoute )
type VehicleService ¶
type VehicleService service
VehicleService service handling all of the vehicle related API calls
func (*VehicleService) GetAllVehicles ¶
func (s *VehicleService) GetAllVehicles(config *GetAllVehiclesRequestConfig) ([]*Vehicle, *http.Response, error)
GetAllVehicles returns all vehicles from the mbta API
func (*VehicleService) GetAllVehiclesWithContext ¶
func (s *VehicleService) GetAllVehiclesWithContext(ctx context.Context, config *GetAllVehiclesRequestConfig) ([]*Vehicle, *http.Response, error)
GetAllVehiclesWithContext returns all vehicles from the mbta API given a context
func (*VehicleService) GetVehicle ¶
func (s *VehicleService) GetVehicle(id string, config *GetVehicleRequestConfig) (*Vehicle, *http.Response, error)
GetVehicle returns a vehicle from the mbta API
func (*VehicleService) GetVehicleWithContext ¶
func (s *VehicleService) GetVehicleWithContext(ctx context.Context, id string, config *GetVehicleRequestConfig) (*Vehicle, *http.Response, error)
GetVehicleWithContext returns a vehicle from the mbta API given a context
type VehicleStatus ¶
type VehicleStatus string
VehicleStatus enum for the possible vehicle statuses
const ( // InTransitTo vehicleStatus for a vehicle in transit InTransitTo VehicleStatus = "IN_TRANSIT_TO" // StoppedAt vehicleStatus for a vehicle stopped at a station StoppedAt VehicleStatus = "STOPPED_AT" // IncomingAt vehicleStatus for a vehicle getting into a station IncomingAt VehicleStatus = "INCOMING_AT" )
type VehiclesSortByType ¶
type VehiclesSortByType string
VehiclesSortByType all of the possible ways to sort by for a GetAllVehicles request
const ( VehiclesSortByBearingAscending VehiclesSortByType = "bearing" VehiclesSortByBearingDescending VehiclesSortByType = "-bearing" VehiclesSortByCurrentStatusAscending VehiclesSortByType = "current_status" VehiclesSortByCurrentStatusDescending VehiclesSortByType = "-current_status" VehiclesSortByCurrentStopSequenceAscending VehiclesSortByType = "current_stop_sequence" VehiclesSortByCurrentStopSequenceDescending VehiclesSortByType = "-current_stop_sequence" VehiclesSortByDirectionIDAscending VehiclesSortByType = "direction_id" VehiclesSortByDirectionIDDescending VehiclesSortByType = "-direction_id" VehiclesSortByLabelAscending VehiclesSortByType = "label" VehiclesSortByLabelDescending VehiclesSortByType = "-label" VehiclesSortByLatitudeAscending VehiclesSortByType = "latitude" VehiclesSortByLatitudeDescending VehiclesSortByType = "-latitude" VehiclesSortByLongitudeAscending VehiclesSortByType = "longitude" VehiclesSortByLongitudeDescending VehiclesSortByType = "-longitude" VehiclesSortBySpeedAscending VehiclesSortByType = "speed" VehiclesSortBySpeedDescending VehiclesSortByType = "-speed" VehiclesSortByUpdatedAtAscending VehiclesSortByType = "updated_at" VehiclesSortByUpdatedAtDescending VehiclesSortByType = "-updated_at" )
type WheelchairBoardingType ¶
type WheelchairBoardingType int
WheelchairBoardingType enum for the possible wheelchair boarding types at a stop
const ( // WheelchairBoardingNoInfo No information WheelchairBoardingNoInfo WheelchairBoardingType = iota // WheelchairBoardingAccessible Accessible (if trip is wheelchair accessible) WheelchairBoardingAccessible // WheelchairBoardingInaccessible Inaccessible WheelchairBoardingInaccessible )