apirtschedule

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2024 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package apirtschedule contains the internal implementation for RTSchedule

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ScheduleDeparture

type ScheduleDeparture struct {
	StopUID        string     `db:"stop_uid" json:"stop_uid"`
	RouteShortName *string    `db:"route_short_name" json:"route_short_name,omitempty"`
	RouteLongName  *string    `db:"route_long_name" json:"route_long_name,omitempty"`
	TripHeadsign   *string    `db:"trip_headsign" json:"trip_headsign,omitempty"`
	DepartureTime  *time.Time `db:"departure_time" json:"departure_time"`
}

ScheduleDeparture represents a single departure (correlating under-the-hood) to an entry in the GTFS stop_times table. This type contains some extra information about each departure as well such as the route short / long name, trip headsign, and departure time. Departure times are provided as UTC.

type ScheduleParams

type ScheduleParams struct {
	FeedIDs    []int    `json:"feed_ids" validate:"required,gt=0"`
	StopUIDs   []string `json:"stop_uids" validate:"required,gt=0"`
	MaxSeconds uint     `json:"max_seconds" validate:"required,gt=0"`

	// Non-required
	Time *time.Time `json:"time" validate:"required"` // Default: now
}

ScheduleParams defines the parameters for the RTSchedule function. The fields FeedIDs, StopUIDs, and MaxSeconds are required. Note that StopUIDs may be determined using the [RTStops] function.

The optional Time field allows you define a custom departure time; if unset it is assumed to use the current system time (now) for departure. The MaxSeconds field is bound to the given time.

type ScheduleResponse

type ScheduleResponse struct {
	Schedule *[]ScheduleDeparture `json:"schedule,omitempty"`
}

ScheduleResponse represents the response for the RTSchedule function containing upcoming departures. See the field Schedule which is an array of ScheduleDeparture indicating potential departures.

func RTSchedule

func RTSchedule(runtime *apirtinit.MobrouteRuntime, params *ScheduleParams) (*ScheduleResponse, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL