amap

package
v1.0.215 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogTable = "amap"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client 实例

func NewClient

func NewClient(config *ClientConfig) (*Client, error)

NewClient 创建实例化

func (*Client) ConfigSLogClientFun added in v1.0.162

func (c *Client) ConfigSLogClientFun(apiSLogFun golog.ApiSLogFun)

ConfigSLogClientFun 日志配置

func (*Client) DefaultHttp added in v1.0.177

func (c *Client) DefaultHttp()

DefaultHttp 默认请求

func (*Client) GeocodeGeo added in v1.0.130

func (c *Client) GeocodeGeo(ctx context.Context, address string, notMustParams ...gorequest.Params) (*GeocodeGeoResult, error)

GeocodeGeo 地理编码 https://lbs.amap.com/api/webservice/guide/api/georegeo

func (*Client) GeocodeRegeo added in v1.0.130

func (c *Client) GeocodeRegeo(ctx context.Context, location string, notMustParams ...gorequest.Params) (*GeocodeRegeoResult, error)

GeocodeRegeo 逆地理编码 https://lbs.amap.com/api/webservice/guide/api/georegeo

func (*Client) GetKey

func (c *Client) GetKey() string

func (*Client) Ip

func (c *Client) Ip(ctx context.Context, ip string, notMustParams ...gorequest.Params) (*IpResult, error)

Ip IP定位 https://lbs.amap.com/api/webservice/guide/api/ipconfig

func (*Client) SetHttp added in v1.0.177

func (c *Client) SetHttp(app *gorequest.App)

SetHttp 配置请求

func (*Client) WeatherWeatherInfo

func (c *Client) WeatherWeatherInfo(ctx context.Context, city string, notMustParams ...gorequest.Params) (*WeatherWeatherInfoResult, error)

WeatherWeatherInfo 天气查询 https://lbs.amap.com/api/webservice/guide/api/weatherinfo

type ClientConfig

type ClientConfig struct {
	Key string
}

ClientConfig 实例配置

type GeocodeGeoResponse added in v1.0.130

type GeocodeGeoResponse struct {
	Status   string `json:"status"`
	Info     string `json:"info"`
	Infocode string `json:"infocode"`
	Count    string `json:"count"`
	Geocodes []struct {
		FormattedAddress string        `json:"formatted_address"`
		Country          string        `json:"country"`
		Province         string        `json:"province"`
		Citycode         string        `json:"citycode"`
		City             string        `json:"city"`
		District         string        `json:"district"`
		Township         []interface{} `json:"township"`
		Neighborhood     struct {
			Name []interface{} `json:"name"`
			Type []interface{} `json:"type"`
		} `json:"neighborhood"`
		Building struct {
			Name []interface{} `json:"name"`
			Type []interface{} `json:"type"`
		} `json:"building"`
		Adcode   string `json:"adcode"`
		Street   string `json:"street"`
		Number   string `json:"number"`
		Location string `json:"location"`
		Level    string `json:"level"`
	} `json:"geocodes"`
}

type GeocodeGeoResult added in v1.0.130

type GeocodeGeoResult struct {
	Result GeocodeGeoResponse // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

type GeocodeRegeoResponse added in v1.0.130

type GeocodeRegeoResponse struct {
	Status    string `json:"status"`
	Regeocode struct {
		Roads []struct {
			Id        string `json:"id"`
			Location  string `json:"location"`
			Direction string `json:"direction"`
			Name      string `json:"name"`
			Distance  string `json:"distance"`
		} `json:"roads"`
		Roadinters []struct {
			SecondName string `json:"second_name"`
			FirstId    string `json:"first_id"`
			SecondId   string `json:"second_id"`
			Location   string `json:"location"`
			Distance   string `json:"distance"`
			FirstName  string `json:"first_name"`
			Direction  string `json:"direction"`
		} `json:"roadinters"`
		FormattedAddress string `json:"formatted_address"`
		AddressComponent struct {
			City         []interface{} `json:"city"`
			Province     string        `json:"province"`
			Adcode       string        `json:"adcode"`
			District     string        `json:"district"`
			Towncode     string        `json:"towncode"`
			StreetNumber struct {
				Number    string `json:"number"`
				Location  string `json:"location"`
				Direction string `json:"direction"`
				Distance  string `json:"distance"`
				Street    string `json:"street"`
			} `json:"streetNumber"`
			Country       string `json:"country"`
			Township      string `json:"township"`
			BusinessAreas []struct {
				Location string `json:"location"`
				Name     string `json:"name"`
				Id       string `json:"id"`
			} `json:"businessAreas"`
			Building struct {
				Name string `json:"name"`
				Type string `json:"type"`
			} `json:"building"`
			Neighborhood struct {
				Name string `json:"name"`
				Type string `json:"type"`
			} `json:"neighborhood"`
			Citycode string `json:"citycode"`
		} `json:"addressComponent"`
		Aois []struct {
			Area     string `json:"area"`
			Type     string `json:"type"`
			Id       string `json:"id"`
			Location string `json:"location"`
			Adcode   string `json:"adcode"`
			Name     string `json:"name"`
			Distance string `json:"distance"`
		} `json:"aois"`
		Pois []struct {
			Id           string      `json:"id"`
			Direction    string      `json:"direction"`
			Businessarea string      `json:"businessarea"`
			Address      string      `json:"address"`
			Poiweight    string      `json:"poiweight"`
			Name         string      `json:"name"`
			Location     string      `json:"location"`
			Distance     string      `json:"distance"`
			Tel          interface{} `json:"tel"`
			Type         string      `json:"type"`
		} `json:"pois"`
	} `json:"regeocode"`
	Info     string `json:"info"`
	Infocode string `json:"infocode"`
}

type GeocodeRegeoResult added in v1.0.130

type GeocodeRegeoResult struct {
	Result GeocodeRegeoResponse // 结果
	Body   []byte               // 内容
	Http   gorequest.Response   // 请求
}

type IpResponse

type IpResponse struct {
	Status    string `json:"status"`    // 值为0或1,0表示失败;1表示成功
	Info      string `json:"info"`      // 返回状态说明,status为0时,info返回错误原因,否则返回“OK”。
	Infocode  string `json:"infocode"`  // 返回状态说明,10000代表正确,详情参阅info状态表
	Province  string `json:"province"`  // 若为直辖市则显示直辖市名称; 如果在局域网 IP网段内,则返回“局域网”; 非法IP以及国外IP则返回空
	City      string `json:"city"`      // 若为直辖市则显示直辖市名称; 如果为局域网网段内IP或者非法IP或国外IP,则返回空
	Adcode    string `json:"adcode"`    // 城市的adcode编码
	Rectangle string `json:"rectangle"` // 所在城市矩形区域范围
}

type IpResult

type IpResult struct {
	Result IpResponse         // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

type WeatherWeatherInfoResponse

type WeatherWeatherInfoResponse struct {
	Status   string `json:"status"`   // 值为0或1 1:成功;0:失败
	Count    string `json:"count"`    // 返回结果总数目
	Info     string `json:"info"`     // 返回的状态信息
	Infocode string `json:"infocode"` // 返回状态说明,10000代表正确
	Lives    []struct {
		Province         string `json:"province"`          // 省份名
		City             string `json:"city"`              // 城市名
		Adcode           string `json:"adcode"`            // 区域编码
		Weather          string `json:"weather"`           // 天气现象(汉字描述)
		Temperature      string `json:"temperature"`       // 实时气温,单位:摄氏度
		Winddirection    string `json:"winddirection"`     // 风向描述
		Windpower        string `json:"windpower"`         // 风力级别,单位:级
		Humidity         string `json:"humidity"`          // 空气湿度
		Reporttime       string `json:"reporttime"`        // 数据发布的时间
		TemperatureFloat string `json:"temperature_float"` // 温度
		HumidityFloat    string `json:"humidity_float"`    // 湿度
	} `json:"lives"` // 实况天气数据信息
	Forecasts []struct {
		City       string `json:"city"`       // 城市名称
		Adcode     string `json:"adcode"`     // 城市编码
		Province   string `json:"province"`   // 省份名称
		Reporttime string `json:"reporttime"` // 预报发布时间
		Casts      []struct {
			Date           string `json:"date"`            // 日期
			Week           string `json:"week"`            // 星期几
			Dayweather     string `json:"dayweather"`      // 白天天气现象
			Nightweather   string `json:"nightweather"`    // 晚上天气现象
			Daytemp        string `json:"daytemp"`         // 白天温度
			Nighttemp      string `json:"nighttemp"`       // 晚上温度
			Daywind        string `json:"daywind"`         // 白天风向
			Nightwind      string `json:"nightwind"`       // 晚上风向
			Daypower       string `json:"daypower"`        // 白天风力
			Nightpower     string `json:"nightpower"`      // 晚上风力
			DaytempFloat   string `json:"daytemp_float"`   // 日温度
			NighttempFloat string `json:"nighttemp_float"` // 夜间温度
		} `json:"casts"` // 预报数据list结构,元素cast,按顺序为当天、第二天、第三天的预报数据
	} `json:"forecasts"` // 预报天气信息数据
}

type WeatherWeatherInfoResult

type WeatherWeatherInfoResult struct {
	Result WeatherWeatherInfoResponse // 结果
	Body   []byte                     // 内容
	Http   gorequest.Response         // 请求
}

Jump to

Keyboard shortcuts

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