Documentation
¶
Index ¶
- Constants
- type ApiClient
- type ResultGeoCityLookup
- type ResultGeoCityLookupInfo
- type ResultGeoPoi
- type ResultGeoPoiEntity
- type ResultGeoTopCity
- type ResultGeoTopCityListEntity
- type ResultQWeather
- func (r *ResultQWeather) ForecastWeatherResult() (*ResultQWeatherDaysForecast, error)
- func (r *ResultQWeather) GeoCityLookupResult() (*ResultGeoCityLookup, error)
- func (r *ResultQWeather) GeoPoiResult() (*ResultGeoPoi, error)
- func (r *ResultQWeather) GeoTopCityResult() (*ResultGeoTopCity, error)
- func (r *ResultQWeather) HistoricalWeatherResult() (*ResultQWeatherHistorical, error)
- func (r *ResultQWeather) NowWeatherResult() (*ResultQWeatherNow, error)
- type ResultQWeatherDaily
- type ResultQWeatherDaysForecast
- type ResultQWeatherError
- type ResultQWeatherHistorical
- type ResultQWeatherNow
- type ResultQWeatherNowInfo
- type ResultQWeatherRefer
- type ResultWeatherDailyEntity
- type ResultWeatherHourlyEntity
Constants ¶
View Source
const ( APIGeoCityLookup = "/geo/v2/city/lookup" //GeoAPI城市搜索 APIHistoricalWeather = "/v7/historical/weather" //时光机天气(历史天气) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient struct {
SHeader struct {
Alg string `json:"alg"`
Kid string `json:"kid"`
}
SPayload struct {
Sub string `json:"sub"`
Iat int64 `json:"iat"`
Exp int64 `json:"exp"`
}
PrivateKey ed25519.PrivateKey
ApiHost string
Token string
}
func NewQWeatherApiClient ¶
NewQWeatherApiClient 创建一个新的和风天气ApiClient实例
func NewQWeatherApiClientByPKED ¶
func NewQWeatherApiClientByPKED(kId, subId, apiHost string, PrivateKey ed25519.PrivateKey) (*ApiClient, error)
NewQWeatherApiClientByPKED 创建一个新的和风天气ApiClient实例(通过PrivateKey ed25519.PrivateKey)
func NewQWeatherApiClientByPKString ¶
NewQWeatherApiClientByPKString 创建一个新的和风天气ApiClient实例(通过PrivateKey明文字符串)
func (*ApiClient) GetWeatherIconCode ¶
type ResultGeoCityLookup ¶
type ResultGeoCityLookup struct {
Code string `json:"code"`
Location []ResultGeoCityLookupInfo `json:"location"`
Refer ResultQWeatherRefer `json:"refer"`
Error ResultQWeatherError `json:"error"`
}
type ResultGeoCityLookupInfo ¶
type ResultGeoCityLookupInfo struct {
Name string `json:"name"`
Id string `json:"id"`
Lat string `json:"lat"`
Lon string `json:"lon"`
Adm2 string `json:"adm2"`
Adm1 string `json:"adm1"`
Country string `json:"country"`
Tz string `json:"tz"`
UtcOffset string `json:"utcOffset"`
IsDst string `json:"isDst"`
Type string `json:"type"`
Rank string `json:"rank"`
FxLink string `json:"fxLink"`
}
type ResultGeoPoi ¶
type ResultGeoPoi struct {
Code string `json:"code"`
Poi []ResultGeoPoiEntity `json:"poi"`
Refer ResultQWeatherRefer `json:"refer"`
Error ResultQWeatherError `json:"error"`
}
type ResultGeoPoiEntity ¶
type ResultGeoPoiEntity struct {
Name string `json:"name"`
Id string `json:"id"`
Lat string `json:"lat"`
Lon string `json:"lon"`
Adm2 string `json:"adm2"`
Adm1 string `json:"adm1"`
Country string `json:"country"`
Tz string `json:"tz"`
UtcOffset string `json:"utcOffset"`
IsDst string `json:"isDst"`
Type string `json:"type"`
Rank string `json:"rank"`
FxLink string `json:"fxLink"`
}
type ResultGeoTopCity ¶
type ResultGeoTopCity struct {
Code string `json:"code"`
TopCityList []ResultGeoTopCityListEntity `json:"topCityList"`
Refer ResultQWeatherRefer `json:"refer"`
Error ResultQWeatherError `json:"error"`
}
type ResultGeoTopCityListEntity ¶
type ResultGeoTopCityListEntity struct {
Name string `json:"name"`
Id string `json:"id"`
Lat string `json:"lat"`
Lon string `json:"lon"`
Adm2 string `json:"adm2"`
Adm1 string `json:"adm1"`
Country string `json:"country"`
Tz string `json:"tz"`
UtcOffset string `json:"utcOffset"`
IsDst string `json:"isDst"`
Type string `json:"type"`
Rank string `json:"rank"`
FxLink string `json:"fxLink"`
}
type ResultQWeather ¶
type ResultQWeather struct {
Body []byte
}
func (*ResultQWeather) ForecastWeatherResult ¶
func (r *ResultQWeather) ForecastWeatherResult() (*ResultQWeatherDaysForecast, error)
ForecastWeatherResult 每日预报天气查询结果解析
func (*ResultQWeather) GeoCityLookupResult ¶
func (r *ResultQWeather) GeoCityLookupResult() (*ResultGeoCityLookup, error)
GeoCityLookupResult GEO城市查询结果解析
func (*ResultQWeather) GeoPoiResult ¶
func (r *ResultQWeather) GeoPoiResult() (*ResultGeoPoi, error)
GeoPoiResult GEO POI查询结果解析(含poi range)
func (*ResultQWeather) GeoTopCityResult ¶
func (r *ResultQWeather) GeoTopCityResult() (*ResultGeoTopCity, error)
GeoTopCityResult GEO热门城市查询结果解析
func (*ResultQWeather) HistoricalWeatherResult ¶
func (r *ResultQWeather) HistoricalWeatherResult() (*ResultQWeatherHistorical, error)
HistoricalWeatherResult 时光机天气(历史天气)查询结果解析
func (*ResultQWeather) NowWeatherResult ¶
func (r *ResultQWeather) NowWeatherResult() (*ResultQWeatherNow, error)
NowWeatherResult 实时天气查询结果解析
type ResultQWeatherDaily ¶
type ResultQWeatherDaily struct {
FxDate string `json:"fxDate"`
Sunrise string `json:"sunrise"`
Sunset string `json:"sunset"`
Moonrise string `json:"moonrise"`
Moonset string `json:"moonset"`
MoonPhase string `json:"moonPhase"`
MoonPhaseIcon string `json:"moonPhaseIcon"`
TempMax string `json:"tempMax"`
TempMin string `json:"tempMin"`
IconDay string `json:"iconDay"`
TextDay string `json:"textDay"`
IconNight string `json:"iconNight"`
TextNight string `json:"textNight"`
Wind360Day string `json:"wind360Day"`
WindDirDay string `json:"windDirDay"`
WindScaleDay string `json:"windScaleDay"`
WindSpeedDay string `json:"windSpeedDay"`
Wind360Night string `json:"wind360Night"`
WindDirNight string `json:"windDirNight"`
WindScaleNight string `json:"windScaleNight"`
WindSpeedNight string `json:"windSpeedNight"`
Humidity string `json:"humidity"`
Precip string `json:"precip"`
Pressure string `json:"pressure"`
Vis string `json:"vis"`
Cloud string `json:"cloud"`
UvIndex string `json:"uvIndex"`
}
type ResultQWeatherDaysForecast ¶
type ResultQWeatherDaysForecast struct {
Code string `json:"code"`
UpdateTime string `json:"updateTime"`
FxLink string `json:"fxLink"`
Daily []ResultQWeatherDaily `json:"daily"`
Refer ResultQWeatherRefer `json:"refer"`
Error ResultQWeatherError `json:"error"`
}
type ResultQWeatherError ¶
type ResultQWeatherHistorical ¶
type ResultQWeatherHistorical struct {
Code string `json:"code"`
FxLink string `json:"fxLink"`
WeatherDaily ResultWeatherDailyEntity `json:"weatherDaily"`
WeatherHourly []ResultWeatherHourlyEntity `json:"weatherHourly"`
Refer ResultQWeatherRefer `json:"refer"`
Error ResultQWeatherError `json:"error"`
}
type ResultQWeatherNow ¶
type ResultQWeatherNow struct {
Code string `json:"code"`
UpdateTime string `json:"updateTime"`
FxLink string `json:"fxLink"`
Now ResultQWeatherNowInfo `json:"now"`
Refer ResultQWeatherRefer `json:"refer"`
Error ResultQWeatherError `json:"error"`
}
type ResultQWeatherNowInfo ¶
type ResultQWeatherNowInfo struct {
ObsTime string `json:"obsTime"`
Temp string `json:"temp"`
FeelsLike string `json:"feelsLike"`
Icon string `json:"icon"`
Text string `json:"text"`
Wind360 string `json:"wind360"`
WindDir string `json:"windDir"`
WindScale string `json:"windScale"`
WindSpeed string `json:"windSpeed"`
Humidity string `json:"humidity"`
Precip string `json:"precip"`
Pressure string `json:"pressure"`
Vis string `json:"vis"`
Cloud string `json:"cloud"`
Dew string `json:"dew"`
}
type ResultQWeatherRefer ¶
type ResultWeatherDailyEntity ¶
type ResultWeatherDailyEntity struct {
Date string `json:"date"`
Sunrise string `json:"sunrise"`
Sunset string `json:"sunset"`
Moonrise string `json:"moonrise"`
Moonset string `json:"moonset"`
MoonPhase string `json:"moonPhase"`
TempMax string `json:"tempMax"`
TempMin string `json:"tempMin"`
Humidity string `json:"humidity"`
Precip string `json:"precip"`
Pressure string `json:"pressure"`
}
type ResultWeatherHourlyEntity ¶
type ResultWeatherHourlyEntity struct {
Time string `json:"time"`
Temp string `json:"temp"`
Icon string `json:"icon"`
Text string `json:"text"`
Precip string `json:"precip"`
Wind360 string `json:"wind360"`
WindDir string `json:"windDir"`
WindScale string `json:"windScale"`
WindSpeed string `json:"windSpeed"`
Humidity string `json:"humidity"`
Pressure string `json:"pressure"`
}
Click to show internal directories.
Click to hide internal directories.