tramsfunc

package module
v0.0.0-...-0abee69 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 6 Imported by: 0

README

tramsfunc

A Google Cloud Plaform (GCP) function to provide Transport for Greater Manchester (TFGM) Metrolink tram information.

This function is not intended for end users. Rather it provides the backend API, so that clients can call it without having to register their own TFGM API key.

To deploy this function into GCP a TFGM API key is needed.

Running locally

This project uses Function Frameworks to run the function locally.

# start local server
TFGM_API_KEY='some api key' go run cmd/local-server/main.go
# call the API
curl http://localhost:8080/tramsfunc

Documentation

Index

Constants

View Source
const (
	TfgmApiKey       = "TFGM_API_KEY"
	TfgmApiUrl       = "TFGM_API_URL"
	TfgmApiKeyHeader = "Ocp-Apim-Subscription-Key"
)

Variables

This section is empty.

Functions

func API

func API(w http.ResponseWriter, r *http.Request)

API is the entry point for GCP Functions.

Types

type Metrolink struct {
	Id              int
	Line            string
	TLAREF          string
	PIDREF          string
	StationLocation string
	AtcoCode        string
	Direction       string
	Dest0           string
	Carriages0      string
	Status0         string
	Wait0           string
	Dest1           string
	Carriages1      string
	Status1         string
	Wait1           string
	Dest2           string
	Carriages2      string
	Status2         string
	Wait2           string
	Dest3           string
	Carriages3      string
	Status3         string
	MessageBoard    string
	Wait3           string
	LastUpdated     time.Time
}

Metrolink represents a TFGM Metrolink tram location

type Metrolinks struct {
	Value []Metrolink `json:"value"`
}

Metrolinks is the JSON response object from the TTFGM API

Directories

Path Synopsis
cmd
local-server command

Jump to

Keyboard shortcuts

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