base

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BaseURL Mapbox API base URL
	BaseURL = "https://api.mapbox.com"
)

Variables

View Source
var ErrorAPILimitExceeded = errors.New("Mapbox API error api rate limit exceeded")

ErrorAPILimitExceeded indicates the API limit has been exceeded

View Source
var ErrorAPIUnauthorized = errors.New("Mapbox API error unauthorized")

ErrorAPIUnauthorized indicates authorization failed

Functions

This section is empty.

Types

type Base

type Base struct {
	// contains filtered or unexported fields
}

Base Mapbox API base

func NewBase

func NewBase(token string) *Base

NewBase Create a new API base instance

func (*Base) Query

func (b *Base) Query(api, version, mode, query string, v *url.Values, inst interface{}) error

Query the mapbox API TODO: Depreciate this

func (*Base) QueryBase added in v0.2.0

func (b *Base) QueryBase(query string, v *url.Values, inst interface{}) error

QueryBase Query the mapbox API and fill the provided instance with the returned JSON TODO: Rename this

func (*Base) QueryRequest added in v0.2.0

func (b *Base) QueryRequest(query string, v *url.Values) (*http.Response, error)

QueryRequest make a get with the provided query string and return the response if successful

func (*Base) SetDebug

func (b *Base) SetDebug(debug bool)

SetDebug enables debug output for API calls

type BoundingBox

type BoundingBox []float64

type Context

type Context struct {
	ID        string `json:"id"`
	Text      string `json:"text"`
	ShortCode string `json:"short_code"`
	WikiData  string `json:"wikidata"`
}

type Feature

type Feature struct {
	ID         string      `json:"id"`
	Type       string      `json:"type"`
	Text       string      `json:"text"`
	PlaceName  string      `json:"place_name"`
	PlaceType  []string    `json:"place_type"`
	Relevance  float64     `json:"relevance"`
	Properties Properties  `json:"properties"`
	BBox       BoundingBox `json:"bbox"`
	Center     Point       `json:"center"`
	Geometry   Geometry    `json:"geometry"`
	Context    []Context   `json:"context"`
}

type FeatureCollection

type FeatureCollection struct {
	Type        string    `json:"type"`
	Features    []Feature `json:"features"`
	Attribution string    `json:"attribution"`
}

type Geometry

type Geometry struct {
	Type        string `json:"type"`
	Coordinates Point  `json:"coordinates"`
}

type Location

type Location struct {
	Latitude  float64 `json:"lat"`
	Longitude float64 `json:"lng"`
}

type MapboxApiMessage added in v0.3.0

type MapboxApiMessage struct {
	Message string
}

type Point

type Point []float64

type Properties added in v0.5.0

type Properties struct {
	Category string `json:"category"`
	Tel      string `json:"tel"`
	Wikidata string `json:"wikidata"`
	Landmark bool   `json:"landmark"`
	Maki     string `json:"short_code"`
}

Jump to

Keyboard shortcuts

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