From 7e8c8ec655cb7df40e436f9eae9c05da075c61ec Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 26 Jul 2022 01:06:17 -0400 Subject: [PATCH] Updated proto files --- proto/current.proto | 13 ++++++------- proto/extended.proto | 15 +++++++-------- proto/location_types.proto | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 proto/location_types.proto diff --git a/proto/current.proto b/proto/current.proto index 6108570..dc8b15d 100644 --- a/proto/current.proto +++ b/proto/current.proto @@ -4,14 +4,13 @@ package weather; option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; +import "location_types.proto"; + message RequestCurrent { - oneof location { - string city = 1; - string zip_code = 2; - string coords = 3; // Comma separated coordinates, e.g. "44.5,-123.3" - } - optional string state = 4; // US Only - optional string country = 5; // Must be ISO 3166 country code + //LocationType location_type = 1; NOT IMPLEMENTED YET + string city = 1; + optional string state = 2; // US Only + optional string country = 3; // Must be ISO 3166 country code } message SendCurrent { diff --git a/proto/extended.proto b/proto/extended.proto index 07b12d6..5a88143 100644 --- a/proto/extended.proto +++ b/proto/extended.proto @@ -4,15 +4,14 @@ package weather; option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; +import "location_types.proto"; + message RequestExtended { - oneof location { - string city = 1; - string zip_code = 2; - string coords = 3; // Comma separated coordinates, e.g. "44.5,-123.3" - } - optional string state = 4; // US Only - optional string country = 5; // Must be ISO 3166 country code - uint32 days = 6; + LocationType location_type = 1; + string location = 2; // zip/postal code, city name, or comma separated coords "-81.2,40.5" + optional string state = 3; // US Only + optional string country = 4; // Must be ISO 3166 country code + uint32 days = 5; } message SendExtended { diff --git a/proto/location_types.proto b/proto/location_types.proto new file mode 100644 index 0000000..edd9f1a --- /dev/null +++ b/proto/location_types.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package weather; + +option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; + +enum LocationType { + LOCATION_TYPE_UNSPECIFIED = 0; + LOCATION_CITY = 1; + LOCATION_ZIP = 2; + LOCATION_COORDS = 3; + /* + * NOT YET IMPLEMENTED + * + LOCATION_CITY_STATE = 4; + LOCATION_CITY_COUNTRY = 5; + LOCATION_ZIP_COUNTRY = 6; + */ +}