Update proto files for additional request options and free-tier API

This commit is contained in:
Andrew Scott 2022-08-31 22:40:26 -04:00
parent 6966aa1d9c
commit b142b6856d
Signed by: a
GPG key ID: 3EB62D0BBB8DB381
3 changed files with 17 additions and 21 deletions

View file

@ -4,8 +4,6 @@ package weather;
option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto";
//import "units.proto"
// Sub-message used by Current & Extended for exact coordinates // Sub-message used by Current & Extended for exact coordinates
message Coordinates { message Coordinates {
float latitude = 1; float latitude = 1;
@ -29,9 +27,9 @@ enum LocationType {
* zip_code {string} - non-numeric values permitted * zip_code {string} - non-numeric values permitted
*/ */
message RequestLocation { message RequestLocation {
// LocationType location_type = 1; LocationType location_type = 1;
string city = 1; optional string city = 2;
// optional string zip_code = 2; optional string zip_code = 3;
} }
// Response to RequestLocation // Response to RequestLocation

View file

@ -9,6 +9,6 @@ import "location.proto";
service WeatherService { service WeatherService {
rpc Current(RequestCurrent) returns (SendCurrent); rpc Current(RequestCurrent) returns (SendCurrent);
rpc Extended(RequestExtended) returns (SendExtended); rpc Extended(RequestFiveDay) returns (SendFiveDay);
rpc Location(RequestLocation) returns (SendLocation); rpc Location(RequestLocation) returns (SendLocation);
} }

View file

@ -4,7 +4,7 @@ package weather;
option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"; option go_package = "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto";
//import "location.proto" import "location.proto";
// Sub-message used by Current & Extended to specify preferred units // Sub-message used by Current & Extended to specify preferred units
enum Units { enum Units {
@ -23,11 +23,11 @@ enum Units {
* coordinates {Coordinates} - Coordinates message with latitude and longitude * coordinates {Coordinates} - Coordinates message with latitude and longitude
*/ */
message RequestCurrent { message RequestCurrent {
// LocationType location_type = 1; LocationType location_type = 1;
// Units units = 2; Units units = 2;
string city = 1; optional string city = 3;
// optional string zip_code = 2; optional string zip_code = 4;
// Coordinates coordinates = 2; optional Coordinates coordinates = 5;
} }
// Response to RequestCurrent // Response to RequestCurrent
@ -42,18 +42,16 @@ message SendCurrent {
* city {string} - case insensitive, spaces and punctuation allowed * city {string} - case insensitive, spaces and punctuation allowed
* zip_code {string} - non-numeric values permitted * zip_code {string} - non-numeric values permitted
* coordinates {Coordinates} - Coordinates message with latitude and longitude * coordinates {Coordinates} - Coordinates message with latitude and longitude
* days {uint32} - number of days to fetch, max 16
*/ */
message RequestExtended { message RequestFiveDay {
// LocationType location_type = 1; LocationType location_type = 1;
// Units units = 2; Units units = 2;
string city = 1; optional string city = 3;
// optional string zip_code = 2; optional string zip_code = 4;
// Coordinates coordinates = 3; optional Coordinates coordinates = 5;
uint32 days = 2;
} }
// Response to RequestExtended // Response to RequestExtended
message SendExtended { message SendFiveDay {
string payload = 1; string payload = 1;
} }