oapi

package
v0.0.0-...-6fb5468 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package oapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type Agency

type Agency struct {
	Id       openapi_types.UUID `json:"id"`
	Name     map[string]string  `json:"name"`
	Slug     string             `json:"slug"`
	Timezone string             `json:"timezone"`
}

Agency defines model for Agency.

type AgencyBranding

type AgencyBranding struct {
	Font      *string `json:"font,omitempty"`
	LogoUrl   *string `json:"logo_url,omitempty"`
	Primary   string  `json:"primary"`
	Secondary *string `json:"secondary,omitempty"`
}

AgencyBranding defines model for AgencyBranding.

type AgencyConfig

type AgencyConfig struct {
	Branding     AgencyBranding           `json:"branding"`
	Currency     string                   `json:"currency"`
	DistanceUnit AgencyConfigDistanceUnit `json:"distance_unit"`
	DriverOps    DriverOpsConfig          `json:"driver_ops"`
	License      AgencyLicense            `json:"license"`
	Locales      []string                 `json:"locales"`
	MapProvider  AgencyConfigMapProvider  `json:"map_provider"`
	Modes        []string                 `json:"modes"`
}

AgencyConfig defines model for AgencyConfig.

type AgencyConfigDistanceUnit

type AgencyConfigDistanceUnit string

AgencyConfigDistanceUnit defines model for AgencyConfig.DistanceUnit.

const (
	Imperial AgencyConfigDistanceUnit = "imperial"
	Metric   AgencyConfigDistanceUnit = "metric"
)

Defines values for AgencyConfigDistanceUnit.

func (AgencyConfigDistanceUnit) Valid

func (e AgencyConfigDistanceUnit) Valid() bool

Valid indicates whether the value is a known member of the AgencyConfigDistanceUnit enum.

type AgencyConfigMapProvider

type AgencyConfigMapProvider string

AgencyConfigMapProvider defines model for AgencyConfig.MapProvider.

const (
	Google    AgencyConfigMapProvider = "google"
	Maplibre  AgencyConfigMapProvider = "maplibre"
	Protomaps AgencyConfigMapProvider = "protomaps"
)

Defines values for AgencyConfigMapProvider.

func (AgencyConfigMapProvider) Valid

func (e AgencyConfigMapProvider) Valid() bool

Valid indicates whether the value is a known member of the AgencyConfigMapProvider enum.

type AgencyLicense

type AgencyLicense struct {
	Attribution string  `json:"attribution"`
	Spdx        string  `json:"spdx"`
	TermsUrl    *string `json:"terms_url,omitempty"`
}

AgencyLicense defines model for AgencyLicense.

type Arrival

type Arrival struct {
	ArrivalTime string `json:"arrival_time"`

	// Confidence How the prediction was derived — high (direct geofence confirmation), medium (interpolated from a normal-density trace) or low (interpolated across a signal gap, or while off-route).
	Confidence *ArrivalConfidence `json:"confidence,omitempty"`

	// DelaySeconds Positive is late, negative is early, 0 is on time.
	DelaySeconds  *int   `json:"delay_seconds,omitempty"`
	DepartureTime string `json:"departure_time"`

	// PredictedArrivalTime Server-computed prediction (Phase 8), when available: an actual measured arrival for a completed stop, or a live estimate for an in-progress trip. Absent when no realtime data exists yet, in which case only the static arrival_time applies.
	PredictedArrivalTime   *time.Time `json:"predicted_arrival_time,omitempty"`
	PredictedDepartureTime *time.Time `json:"predicted_departure_time,omitempty"`
	RouteId                string     `json:"route_id"`
	RouteShortName         *string    `json:"route_short_name,omitempty"`
	StopId                 string     `json:"stop_id"`
	StopSequence           int        `json:"stop_sequence"`
	TripHeadsign           *string    `json:"trip_headsign,omitempty"`
	TripId                 string     `json:"trip_id"`
	WheelchairAccessible   *int       `json:"wheelchair_accessible,omitempty"`
}

Arrival defines model for Arrival.

type ArrivalConfidence

type ArrivalConfidence string

ArrivalConfidence How the prediction was derived — high (direct geofence confirmation), medium (interpolated from a normal-density trace) or low (interpolated across a signal gap, or while off-route).

const (
	High   ArrivalConfidence = "high"
	Low    ArrivalConfidence = "low"
	Medium ArrivalConfidence = "medium"
)

Defines values for ArrivalConfidence.

func (ArrivalConfidence) Valid

func (e ArrivalConfidence) Valid() bool

Valid indicates whether the value is a known member of the ArrivalConfidence enum.

type ArrivalList

type ArrivalList struct {
	Items  []Arrival `json:"items"`
	Limit  *int      `json:"limit,omitempty"`
	Offset *int      `json:"offset,omitempty"`
	Total  *int      `json:"total,omitempty"`
}

ArrivalList defines model for ArrivalList.

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type DriverOpsConfig

type DriverOpsConfig struct {
	AutoStartTrip       bool    `json:"auto_start_trip"`
	LockUiAboveKmh      float32 `json:"lock_ui_above_kmh"`
	PingIntervalIdleS   int     `json:"ping_interval_idle_s"`
	PingIntervalMovingS int     `json:"ping_interval_moving_s"`
	StopGeofenceM       float32 `json:"stop_geofence_m"`
}

DriverOpsConfig defines model for DriverOpsConfig.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type ListArrivalsParams

type ListArrivalsParams struct {
	StopId      *string             `form:"stop_id,omitempty" json:"stop_id,omitempty"`
	RouteId     *string             `form:"route_id,omitempty" json:"route_id,omitempty"`
	ServiceDate *openapi_types.Date `form:"service_date,omitempty" json:"service_date,omitempty"`
	Limit       *int                `form:"limit,omitempty" json:"limit,omitempty"`
	Offset      *int                `form:"offset,omitempty" json:"offset,omitempty"`
}

ListArrivalsParams defines parameters for ListArrivals.

type ListRoutesParams

type ListRoutesParams struct {
	Limit  *int `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}

ListRoutesParams defines parameters for ListRoutes.

type ListStopsParams

type ListStopsParams struct {
	Lat     *float64 `form:"lat,omitempty" json:"lat,omitempty"`
	Lon     *float64 `form:"lon,omitempty" json:"lon,omitempty"`
	RadiusM *float64 `form:"radius_m,omitempty" json:"radius_m,omitempty"`
	Limit   *int     `form:"limit,omitempty" json:"limit,omitempty"`
	Offset  *int     `form:"offset,omitempty" json:"offset,omitempty"`
}

ListStopsParams defines parameters for ListStops.

type ListTripsParams

type ListTripsParams struct {
	RouteId   *string `form:"route_id,omitempty" json:"route_id,omitempty"`
	ServiceId *string `form:"service_id,omitempty" json:"service_id,omitempty"`
	Limit     *int    `form:"limit,omitempty" json:"limit,omitempty"`
	Offset    *int    `form:"offset,omitempty" json:"offset,omitempty"`
}

ListTripsParams defines parameters for ListTrips.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type ReadyResponse

type ReadyResponse struct {
	// Status Example: ready
	Status string `json:"status"`
}

ReadyResponse defines model for ReadyResponse.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type Route

type Route struct {
	RouteColor     *string `json:"route_color,omitempty"`
	RouteDesc      *string `json:"route_desc,omitempty"`
	RouteId        string  `json:"route_id"`
	RouteLongName  *string `json:"route_long_name,omitempty"`
	RouteShortName *string `json:"route_short_name,omitempty"`
	RouteSortOrder *int    `json:"route_sort_order,omitempty"`
	RouteTextColor *string `json:"route_text_color,omitempty"`
	RouteType      int     `json:"route_type"`
	RouteUrl       *string `json:"route_url,omitempty"`
}

Route defines model for Route.

type RouteList

type RouteList struct {
	Items  []Route `json:"items"`
	Limit  *int    `json:"limit,omitempty"`
	Offset *int    `json:"offset,omitempty"`
	Total  *int    `json:"total,omitempty"`
}

RouteList defines model for RouteList.

type ServerInterface

type ServerInterface interface {
	// Healthz Liveness probe
	// (GET /healthz)
	Healthz(w http.ResponseWriter, r *http.Request)
	// Readyz Readiness probe
	// (GET /readyz)
	Readyz(w http.ResponseWriter, r *http.Request)
	// GetAgency Get public agency metadata
	// (GET /v0/agencies/{slug})
	GetAgency(w http.ResponseWriter, r *http.Request, slug string)
	// ListArrivals List upcoming arrivals for an agency
	// (GET /v0/agencies/{slug}/arrivals)
	ListArrivals(w http.ResponseWriter, r *http.Request, slug string, params ListArrivalsParams)
	// GetAgencyConfig Get agency runtime configuration
	// (GET /v0/agencies/{slug}/config)
	GetAgencyConfig(w http.ResponseWriter, r *http.Request, slug string)
	// ListRoutes List routes for an agency
	// (GET /v0/agencies/{slug}/routes)
	ListRoutes(w http.ResponseWriter, r *http.Request, slug string, params ListRoutesParams)
	// GetRoute Get a single route
	// (GET /v0/agencies/{slug}/routes/{route_id})
	GetRoute(w http.ResponseWriter, r *http.Request, slug string, routeId string)
	// ListStops List stops for an agency
	// (GET /v0/agencies/{slug}/stops)
	ListStops(w http.ResponseWriter, r *http.Request, slug string, params ListStopsParams)
	// GetStop Get a single stop
	// (GET /v0/agencies/{slug}/stops/{stop_id})
	GetStop(w http.ResponseWriter, r *http.Request, slug string, stopId string)
	// ListTrips List trips for an agency
	// (GET /v0/agencies/{slug}/trips)
	ListTrips(w http.ResponseWriter, r *http.Request, slug string, params ListTripsParams)
	// GetTrip Get a single trip
	// (GET /v0/agencies/{slug}/trips/{trip_id})
	GetTrip(w http.ResponseWriter, r *http.Request, slug string, tripId string)
	// ListTripStopTimes List stop times for a trip
	// (GET /v0/agencies/{slug}/trips/{trip_id}/stop_times)
	ListTripStopTimes(w http.ResponseWriter, r *http.Request, slug string, tripId string)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetAgency

func (siw *ServerInterfaceWrapper) GetAgency(w http.ResponseWriter, r *http.Request)

GetAgency operation middleware

func (*ServerInterfaceWrapper) GetAgencyConfig

func (siw *ServerInterfaceWrapper) GetAgencyConfig(w http.ResponseWriter, r *http.Request)

GetAgencyConfig operation middleware

func (*ServerInterfaceWrapper) GetRoute

func (siw *ServerInterfaceWrapper) GetRoute(w http.ResponseWriter, r *http.Request)

GetRoute operation middleware

func (*ServerInterfaceWrapper) GetStop

GetStop operation middleware

func (*ServerInterfaceWrapper) GetTrip

GetTrip operation middleware

func (*ServerInterfaceWrapper) Healthz

Healthz operation middleware

func (*ServerInterfaceWrapper) ListArrivals

func (siw *ServerInterfaceWrapper) ListArrivals(w http.ResponseWriter, r *http.Request)

ListArrivals operation middleware

func (*ServerInterfaceWrapper) ListRoutes

func (siw *ServerInterfaceWrapper) ListRoutes(w http.ResponseWriter, r *http.Request)

ListRoutes operation middleware

func (*ServerInterfaceWrapper) ListStops

func (siw *ServerInterfaceWrapper) ListStops(w http.ResponseWriter, r *http.Request)

ListStops operation middleware

func (*ServerInterfaceWrapper) ListTripStopTimes

func (siw *ServerInterfaceWrapper) ListTripStopTimes(w http.ResponseWriter, r *http.Request)

ListTripStopTimes operation middleware

func (*ServerInterfaceWrapper) ListTrips

func (siw *ServerInterfaceWrapper) ListTrips(w http.ResponseWriter, r *http.Request)

ListTrips operation middleware

func (*ServerInterfaceWrapper) Readyz

Readyz operation middleware

type Stop

type Stop struct {
	LocationType       *int     `json:"location_type,omitempty"`
	ParentStation      *string  `json:"parent_station,omitempty"`
	PlatformCode       *string  `json:"platform_code,omitempty"`
	StopCode           *string  `json:"stop_code,omitempty"`
	StopDesc           *string  `json:"stop_desc,omitempty"`
	StopId             string   `json:"stop_id"`
	StopLat            *float64 `json:"stop_lat,omitempty"`
	StopLon            *float64 `json:"stop_lon,omitempty"`
	StopName           string   `json:"stop_name"`
	WheelchairBoarding *int     `json:"wheelchair_boarding,omitempty"`
}

Stop defines model for Stop.

type StopList

type StopList struct {
	Items  []Stop `json:"items"`
	Limit  *int   `json:"limit,omitempty"`
	Offset *int   `json:"offset,omitempty"`
	Total  *int   `json:"total,omitempty"`
}

StopList defines model for StopList.

type StopTime

type StopTime struct {
	// ArrivalTime HH:MM:SS, may exceed 24:00:00
	ArrivalTime   *string `json:"arrival_time,omitempty"`
	DepartureTime *string `json:"departure_time,omitempty"`
	DropOffType   *int    `json:"drop_off_type,omitempty"`
	PickupType    *int    `json:"pickup_type,omitempty"`
	StopHeadsign  *string `json:"stop_headsign,omitempty"`
	StopId        string  `json:"stop_id"`
	StopSequence  int     `json:"stop_sequence"`
	Timepoint     *int    `json:"timepoint,omitempty"`
	TripId        string  `json:"trip_id"`
}

StopTime defines model for StopTime.

type StopTimeList

type StopTimeList struct {
	Items []StopTime `json:"items"`
}

StopTimeList defines model for StopTimeList.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type Trip

type Trip struct {
	BikesAllowed         *int    `json:"bikes_allowed,omitempty"`
	BlockId              *string `json:"block_id,omitempty"`
	DirectionId          *int    `json:"direction_id,omitempty"`
	RouteId              string  `json:"route_id"`
	ServiceId            string  `json:"service_id"`
	ShapeId              *string `json:"shape_id,omitempty"`
	TripHeadsign         *string `json:"trip_headsign,omitempty"`
	TripId               string  `json:"trip_id"`
	TripShortName        *string `json:"trip_short_name,omitempty"`
	WheelchairAccessible *int    `json:"wheelchair_accessible,omitempty"`
}

Trip defines model for Trip.

type TripList

type TripList struct {
	Items  []Trip `json:"items"`
	Limit  *int   `json:"limit,omitempty"`
	Offset *int   `json:"offset,omitempty"`
	Total  *int   `json:"total,omitempty"`
}

TripList defines model for TripList.

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) GetAgency

func (_ Unimplemented) GetAgency(w http.ResponseWriter, r *http.Request, slug string)

GetAgency Get public agency metadata (GET /v0/agencies/{slug})

func (Unimplemented) GetAgencyConfig

func (_ Unimplemented) GetAgencyConfig(w http.ResponseWriter, r *http.Request, slug string)

GetAgencyConfig Get agency runtime configuration (GET /v0/agencies/{slug}/config)

func (Unimplemented) GetRoute

func (_ Unimplemented) GetRoute(w http.ResponseWriter, r *http.Request, slug string, routeId string)

GetRoute Get a single route (GET /v0/agencies/{slug}/routes/{route_id})

func (Unimplemented) GetStop

func (_ Unimplemented) GetStop(w http.ResponseWriter, r *http.Request, slug string, stopId string)

GetStop Get a single stop (GET /v0/agencies/{slug}/stops/{stop_id})

func (Unimplemented) GetTrip

func (_ Unimplemented) GetTrip(w http.ResponseWriter, r *http.Request, slug string, tripId string)

GetTrip Get a single trip (GET /v0/agencies/{slug}/trips/{trip_id})

func (Unimplemented) Healthz

func (_ Unimplemented) Healthz(w http.ResponseWriter, r *http.Request)

Healthz Liveness probe (GET /healthz)

func (Unimplemented) ListArrivals

func (_ Unimplemented) ListArrivals(w http.ResponseWriter, r *http.Request, slug string, params ListArrivalsParams)

ListArrivals List upcoming arrivals for an agency (GET /v0/agencies/{slug}/arrivals)

func (Unimplemented) ListRoutes

func (_ Unimplemented) ListRoutes(w http.ResponseWriter, r *http.Request, slug string, params ListRoutesParams)

ListRoutes List routes for an agency (GET /v0/agencies/{slug}/routes)

func (Unimplemented) ListStops

func (_ Unimplemented) ListStops(w http.ResponseWriter, r *http.Request, slug string, params ListStopsParams)

ListStops List stops for an agency (GET /v0/agencies/{slug}/stops)

func (Unimplemented) ListTripStopTimes

func (_ Unimplemented) ListTripStopTimes(w http.ResponseWriter, r *http.Request, slug string, tripId string)

ListTripStopTimes List stop times for a trip (GET /v0/agencies/{slug}/trips/{trip_id}/stop_times)

func (Unimplemented) ListTrips

func (_ Unimplemented) ListTrips(w http.ResponseWriter, r *http.Request, slug string, params ListTripsParams)

ListTrips List trips for an agency (GET /v0/agencies/{slug}/trips)

func (Unimplemented) Readyz

func (_ Unimplemented) Readyz(w http.ResponseWriter, r *http.Request)

Readyz Readiness probe (GET /readyz)

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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