diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..6ac25ab --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module codeberg.org/OpenWeatherMap-gRPC-API + +go 1.18 diff --git a/proto/current.proto b/proto/current.proto new file mode 100644 index 0000000..6108570 --- /dev/null +++ b/proto/current.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package weather; + +option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/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 +} + +message SendCurrent { + string payload = 1; +} diff --git a/proto/extended.proto b/proto/extended.proto new file mode 100644 index 0000000..07b12d6 --- /dev/null +++ b/proto/extended.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package weather; + +option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/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; +} + +message SendExtended { + string payload = 1; +} diff --git a/proto/weather.proto b/proto/weather.proto new file mode 100644 index 0000000..22cd648 --- /dev/null +++ b/proto/weather.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package weather; + +option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; + +import "current.proto"; +import "extended.proto"; + +service WeatherService { + rpc Current(RequestCurrent) returns (SendCurrent); + rpc Extended(RequestExtended) returns (SendExtended); +}