base

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2017 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
	Text      string
	ShortCode string
	WikiData  string
}

type Feature

type Feature struct {
	ID         string
	Type       string
	Text       string
	PlaceName  string
	PlaceType  []string
	Relevance  float64
	Properties map[string]string
	BBox       BoundingBox
	Center     Point
	Geometry   Geometry
	Context    []Context
}

type FeatureCollection

type FeatureCollection struct {
	Type        string
	Features    []Feature
	Attribution string
}

type Geometry

type Geometry struct {
	Type        string
	Coordinates Point
}

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

Jump to

Keyboard shortcuts

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