mirror of
https://codeberg.org/andyscott/OpenWeather-gRPC-API.git
synced 2025-01-01 13:35:55 -05:00
Minor updates to proto definitions for location enum and oneof
This commit is contained in:
parent
6adee3e31b
commit
bcbe199848
3 changed files with 27 additions and 31 deletions
|
@ -4,32 +4,38 @@ package weather;
|
||||||
|
|
||||||
option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto";
|
option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto";
|
||||||
|
|
||||||
// Sub-message used by Current & Extended for exact coordinates
|
// Sub-message for exact coordinates
|
||||||
message Coordinates {
|
message Coordinates {
|
||||||
float latitude = 1;
|
float latitude = 1;
|
||||||
float longitude = 2;
|
float longitude = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used by Location, Current, and Extended to help the API find info for the
|
// Sub-message to specify location
|
||||||
// correct location. If unspecified, an attept is still made but results may
|
message OneOfLocation {
|
||||||
// be inaccurate
|
oneof location_id {
|
||||||
|
string city = 1;
|
||||||
|
string zip_code = 2;
|
||||||
|
Coordinates coords = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used to help the API find info for the correct location. If unspecified, an
|
||||||
|
// attept is still made but results may be inaccurate.
|
||||||
enum LocationType {
|
enum LocationType {
|
||||||
LOCATION_TYPE_UNSPECIFIED = 0;
|
LOCATION_TYPE_UNSPECIFIED = 0;
|
||||||
LOCATION_CITY = 1;
|
LOCATION_TYPE_CITY = 1;
|
||||||
LOCATION_ZIP = 2;
|
LOCATION_TYPE_ZIP_CODE = 2;
|
||||||
LOCATION_COORDS = 3;
|
LOCATION_TYPE_COORDS = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the latitude and longitude for a given location
|
/* Get the latitude and longitude for a given location
|
||||||
* Commented parameters in the message definition are not implemeneted yet
|
* Commented parameters in the message definition are not implemeneted yet
|
||||||
* location_type {enum} - name or value
|
* location_type {LocationType} - name or value of the desired LocationType enum
|
||||||
* city {string} - case insensitive, spaces and punctuation allowed
|
* location {OneOfLocation} - city name, zip code, or coordinates
|
||||||
* zip_code {string} - non-numeric values permitted
|
|
||||||
*/
|
*/
|
||||||
message RequestLocation {
|
message RequestLocation {
|
||||||
LocationType location_type = 1;
|
LocationType location_type = 1;
|
||||||
optional string city = 2;
|
OneOfLocation location = 2;
|
||||||
optional string zip_code = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response to RequestLocation
|
// Response to RequestLocation
|
||||||
|
|
|
@ -9,6 +9,6 @@ import "location.proto";
|
||||||
|
|
||||||
service WeatherService {
|
service WeatherService {
|
||||||
rpc Current(RequestCurrent) returns (SendCurrent);
|
rpc Current(RequestCurrent) returns (SendCurrent);
|
||||||
rpc Extended(RequestFiveDay) returns (SendFiveDay);
|
rpc FiveDay(RequestFiveDay) returns (SendFiveDay);
|
||||||
rpc Location(RequestLocation) returns (SendLocation);
|
rpc Location(RequestLocation) returns (SendLocation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,19 +15,14 @@ enum Units {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the current forecast for a given location
|
/* Get the current forecast for a given location
|
||||||
* Commented parameters in the message definition are not implemeneted yet
|
* location_type {LocationType} - name or value of the desired LocationType enum
|
||||||
* location_type {enum} - name or value
|
* units {Units} - name or value of the desired Units enum
|
||||||
* units {enum} - name or value
|
* location {OneOfLocation} - city name, zip code, or coordinates
|
||||||
* city {string} - case insensitive, spaces and punctuation allowed
|
|
||||||
* zip_code {string} - non-numeric values permitted
|
|
||||||
* coordinates {Coordinates} - Coordinates message with latitude and longitude
|
|
||||||
*/
|
*/
|
||||||
message RequestCurrent {
|
message RequestCurrent {
|
||||||
LocationType location_type = 1;
|
LocationType location_type = 1;
|
||||||
Units units = 2;
|
Units units = 2;
|
||||||
optional string city = 3;
|
OneOfLocation location = 3;
|
||||||
optional string zip_code = 4;
|
|
||||||
optional Coordinates coordinates = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response to RequestCurrent
|
// Response to RequestCurrent
|
||||||
|
@ -36,19 +31,14 @@ message SendCurrent {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the extended forecast for a given location up to 16 days in the future
|
/* Get the extended forecast for a given location up to 16 days in the future
|
||||||
* Commented parameters in the message definition are not implemeneted yet
|
* location_type {LocationType} - name or value of the desired LocationType enum
|
||||||
* location_type {enum} - name or value
|
* units {Units} - name or value of the desired Units enum
|
||||||
* units {enum} - name or value
|
* location {OneOfLocation} - city name, zip code, or coordinates
|
||||||
* city {string} - case insensitive, spaces and punctuation allowed
|
|
||||||
* zip_code {string} - non-numeric values permitted
|
|
||||||
* coordinates {Coordinates} - Coordinates message with latitude and longitude
|
|
||||||
*/
|
*/
|
||||||
message RequestFiveDay {
|
message RequestFiveDay {
|
||||||
LocationType location_type = 1;
|
LocationType location_type = 1;
|
||||||
Units units = 2;
|
Units units = 2;
|
||||||
optional string city = 3;
|
OneOfLocation location = 3;
|
||||||
optional string zip_code = 4;
|
|
||||||
optional Coordinates coordinates = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response to RequestExtended
|
// Response to RequestExtended
|
||||||
|
|
Loading…
Reference in a new issue