mirror of
https://codeberg.org/andyscott/OpenWeather-gRPC-API.git
synced 2024-11-05 05:20:48 -05:00
48 lines
1.2 KiB
Protocol Buffer
48 lines
1.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package weather;
|
|
|
|
option go_package = "codeberg.org/andcscott/OpenWeather-gRPC-API/proto";
|
|
|
|
// Sub-message for Coordinates
|
|
message Coordinates {
|
|
float latitude = 1;
|
|
float longitude = 2;
|
|
}
|
|
|
|
// Sub-message for RequestLocation
|
|
message OneOfLocation {
|
|
oneof location_id {
|
|
string city = 1;
|
|
string zip_code = 2;
|
|
Coordinates coords = 3;
|
|
}
|
|
}
|
|
|
|
/* 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.
|
|
*/
|
|
enum LocationType {
|
|
LOCATION_TYPE_UNSPECIFIED = 0;
|
|
LOCATION_TYPE_CITY = 1;
|
|
LOCATION_TYPE_ZIP_CODE = 2;
|
|
LOCATION_TYPE_COORDS = 3;
|
|
}
|
|
|
|
/* Get the latitude and longitude 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 {OneOfLocation} - city name, zip code, or coordinates
|
|
*/
|
|
message RequestLocation {
|
|
LocationType location_type = 1;
|
|
OneOfLocation location = 2;
|
|
}
|
|
|
|
// Response to RequestLocation
|
|
message SendLocation {
|
|
float latitude = 1;
|
|
float longitude = 2;
|
|
}
|