rest

package
v0.0.0-...-673c755 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const CIRCLESIZE = 10

CIRCLESIZE .

View Source
const CIRCLEWIDTH = 5

CIRCLEWIDTH .

View Source
const DEFAULTLIMIT = 20

DEFAULTLIMIT is the default API limit

View Source
const MAXRADIUS = 100 * 1000.0

MAXRADIUS is the maximum point search radius

Variables

View Source
var MAXLIMIT = 1_000

MAXLIMIT is the API limit maximum

Functions

func NewServer

func NewServer(graphqlHandler http.Handler) (http.Handler, error)

NewServer .

Types

type AgencyRequest

type AgencyRequest struct {
	ID              int       `json:"id,string"`
	AgencyKey       string    `json:"agency_key"`
	AgencyID        string    `json:"agency_id"`
	AgencyName      string    `json:"agency_name"`
	OnestopID       string    `json:"onestop_id"`
	FeedVersionSHA1 string    `json:"feed_version_sha1"`
	FeedOnestopID   string    `json:"feed_onestop_id"`
	Search          string    `json:"search"`
	Lon             float64   `json:"lon,string"`
	Lat             float64   `json:"lat,string"`
	Bbox            *restBbox `json:"bbox"`
	Radius          float64   `json:"radius,string"`
	Adm0Name        string    `json:"adm0_name"`
	Adm0Iso         string    `json:"adm0_iso"`
	Adm1Name        string    `json:"adm1_name"`
	Adm1Iso         string    `json:"adm1_iso"`
	CityName        string    `json:"city_name"`
	IncludeAlerts   bool      `json:"include_alerts,string"`
	IncludeRoutes   bool      `json:"include_routes,string"`
	LicenseFilter
	WithCursor
}

AgencyRequest holds options for a Route request

func (AgencyRequest) Query

func (r AgencyRequest) Query() (string, map[string]interface{})

Query returns a GraphQL query string and variables.

func (AgencyRequest) ResponseKey

func (r AgencyRequest) ResponseKey() string

ResponseKey returns the GraphQL response entity key.

type FeedRequest

type FeedRequest struct {
	FeedKey          string    `json:"feed_key"`
	ID               int       `json:"id,string"`
	OnestopID        string    `json:"onestop_id"`
	Spec             string    `json:"spec"`
	Search           string    `json:"search"`
	FetchError       string    `json:"fetch_error"`
	TagKey           string    `json:"tag_key"`
	TagValue         string    `json:"tag_value"`
	URL              string    `json:"url"`
	URLType          string    `json:"url_type"`
	URLCaseSensitive bool      `json:"url_case_sensitive"`
	Lon              float64   `json:"lon,string"`
	Lat              float64   `json:"lat,string"`
	Radius           float64   `json:"radius,string"`
	Bbox             *restBbox `json:"bbox"`
	LicenseFilter
	WithCursor
}

FeedRequest holds options for a Route request

func (FeedRequest) ProcessGeoJSON

func (r FeedRequest) ProcessGeoJSON(response map[string]interface{}) error

ProcessGeoJSON .

func (FeedRequest) Query

func (r FeedRequest) Query() (string, map[string]interface{})

Query returns a GraphQL query string and variables.

func (FeedRequest) ResponseKey

func (r FeedRequest) ResponseKey() string

ResponseKey .

type FeedVersionRequest

type FeedVersionRequest struct {
	FeedVersionKey  string    `json:"feed_version_key"`
	FeedKey         string    `json:"feed_key"`
	ID              int       `json:"id,string"`
	FeedID          int       `json:"feed_id,string"`
	FeedOnestopID   string    `json:"feed_onestop_id"`
	Sha1            string    `json:"sha1"`
	FetchedBefore   string    `json:"fetched_before"`
	FetchedAfter    string    `json:"fetched_after"`
	CoversStartDate string    `json:"covers_start_date"`
	CoversEndDate   string    `json:"covers_end_date"`
	Lon             float64   `json:"lon,string"`
	Lat             float64   `json:"lat,string"`
	Radius          float64   `json:"radius,string"`
	Bbox            *restBbox `json:"bbox"`
	WithCursor
}

FeedVersionRequest holds options for a Route request

func (FeedVersionRequest) Query

func (r FeedVersionRequest) Query() (string, map[string]interface{})

Query returns a GraphQL query string and variables.

func (FeedVersionRequest) ResponseKey

func (r FeedVersionRequest) ResponseKey() string

ResponseKey .

type LicenseFilter

type LicenseFilter struct {
	LicenseCommercialUseAllowed  string `json:"license_commercial_use_allowed"`
	LicenseShareAlikeOptional    string `json:"license_share_alike_optional"`
	LicenseCreateDerivedProduct  string `json:"license_create_derived_product"`
	LicenseRedistributionAllowed string `json:"license_redistribution_allowed"`
	LicenseUseWithoutAttribution string `json:"license_use_without_attribution"`
}

type OperatorRequest

type OperatorRequest struct {
	OperatorKey   string `json:"operator_key"`
	ID            int    `json:"id,string"`
	OnestopID     string `json:"onestop_id"`
	FeedOnestopID string `json:"feed_onestop_id"`
	Search        string `json:"search"`
	TagKey        string `json:"tag_key"`
	TagValue      string `json:"tag_value"`
	Adm0Name      string `json:"adm0_name"`
	Adm0Iso       string `json:"adm0_iso"`
	Adm1Name      string `json:"adm1_name"`
	Adm1Iso       string `json:"adm1_iso"`
	CityName      string `json:"city_name"`
	IncludeAlerts bool   `json:"include_alerts,string"`
	LicenseFilter
	WithCursor
}

OperatorRequest holds options for a Route request

func (OperatorRequest) Query

func (r OperatorRequest) Query() (string, map[string]interface{})

Query returns a GraphQL query string and variables.

func (OperatorRequest) ResponseKey

func (r OperatorRequest) ResponseKey() string

ResponseKey returns the GraphQL response entity key.

type RouteRequest

type RouteRequest struct {
	ID                int       `json:"id,string"`
	RouteKey          string    `json:"route_key"`
	AgencyKey         string    `json:"agency_key"`
	RouteID           string    `json:"route_id"`
	RouteType         string    `json:"route_type"`
	OnestopID         string    `json:"onestop_id"`
	OperatorOnestopID string    `json:"operator_onestop_id"`
	Format            string    `json:"format"`
	Search            string    `json:"search"`
	AgencyID          int       `json:"agency_id,string"`
	FeedVersionSHA1   string    `json:"feed_version_sha1"`
	FeedOnestopID     string    `json:"feed_onestop_id"`
	Lon               float64   `json:"lon,string"`
	Lat               float64   `json:"lat,string"`
	Radius            float64   `json:"radius,string"`
	Bbox              *restBbox `json:"bbox"`
	IncludeGeometry   bool      `json:"include_geometry,string"`
	IncludeAlerts     bool      `json:"include_alerts,string"`
	IncludeStops      bool      `json:"include_stops,string"`
	LicenseFilter
	WithCursor
}

RouteRequest holds options for a Route request

func (RouteRequest) Query

func (r RouteRequest) Query() (string, map[string]interface{})

Query returns a GraphQL query string and variables.

func (RouteRequest) ResponseKey

func (r RouteRequest) ResponseKey() string

ResponseKey returns the GraphQL response entity key.

type StopDepartureRequest

type StopDepartureRequest struct {
	StopKey          string `json:"stop_key"`
	ID               int    `json:"id,string"`
	StopID           string `json:"stop_id"`
	FeedOnestopID    string `json:"feed_onestop_id"`
	OnestopID        string `json:"onestop_id"`
	Next             int    `json:"next,string"`
	ServiceDate      string `json:"service_date"`
	StartTime        string `json:"start_time"`
	EndTime          string `json:"end_time"`
	IncludeGeometry  bool   `json:"include_geometry,string"`
	IncludeAlerts    bool   `json:"include_alerts,string"`
	UseServiceWindow *bool  `json:"use_service_window,string"`
	WithCursor
}

StopDepartureRequest holds options for a /stops/_/departures request

func (StopDepartureRequest) IncludeNext

func (r StopDepartureRequest) IncludeNext() bool

IncludeNext

func (StopDepartureRequest) Query

func (r StopDepartureRequest) Query() (string, map[string]interface{})

Query returns a GraphQL query string and variables.

func (StopDepartureRequest) ResponseKey

func (r StopDepartureRequest) ResponseKey() string

ResponseKey returns the GraphQL response entity key.

type StopRequest

type StopRequest struct {
	ID                 int       `json:"id,string"`
	StopKey            string    `json:"stop_key"`
	StopID             string    `json:"stop_id"`
	OnestopID          string    `json:"onestop_id"`
	FeedVersionSHA1    string    `json:"feed_version_sha1"`
	FeedOnestopID      string    `json:"feed_onestop_id"`
	Search             string    `json:"search"`
	Bbox               *restBbox `json:"bbox"`
	Lon                float64   `json:"lon,string"`
	Lat                float64   `json:"lat,string"`
	Radius             float64   `json:"radius,string"`
	Format             string    `json:"format"`
	ServedByOnestopIds string    `json:"served_by_onestop_ids"`
	ServedByRouteType  *int      `json:"served_by_route_type,string"`
	IncludeAlerts      bool      `json:"include_alerts,string"`
	IncludeRoutes      bool      `json:"include_routes,string"`
	LicenseFilter
	WithCursor
}

StopRequest holds options for a /stops request

func (StopRequest) Query

func (r StopRequest) Query() (string, map[string]interface{})

Query returns a GraphQL query string and variables.

func (StopRequest) ResponseKey

func (r StopRequest) ResponseKey() string

ResponseKey returns the GraphQL response entity key.

type TripRequest

type TripRequest struct {
	ID               int    `json:"id,string"`
	TripID           string `json:"trip_id"`
	RouteKey         string `json:"route_key"`
	RouteID          int    `json:"route_id,string"`
	RouteOnestopID   string `json:"route_onestop_id"`
	FeedOnestopID    string `json:"feed_onestop_id"`
	FeedVersionSHA1  string `json:"feed_version_sha1"`
	ServiceDate      string `json:"service_date"`
	IncludeGeometry  bool   `json:"include_geometry,string"`
	IncludeStopTimes bool   `json:"include_stop_times,string"`
	IncludeAlerts    bool   `json:"include_alerts,string"`
	Format           string
	LicenseFilter
	WithCursor
}

TripRequest holds options for a /trips request

func (TripRequest) ProcessGeoJSON

func (r TripRequest) ProcessGeoJSON(response map[string]interface{}) error

ProcessGeoJSON .

func (TripRequest) Query

func (r TripRequest) Query() (string, map[string]interface{})

Query returns a GraphQL query string and variables.

func (TripRequest) ResponseKey

func (r TripRequest) ResponseKey() string

ResponseKey .

type WithCursor

type WithCursor struct {
	Limit int `json:"limit,string"`
	After int `json:"after,string"`
}

func (WithCursor) CheckAfter

func (w WithCursor) CheckAfter() int

func (WithCursor) CheckLimit

func (w WithCursor) CheckLimit() int

Jump to

Keyboard shortcuts

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