1234567891011121314151617181920212223242526272829303132333435 |
- //go:generate make deps
- package main
- import (
- "devel.mephi.ru/dyokunev/go-sdapi/sdApi1"
- "fmt"
- "github.com/alyu/configparser"
- )
- func checkErr(err error) {
- if err != nil {
- panic(err)
- }
- }
- func main() {
- config, err := configparser.Read("/etc/sdapi.ini")
- checkErr(err)
- section, err := config.Section("sdapi1")
- checkErr(err)
- sdApi1.SetApiKey(section.ValueOf("api_key"))
- units, err := sdApi1.GetUnits()
- checkErr(err)
- unitsMap := units.ToMap()
- unit536 := unitsMap[8000161]
- unit536recursive := unit536.GetRecursive()
- fmt.Printf("unitIds == %v\n", unit536recursive.GetUnitIds())
- }
|