From b73ca7da06f57f283d69f8ffb8ff8d7dc2201aa8 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Mon, 25 Jul 2022 16:16:27 -0400 Subject: [PATCH] Created module and basic proto files --- go.mod | 3 +++ proto/current.proto | 19 +++++++++++++++++++ proto/extended.proto | 20 ++++++++++++++++++++ proto/weather.proto | 13 +++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 go.mod create mode 100644 proto/current.proto create mode 100644 proto/extended.proto create mode 100644 proto/weather.proto 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); +}