base

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BaseURL Goong API base URL
	BaseURL = "https://rsapi.goong.io"
)

Variables

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

ErrorAPILimitExceeded indicates the API limit has been exceeded

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

ErrorAPIUnauthorized indicates authorization failed

Functions

This section is empty.

Types

type Base

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

Base Goong API base

func NewBase

func NewBase(apiKey string) (*Base, error)

NewBase Create a new API base instance

func (*Base) Query

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

Query the Goong API TODO: Depreciate this

func (*Base) QueryBase

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

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

func (*Base) QueryRequest

func (b *Base) QueryRequest(ctx context.Context, 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 Geometry

type Geometry struct {
	Location Location `json:"location"`
}

type GoongApiError

type GoongApiError struct {
	Error struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
}

type Location

type Location struct {
	Lat float64 `json:"lat"`
	Lng float64 `json:"lng"`
}

type PlaceDetailResult

type PlaceDetailResult struct {
	PlaceID          string   `json:"place_id"`
	FormattedAddress string   `json:"formatted_address"`
	Geometry         Geometry `json:"geometry"`
	Name             string   `json:"name"`
	Types            []string `json:"types"`
	DistanceMeters   *int     `json:"distance_meters,omitempty"`
}

type PlusCode

type PlusCode struct {
	CompoundCode string `json:"compound_code"`
	GlobalCode   string `json:"global_code"`
}

type Predictions

type Predictions struct {
	Description          string               `json:"description"`
	MatchedSubstrings    []interface{}        `json:"matched_substrings"`
	PlaceID              string               `json:"place_id"`
	Reference            string               `json:"reference"`
	StructuredFormatting StructuredFormatting `json:"structured_formatting"`
	Terms                []interface{}        `json:"terms"`
	HasChildren          bool                 `json:"has_children"`
	DisplayType          string               `json:"display_type"`
	Score                float64              `json:"score"`
	PlusCode             PlusCode             `json:"plus_code"`
	Types                []string             `json:"types"`
	DistanceMeters       *int                 `json:"distance_meters,omitempty"`
}

type StructuredFormatting

type StructuredFormatting struct {
	MainText      string `json:"main_text"`
	SecondaryText string `json:"secondary_text"`
}

Jump to

Keyboard shortcuts

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