Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/humans-group/go-yandex-maps-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/humans-group/go-yandex-maps-api

  • v0.0.2
  • Source
  • Go
  • Socket score

Version published
Created
Source

go-yandex-maps-api

Golang SDK for Yandex Maps API

Usage

To use package import:

	"fmt"
	"log"

	"github.com/humans-grpoup/go-yandex-maps-api/services/suggest"
	"github.com/humans-grpoup/go-yandex-maps-api/services/httpclient"
)

Make sure that you have an API key before utilizing the package

	apiSuggest = "<API_KEY>"//Need to be substituted by your own API key
	...
) 

Then you can make a request to Yandex Suggest API as follows:


import (
	"fmt"
	"log"

	"github.com/humans-grpoup/go-yandex-maps-api/services/suggest"
	"github.com/humans-grpoup/go-yandex-maps-api/services/httpclient"
)

const (
	apiSuggest = "<API_KEY>"//Need to be substituted by your own API key
	lat = 69.02
	lng = 42.01
	lang = "eng"
	limit = 5
)

func main() {
	// Example: Suggest 
	address := "New York"
	suggestAPI := suggest.NewSuggest(apiSuggest)
    // Build a URL for the API request
    // Add a response language
	suggestAPI.AddLanguage(lang)
    // Add a search point coordinate
	suggestAPI.AddSearchPoint(lat, lng)
    // Add a limit on response results
	suggestAPI.AddLimit(limit)
    //
	suggestion, err := client.Suggest(suggestAPI, address)
	if err != nil {
		log.Fatalf("Suggest error: %v", err)
	}
	fmt.Printf("Suggest for text is %v\n", suggestion)
}

Sturcure retrieved by Yandex Suggest is:

		SuggestReqID string         `json:"suggest_reqid"`
		Results      []SuggestResult `json:"results"`
	}
	
	SuggestResult struct {
		Title    Title    `json:"title"`
		Subtitle Subtitle `json:"subtitle,omitempty"`
		Tags     []string `json:"tags"`
		Distance Distance `json:"distance"`
	}
	
	Title struct {
		Text string    `json:"text"`
		HL   []HLRange `json:"hl,omitempty"`
	}
	
	HLRange struct {
		Begin int `json:"begin"`
		End   int `json:"end"`
	}
	
	Subtitle struct {
		Text string `json:"text"`
	}
	
	Distance struct {
		Value float64 `json:"value"`
		Text  string  `json:"text"`
	}

License

MIT

FAQs

Package last updated on 24 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc