diff --git a/proto/current.proto b/proto/current.proto deleted file mode 100644 index 560c122..0000000 --- a/proto/current.proto +++ /dev/null @@ -1,21 +0,0 @@ -syntax = "proto3"; - -package weather; - -option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; - -//import "location_types.proto"; -//import "units.proto" - -message RequestCurrent { - //LocationType location_type = 1; NOT IMPLEMENTED YET - //Units units = 2; NOT IMPLEMENTED YET - string city = 1; - // optional string zip_code = 2; NOT IMPLEMENTED YET - // optional string state = 2; // US Only / NOT IMPLEMENTED YET - // optional string country = 3; // Must be an ISO 3166 code / NOT IMPLEMENTED YET -} - -message SendCurrent { - string payload = 1; -} diff --git a/proto/extended.proto b/proto/extended.proto deleted file mode 100644 index 1005d2a..0000000 --- a/proto/extended.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; - -package weather; - -option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; - -//import "location_types.proto"; -//import "units.proto" - -message RequestExtended { - //LocationType location_type = 1; NOT IMPLEMENTED YET - //Units units = 2; NOT IMPLEMENTED YET - string city = 1; - // optional string zip_code = 2; NOT IMPLEMENTED YET - // optional string state = 2; // US Only / NOT IMPLEMENTED YET - // optional string country = 3; // Must be ISO 3166 code / NOT IMPLEMENTED YET - uint32 days = 2; -} - -message SendExtended { - string payload = 1; -} diff --git a/proto/location.proto b/proto/location.proto index fa2cd8b..991d732 100644 --- a/proto/location.proto +++ b/proto/location.proto @@ -4,18 +4,37 @@ package weather; option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; -//import "location_types.proto"; //import "units.proto" -message RequestLocation { - //LocationType location_type = 1; NOT IMPLEMENTED YET - //Units units = 2; NOT IMPLEMENTED YET - string city = 1; - // optional string zip_code = 2; NOT IMPLEMENTED YET - // optional string state = 2; // US Only / NOT IMPLEMENTED YET - // optional string country = 3; // Must be an ISO 3166 code / NOT IMPLEMENTED YET +// Sub-message used by Current & Extended for exact coordinates +message Coordinates { + float latitude = 1; + float longitude = 2; } +// Used by Location, Current, and Extended to help the API find info for the +// correct location. If unspecified, an attept is still made but results may +// be inaccurate +enum LocationType { + LOCATION_TYPE_UNSPECIFIED = 0; + LOCATION_CITY = 1; + LOCATION_ZIP = 2; + LOCATION_COORDS = 3; +} + +/* Get the latitude and longitude for a given location + * Commented parameters in the message definition are not implemeneted yet + * location_type {enum} - name or value + * city {string} - case insensitive, spaces and punctuation allowed + * zip_code {string} - non-numeric values permitted + */ +message RequestLocation { + // LocationType location_type = 1; + string city = 1; + // optional string zip_code = 2; +} + +// Response to RequestLocation message SendLocation { float latitude = 1; float longitude = 2; diff --git a/proto/location_types.proto b/proto/location_types.proto deleted file mode 100644 index a558257..0000000 --- a/proto/location_types.proto +++ /dev/null @@ -1,15 +0,0 @@ -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; - LOCATION_CITY_STATE = 4; - LOCATION_CITY_COUNTRY = 5; - LOCATION_ZIP_COUNTRY = 6; -} diff --git a/proto/service.proto b/proto/service.proto index 8cef041..f66c80f 100644 --- a/proto/service.proto +++ b/proto/service.proto @@ -4,8 +4,7 @@ package weather; option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; -import "current.proto"; -import "extended.proto"; +import "weather.proto"; import "location.proto"; service WeatherService { diff --git a/proto/units.proto b/proto/units.proto deleted file mode 100644 index 5a62d99..0000000 --- a/proto/units.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -package weather; - -option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; - -enum Units { - UNITS_UNSPECIFIED = 0; - UNITS_STANDARD = 1; - UNITS_METRIC = 2; - UNITS_IMPERIAL = 3; -} diff --git a/proto/weather.proto b/proto/weather.proto new file mode 100644 index 0000000..e8f3282 --- /dev/null +++ b/proto/weather.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; + +package weather; + +option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; + +//import "location.proto" + +// Sub-message used by Current & Extended to specify preferred units +enum Units { + UNITS_UNSPECIFIED = 0; + UNITS_STANDARD = 1; + UNITS_METRIC = 2; + UNITS_IMPERIAL = 3; +} + +/* Get the current forecast for a given location + * Commented parameters in the message definition are not implemeneted yet + * location_type {enum} - name or value + * units {enum} - name or value + * 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 { + // LocationType location_type = 1; + // Units units = 2; + string city = 1; + // optional string zip_code = 2; + // Coordinates coordinates = 2; +} + +// Response to RequestCurrent +message SendCurrent { + string payload = 1; +} + +/* 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 {enum} - name or value + * units {enum} - name or value + * city {string} - case insensitive, spaces and punctuation allowed + * zip_code {string} - non-numeric values permitted + * coordinates {Coordinates} - Coordinates message with latitude and longitude + * days {uint32} - number of days to fetch, max 16 + */ +message RequestExtended { + // LocationType location_type = 1; + // Units units = 2; + string city = 1; + // optional string zip_code = 2; + // Coordinates coordinates = 3; + uint32 days = 2; +} + +// Response to RequestExtended +message SendExtended { + string payload = 1; +}