gaodeKit

package
v3.0.66 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct {
	// Status 值为0或1,1:成功;0:失败
	Status   string `json:"status"`
	InfoCode string `json:"infocode"`
	Info     string `json:"info"`
}

func (*BaseResponse) IsSuccess

func (baseResp *BaseResponse) IsSuccess() error

type Cast

type Cast struct {
	// Date 日期
	Date string `json:"date"`

	// Week 星期几
	Week string `json:"week"`

	// DayWeather 白天天气现象
	DayWeather string `json:"dayweather"`

	// NightWeather 晚上天气现象
	NightWeather string `json:"nightweather"`

	// DayTemp 白天温度
	DayTemp string `json:"daytemp"`

	// NightTemp 晚上温度
	NightTemp string `json:"nighttemp"`
}

type Client

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

func NewClient

func NewClient(key string) (*Client, error)

func (*Client) GetForecast

func (client *Client) GetForecast(city string) (*Forecast, error)

GetForecast 获取"预报"天气.

@param city 城市编码

func (*Client) GetIpInfo

func (client *Client) GetIpInfo(ip string) (*IpInfo, error)

GetIpInfo

PS: 仅支持IPV4,不支持国外IP解析.

func (*Client) GetLive

func (client *Client) GetLive(city string) (*Live, error)

GetLive 获取"实况"天气.

@param city 城市编码

func (*Client) GetTodayCast

func (client *Client) GetTodayCast(city string) (*Cast, error)

GetTodayCast 获取今天的"预报"天气.

type Forecast

type Forecast struct {
	// Province 省份名
	Province string `json:"province"`
	// City 城市(区域)名
	City string `json:"city"`
	// Adcode 城市(区域)编码
	Adcode string `json:"adcode"`
	// ReportTime 数据发布的时间
	ReportTime string `json:"reporttime"`

	// Casts 预报数据list结构,元素cast,按顺序为当天、第二天、第三天的预报数据
	Casts []*Cast `json:"casts"`
}

type IpInfo

type IpInfo struct {
	// Province 省份名称
	Province string `json:"province"`

	// City 城市名称
	City string `json:"city"`

	// Adcode 城市的adcode编码
	Adcode string `json:"adcode"`

	// Rectangle 所在城市矩形区域范围
	Rectangle string `json:"rectangle"`
}

type IpResponse

type IpResponse struct {
	BaseResponse

	IpInfo
}

type Live

type Live struct {
	// Province 省份名
	Province string `json:"province"`
	// City 城市(区域)名
	City string `json:"city"`
	// Adcode 城市(区域)编码
	Adcode string `json:"adcode"`
	// ReportTime 数据发布的时间
	ReportTime string `json:"reporttime"`

	// Weather 天气现象(汉字描述)
	Weather string `json:"weather"`

	// Temperature 实时气温,单位:摄氏度
	Temperature string `json:"temperature"`

	// WindPower 风力级别,单位:级
	WindPower string `json:"windpower"`

	// Humidity 空气湿度
	Humidity string `json:"humidity"`
}

type WeatherResponse

type WeatherResponse struct {
	BaseResponse

	Lives     []*Live     `json:"lives"`
	Forecasts []*Forecast `json:"forecasts"`
}

Jump to

Keyboard shortcuts

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