2022-07-26 15:05:21 -04:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package weather;
|
|
|
|
|
|
|
|
option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto";
|
|
|
|
|
2022-09-01 22:47:37 -04:00
|
|
|
// Sub-message for Coordinates
|
2022-07-28 01:27:11 -04:00
|
|
|
message Coordinates {
|
|
|
|
float latitude = 1;
|
|
|
|
float longitude = 2;
|
|
|
|
}
|
|
|
|
|
2022-09-01 22:47:37 -04:00
|
|
|
// Sub-message for RequestLocation
|
2022-09-01 02:05:33 -04:00
|
|
|
message OneOfLocation {
|
|
|
|
oneof location_id {
|
|
|
|
string city = 1;
|
|
|
|
string zip_code = 2;
|
|
|
|
Coordinates coords = 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-01 22:47:37 -04:00
|
|
|
/* Enum to specify the location type for which data is needed.
|
|
|
|
* Helps the API find info for the correct location. If unspecified, an
|
|
|
|
* attept is still made. However, results may be inaccurate if city is used,
|
|
|
|
* or fail entirely if zip code or coordinates are used.
|
|
|
|
*/
|
2022-07-28 01:27:11 -04:00
|
|
|
enum LocationType {
|
|
|
|
LOCATION_TYPE_UNSPECIFIED = 0;
|
2022-09-01 02:05:33 -04:00
|
|
|
LOCATION_TYPE_CITY = 1;
|
|
|
|
LOCATION_TYPE_ZIP_CODE = 2;
|
|
|
|
LOCATION_TYPE_COORDS = 3;
|
2022-07-28 01:27:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the latitude and longitude for a given location
|
|
|
|
* Commented parameters in the message definition are not implemeneted yet
|
2022-09-01 02:05:33 -04:00
|
|
|
* location_type {LocationType} - name or value of the desired LocationType enum
|
|
|
|
* location {OneOfLocation} - city name, zip code, or coordinates
|
2022-07-28 01:27:11 -04:00
|
|
|
*/
|
2022-07-26 15:05:21 -04:00
|
|
|
message RequestLocation {
|
2022-08-31 22:40:26 -04:00
|
|
|
LocationType location_type = 1;
|
2022-09-01 02:05:33 -04:00
|
|
|
OneOfLocation location = 2;
|
2022-07-26 15:05:21 -04:00
|
|
|
}
|
|
|
|
|
2022-07-28 01:27:11 -04:00
|
|
|
// Response to RequestLocation
|
2022-07-26 15:05:21 -04:00
|
|
|
message SendLocation {
|
|
|
|
float latitude = 1;
|
|
|
|
float longitude = 2;
|
|
|
|
}
|