datagovsg

package
v0.0.0-...-9fb24d2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIInfo

type APIInfo struct {
	Status string `json:"status,omitempty"`
}

type Area

type Area struct {
	Name          string   `json:"name,omitempty"`
	LabelLocation Location `json:"label_location,omitempty"`
}

type Client

type Client struct {
	APIKey string
	// contains filtered or unexported fields
}

Client is a special HTTP client that batches HTTP requests for the same URL, returning requests through channels

func GetClientFromContext

func GetClientFromContext(ctx context.Context) *Client

func NewClient

func NewClient(apiKey string) *Client

NewClient returns a new Client

func (*Client) Get

func (c *Client) Get(url string, target interface{}) chan ClientResult

Get allows user to make a /GET HTTP request, getting it through a channel.

type ClientResult

type ClientResult struct {
	Body interface{}
	Err  error
}

ClientResult contains the result from the HTTP request from Client

type DatetimeRange

type DatetimeRange struct {
	Start string `json:"start,omitempty"`
	End   string `json:"end,omitempty"`
}

type FourDayWeatherForecast

type FourDayWeatherForecast struct {
	Timestamp        string           `json:"timestamp,omitempty"`
	Wind             Wind             `json:"wind,omitempty"`
	Forecast         string           `json:"forecast,omitempty"`
	RelativeHumidity RelativeHumidity `json:"relative_humidity,omitempty"`
	Date             string           `json:"date,omitempty"`
	Temperature      Temperature      `json:"temperature,omitempty"`
}

type FourDayWeatherForecastOptions

type FourDayWeatherForecastOptions struct {
	DateTime string `json:"date_time,omitempy" url:"date_time,omitempy"`
	Date     string `json:"date,omitempy" url:"date,omitempy"`
}

type FourDayWeatherForecastResult

type FourDayWeatherForecastResult struct {
	APIInfo APIInfo                            `json:"api_info,omitempty"`
	Items   []FourDayWeatherForecastResultItem `json:"items,omitempty"`
}

func (*FourDayWeatherForecastResult) ToGraphQL

func (resp *FourDayWeatherForecastResult) ToGraphQL() interface{}

type FourDayWeatherForecastResultItem

type FourDayWeatherForecastResultItem struct {
	UpdateTimestamp string                   `json:"update_timestamp,omitempty"`
	Timestamp       string                   `json:"timestamp,omitempty"`
	Forecasts       []FourDayWeatherForecast `json:"forecasts,omitempty"`
}

type GeneralTwentyFourHourWeatherForecast

type GeneralTwentyFourHourWeatherForecast struct {
	Forecast         string           `json:"forecast,omitempty"`
	RelativeHumidity RelativeHumidity `json:"relative_humidity,omitempty"`
	Temperature      Temperature      `json:"temperature,omitempty"`
	Wind             Wind             `json:"wind,omitempty"`
}

type Location

type Location struct {
	Longitude float64 `json:"longitude,omitempty"`
	Latitude  float64 `json:"latitude,omitempty"`
}

type PM25ReadingIntervals

type PM25ReadingIntervals struct {
	PM25OneHourly PM25ReadingRegions `json:"pm25_one_hourly,omitempty"`
}

type PM25ReadingIntervalsGraphQL

type PM25ReadingIntervalsGraphQL struct {
	PM25OneHourly PM25ReadingRegionsGraphQL `json:"pm25_one_hourly,omitempty"`
}

type PM25ReadingRegions

type PM25ReadingRegions struct {
	South   int `json:"south,omitempty"`
	North   int `json:"north,omitempty"`
	East    int `json:"east,omitempty"`
	Central int `json:"central,omitempty"`
	West    int `json:"west,omitempty"`
}

type PM25ReadingRegionsGraphQL

type PM25ReadingRegionsGraphQL struct {
	South   PM25Readings `json:"south,omitempty"`
	North   PM25Readings `json:"north,omitempty"`
	East    PM25Readings `json:"east,omitempty"`
	Central PM25Readings `json:"central,omitempty"`
	West    PM25Readings `json:"west,omitempty"`
}

type PM25Readings

type PM25Readings struct {
	Value int  `json:"value,omitempty"`
	Area  Area `json:"area,omitempty"`
}

type PM25ReadingsOptions

type PM25ReadingsOptions struct {
	DateTime string `json:"date_time,omitempy" url:"date_time,omitempy"`
	Date     string `json:"date,omitempy" url:"date,omitempy"`
}

type PM25ReadingsResult

type PM25ReadingsResult struct {
	APIInfo        APIInfo                  `json:"api_info,omitempty"`
	RegionMetadata []Area                   `json:"region_metadata,omitempty"`
	Items          []PM25ReadingsResultItem `json:"items,omitempty"`
}

func (*PM25ReadingsResult) AreaByName

func (resp *PM25ReadingsResult) AreaByName(name string) Area

func (*PM25ReadingsResult) ToGraphQL

func (resp *PM25ReadingsResult) ToGraphQL() interface{}

type PM25ReadingsResultGraphQL

type PM25ReadingsResultGraphQL struct {
	APIInfo APIInfo                         `json:"api_info,omitempty"`
	Items   []PM25ReadingsResultItemGraphQL `json:"items,omitempty"`
}

type PM25ReadingsResultItem

type PM25ReadingsResultItem struct {
	UpdateTimestamp string               `json:"update_timestamp,omitempty"`
	Timestamp       string               `json:"timestamp,omitempty"`
	Readings        PM25ReadingIntervals `json:"readings,omitempty"`
}

type PM25ReadingsResultItemGraphQL

type PM25ReadingsResultItemGraphQL struct {
	UpdateTimestamp string                      `json:"update_timestamp,omitempty"`
	Timestamp       string                      `json:"timestamp,omitempty"`
	Readings        PM25ReadingIntervalsGraphQL `json:"readings,omitempty"`
}

type PSIReadingIntervals

type PSIReadingIntervals struct {
	PSITwentyFourHourly  PSIReadingRegions `json:"psi_twenty_four_hourly,omitempty"`
	PM10TwentyFourHourly PSIReadingRegions `json:"pm10_twenty_four_hourly,omitempty"`
	PM10SubIndex         PSIReadingRegions `json:"pm10_sub_index,omitempty"`
	PM25TwentyFourHourly PSIReadingRegions `json:"pm25_twenty_four_hourly,omitempty"`
	PSIThreeHourly       PSIReadingRegions `json:"psi_three_hourly,omitempty"`
	SO2TwentyFourHourly  PSIReadingRegions `json:"so2_twenty_four_hourly,omitempty"`
	O3SubIndex           PSIReadingRegions `json:"o3_sub_index,omitempty"`
	NO2OneHourMax        PSIReadingRegions `json:"no2_one_hour_max,omitempty"`
	SO2SubIndex          PSIReadingRegions `json:"so2_sub_index,omitempty"`
	PM2SubIndex          PSIReadingRegions `json:"pm25_sub_index,omitempty"`
	COEightHourMax       PSIReadingRegions `json:"co_eight_hour_max,omitempty"`
	COSubIndex           PSIReadingRegions `json:"co_sub_index,omitempty"`
	O3EightHourMax       PSIReadingRegions `json:"o3_eight_hour_max,omitempty"`
}

type PSIReadingIntervalsGraphQL

type PSIReadingIntervalsGraphQL struct {
	PSITwentyFourHourly  PSIReadingRegionsGraphQL `json:"psi_twenty_four_hourly,omitempty"`
	PM10TwentyFourHourly PSIReadingRegionsGraphQL `json:"pm10_twenty_four_hourly,omitempty"`
	PM10SubIndex         PSIReadingRegionsGraphQL `json:"pm10_sub_index,omitempty"`
	PM25TwentyFourHourly PSIReadingRegionsGraphQL `json:"pm25_twenty_four_hourly,omitempty"`
	PSIThreeHourly       PSIReadingRegionsGraphQL `json:"psi_three_hourly,omitempty"`
	SO2TwentyFourHourly  PSIReadingRegionsGraphQL `json:"so2_twenty_four_hourly,omitempty"`
	O3SubIndex           PSIReadingRegionsGraphQL `json:"o3_sub_index,omitempty"`
	NO2OneHourMax        PSIReadingRegionsGraphQL `json:"no2_one_hour_max,omitempty"`
	SO2SubIndex          PSIReadingRegionsGraphQL `json:"so2_sub_index,omitempty"`
	PM2SubIndex          PSIReadingRegionsGraphQL `json:"pm25_sub_index,omitempty"`
	COEightHourMax       PSIReadingRegionsGraphQL `json:"co_eight_hour_max,omitempty"`
	COSubIndex           PSIReadingRegionsGraphQL `json:"co_sub_index,omitempty"`
	O3EightHourMax       PSIReadingRegionsGraphQL `json:"o3_eight_hour_max,omitempty"`
}

type PSIReadingRegions

type PSIReadingRegions struct {
	National float32 `json:"national,omitempty"`
	South    float32 `json:"south,omitempty"`
	North    float32 `json:"north,omitempty"`
	East     float32 `json:"east,omitempty"`
	Central  float32 `json:"central,omitempty"`
	West     float32 `json:"west,omitempty"`
}

type PSIReadingRegionsGraphQL

type PSIReadingRegionsGraphQL struct {
	National PSIReadings `json:"national,omitempty"`
	South    PSIReadings `json:"south,omitempty"`
	North    PSIReadings `json:"north,omitempty"`
	East     PSIReadings `json:"east,omitempty"`
	Central  PSIReadings `json:"central,omitempty"`
	West     PSIReadings `json:"west,omitempty"`
}

type PSIReadings

type PSIReadings struct {
	Value float32 `json:"value,omitempty"`
	Area  Area    `json:"area,omitempty"`
}

type PSIReadingsOptions

type PSIReadingsOptions struct {
	DateTime string `json:"date_time,omitempy" url:"date_time,omitempy"`
	Date     string `json:"date,omitempy" url:"date,omitempy"`
}

type PSIReadingsResult

type PSIReadingsResult struct {
	APIInfo        APIInfo                 `json:"api_info,omitempty"`
	RegionMetadata []Area                  `json:"region_metadata,omitempty"`
	Items          []PSIReadingsResultItem `json:"items,omitempty"`
}

func (*PSIReadingsResult) AreaByName

func (resp *PSIReadingsResult) AreaByName(name string) Area

func (*PSIReadingsResult) ToGraphQL

func (resp *PSIReadingsResult) ToGraphQL() interface{}

type PSIReadingsResultGraphQL

type PSIReadingsResultGraphQL struct {
	APIInfo APIInfo                        `json:"api_info,omitempty"`
	Items   []PSIReadingsResultItemGraphQL `json:"items,omitempty"`
}

type PSIReadingsResultItem

type PSIReadingsResultItem struct {
	UpdateTimestamp string              `json:"update_timestamp,omitempty"`
	Timestamp       string              `json:"timestamp,omitempty"`
	Readings        PSIReadingIntervals `json:"readings,omitempty"`
}

type PSIReadingsResultItemGraphQL

type PSIReadingsResultItemGraphQL struct {
	UpdateTimestamp string                     `json:"update_timestamp,omitempty"`
	Timestamp       string                     `json:"timestamp,omitempty"`
	Readings        PSIReadingIntervalsGraphQL `json:"readings,omitempty"`
}

type RegionWeatherForecast

type RegionWeatherForecast struct {
	South   string `json:"south,omitempty"`
	North   string `json:"north,omitempty"`
	East    string `json:"east,omitempty"`
	Central string `json:"central,omitempty"`
	West    string `json:"west,omitempty"`
}

type RelativeHumidity

type RelativeHumidity struct {
	High int `json:"high,omitempty"`
	Low  int `json:"low,omitempty"`
}

type Speed

type Speed struct {
	High int `json:"high,omitempty"`
	Low  int `json:"low,omitempty"`
}

type TaxiAvailabilityOptions

type TaxiAvailabilityOptions struct {
	DateTime string `json:"date_time,omitempy" url:"date_time,omitempy"`
}

type TaxiAvailabilityResult

type TaxiAvailabilityResult struct {
	Type     string                       `json:"type,omitempty"`
	CRS      interface{}                  `json:"crs,omitempty"`
	Features []TaxiAvailabilityResultItem `json:"features,omitempty"`
}

TaxiAvailabilityResult interim struct until we model GeoJSON struct

func (*TaxiAvailabilityResult) ToGraphQL

func (resp *TaxiAvailabilityResult) ToGraphQL() interface{}

type TaxiAvailabilityResultGraphQL

type TaxiAvailabilityResultGraphQL struct {
	Timestamp string                 `json:"timestamp,omitempty"`
	TaxiCount int                    `json:"taxi_count,omitempty"`
	APIInfo   APIInfo                `json:"api_info,omitempty"`
	Result    map[string]interface{} `json:"result,omitempty"`
}

type TaxiAvailabilityResultItem

type TaxiAvailabilityResultItem struct {
	Type       string                           `json:"type,omitempty"`
	Geometry   interface{}                      `json:"geometry,omitempty"`
	Properties TaxiAvailabilityResultProperties `json:"properties,omitempty"`
}

type TaxiAvailabilityResultProperties

type TaxiAvailabilityResultProperties struct {
	Timestamp string  `json:"timestamp,omitempty"`
	TaxiCount int     `json:"taxi_count,omitempty"`
	APIInfo   APIInfo `json:"api_info,omitempty"`
}

type Temperature

type Temperature struct {
	High int `json:"high,omitempty"`
	Low  int `json:"low,omitempty"`
}

type TrafficImageCamera

type TrafficImageCamera struct {
	Timestamp     string               `json:"timestamp,omitempty"`
	Image         string               `json:"image,omitempty"`
	Location      Location             `json:"location,omitempty"`
	CameraID      int                  `json:"camera_id,omitempty"`
	ImageID       int                  `json:"image_id,omitempty"`
	ImageMetadata TrafficImageMetadata `json:"image_metadata,omitempty"`
}

type TrafficImageMetadata

type TrafficImageMetadata struct {
	Height int    `json:"height,omitempty"`
	Width  int    `json:"width,omitempty"`
	MD5    string `json:"md5,omitempty"`
}

type TrafficImagesOptions

type TrafficImagesOptions struct {
	DateTime string `json:"date_time,omitempy" url:"date_time,omitempy"`
}

type TrafficImagesResult

type TrafficImagesResult struct {
	APIInfo APIInfo                   `json:"api_info,omitempty"`
	Items   []TrafficImagesResultItem `json:"items,omitempty"`
}

func (*TrafficImagesResult) ToGraphQL

func (resp *TrafficImagesResult) ToGraphQL() interface{}

type TrafficImagesResultItem

type TrafficImagesResultItem struct {
	Timestamp string               `json:"timestamp,omitempty"`
	Cameras   []TrafficImageCamera `json:"cameras,omitempty"`
}

type TwentyFourHourWeatherForecast

type TwentyFourHourWeatherForecast struct {
	Time    DatetimeRange         `json:"time,omitempty"`
	Regions RegionWeatherForecast `json:"regions,omitempty"`
}

type TwentyFourHourWeatherForecastOptions

type TwentyFourHourWeatherForecastOptions struct {
	DateTime string `json:"date_time,omitempy" url:"date_time,omitempy"`
	Date     string `json:"date,omitempy" url:"date,omitempy"`
}

type TwentyFourHourWeatherForecastResult

type TwentyFourHourWeatherForecastResult struct {
	APIInfo APIInfo                                   `json:"api_info,omitempty"`
	Items   []TwentyFourHourWeatherForecastResultItem `json:"items,omitempty"`
}

func (*TwentyFourHourWeatherForecastResult) ToGraphQL

func (resp *TwentyFourHourWeatherForecastResult) ToGraphQL() interface{}

type TwentyFourHourWeatherForecastResultItem

type TwentyFourHourWeatherForecastResultItem struct {
	UpdateTimestamp string                               `json:"update_timestamp,omitempty"`
	Timestamp       string                               `json:"timestamp,omitempty"`
	ValidPeriod     DatetimeRange                        `json:"valid_period,omitempty"`
	General         GeneralTwentyFourHourWeatherForecast `json:"general,omitempty"`
	Periods         []TwentyFourHourWeatherForecast      `json:"periods,omitempty"`
}

type TwoHourWeatherForecast

type TwoHourWeatherForecast struct {
	Area     string `json:"area,omitempty"`
	Forecast string `json:"forecast,omitempty"`
}

type TwoHourWeatherForecastGraphQL

type TwoHourWeatherForecastGraphQL struct {
	Area     Area   `json:"area,omitempty"`
	Forecast string `json:"forecast,omitempty"`
}

type TwoHourWeatherForecastOptions

type TwoHourWeatherForecastOptions struct {
	DateTime string `json:"date_time,omitempy" url:"date_time,omitempy"`
	Date     string `json:"date,omitempy" url:"date,omitempy"`
}

type TwoHourWeatherForecastResult

type TwoHourWeatherForecastResult struct {
	APIInfo      APIInfo                            `json:"api_info,omitempty"`
	AreaMetadata []Area                             `json:"area_metadata,omitempty"`
	Items        []TwoHourWeatherForecastResultItem `json:"items,omitempty"`
}

func (*TwoHourWeatherForecastResult) AreaByName

func (resp *TwoHourWeatherForecastResult) AreaByName(name string) Area

func (*TwoHourWeatherForecastResult) ToGraphQL

func (resp *TwoHourWeatherForecastResult) ToGraphQL() interface{}

type TwoHourWeatherForecastResultGraphQL

type TwoHourWeatherForecastResultGraphQL struct {
	APIInfo APIInfo                                   `json:"api_info,omitempty"`
	Items   []TwoHourWeatherForecastResultItemGraphQL `json:"items,omitempty"`
}

type TwoHourWeatherForecastResultItem

type TwoHourWeatherForecastResultItem struct {
	UpdateTimestamp string                   `json:"update_timestamp,omitempty"`
	Timestamp       string                   `json:"timestamp,omitempty"`
	ValidPeriod     DatetimeRange            `json:"valid_period,omitempty"`
	Forecasts       []TwoHourWeatherForecast `json:"forecasts,omitempty"`
}

type TwoHourWeatherForecastResultItemGraphQL

type TwoHourWeatherForecastResultItemGraphQL struct {
	UpdateTimestamp string                          `json:"update_timestamp,omitempty"`
	Timestamp       string                          `json:"timestamp,omitempty"`
	ValidPeriod     DatetimeRange                   `json:"valid_period,omitempty"`
	Forecasts       []TwoHourWeatherForecastGraphQL `json:"forecasts,omitempty"`
}

type UVIndexOptions

type UVIndexOptions struct {
	DateTime string `json:"date_time,omitempy" url:"date_time,omitempy"`
	Date     string `json:"date,omitempy" url:"date,omitempy"`
}

type UVIndexReading

type UVIndexReading struct {
	Value     int    `json:"value,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
}

type UVIndexReadingsResult

type UVIndexReadingsResult struct {
	APIInfo APIInfo                     `json:"api_info,omitempty"`
	Items   []UVIndexReadingsResultItem `json:"items,omitempty"`
}

func (*UVIndexReadingsResult) ToGraphQL

func (resp *UVIndexReadingsResult) ToGraphQL() interface{}

type UVIndexReadingsResultItem

type UVIndexReadingsResultItem struct {
	UpdateTimestamp string           `json:"update_timestamp,omitempty"`
	Timestamp       string           `json:"timestamp,omitempty"`
	Index           []UVIndexReading `json:"index,omitempty"`
}

type Wind

type Wind struct {
	Speed     Speed  `json:"speed,omitempty"`
	Direction string `json:"direction,omitempty"`
}

Jump to

Keyboard shortcuts

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