2019-04-08 14:49:07 +03:00
|
|
|
# Client for DaData.ru
|
|
|
|
|
|
|
|
Forked from https://github.com/webdeskltd/dadata.
|
|
|
|
|
|
|
|
|
|
|
|
[![Build Status](https://travis-ci.org/ekomobile/dadata.svg)](https://travis-ci.org/ekomobile/dadata)
|
|
|
|
[![GitHub release](https://img.shields.io/github/release/ekomobile/dadata.svg)](https://github.com/ekomobile/dadata/releases)
|
|
|
|
[![Go Report Card](https://goreportcard.com/badge/github.com/ekomobile/dadata)](https://goreportcard.com/report/github.com/ekomobile/dadata)
|
|
|
|
[![GoDoc](https://godoc.org/github.com/ekomobile/dadata?status.svg)](https://godoc.org/github.com/ekomobile/dadata)
|
|
|
|
|
|
|
|
DaData API v2
|
|
|
|
|
|
|
|
Implemented [Clean](https://dadata.ru/api/clean/) and [Suggest](https://dadata.ru/api/suggest/) methods.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
`go get github.com/ekomobile/dadata`
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
```go
|
|
|
|
import (
|
2019-04-09 17:08:32 +03:00
|
|
|
"context"
|
2019-04-08 14:49:07 +03:00
|
|
|
"fmt"
|
|
|
|
|
2019-04-09 17:08:32 +03:00
|
|
|
"github.com/ekomobile/dadata/v2"
|
|
|
|
"github.com/ekomobile/dadata/v2/api/suggest"
|
2019-04-08 14:49:07 +03:00
|
|
|
)
|
|
|
|
|
2019-04-09 17:08:32 +03:00
|
|
|
func DaDataExample() {
|
|
|
|
api := dadata.NewSuggestApi()
|
2019-04-08 14:49:07 +03:00
|
|
|
|
2019-04-09 17:08:32 +03:00
|
|
|
params := suggest.RequestParams{
|
|
|
|
Query: "ул Свободы",
|
2019-04-08 14:49:07 +03:00
|
|
|
}
|
|
|
|
|
2019-04-09 17:08:32 +03:00
|
|
|
suggestions, err := api.Address(context.Background(), ¶ms)
|
|
|
|
if err != nil {
|
|
|
|
return
|
2019-04-08 14:49:07 +03:00
|
|
|
}
|
|
|
|
|
2019-04-09 17:08:32 +03:00
|
|
|
for _, s := range suggestions {
|
|
|
|
fmt.Printf("%s", s.Value)
|
|
|
|
}
|
2019-04-08 14:49:07 +03:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Licence
|
|
|
|
MIT see [LICENSE](LICENSE)
|