34 lines
1.2 KiB
Thrift
34 lines
1.2 KiB
Thrift
// ./idl/WeatherAndEarthquake.thrift
|
||
namespace go weather_and_earthquake
|
||
|
||
struct QueryReq {
|
||
// 操作码
|
||
// 0: 查最新地震信息。
|
||
// 1: 默认情况,通过ip地址查看天气。此时不需要其他参数。
|
||
// 2: 通过提供的 LocationKey 查看天气。需要提供 LocationKey。
|
||
// 3: 通过地名查看天气。需要提供 Addr。
|
||
1: i32 Op (api.query="op");
|
||
2: string LocationKey (api.query="key");
|
||
3: string Addr (api.query="addr");
|
||
}
|
||
|
||
struct QueryResp {
|
||
// 0: 成功。如果是地震信息,就返回地震信息。如果是通过ip或者locationKey查询天气,就返回当前情况和预报。
|
||
// 如果是通过地点查询,表示查到地点,并且只有一个,且通过这个key查询到了天气情况。
|
||
// -1: 参数错误
|
||
// -2: 请求头参数错误
|
||
// -3: 签名校验失败
|
||
// 1: 查询天气失败
|
||
// 2: 查询地名失败
|
||
// 3: 根据地名查询到多个地址,需要确认。
|
||
1: i32 Code;
|
||
2: string LocationKey;
|
||
3: string Locations;
|
||
4: string CurrentConditions;
|
||
5: string DailyForecasts;
|
||
6: string EarthquakeInformations;
|
||
}
|
||
|
||
service WeatherAndEarthquakeService {
|
||
QueryResp QueryMethod(1: QueryReq request) (api.get="/query");
|
||
} |